]> git.pond.sub.org Git - empserver/commitdiff
(move, explore): Simplify computation of destination sector's work and
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 24 Aug 2004 07:08:59 +0000 (07:08 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 24 Aug 2004 07:08:59 +0000 (07:08 +0000)
loyalty to get rid of compiler warnings.

src/lib/commands/expl.c
src/lib/commands/move.c

index 51566f5db83e0b8556929262e118d75a16f121cd..ae2905336f25fed8def59d8e3be851f5110f4efc 100644 (file)
@@ -103,15 +103,13 @@ explore(void)
           xyas(sect.sct_x, sect.sct_y, player->cnum));
        return RET_SYN;
     }
-    if (vtype == I_CIVIL) {
-       work = sect.sct_work;
-       if (work != 100)
-           pr("Warning: civil unrest\n");
-       loyal = sect.sct_loyal;
-    } else if (vtype == I_MILIT) {
-       work = 100;
-       loyal = 0;
-    }
+
+    /* only used when moving civs; but prevent spurious compiler warnings */
+    work = sect.sct_work;
+    loyal = sect.sct_loyal;
+    if (vtype == I_CIVIL && work != 100)
+       pr("Warning: civil unrest\n");
+
     sprintf(prompt, "Number of %s to explore with? (max %d) ",
            ip->i_name, amt_src);
     amount = onearg(player->argp[3], prompt);
@@ -223,8 +221,8 @@ explore(void)
        takeover(&sect, player->cnum);
        justtook = 1;
        sect.sct_oldown = own;
-       sect.sct_work = work;
-       sect.sct_loyal = loyal;
+       sect.sct_work = 100;
+       sect.sct_loyal = 0;
     }
     if (vtype == I_CIVIL && sect.sct_oldown != player->cnum) {
        pr("Your civilians don't want to stay!\n");
index fec474d8b59dcd07ec3116406f4fd05a617517f9..92dbfbd5e49a2246755dce80e035c37ae2e5ae78 100644 (file)
@@ -120,15 +120,13 @@ move(void)
           xyas(sect.sct_x, sect.sct_y, player->cnum));
        return RET_SYN;
     }
-    if (vtype == I_CIVIL) {
-       work = sect.sct_work;
-       if (work != 100)
-           pr("Warning: civil unrest\n");
-       loyal = sect.sct_loyal;
-    } else if (vtype == I_MILIT) {
-       work = 100;
-       loyal = 0;
-    }
+
+    /* only used when moving civs; but prevent spurious compiler warnings */
+    work = sect.sct_work;
+    loyal = sect.sct_loyal;
+    if (vtype == I_CIVIL && work != 100)
+       pr("Warning: civil unrest\n");
+
     if (istest)
        sprintf(prompt, "Number of %s to test move? ", ip->i_name);
     else