void update_map(const std::string& realm, unsigned short x, unsigned short y) { auto mapwriter = new MapWriter(); mapwriter->OpenExistingFiles( realm ); rawmapfullread(); rawstaticfullread(); unsigned short x_base = x / SOLIDX_X_SIZE * SOLIDX_X_SIZE; unsigned short y_base = y / SOLIDX_Y_SIZE * SOLIDX_Y_SIZE; ProcessSolidBlock( x_base, y_base, *mapwriter ); delete mapwriter; INFO_PRINT << "empty=" << empty << ", nonempty=" << nonempty << "\n" << "with more_solids: " << with_more_solids << "\n" << "total statics=" << total_statics << "\n"; }
void create_map( const std::string& realm, unsigned short width, unsigned short height ) { auto mapwriter = new MapWriter(); INFO_PRINT << "Creating map base and solids files.\n" << " Realm: " << realm << "\n" << " Map ID: " << uo_mapid << "\n" << " Use Dif files: " << ( uo_usedif ? "Yes" : "No" ) << "\n" << " Size: " << uo_map_width << "x" << uo_map_height << "\n" << "Initializing files: "; mapwriter->CreateNewFiles( realm, width, height ); INFO_PRINT << "Done.\n"; Tools::Timer<> timer; rawmapfullread(); rawstaticfullread(); INFO_PRINT << " Reading mapfiles time: " << timer.ellapsed() << " ms.\n"; for ( unsigned short y_base = 0; y_base < height; y_base += SOLIDX_Y_SIZE ) { for ( unsigned short x_base = 0; x_base < width; x_base += SOLIDX_X_SIZE ) { ProcessSolidBlock( x_base, y_base, *mapwriter ); } INFO_PRINT << "\rConverting: " << y_base * 100 / height << "%"; } timer.stop(); mapwriter->WriteConfigFile(); delete mapwriter; INFO_PRINT << "\rConversion complete. \n" << "Conversion details:\n" << " Total blocks: " << empty + nonempty << "\n" << " Blocks with solids: " << nonempty << " (" << ( nonempty * 100 / ( empty + nonempty ) ) << "%)" << "\n" << " Blocks without solids: " << empty << " (" << ( empty * 100 / ( empty + nonempty ) ) << "%)" << "\n" << " Locations with solids: " << with_more_solids << "\n" << " Total number of solids: " << total_statics << "\n" << " Elapsed time: " << timer.ellapsed() << " ms.\n"; }