subs: Rename lnd_delete() to lnd_put_one()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-25 16:11:53 +01:00
parent 7548337e73
commit 56cadfe157
4 changed files with 27 additions and 27 deletions

View file

@ -180,7 +180,6 @@ extern double attack_val(int, struct lndstr *);
extern double defense_val(struct lndstr *); extern double defense_val(struct lndstr *);
extern int lnd_reaction_range(struct lndstr *); extern int lnd_reaction_range(struct lndstr *);
extern void lnd_print(natid, struct ulist *, char *); extern void lnd_print(natid, struct ulist *, char *);
extern void lnd_delete(struct ulist *);
extern int lnd_take_casualty(int, struct ulist *, int); extern int lnd_take_casualty(int, struct ulist *, int);
extern void lnd_submil(struct lndstr *, int); extern void lnd_submil(struct lndstr *, int);
extern void lnd_takemob(struct emp_qelem *, double); extern void lnd_takemob(struct emp_qelem *, double);
@ -189,6 +188,7 @@ extern void intelligence_report(int, struct lndstr *, int, char *);
extern void lnd_mar(struct emp_qelem *, double *, double *, int *, natid); extern void lnd_mar(struct emp_qelem *, double *, double *, int *, natid);
extern void lnd_mar_put(struct emp_qelem *, natid); extern void lnd_mar_put(struct emp_qelem *, natid);
extern void lnd_put(struct emp_qelem *); extern void lnd_put(struct emp_qelem *);
extern void lnd_put_one(struct ulist *);
extern int lnd_hardtarget(struct lndstr *); extern int lnd_hardtarget(struct lndstr *);
extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int); extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
extern int lnd_support(natid, natid, coord, coord, int); extern int lnd_support(natid, natid, coord, coord, int);

View file

@ -176,7 +176,7 @@ assa(void)
pr(" and was killed in the attempt.\n"); pr(" and was killed in the attempt.\n");
llp->unit.land.lnd_effic = 0; llp->unit.land.lnd_effic = 0;
putland(llp->unit.land.lnd_uid, &llp->unit.land); putland(llp->unit.land.lnd_uid, &llp->unit.land);
lnd_delete(llp); lnd_put_one(llp);
} else { } else {
wu(0, def->own, "%s spy spotted in %s.\n", wu(0, def->own, "%s spy spotted in %s.\n",
cname(player->cnum), xyas(def->x, def->y, cname(player->cnum), xyas(def->x, def->y,

View file

@ -1246,7 +1246,7 @@ get_ototal(int combat_mode, struct combat *off, struct emp_qelem *olist,
if (w < 0) { if (w < 0) {
lnd_print(player->cnum, llp, lnd_print(player->cnum, llp,
"can't attack from this sector now"); "can't attack from this sector now");
lnd_delete(llp); lnd_put_one(llp);
continue; continue;
} }
ototal += attack_val(combat_mode, &llp->unit.land) * ototal += attack_val(combat_mode, &llp->unit.land) *
@ -1312,7 +1312,7 @@ get_oland(int combat_mode, struct ulist *llp)
sprintf(buf, "was destroyed and is no longer a part of the %s", sprintf(buf, "was destroyed and is no longer a part of the %s",
att_mode[combat_mode]); att_mode[combat_mode]);
lnd_print(player->cnum, llp, buf); lnd_print(player->cnum, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
return 0; return 0;
} }
if (lp->lnd_x != llp->x || lp->lnd_y != llp->y) { if (lp->lnd_x != llp->x || lp->lnd_y != llp->y) {
@ -1320,7 +1320,7 @@ get_oland(int combat_mode, struct ulist *llp)
"left to fight another battle and is no longer a part of the %s", "left to fight another battle and is no longer a part of the %s",
att_mode[combat_mode]); att_mode[combat_mode]);
lnd_print(player->cnum, llp, buf); lnd_print(player->cnum, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
return 0; return 0;
} }
if (lp->lnd_effic < llp->eff) { if (lp->lnd_effic < llp->eff) {
@ -1344,13 +1344,13 @@ get_dland(struct combat *def, struct ulist *llp)
if (lp->lnd_effic < LAND_MINEFF) { if (lp->lnd_effic < LAND_MINEFF) {
sprintf(buf, "was destroyed and is no longer a part of the defense"); sprintf(buf, "was destroyed and is no longer a part of the defense");
lnd_print(llp->unit.land.lnd_own, llp, buf); lnd_print(llp->unit.land.lnd_own, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
return 0; return 0;
} }
if (lp->lnd_x != def->x || lp->lnd_y != def->y) { if (lp->lnd_x != def->x || lp->lnd_y != def->y) {
lnd_print(llp->unit.land.lnd_own, llp, lnd_print(llp->unit.land.lnd_own, llp,
"left to go fight another battle and is no longer a part of the defense"); "left to go fight another battle and is no longer a part of the defense");
lnd_delete(llp); lnd_put_one(llp);
return 0; return 0;
} }
@ -1371,7 +1371,7 @@ kill_land(struct emp_qelem *list)
llp->unit.land.lnd_effic = 0; llp->unit.land.lnd_effic = 0;
lnd_print(player->cnum, llp, lnd_print(player->cnum, llp,
"cannot return to the ship, and dies!"); "cannot return to the ship, and dies!");
lnd_delete(llp); lnd_put_one(llp);
} }
} }
} }
@ -2110,7 +2110,7 @@ send_reacting_units_home(struct emp_qelem *list)
llp->unit.land.lnd_x = llp->x; llp->unit.land.lnd_x = llp->x;
llp->unit.land.lnd_y = llp->y; llp->unit.land.lnd_y = llp->y;
lnd_print(llp->unit.land.lnd_own, llp, buf); lnd_print(llp->unit.land.lnd_own, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
} }
} }
} }
@ -2190,7 +2190,7 @@ take_def(int combat_mode, struct emp_qelem *list, struct combat *off,
sprintf(buf, "moves in to occupy %s", sprintf(buf, "moves in to occupy %s",
xyas(def->x, def->y, player->cnum)); xyas(def->x, def->y, player->cnum));
lnd_print(player->cnum, llp, buf); lnd_print(player->cnum, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
} }
} }
} }
@ -2212,7 +2212,7 @@ take_def(int combat_mode, struct emp_qelem *list, struct combat *off,
putland(land.lnd_uid, &land); putland(land.lnd_uid, &land);
} }
if (delete_me) if (delete_me)
lnd_delete(delete_me); lnd_put_one(delete_me);
att_get_combat(def, 0); att_get_combat(def, 0);
return 1; return 1;
} }
@ -2272,7 +2272,7 @@ ask_move_in(struct combat *off, struct emp_qelem *olist,
xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y, xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y,
player->cnum)); player->cnum));
lnd_print(player->cnum, llp, buf); lnd_print(player->cnum, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
} }
if (QEMPTY(olist)) if (QEMPTY(olist))
return; return;
@ -2286,7 +2286,7 @@ ask_move_in(struct combat *off, struct emp_qelem *olist,
xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y, xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y,
player->cnum)); player->cnum));
lnd_print(player->cnum, llp, buf); lnd_print(player->cnum, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
} }
return; return;
} }

