void LandOverlay::serialize(OutputSerialStream &stream) { stream.write_objectID(this); stream.write_int((int) _buildingType, 1, 0, B_MAX); stream.write_int(getTile().getI(), 2, 0, 1000); stream.write_int(getTile().getJ(), 2, 0, 1000); }
void Market::serialize(OutputSerialStream &stream) { ServiceBuilding::serialize(stream); _goodStore.serialize(stream); stream.write_objectID(_marketBuyer); stream.write_int(_buyerDelay, 2, 0, 65535); }
void ServiceBuilding::serialize(OutputSerialStream &stream) { WorkingBuilding::serialize(stream); stream.write_int(_serviceTimer, 2, 0, 1000); stream.write_int(_serviceDelay, 2, 0, 1000); stream.write_int(_serviceRange, 2, 0, 65535); }
void Tilemap::serialize(OutputSerialStream &stream) { stream.write_int(_size, 2, 0, 1000); // saves the graphics map PicLoader &picLoader = PicLoader::instance(); std::string pic_name; short int imgId; // 16bits for (int i=0; i<_size; ++i) { for (int j=0; j<_size; ++j) { Tile &tile = at(i, j); TerrainTile &terrain = tile.get_terrain(); imgId = 0; if (&tile == tile.get_master_tile() || tile.get_master_tile() == NULL) { // this is a master tile if ( !terrain.isBuilding() ) { // this is not a building pic_name = tile.get_picture().get_name(); imgId = TerrainTileHelper::convPicName2Id(pic_name); } } stream.write_int(imgId, 2, 0, 65535); terrain.serialize(stream); } } }
void ServiceWalker::serialize(OutputSerialStream &stream) { Walker::serialize(stream); stream.write_int((int) _service, 1, 0, S_MAX); stream.write_objectID(_building); stream.write_int(_maxDistance, 2, 0, 65535); }
void TraineeWalker::serialize(OutputSerialStream &stream) { Walker::serialize(stream); stream.write_int((int) _traineeType, 1, 0, WTT_MAX); stream.write_objectID(_originBuilding); stream.write_objectID(_destinationBuilding); stream.write_int(_maxDistance, 2, 0, 65535); }
void Walker::serialize(OutputSerialStream &stream) { stream.write_objectID(this); stream.write_int((int) _walkerType, 1, 0, WT_MAX); _pathWay.serialize(stream); stream.write_int((int) _action._action, 1, 0, WA_MAX); stream.write_int((int) _action._direction, 1, 0, D_MAX); stream.write_int(_i, 2, 0, 1000); stream.write_int(_j, 2, 0, 1000); stream.write_int(_si, 1, 0, 50); stream.write_int(_sj, 1, 0, 50); stream.write_int(_ii, 4, 0, 1000000); stream.write_int(_jj, 4, 0, 1000000); stream.write_int(_speed, 1, 0, 50); stream.write_int(_midTileI, 1, 0, 50); stream.write_int(_midTileJ, 1, 0, 50); stream.write_int(_animIndex, 1, 0, 50); }
void Building::serialize(OutputSerialStream &stream) { Construction::serialize(stream); stream.write_int((int) _damageLevel, 1, 0, 100); // approximation... stream.write_int((int) _fireLevel, 1, 0, 100); // approximation... stream.write_int(_traineeMap.size(), 1, 0, WTT_MAX); for (std::map<WalkerTraineeType, int>::iterator itLevel = _traineeMap.begin(); itLevel != _traineeMap.end(); ++itLevel) { WalkerTraineeType traineeType = itLevel->first; int traineeLevel = itLevel->second; stream.write_int((int)traineeType, 1, 0, WTT_MAX); stream.write_int(traineeLevel, 1, 0, 200); } stream.write_int(_reservedTrainees.size(), 1, 0, WTT_MAX); for (std::set<WalkerTraineeType>::iterator itReservation = _reservedTrainees.begin(); itReservation != _reservedTrainees.end(); ++itReservation) { WalkerTraineeType traineeType = *itReservation; stream.write_int((int)traineeType, 1, 0, WTT_MAX); } }
void WorkingBuilding::serialize(OutputSerialStream &stream) { Building::serialize(stream); stream.write_int((int) _currentWorkers, 1, 0, 100); }
void TerrainTile::serialize(OutputSerialStream &stream) { int terrainBitset = encode(); stream.write_int(terrainBitset, 2, 0, 65535); stream.write_objectID(_overlay); }