void C3Sav::Impl::initEntryExit(std::fstream &f, PlayerCityPtr ioCity) { unsigned int size = ioCity->tilemap().size(); const unsigned int savePos = f.tellg(); // init road entry/exit point unsigned short int i = 0; unsigned short int j = 0; f.seekg(1236, std::ios::cur); f.read((char*)&i, 2); f.read((char*)&j, 2); BorderInfo borderInfo; borderInfo.roadEntry = TilePos( i, size - j - 1 ); f.read((char*)&i, 2); f.read((char*)&j, 2); borderInfo.roadExit = TilePos( i, size - j - 1 ); // init boat entry/exit point f.seekg(savePos, std::ios::beg); f.seekg(1276, std::ios::cur); f.read((char*)&i, 2); f.read((char*)&j, 2); borderInfo.boatEntry = TilePos( i, size - j - 1 ); f.read((char*)&i, 2); f.read((char*)&j, 2); borderInfo.boatExit = TilePos( i, size - j - 1); ioCity->setBorderInfo( borderInfo ); f.seekg(savePos, std::ios::beg); }
void C3Map::Impl::initEntryExit(std::fstream &f, PlayerCityPtr ioCity) { unsigned int size = ioCity->tilemap().size(); // init road entry/exit point unsigned short int i = 0; unsigned short int j = 0; f.seekg(kRoadEntry, std::ios::beg); f.read((char*)&i, 2); f.read((char*)&j, 2); BorderInfo borderInfo; borderInfo.roadEntry = TilePos( i, size - j - 1 ); f.read((char*)&i, 2); f.read((char*)&j, 2); borderInfo.roadExit = TilePos( i, size - j - 1 ); // init boat entry/exit point f.seekg(kBoatEntry, std::ios::beg); f.read((char*)&i, 2); f.read((char*)&j, 2); borderInfo.boatEntry = TilePos( i, size - j - 1 ); f.read((char*)&i, 2); f.read((char*)&j, 2); borderInfo.boatExit = TilePos( i, size - j - 1); ioCity->setBorderInfo( borderInfo ); //std::cout << "road entry at:" << ioCity.getRoadEntryI() << "," << ioCity.getRoadEntryJ() << std::endl; //std::cout << "road exit at:" << ioCity.getRoadExitI() << "," << ioCity.getRoadExitJ() << std::endl; //std::cout << "boat entry at:" << ioCity.getBoatEntryI() << "," << ioCity.getBoatEntryJ() << std::endl; //std::cout << "boat exit at:" << ioCity.getBoatExitI() << "," << ioCity.getBoatExitJ() << std::endl; }