mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 21:48:35 +00:00
Small optimization:
unit_type_data::add_advancement() will only have an effect the first time it is called for a given unit_type. So only call it once per unit_type (instead of once per unit_type per build status).
This commit is contained in:
parent
d7176645e4
commit
92712c5b64
@ -1464,9 +1464,13 @@ void unit_type_data::build_all(unit_type::BUILD_STATUS status)
|
||||
build_unit_type(u->second, status);
|
||||
loadscreen::increment_progress();
|
||||
}
|
||||
for (unit_type_map::iterator u = types_.begin(), u_end = types_.end(); u != u_end; ++u) {
|
||||
add_advancement(u->second);
|
||||
}
|
||||
// Handle [advancefrom] (once) after building to (at least) the CREATED level.
|
||||
// (Currently, this could be simply a test for build_status_ == NOT_BUILT,
|
||||
// but to guard against future changes, use a more thorough test.)
|
||||
if ( build_status_ < unit_type::CREATED && unit_type::CREATED <= status )
|
||||
for (unit_type_map::iterator u = types_.begin(), u_end = types_.end(); u != u_end; ++u) {
|
||||
add_advancement(u->second);
|
||||
}
|
||||
|
||||
build_status_ = status;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user