forked from github/server
unit.has_attrib should not require the attribute to be registered.
This commit is contained in:
parent
a59f321b44
commit
75049d3bbc
|
@ -187,12 +187,10 @@ target_link_libraries(eressea
|
|||
${INIPARSER_LIBRARIES}
|
||||
)
|
||||
|
||||
find_library(C_MATH_LIBRARY m)
|
||||
|
||||
add_executable(convert convert.c)
|
||||
target_link_libraries(convert
|
||||
game
|
||||
${C_MATH_LIBRARY}
|
||||
${LUA_MATH_LIBRARY}
|
||||
${STORAGE_LIBRARIES}
|
||||
${CLIBS_LIBRARIES}
|
||||
${INIPARSER_LIBRARIES}
|
||||
|
|
|
@ -787,7 +787,13 @@ static int tolua_unit_get_curse(lua_State *L) {
|
|||
static int tolua_unit_has_attrib(lua_State *L) {
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *name = tolua_tostring(L, 2, 0);
|
||||
attrib * a = self->attribs ? a_find(self->attribs, at_find(name)) : NULL;
|
||||
attrib * a = self->attribs;
|
||||
while (a) {
|
||||
if (strcmp(a->type->name, name) == 0) {
|
||||
break;
|
||||
}
|
||||
a = a->nexttype;
|
||||
}
|
||||
lua_pushboolean(L, a != NULL);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue