Exemple #1
0
void save(openage::GameMain *game, std::string fname) {
	std::ofstream file(fname, std::ofstream::out);

	// how many chunks
	std::vector<coord::chunk> used = game->terrain->used_chunks();
	file << used.size() << std::endl;

	// save each chunk
	for (coord::chunk &position : used) {
		file << position.ne << " " << position.se << std::endl;
		openage::TerrainChunk *chunk = game->terrain->get_chunk(position);

		file << chunk->tile_count << std::endl;
		for (size_t p = 0; p < chunk->tile_count; ++p) {
			save_tile_content( file, chunk->get_data(p) );
		}
	}

	// save units
	std::vector<openage::Unit *> units = game->placed_units.all_units();
	file << units.size() << std::endl;
	for (Unit *u : units) {
		save_unit( file, u );
	}
}
Exemple #2
0
void Building::save_cubeEX(FILE * file){
	fprintf(file,"%d %f\n",rotate,size);
	save_unit(file);
	save_building(file);
}