Merge branch 'master' of manuel-voegele.de:inf3
This commit is contained in:
@@ -169,8 +169,9 @@ namespace WorldOfPeacecraft
|
||||
}
|
||||
Map map = new Map(height, width);
|
||||
foreach (Block cell in cellsBlock.GetBlocks()) {
|
||||
// TODO Fertigstellen
|
||||
map.SetTile(MapMapcell(cell));
|
||||
}
|
||||
backend.SetMap(map);
|
||||
}
|
||||
|
||||
private void ProcessMessage (Block mesBlock)
|
||||
@@ -265,13 +266,39 @@ namespace WorldOfPeacecraft
|
||||
return new Player (id, x, y, desc, busy, score);
|
||||
}
|
||||
|
||||
private ITile MapMapcell (Block cellBlock)
|
||||
private Tile MapMapcell (Block cellBlock)
|
||||
{
|
||||
CheckBlocksSize(cellBlock, 1, 1);
|
||||
int x = cellBlock.GetIntValue("col");
|
||||
int y = cellBlock.GetIntValue("row");
|
||||
CheckBlocksSize (cellBlock, 1, 1);
|
||||
int x = cellBlock.GetIntValue ("col");
|
||||
int y = cellBlock.GetIntValue ("row");
|
||||
Block propsBlock = cellBlock.GetBlocks ().First.Value;
|
||||
// TODO Fertigstellen
|
||||
bool walkable = false;
|
||||
bool wall = false;
|
||||
bool forest = false;
|
||||
bool water = false;
|
||||
bool huntable = false;
|
||||
foreach (string prop in propsBlock.GetUnnamedValues()) {
|
||||
switch (prop) {
|
||||
case "WALKABLE":
|
||||
walkable = true;
|
||||
break;
|
||||
case "WALL":
|
||||
wall = true;
|
||||
break;
|
||||
case "FOREST":
|
||||
forest = true;
|
||||
break;
|
||||
case "WATER":
|
||||
water = true;
|
||||
break;
|
||||
case "HUNTABLE":
|
||||
huntable = true;
|
||||
break;
|
||||
default:
|
||||
throw new ParsingException("Unknown mapcell-property '" + prop + "'");
|
||||
}
|
||||
}
|
||||
return new Tile(x,y,walkable, wall, forest, huntable, water);
|
||||
}
|
||||
|
||||
private void ThrowUnknownBlockException (Block parentBlock, Block childBlock)
|
||||
|
||||
Reference in New Issue
Block a user