Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Map::write(char *filename) {
- int hd1[4];short hd2[2];
- hd1[0]=9; hd1[1]=posX; hd1[2]=posY; hd1[3]=posZ;
- hd2[0]=angle; hd2[1]=secNum;
- unsigned short sz=(unsigned short)s.size();
- std::ofstream out(filename, std::ofstream::binary);
- out.write(reinterpret_cast<char*>(hd1), sizeof(hd1));
- out.write(reinterpret_cast<char*>(hd2), sizeof(hd2));
- // sectors
- out.write((char*)(&sz), sizeof(sz));
- for ( auto T: s)
- {
- T.extra=-1;
- out.write((char*)(&T), size_sector);
- };
- // walls
- sz=(unsigned short)w.size();
- out.write((char*)(&sz), sizeof(sz));
- for ( auto T: w)
- {
- T.extra=-1;
- out.write((char*)(&T), size_wall);
- };
- // sprites
- sz=(unsigned short)sp.size();
- out.write((char*)(&sz), sizeof(sz));
- for ( auto T: sp)
- {
- T.extra=-1;
- out.write((char*)(&T), size_sprite);
- };
- out.close();
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment