Example #1
0
// static
void Serdes::SerializeMapObjectEvent(MapObject const & poi, MapObject::Event const & poiEvent,
                                     std::vector<int8_t> & result)
{
  result.clear();

  using Sink = MemWriter<std::vector<int8_t>>;

  Sink writer(result);
  coding::SerializerJson<Sink> ser(writer);
  std::string const nextLine = "\n";

  MapObjectEvent event;
  event.m_bestPoiType = poi.GetBestType();
  event.m_poiPos = poi.GetPos();
  event.m_defaultName = poi.GetDefaultName();
  event.m_readableName = poi.GetReadableName();
  event.m_event = poiEvent;
  ser(event);
  writer.Write(nextLine.data(), nextLine.size());
}
Example #2
0
void WorldMap::Click(MapObject& obj)
{
	sf::Vector2i node = GetIndex(obj.GetPos());
	mapGrid[node.y][node.x].second.ChangeType(obj.GetType());
}