mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-01 18:19:10 +00:00
return 0 for length of arrays inside nonexistent containers (bug #13734)
This commit is contained in:
parent
23bd84f78a
commit
808d642bf8
@ -3,6 +3,8 @@ Version 1.7.2+svn:
|
||||
* New unit graphics and animations for the Troll Hero.
|
||||
* Language and i18n:
|
||||
* Updated translations: Dutch, French
|
||||
* WML Engine:
|
||||
* return 0 for length of arrays inside nonexistent containers (bug #13734)
|
||||
* Miscellaneous and bugfixes:
|
||||
* 'Recruit' and 'recall' don't appear in context menus unless the
|
||||
leader is on a keep. (bug #13856 and #13855)
|
||||
|
@ -532,7 +532,14 @@ t_string& game_state::get_variable(const std::string& key)
|
||||
const t_string& game_state::get_variable_const(const std::string& key) const
|
||||
{
|
||||
variable_info to_get(key, false, variable_info::TYPE_SCALAR);
|
||||
if(!to_get.is_valid) return temporaries[key];
|
||||
if(!to_get.is_valid) {
|
||||
t_string& to_return = temporaries[key];
|
||||
if(key.size() > 7 and key.substr(key.size()-7)==".length") {
|
||||
// length is a special attribute, so guarantee its correctness
|
||||
to_return = "0";
|
||||
}
|
||||
return to_return;
|
||||
}
|
||||
return to_get.as_scalar();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user