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}
|
${INIPARSER_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(C_MATH_LIBRARY m)
|
|
||||||
|
|
||||||
add_executable(convert convert.c)
|
add_executable(convert convert.c)
|
||||||
target_link_libraries(convert
|
target_link_libraries(convert
|
||||||
game
|
game
|
||||||
${C_MATH_LIBRARY}
|
${LUA_MATH_LIBRARY}
|
||||||
${STORAGE_LIBRARIES}
|
${STORAGE_LIBRARIES}
|
||||||
${CLIBS_LIBRARIES}
|
${CLIBS_LIBRARIES}
|
||||||
${INIPARSER_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) {
|
static int tolua_unit_has_attrib(lua_State *L) {
|
||||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||||
const char *name = tolua_tostring(L, 2, 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);
|
lua_pushboolean(L, a != NULL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue