static int z_histogram() { unsigned int zcount[256]; memset(zcount, 0, sizeof(zcount)); INFO_PRINT << "Reading UO data..\n"; Core::open_uo_data_files(); Core::read_uo_data(); for (u16 x = 0; x < 6143; ++x) { INFO_PRINT << "."; for (u16 y = 0; y < 4095; ++y) { Core::USTRUCT_MAPINFO mi; short z; getmapinfo(x, y, &z, &mi); assert(z >= Core::ZCOORD_MIN && z <= Core::ZCOORD_MAX); ++zcount[z + 128]; } } INFO_PRINT << "\n"; for (int i = 0; i < 256; ++i) { if (zcount[i]) INFO_PRINT << i - 128 << ": " << zcount[i] << "\n"; } Core::clear_tiledata(); return 0; }
int z_histogram() { unsigned long zcount[256]; cout << "Reading UO data.." << endl; open_uo_data_files(); read_uo_data(); for( u16 x = 0; x < 6143; ++x ) { cout << "."; for( u16 y = 0; y < 4095; ++y ) { USTRUCT_MAPINFO mi; short z; getmapinfo( x, y, &z, &mi ); assert( z >= -128 && z <= 127 ); ++zcount[ z+128 ]; } } cout << endl; for( int i = 0; i < 256; ++i ) { if (zcount[i]) cout << i-128 << ": " << zcount[i] << endl; } clear_tiledata(); return 0; }