Commit 809314ac authored by Jonathan Michalon's avatar Jonathan Michalon
Browse files

Changed Game constructor to allow optional stack parameter

parent fe3ca9e2
......@@ -88,10 +88,13 @@ namespace OVCC
public signal void unplaceable_tile (Tile t);
public Game.from_tileset (TileSet ts)
public Game (TileSet ts, Stack? s = null)
{
var s = new Stack.from_tileset (ts);
Object (tileset: ts, stack: s, board: new Board (s.pop ()));
var our_stack = s;
if (s == null) {
our_stack = new Stack.from_tileset (ts);
}
Object (tileset: ts, stack: our_stack, board: new Board (our_stack.pop ()));
stack.item_removed.connect (t => {
this.notify_property ("current-tile");
......
......@@ -24,8 +24,8 @@ namespace OVCCClient {
{
/* network wrapper around OVCC Game */
public Game.from_tileset (OVCC.TileSet ts) {
base.from_tileset (ts);
public Game (OVCC.TileSet ts, OVCC.Stack? s) {
base (ts, s);
}
}
}
......@@ -182,7 +182,7 @@ namespace OVCCClient
tiles.load (File.new_for_path (TILES_FILE));
tileset.load (tiles, File.new_for_path (TILESET_FILE));
Game game = new Game.from_tileset(tileset);
Game game = new Game (tileset, null);
/* start communication NOW: we have the game and the player and must
* send the PLAYER_ADDED triggered by next instruction... */
......
......@@ -175,7 +175,7 @@ public class Server: ThreadedSocketService
tiles.load (File.new_for_path (TILES_FILE));
tileset.load (tiles, File.new_for_path (TILESET_FILE));
Game table = new Game.from_tileset(tileset);
Game table = new Game (tileset, null);
this.tables.prepend (table);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment