From 4b5c062fc32e6bafebeabe125b0146f2dd5c5bec Mon Sep 17 00:00:00 2001 From: codemime Date: Mon, 25 Apr 2016 03:50:46 +0300 Subject: [PATCH] Check terrain objects using own 'ter_t::check()' --- src/mapdata.cpp | 28 +++++++++++++++++----------- src/mapdata.h | 1 + 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/mapdata.cpp b/src/mapdata.cpp index 7796c4ecbcb12..bcc04cc3b19b9 100644 --- a/src/mapdata.cpp +++ b/src/mapdata.cpp @@ -1001,6 +1001,22 @@ void check_decon_items(const map_deconstruct_info &mbi, const std::string &id, b } } +void ter_t::check() const +{ + check_bash_items( bash, id.str(), true ); + check_decon_items( deconstruct, id.str(), true ); + + if( !transforms_into.is_valid() ) { + debugmsg( "invalid transforms_into %s for %s", transforms_into.c_str(), id.c_str() ); + } + if( !open.is_valid() ) { + debugmsg( "invalid terrain %s for opening %s", open.c_str(), id.c_str() ); + } + if( !close.is_valid() ) { + debugmsg( "invalid terrain %s for closing %s", close.c_str(), id.c_str() ); + } +} + void check_furniture_and_terrain() { for( const furn_t& f : furnlist ) { @@ -1014,16 +1030,6 @@ void check_furniture_and_terrain() } } for( const ter_t& t : terrain_data.get_all() ) { - check_bash_items(t.bash, t.id.str(), true); - check_decon_items(t.deconstruct, t.id.str(), true); - if( !t.transforms_into.is_valid() ) { - debugmsg( "invalid transforms_into %s for %s", t.transforms_into.c_str(), t.id.c_str() ); - } - if( !t.open.is_valid() ) { - debugmsg( "invalid terrain %s for opening %s", t.open.c_str(), t.id.c_str() ); - } - if( !t.close.is_valid() ) { - debugmsg( "invalid terrain %s for closing %s", t.close.c_str(), t.id.c_str() ); - } + t.check(); } } diff --git a/src/mapdata.h b/src/mapdata.h index 1d133ba8040b3..2b0c0710ad825 100644 --- a/src/mapdata.h +++ b/src/mapdata.h @@ -274,6 +274,7 @@ struct ter_t : map_data_common_t { bool was_loaded = false; void load( JsonObject &jo ); + void check() const; }; void set_ter_ids();