]> git.pond.sub.org Git - empserver/commitdiff
lnd_delete() can no longer print a message
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 20 Jun 2010 06:34:11 +0000 (08:34 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 24 Jul 2010 09:28:32 +0000 (11:28 +0200)
Callers changed to print it themselves.

But print the first "boards" message before plane takeover instead of
after, in take_def().

include/land.h
src/lib/commands/assa.c
src/lib/subs/attsub.c
src/lib/subs/lndsub.c

index 899e42c4bce458507c19e2715391d6d3356e18ea..93a1fd54e17634634fd98f30a569f8f08794f0e2 100644 (file)
@@ -181,7 +181,7 @@ extern double attack_val(int, struct lndstr *);
 extern double defense_val(struct lndstr *);
 extern int lnd_reaction_range(struct lndstr *);
 extern void lnd_print(struct ulist *, char *);
-extern void lnd_delete(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);
index b8ac970cc79039429bef43ad86d9b077c8d76d5c..3a66ea9fcdd3142ffdae8044c0ba10b82b67a719 100644 (file)
@@ -181,7 +181,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, NULL);
+                   lnd_delete(llp);
                } else {
                    wu(0, def->own, "%s spy spotted in %s.\n",
                       cname(player->cnum), xyas(def->x, def->y,
index 6111db5da498b74fca8b66df2bc8f4e6f31e9f79..4738112aa5f00caa51c12fc0da0dd33eb22d2ce6 100644 (file)
@@ -1290,7 +1290,8 @@ get_ototal(int combat_mode, struct combat *off, struct emp_qelem *olist,
                    w = n;
            }
            if (w < 0) {
-               lnd_delete(llp, "is in a sector not owned by you");
+               lnd_print(llp, "is in a sector not owned by you");
+               lnd_delete(llp);
                continue;
            }
            ototal += attack_val(combat_mode, &llp->unit.land) *
@@ -1355,14 +1356,16 @@ get_oland(int combat_mode, struct ulist *llp)
     if (lp->lnd_own != player->cnum) {
        sprintf(buf, "was destroyed and is no longer a part of the %s",
                att_mode[combat_mode]);
-       lnd_delete(llp, buf);
+       lnd_print(llp, buf);
+       lnd_delete(llp);
        return 0;
     }
     if (lp->lnd_x != llp->x || lp->lnd_y != llp->y) {
        sprintf(buf,
                "left to fight another battle and is no longer a part of the %s",
                att_mode[combat_mode]);
-       lnd_delete(llp, buf);
+       lnd_print(llp, buf);
+       lnd_delete(llp);
        return 0;
     }
     if (lp->lnd_effic < llp->eff) {
@@ -1385,12 +1388,14 @@ 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_delete(llp, buf);
+       lnd_print(llp, buf);
+       lnd_delete(llp);
        return 0;
     }
     if (lp->lnd_x != def->x || lp->lnd_y != def->y) {
-       lnd_delete(llp,
-                  "left to go fight another battle and is no longer a part of the defense");
+       lnd_print(llp,
+                 "left to go fight another battle and is no longer a part of the defense");
+       lnd_delete(llp);
        return 0;
     }
 
@@ -1409,7 +1414,8 @@ kill_land(struct emp_qelem *list)
        llp = (struct ulist *)qp;
        if (llp->unit.land.lnd_ship >= 0) {
            llp->unit.land.lnd_effic = 0;
-           lnd_delete(llp, "cannot return to the ship, and dies!");
+           lnd_print(llp, "cannot return to the ship, and dies!");
+           lnd_delete(llp);
        }
     }
 }
@@ -2156,7 +2162,8 @@ send_reacting_units_home(struct emp_qelem *list)
                    xyas(llp->x, llp->y, llp->unit.land.lnd_own));
            llp->unit.land.lnd_x = llp->x;
            llp->unit.land.lnd_y = llp->y;
-           lnd_delete(llp, buf);
+           lnd_print(llp, buf);
+           lnd_delete(llp);
        }
     }
 }
