eliminate deprecated function.

This commit is contained in:
Enno Rehling 2020-08-13 16:39:49 +02:00
parent bf00a9a994
commit 2e44e2dd09
10 changed files with 11 additions and 16 deletions

View File

@ -16,6 +16,7 @@
#include <kernel/event.h>
#include <util/log.h>
#include <util/macros.h>
#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;
}

View File

@ -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");

View File

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

View File

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

View File

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

View File

@ -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);
}
/* ------------------------------------------------------------- */

View File

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

View File

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

View File

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

View File

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