Don't assert on config input.

assert() is not a good way to handle incorrect user input,
It is a debugging tool that should only be used for
conditions that the program guarantees to be true
(unless there a is a bug in the c++ code).
This commit is contained in:
gfgtdf 2023-10-25 01:16:39 +02:00
parent 8d2d58d6ec
commit 9f66b1e8ff
2 changed files with 1 additions and 3 deletions

View File

@ -250,7 +250,7 @@ void helper_advance_unit(const map_location& loc){
const unit_type *advanced_type = unit_types.find(advance_unit_typename);
if(!advanced_type) {
ERR_AI_SIM_ACTIONS << "Simulating advancing to unknown unit type: " << advance_unit_typename;
assert(false && "simulating to unknown unit type");
return;
}
advanced_unit->set_experience(advanced_unit->experience_overflow());
advanced_unit->advance_to(*advanced_type);

View File

@ -634,8 +634,6 @@ void canvas::parse_cfg(const config& cfg)
} else {
ERR_GUI_P << "Canvas: found a shape of an invalid type " << type
<< ".";
assert(false);
}
}
}