]> git.pond.sub.org Git - empserver/commitdiff
subs: Rename lnd_delete() to lnd_put_one()
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 25 Jan 2014 15:11:53 +0000 (16:11 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 17 Jan 2015 14:25:24 +0000 (15:25 +0100)
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
include/land.h
src/lib/commands/assa.c
src/lib/subs/attsub.c
src/lib/subs/lndsub.c

index 4dbc2d0374970a74cb05cf1836ab9be189bd82f5..336ea2dc2bcf1b8544a7126a7d67bcf4aeff2cc5 100644 (file)
@@ -180,7 +180,6 @@ extern double attack_val(int, struct lndstr *);
 extern double defense_val(struct lndstr *);
 extern int lnd_reaction_range(struct lndstr *);
 extern void lnd_print(natid, struct ulist *, char *);
-extern void lnd_delete(struct ulist *);
 extern int lnd_take_casualty(int, struct ulist *, int);
 extern void lnd_submil(struct lndstr *, int);
 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_put(struct emp_qelem *, natid);
 extern void lnd_put(struct emp_qelem *);
+extern void lnd_put_one(struct ulist *);
 extern int lnd_hardtarget(struct lndstr *);
 extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
 extern int lnd_support(natid, natid, coord, coord, int);
index 7c4aa1526e0ac45aacacef808df1214e1d190f5a..2b3164cb1fb21c034a4b25dd70eb8bfc7caf9a1c 100644 (file)
@@ -176,7 +176,7 @@ assa(void)
                    pr(" and was killed in the attempt.\n");
                    llp->unit.land.lnd_effic = 0;
                    putland(llp->unit.land.lnd_uid, &llp->unit.land);
-                   lnd_delete(llp);
+                   lnd_put_one(llp);
                } else {
                    wu(0, def->own, "%s spy spotted in %s.\n",
                       cname(player->cnum), xyas(def->x, def->y,
index af3df3a6fafc8708b16bea2dc3461ff2f6e02ae8..9640f10ee766ba4023ad5b77413cff35b494d36b 100644 (file)
@@ -1246,7 +1246,7 @@ get_ototal(int combat_mode, struct combat *off, struct emp_qelem *olist,
            if (w < 0) {
                lnd_print(player->cnum, llp,
                          "can't attack from this sector now");
-               lnd_delete(llp);
+               lnd_put_one(llp);
                continue;
            }
            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",
                att_mode[combat_mode]);
        lnd_print(player->cnum, llp, buf);
-       lnd_delete(llp);
+       lnd_put_one(llp);
        return 0;
     }
     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",
                att_mode[combat_mode]);
        lnd_print(player->cnum, llp, buf);
-       lnd_delete(llp);
+       lnd_put_one(llp);
        return 0;
     }
     if (lp->lnd_effic < llp->eff) {
@@ -1344,13 +1344,13 @@ get_dland(struct combat *def, struct ulist *llp)
     if (lp->lnd_effic < LAND_MINEFF) {
        sprintf(buf, "was destroyed and is no longer a part of the defense");
        lnd_print(llp->unit.land.lnd_own, llp, buf);
-       lnd_delete(llp);
+       lnd_put_one(llp);
        return 0;
     }
     if (lp->lnd_x != def->x || lp->lnd_y != def->y) {
        lnd_print(llp->unit.land.lnd_own, llp,
                  "left to go fight another battle and is no longer a part of the defense");
-       lnd_delete(llp);
+       lnd_put_one(llp);
        return 0;
     }
 
@@ -1371,7 +1371,7 @@ kill_land(struct emp_qelem *list)
            llp->unit.land.lnd_effic = 0;
            lnd_print(player->cnum, llp,
                      "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_y = llp->y;
            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",
                        xyas(def->x, def->y, player->cnum));
                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);
     }
     if (delete_me)
-       lnd_delete(delete_me);
+       lnd_put_one(delete_me);
     att_get_combat(def, 0);
     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,
                     player->cnum));
        lnd_print(player->cnum, llp, buf);
-       lnd_delete(llp);
+       lnd_put_one(llp);
     }
     if (QEMPTY(olist))
        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,
                         player->cnum));
            lnd_print(player->cnum, llp, buf);
-           lnd_delete(llp);
+           lnd_put_one(llp);
        }
        return;
     }
index 9183d0aaf0d91eeb58013213f78ccb7a20c28358..3b25ff0cb90ccb53a33fbecffec3fd78ecc2496d 100644 (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);
 }
 
-void
-lnd_delete(struct ulist *llp)
-{
-    putland(llp->unit.land.lnd_uid, &llp->unit.land);
-    emp_remque(&llp->queue);
-    free(llp);
-}
-
 int
 lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
                        /* 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,
                     llp->unit.land.lnd_own));
        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 */
        return taken;
     } else {
@@ -264,7 +256,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
                        llp->unit.land.lnd_effic,
                        xyas(bx, by, llp->unit.land.lnd_own));
                lnd_print(llp->unit.land.lnd_own, llp, buf);
-               lnd_delete(llp);
+               lnd_put_one(llp);
            }
        } else {                /* attacking from a sector */
            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->mobil = 0.0;
            lnd_print(llp->unit.land.lnd_own, llp, buf);
-           lnd_delete(llp);
+           lnd_put_one(llp);
        }
     }
     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) {
            lnd_print(llp->unit.land.lnd_own, llp,
                      "has nowhere to retreat, and dies!");
-           lnd_delete(llp);
+           lnd_put_one(llp);
        } else
            lnd_print(llp->unit.land.lnd_own, llp,
                      "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.
  * 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)
        llp->mobil = -127;
     llp->unit.land.lnd_mobil = llp->mobil;
-    lnd_delete(llp);
+    lnd_put_one(llp);
 }
 
 static int
@@ -1059,7 +1059,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
                        prland(&llp->unit.land));
                    llp->unit.land.lnd_effic = 0;
                    putland(llp->unit.land.lnd_uid, &llp->unit.land);
-                   lnd_delete(llp);
+                   lnd_put_one(llp);
                }
            }
        }