Example #1
0
//Adds an actor to the level from its XML file.
void Level::AddActor(rapidxml::xml_node<>* root)
{
	if(!root)
		throw "Actor XML missing";

	Actor* actor = new Actor(root, textureManager);
	int x = actor->GetPosition().x;
	int y = actor->GetPosition().y;
	Tile* occupied = map[x][y];

	if(!occupied)
		throw "Actor placed on non-tile";

	occupied->SetDomOccupant(actor);
	actors.resize(++actCount);
	actors[actCount - 1] = actor;
}