Skip to content

Commit

Permalink
Check terrain objects using own 'ter_t::check()'
Browse files Browse the repository at this point in the history
  • Loading branch information
codemime committed Apr 25, 2016
1 parent 929b044 commit 4b5c062
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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();
}
}
1 change: 1 addition & 0 deletions src/mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4b5c062

Please sign in to comment.