mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 17:03:25 +00:00
2008-11-10T04:06:50Z!patrick_x99@hotmail.com did not fully fix bug #12558...
...now also create unique id for recruits
This commit is contained in:
parent
8a64c9188b
commit
071ef83f1e
12
src/unit.cpp
12
src/unit.cpp
@ -1373,14 +1373,9 @@ void unit::read(const config& cfg, bool use_traits, game_state* state)
|
||||
name_ = cfg["name"];
|
||||
std::string custom_unit_desc = cfg["description"];
|
||||
|
||||
id_ = cfg["id"];
|
||||
underlying_id_ = lexical_cast_default<size_t>(cfg["underlying_id"],0);
|
||||
set_underlying_id();
|
||||
id_ = cfg["id"];
|
||||
if (id_.empty()) {
|
||||
std::stringstream ss;
|
||||
ss << type_ << "-" << underlying_id_;
|
||||
id_ = ss.str();
|
||||
}
|
||||
|
||||
role_ = cfg["role"];
|
||||
ai_special_ = cfg["ai_special"];
|
||||
@ -2994,6 +2989,11 @@ void unit::set_underlying_id() {
|
||||
if(underlying_id_ == 0){
|
||||
underlying_id_ = n_unit::id_manager::instance().next_id();
|
||||
}
|
||||
if (id_.empty()) {
|
||||
std::stringstream ss;
|
||||
ss << (type_.empty()?"Unit":type_) << "-" << underlying_id_;
|
||||
id_ = ss.str();
|
||||
}
|
||||
}
|
||||
|
||||
void unit::clone()
|
||||
|
Loading…
x
Reference in New Issue
Block a user