diff --git a/src/bind_unit.c b/src/bind_unit.c index 28e24e85b..d494e5379 100644 --- a/src/bind_unit.c +++ b/src/bind_unit.c @@ -16,6 +16,7 @@ #include #include #include +#include "util/strings.h" #include "util/variant.h" /* kernel includes */ @@ -61,7 +62,9 @@ static int tolua_bufunit(lua_State * L) { if (f) { char buf[8192]; int mode = (int)tolua_tonumber(L, 3, (int)seen_unit); - bufunit_depr(f, u, mode, buf, sizeof(buf)); + sbstring sbs; + sbs_init(&sbs, buf, sizeof(buf)); + bufunit(f, u, NULL, mode, u->flags & UFL_ANON_FACTION, &sbs); tolua_pushstring(L, buf); return 1; } @@ -198,7 +201,7 @@ static int tolua_unit_set_id(lua_State * L) static int tolua_unit_get_auramax(lua_State * L) { unit *u = (unit *)tolua_tousertype(L, 1, 0); - lua_pushinteger(L, max_spellpoints_depr(u->region, u)); + lua_pushinteger(L, max_spellpoints(u, u->region)); return 1; } diff --git a/src/creport.c b/src/creport.c index 18957447b..45866ae07 100644 --- a/src/creport.c +++ b/src/creport.c @@ -875,7 +875,7 @@ void cr_output_unit(stream *out, const faction * f, mage = get_mage(u); if (mage) { stream_printf(out, "%d;Aura\n", get_spellpoints(u)); - stream_printf(out, "%d;Auramax\n", max_spellpoints_depr(u->region, u)); + stream_printf(out, "%d;Auramax\n", max_spellpoints(u, u->region)); } /* default commands */ stream_printf(out, "COMMANDS\n"); diff --git a/src/items/xerewards.c b/src/items/xerewards.c index acea74fc3..e0ce80802 100644 --- a/src/items/xerewards.c +++ b/src/items/xerewards.c @@ -56,7 +56,7 @@ use_manacrystal(struct unit *u, const struct item_type *itype, int amount, return -1; } - msp = max_spellpoints_depr(u->region, u) / 2; + msp = max_spellpoints(u, u->region) / 2; if (msp < 25) msp = 25; for (i = 0; i != amount; ++i) { sp += msp; diff --git a/src/kernel/pool.c b/src/kernel/pool.c index f09781478..90e6372f7 100644 --- a/src/kernel/pool.c +++ b/src/kernel/pool.c @@ -44,7 +44,7 @@ int get_resource(const unit * u, const resource_type * rtype) return get_spellpoints(u); } if (rtype == get_resourcetype(R_PERMAURA)) { - return max_spellpoints_depr(u->region, u); + return max_spellpoints(u, u->region); } log_error("trying to get unknown resource '%s'.\n", rtype->_name); return 0; diff --git a/src/laws.c b/src/laws.c index b18a3dd2b..676f82b9d 100644 --- a/src/laws.c +++ b/src/laws.c @@ -735,7 +735,6 @@ void immigration(void) for (r = regions; r; r = r->next) { if (r->land && r->land->newpeasants) { int rp = rpeasants(r) + r->land->newpeasants; - /* FIXME: kann ernsthaft abs(newpeasants) > rpeasants(r) sein? */ if (rp < 0) rp = 0; rsetpeasants(r, rp); r->land->newpeasants = 0; diff --git a/src/magic.c b/src/magic.c index 578557b23..c29da6acd 100644 --- a/src/magic.c +++ b/src/magic.c @@ -652,11 +652,6 @@ int max_spellpoints(const struct unit *u, const region * r) return (msp > 0) ? (int)msp : 0; } -int max_spellpoints_depr(const struct region *r, const struct unit *u) -{ - return max_spellpoints(u, r); -} - int change_maxspellpoints(unit * u, int csp) { sc_mage *m = get_mage(u); @@ -664,7 +659,7 @@ int change_maxspellpoints(unit * u, int csp) return 0; } m->spchange += csp; - return max_spellpoints_depr(u->region, u); + return max_spellpoints(u, u->region); } /* ------------------------------------------------------------- */ diff --git a/src/magic.h b/src/magic.h index 068ab223e..1eeefabed 100644 --- a/src/magic.h +++ b/src/magic.h @@ -235,7 +235,6 @@ extern "C" { /* setzt die Magiepunkte auf sp */ int change_spellpoints(struct unit *u, int mp); /* veraendert die Anzahl der Magiepunkte der Einheit um +mp */ - int max_spellpoints_depr(const struct region *r, const struct unit *u); int max_spellpoints(const struct unit *u, const struct region *r); /* gibt die aktuell maximal moeglichen Magiepunkte der Einheit zurueck */ int change_maxspellpoints(struct unit *u, int csp); diff --git a/src/magic.test.c b/src/magic.test.c index 9c4b428a8..ec00bbb9e 100644 --- a/src/magic.test.c +++ b/src/magic.test.c @@ -447,7 +447,6 @@ static void test_max_spellpoints(CuTest *tc) { test_setup(); rc = test_create_race("human"); u = test_create_unit(test_create_faction(rc), test_create_plain(0, 0)); - CuAssertIntEquals(tc, 0, max_spellpoints_depr(u->region, u)); CuAssertIntEquals(tc, 0, max_spellpoints(u, u->region)); CuAssertIntEquals(tc, 0, max_spellpoints(u, NULL)); create_mage(u, M_GWYRRD); diff --git a/src/spells.c b/src/spells.c index 604810d1c..13a63fe9c 100644 --- a/src/spells.c +++ b/src/spells.c @@ -3782,7 +3782,7 @@ static int sp_migranten(castorder * co) return 0; } /* maximal Stufe Personen */ - if (target->number > max_force || target->number > max_spellpoints_depr(r, mage)) { + if (target->number > max_force || target->number > max_spellpoints(mage, r)) { ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "spellfail_toomanytargets", "")); return 0; diff --git a/src/triggers/shock.c b/src/triggers/shock.c index b45eeb90b..416b628ac 100644 --- a/src/triggers/shock.c +++ b/src/triggers/shock.c @@ -52,7 +52,7 @@ static void do_shock(unit * u, const char *reason) /* Aura - Verlust */ if (is_mage(u)) { - int aura = max_spellpoints_depr(u->region, u) / 10; + int aura = max_spellpoints(u, u->region) / 10; int now = get_spellpoints(u); if (now > aura) { set_spellpoints(u, aura);