@@ -2229,12 +2236,14 @@ take_def(int combat_mode, struct emp_qelem *list, struct combat *off,
            if (def->type == EF_SHIP) {
                llp->unit.land.lnd_ship = def->shp_uid;
                sprintf(buf, "boards %s", prcom(0, def));
+               lnd_print(llp, buf);
                delete_me = llp;
            } else {
                llp->unit.land.lnd_ship = -1;
                sprintf(buf, "moves in to occupy %s",
                        xyas(def->x, def->y, player->cnum));
-               lnd_delete(llp, buf);
+               lnd_print(llp, buf);
+               lnd_delete(llp);
            }
        }
     }
@@ -2256,7 +2265,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, buf);
+       lnd_delete(delete_me);
     att_get_combat(def, 0);
     return 1;
 }
@@ -2315,7 +2324,8 @@ ask_move_in(struct combat *off, struct emp_qelem *olist,
        sprintf(buf, "stays in %s",
                xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y,
                     player->cnum));
-       lnd_delete(llp, buf);
+       lnd_print(llp, buf);
+       lnd_delete(llp);
     }
     if (QEMPTY(olist))
        return;
@@ -2328,7 +2338,8 @@ ask_move_in(struct combat *off, struct emp_qelem *olist,
            sprintf(buf, "stays in %s",
                    xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y,
                         player->cnum));
-           lnd_delete(llp, buf);
+           lnd_print(llp, buf);
+           lnd_delete(llp);
        }
        return;
     }
index 24b9417d9657607c70c95908d0ed3698fd454408..728f7298f38560e9cc221520b58eb1f1d8fdc1b8 100644 (file)
@@ -145,10 +145,8 @@ lnd_print(struct ulist *llp, char *s)
 }
 
 void
-lnd_delete(struct ulist *llp, char *s)
+lnd_delete(struct ulist *llp)
 {
-    if (s)
-       lnd_print(llp, s);
     putland(llp->unit.land.lnd_uid, &llp->unit.land);
     emp_remque((struct emp_qelem *)llp);
     free(llp);
@@ -192,7 +190,8 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
                combat_mode ? att_mode[combat_mode] : "defending",
                xyas(llp->unit.land.lnd_x, llp->unit.land.lnd_y,
                     llp->unit.land.lnd_own));
-       lnd_delete(llp, buf);
+       lnd_print(llp, buf);
+       lnd_delete(llp);
        /* Since we killed the unit, we killed all the mil on it */
        return taken;
     } else {
@@ -268,7 +267,8 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
                sprintf(buf, "retreats at %d%% efficiency to %s!",
                        llp->unit.land.lnd_effic,
                        xyas(bx, by, llp->unit.land.lnd_own));
-               lnd_delete(llp, buf);
+               lnd_print(llp, buf);
+               lnd_delete(llp);
            }
        } else {                /* attacking from a sector */
            sprintf(buf, "leaves the battlefield at %d%% efficiency",
@@ -278,7 +278,8 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
            else
                llp->unit.land.lnd_mobil -= (int)llp->mobil;
            llp->mobil = 0.0;
-           lnd_delete(llp, buf);
+           lnd_print(llp, buf);
+           lnd_delete(llp);
        }
     }
     if (nowhere_to_go) {
@@ -286,9 +287,10 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
        llp->unit.land.lnd_effic -= 10;
        lnd_submil(&llp->unit.land,
                   ((struct lchrstr *)llp->chrp)->l_item[I_MILIT] / 10);
-       if (llp->unit.land.lnd_effic < LAND_MINEFF)
-           lnd_delete(llp, "has nowhere to retreat, and dies!");
-       else
+       if (llp->unit.land.lnd_effic < LAND_MINEFF) {
+           lnd_print(llp, "has nowhere to retreat, and dies!");
+           lnd_delete(llp);
+       } else
            lnd_print(llp,
                      "has nowhere to retreat and takes extra losses!");
     }
@@ -1021,7 +1023,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
                    pr("%s was shot and killed.\n", prland(&llp->unit.land));
                    llp->unit.land.lnd_effic = 0;
                    putland(llp->unit.land.lnd_uid, &llp->unit.land);
-                   lnd_delete(llp, NULL);
+                   lnd_delete(llp);
                }
            }
        }