diff --git a/src/cata_tiles.cpp b/src/cata_tiles.cpp index e8c3063a89182..ca6e2cc8157e1 100644 --- a/src/cata_tiles.cpp +++ b/src/cata_tiles.cpp @@ -3496,22 +3496,22 @@ void cata_tiles::do_tile_loading_report() return; } - tile_loading_report( ter_t::count(), "Terrain", "" ); - tile_loading_report( furn_t::count(), "Furniture", "" ); + tile_loading_report( ter_t::count(), C_TERRAIN, "" ); + tile_loading_report( furn_t::count(), C_FURNITURE, "" ); std::map items; for( const itype *e : item_controller->all() ) { items.emplace( e->get_id(), e ); } - tile_loading_report( items, "Items", "" ); + tile_loading_report( items, C_ITEM, "" ); auto mtypes = MonsterGenerator::generator().get_all_mtypes(); lr_generic( mtypes.begin(), mtypes.end(), []( const std::vector::iterator & m ) { return ( *m ).id.str(); - }, "Monsters", "" ); - tile_loading_report( vpart_info::all(), "Vehicle Parts", "vp_" ); - tile_loading_report( trap::count(), "Traps", "" ); - tile_loading_report( field_type::count(), "Field Types", "" ); + }, C_MONSTER, "" ); + tile_loading_report( vpart_info::all(), C_VEHICLE_PART, "vp_" ); + tile_loading_report( trap::count(), C_TRAP, "" ); + tile_loading_report( field_type::count(), C_FIELD, "" ); // needed until DebugLog ostream::flush bugfix lands DebugLog( D_INFO, DC_ALL ); @@ -3537,54 +3537,58 @@ point cata_tiles::player_to_screen( const point &p ) const } template -void cata_tiles::lr_generic( Iter begin, Iter end, Func id_func, const std::string &label, +void cata_tiles::lr_generic( Iter begin, Iter end, Func id_func, TILE_CATEGORY category, const std::string &prefix ) { - int missing = 0; - int present = 0; std::string missing_list; + std::string missing_with_looks_like_list; for( ; begin != end; ++begin ) { const std::string id_string = id_func( begin ); - if( !tileset_ptr->find_tile_type( prefix + id_string ) ) { - missing++; + + std::string mutable_id_string = id_string; + + if( !tileset_ptr->find_tile_type( prefix + id_string ) && + !find_tile_looks_like( mutable_id_string, category ) ) { missing_list.append( id_string + " " ); - } else { - present++; + } else if( !tileset_ptr->find_tile_type( prefix + id_string ) ) { + missing_with_looks_like_list.append( id_string + " " ); } } - DebugLog( D_INFO, DC_ALL ) << "Missing " << label << ": " << missing_list; + DebugLog( D_INFO, DC_ALL ) << "Missing " << TILE_CATEGORY_IDS[category] << ": " << missing_list; + DebugLog( D_INFO, DC_ALL ) << "Missing " << TILE_CATEGORY_IDS[category] << + " (but looks_like tile exists): " << missing_with_looks_like_list; } template -void cata_tiles::tile_loading_report( const maptype &tiletypemap, const std::string &label, +void cata_tiles::tile_loading_report( const maptype &tiletypemap, TILE_CATEGORY category, const std::string &prefix ) { lr_generic( tiletypemap.begin(), tiletypemap.end(), []( const decltype( tiletypemap.begin() ) & v ) { // c_str works for std::string and for string_id! return v->first.c_str(); - }, label, prefix ); + }, category, prefix ); } template -void cata_tiles::tile_loading_report( const size_t count, const std::string &label, +void cata_tiles::tile_loading_report( const size_t count, TILE_CATEGORY category, const std::string &prefix ) { lr_generic( static_cast( 0 ), count, []( const size_t i ) { return int_id( i ).id().str(); - }, label, prefix ); + }, category, prefix ); } template void cata_tiles::tile_loading_report( const arraytype &array, int array_length, - const std::string &label, const std::string &prefix ) + TILE_CATEGORY category, const std::string &prefix ) { const auto begin = &( array[0] ); lr_generic( begin, begin + array_length, []( decltype( begin ) const v ) { return v->id; - }, label, prefix ); + }, category, prefix ); } std::vector cata_tiles::build_renderer_list() diff --git a/src/cata_tiles.h b/src/cata_tiles.h index 7c50e11f8cb15..87daca1def42e 100644 --- a/src/cata_tiles.h +++ b/src/cata_tiles.h @@ -480,19 +480,19 @@ class cata_tiles static std::vector build_display_list(); protected: template - void tile_loading_report( const maptype &tiletypemap, const std::string &label, + void tile_loading_report( const maptype &tiletypemap, TILE_CATEGORY category, const std::string &prefix = "" ); template - void tile_loading_report( const arraytype &array, int array_length, const std::string &label, + void tile_loading_report( const arraytype &array, int array_length, TILE_CATEGORY category, const std::string &prefix = "" ); template - void tile_loading_report( size_t count, const std::string &label, const std::string &prefix ); + void tile_loading_report( size_t count, TILE_CATEGORY category, const std::string &prefix ); /** * Generic tile_loading_report, begin and end are iterators, id_func translates the iterator * to an id string (result of id_func must be convertible to string). */ template - void lr_generic( Iter begin, Iter end, Func id_func, const std::string &label, + void lr_generic( Iter begin, Iter end, Func id_func, TILE_CATEGORY category, const std::string &prefix ); /** Lighting */ void init_light();