Fix WFL unit.side returning one less than the actual side
This commit is contained in:
parent
ca00829199
commit
d6c9b67e89
2 changed files with 4 additions and 1 deletions
|
@ -378,6 +378,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
} else if(key == "teams")
|
||||
{
|
||||
std::vector<variant> vars;
|
||||
vars.emplace_back(); // This enables the array to be 1-indexed instead of 0-indexed.
|
||||
for(std::vector<team>::const_iterator i = resources::gameboard->teams().begin(); i != resources::gameboard->teams().end(); ++i) {
|
||||
vars.emplace_back(std::make_shared<team_callable>(*i));
|
||||
}
|
||||
|
@ -386,6 +387,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
} else if(key == "allies")
|
||||
{
|
||||
std::vector<variant> vars;
|
||||
vars.emplace_back(); // This enables the array to be 1-indexed instead of 0-indexed.
|
||||
for( size_t i = 0; i < resources::gameboard->teams().size(); ++i) {
|
||||
if ( !current_team().is_enemy( i+1 ) )
|
||||
vars.emplace_back(i);
|
||||
|
@ -395,6 +397,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
} else if(key == "enemies")
|
||||
{
|
||||
std::vector<variant> vars;
|
||||
vars.emplace_back(); // This enables the array to be 1-indexed instead of 0-indexed.
|
||||
for( size_t i = 0; i < resources::gameboard->teams().size(); ++i) {
|
||||
if ( current_team().is_enemy( i+1 ) )
|
||||
vars.emplace_back(i);
|
||||
|
|
|
@ -232,7 +232,7 @@ variant unit_callable::get_value(const std::string& key) const
|
|||
} else if(key == "states" || key == "status") {
|
||||
return formula_callable::convert_set(u_.get_states());
|
||||
} else if(key == "side") {
|
||||
return variant(u_.side()-1);
|
||||
return variant(u_.side());
|
||||
} else if(key == "cost") {
|
||||
return variant(u_.cost());
|
||||
} else if(key == "upkeep") {
|
||||
|
|
Loading…
Add table
Reference in a new issue