Merge branch 'develop' of github.com:ennorehling/eressea into develop

This commit is contained in:
Enno Rehling 2019-09-19 05:05:42 +02:00
commit e66329b71d
2 changed files with 21 additions and 11 deletions

View File

@ -531,8 +531,8 @@ static int tolua_unit_setskill(lua_State * L)
bool rcmod = tolua_toboolean(L, 4, 0);
skill_t sk = findskill(skname);
if (rcmod) level -= u_race(u)->bonus[sk];
if (sk != NOSKILL) {
if (rcmod) level -= u_race(u)->bonus[sk];
set_level(u, sk, level);
lua_pushinteger(L, level);
return 1;
@ -747,6 +747,15 @@ static int tolua_unit_get_curse(lua_State *L) {
return 0;
}
static int tolua_unit_clear_attribs(lua_State *L) {
unit *u = (unit *)tolua_tousertype(L, 1, NULL);
const char *name = tolua_tostring(L, 2, NULL);
const attrib_type *at = name ? at_find(name) : NULL;
a_removeall(&u->attribs, at);
return 0;
}
static int tolua_unit_has_attrib(lua_State *L) {
unit *u = (unit *)tolua_tousertype(L, 1, 0);
const char *name = tolua_tostring(L, 2, 0);
@ -979,6 +988,7 @@ void tolua_unit_open(lua_State * L)
tolua_function(L, TOLUA_CAST "add_order", tolua_unit_add_order);
tolua_function(L, TOLUA_CAST "clear_orders", tolua_unit_clear_orders);
tolua_function(L, TOLUA_CAST "get_curse", tolua_unit_get_curse);
tolua_function(L, TOLUA_CAST "clear_attribs", tolua_unit_clear_attribs);
tolua_function(L, TOLUA_CAST "has_attrib", tolua_unit_has_attrib);
/* key-attributes for named flags: */

View File

@ -441,16 +441,6 @@ static void paint_info_region(window * wnd, const state * st)
r->land->trees[1] + r->land->trees[2]);
}
line++;
if (r->ships && (st->info_flags & IFL_SHIPS)) {
ship *sh;
wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
mvwaddnstr(win, line++, 1, "* ships:", size - 5);
wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
for (sh = r->ships; sh && line < maxline; sh = sh->next) {
mvwprintw(win, line, 1, "%.4s ", itoa36(sh->no));
umvwaddnstr(win, line++, 6, (char *)sh->type->_name, size - 5);
}
}
if (r->units && (st->info_flags & IFL_FACTIONS)) {
unit *u;
wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
@ -477,6 +467,16 @@ static void paint_info_region(window * wnd, const state * st)
umvwaddnstr(win, line++, 6, unit_getname(u), size - 5);
}
}
if (r->ships && (st->info_flags & IFL_SHIPS)) {
ship *sh;
wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
mvwaddnstr(win, line++, 1, "* ships:", size - 5);
wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
for (sh = r->ships; sh && line < maxline; sh = sh->next) {
mvwprintw(win, line, 1, "%.4s ", itoa36(sh->no));
umvwaddnstr(win, line++, 6, (char *)sh->type->_name, size - 5);
}
}
}
}