View file

@ -145,14 +145,6 @@ lnd_print(natid actor, struct ulist *llp, char *s)
wu(0, actor, "%s %s\n", prland(&llp->unit.land), s); wu(0, actor, "%s %s\n", prland(&llp->unit.land), s);
} }
void
lnd_delete(struct ulist *llp)
{
putland(llp->unit.land.lnd_uid, &llp->unit.land);
emp_remque(&llp->queue);
free(llp);
}
int int
lnd_take_casualty(int combat_mode, struct ulist *llp, int cas) lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
/* attacking or assaulting or paratrooping? */ /* attacking or assaulting or paratrooping? */
@ -190,7 +182,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y, xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y,
llp->unit.land.lnd_own)); llp->unit.land.lnd_own));
lnd_print(llp->unit.land.lnd_own, llp, buf); lnd_print(llp->unit.land.lnd_own, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
/* Since we killed the unit, we killed all the mil on it */ /* Since we killed the unit, we killed all the mil on it */
return taken; return taken;
} else { } else {
@ -264,7 +256,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
llp->unit.land.lnd_effic, llp->unit.land.lnd_effic,
xyas(bx, by, llp->unit.land.lnd_own)); xyas(bx, by, llp->unit.land.lnd_own));
lnd_print(llp->unit.land.lnd_own, llp, buf); lnd_print(llp->unit.land.lnd_own, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
} }
} else { /* attacking from a sector */ } else { /* attacking from a sector */
sprintf(buf, "leaves the battlefield at %d%% efficiency", sprintf(buf, "leaves the battlefield at %d%% efficiency",
@ -275,7 +267,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
llp->unit.land.lnd_mobil -= (int)llp->mobil; llp->unit.land.lnd_mobil -= (int)llp->mobil;
llp->mobil = 0.0; llp->mobil = 0.0;
lnd_print(llp->unit.land.lnd_own, llp, buf); lnd_print(llp->unit.land.lnd_own, llp, buf);
lnd_delete(llp); lnd_put_one(llp);
} }
} }
if (nowhere_to_go) { if (nowhere_to_go) {
@ -286,7 +278,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
if (llp->unit.land.lnd_effic < LAND_MINEFF) { if (llp->unit.land.lnd_effic < LAND_MINEFF) {
lnd_print(llp->unit.land.lnd_own, llp, lnd_print(llp->unit.land.lnd_own, llp,
"has nowhere to retreat, and dies!"); "has nowhere to retreat, and dies!");
lnd_delete(llp); lnd_put_one(llp);
} else } else
lnd_print(llp->unit.land.lnd_own, llp, lnd_print(llp->unit.land.lnd_own, llp,
"has nowhere to retreat and takes extra losses!"); "has nowhere to retreat and takes extra losses!");
@ -568,6 +560,14 @@ lnd_put(struct emp_qelem *list)
} }
} }
void
lnd_put_one(struct ulist *llp)
{
putland(llp->unit.land.lnd_uid, &llp->unit.land);
emp_remque(&llp->queue);
free(llp);
}
/* /*
* Sweep landmines with engineers in LAND_LIST for ACTOR. * Sweep landmines with engineers in LAND_LIST for ACTOR.
* If EXPLICIT is non-zero, this is for an explicit sweep command from * If EXPLICIT is non-zero, this is for an explicit sweep command from
@ -695,7 +695,7 @@ lnd_stays(natid actor, char *str, struct ulist *llp)
if (llp->mobil < -127) if (llp->mobil < -127)
llp->mobil = -127; llp->mobil = -127;
llp->unit.land.lnd_mobil = llp->mobil; llp->unit.land.lnd_mobil = llp->mobil;
lnd_delete(llp); lnd_put_one(llp);
} }
static int static int
@ -1059,7 +1059,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
prland(&llp->unit.land)); prland(&llp->unit.land));
llp->unit.land.lnd_effic = 0; llp->unit.land.lnd_effic = 0;
putland(llp->unit.land.lnd_uid, &llp->unit.land); putland(llp->unit.land.lnd_uid, &llp->unit.land);
lnd_delete(llp); lnd_put_one(llp);
} }
} }
} }