Пример #1
0
void Level::ReadTile(char* tile)
{
  Tile *t = new Tile;
  t->Initialize();

  t->ReadTile(tile);

  _tiles.push_back(t);
}
Пример #2
0
void EditWorld::HandleInteraction(const sf::Uint16 interaction_id, const sf::Uint16 client_id, sf::Packet& data) {
	sf::Int16 x,y;
	data >> x >> y;

	if(interaction_id == CREATE_TILE) {
		bool ok = true;

		BOOST_FOREACH(Engine::Entity& e, mEntities) {
			if(e.GetEntityTypeId() == ENTITYTYPEID_TILE) {
				if(floor(e.GetPosition().x) == x && floor(e.GetPosition().y) == y )
					ok = false;
			}
		}

		if(ok) {
			Tile* t = new Tile();
			t->Initialize("tileset", x, y);
			AddEntity(t);
		}
	} else if(interaction_id == REMOVE_TILE) {