Fixed valid field not properly detecting removed units.
This commit is contained in:
parent
bba7c154c5
commit
460ce60bc3
1 changed files with 3 additions and 4 deletions
|
@ -837,21 +837,20 @@ static int impl_unit_get(lua_State *L)
|
|||
{
|
||||
lua_unit *lu = static_cast<lua_unit *>(lua_touserdata(L, 1));
|
||||
char const *m = luaL_checkstring(L, 2);
|
||||
unit const *pu = lu->get();
|
||||
|
||||
if (strcmp(m, "valid") == 0)
|
||||
{
|
||||
if (!pu) return 0;
|
||||
if (lu->on_map())
|
||||
lua_pushstring(L, "map");
|
||||
else if (lu->on_recall_list())
|
||||
lua_pushstring(L, "recall");
|
||||
else if (lu->get())
|
||||
lua_pushstring(L, "private");
|
||||
else
|
||||
return 0;
|
||||
lua_pushstring(L, "private");
|
||||
return 1;
|
||||
}
|
||||
|
||||
unit const *pu = lu->get();
|
||||
if (!pu) return luaL_argerror(L, 1, "unknown unit");
|
||||
unit const &u = *pu;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue