unit.has_attrib should not require the attribute to be registered.

This commit is contained in:
Enno Rehling 2017-03-27 22:07:18 +02:00
parent a59f321b44
commit 75049d3bbc
2 changed files with 8 additions and 4 deletions

View File

@ -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}

View File

@ -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;
} }