return -1 for time-to-live when it's not meaningful for a unit. ignore negative life bar values
This commit is contained in:
parent
83d0849bf0
commit
106db194bd
2 changed files with 4 additions and 1 deletions
src
|
@ -284,6 +284,9 @@ static const CUnit *GetUnitRef(const CUnit &unit, EnumUnit e)
|
|||
} else {
|
||||
f = (100 * EvalNumber(this->ValueFunc)) / this->ValueMax;
|
||||
f = f > 100 ? 100 : f;
|
||||
if (f < 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
|
||||
|
|
|
@ -1110,7 +1110,7 @@ static int CclGetUnitVariable(lua_State *l)
|
|||
int pcnt = W * 100.0 / G;
|
||||
lua_pushinteger(l, pcnt);
|
||||
} else {
|
||||
lua_pushinteger(l, 100);
|
||||
lua_pushinteger(l, -1);
|
||||
}
|
||||
} else if (!strcmp(value, "IndividualUpgrade")) {
|
||||
LuaCheckArgs(l, 3);
|
||||
|
|
Loading…
Add table
Reference in a new issue