]> git.pond.sub.org Git - empserver/commitdiff
Che cannot target #0:
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 16 Jun 2006 20:01:30 +0000 (20:01 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 16 Jun 2006 20:01:30 +0000 (20:01 +0000)
(guerrilla): Oops on it.
(doland, takeover): Clear them when che_target becomes 0.

(doland): Fix bogus message.

(guerrilla): Remove silly sanity check.

src/lib/commands/edit.c
src/lib/subs/takeover.c
src/lib/update/revolt.c

index de3b7c209d2f4491afc05566d181645491f04cbc..e7e1a46e2b5f4ef02be7b65aed1741e09f9048a7 100644 (file)
@@ -560,10 +560,12 @@ doland(char op, int arg, char *p, struct sctstr *sect)
     case 'X':
        old = sect->sct_che_target;
        new = errcheck(arg, 0, MAXNOC - 1);
-       pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
+       pr("Che target of %s changed from %s (#%d) to %s (#%d).\n",
           xyas(sect->sct_x, sect->sct_y, player->cnum),
           cname(old), old, cname(new), new);
        sect->sct_che_target = new;
+       if (new == 0)
+           sect->sct_che = 0;
        break;
     case 'p':
        old = sect->sct_pstage;
index be1f802708332d6e857130560dc21651b25c1417..aed1ccece08d02afc6fa7bfea7e11057531d4df3 100644 (file)
@@ -141,6 +141,8 @@ takeover(struct sctstr *sp, natid newown)
     sp->sct_che = che_count;
     if (newown != sp->sct_oldown)
        sp->sct_che_target = newown;
+    if (sp->sct_che_target == 0)
+       sp->sct_che = 0;
     sp->sct_item[I_CIVIL] = civ;
     if (sp->sct_oldown == newown || civ == 0) {
        /*
index fb6226cd7cd613c7d2123240dd83b4e4cf5a755c..5ac712923b0eb918781a0e2e65869f0bd4d706ef 100644 (file)
@@ -203,10 +203,8 @@ guerrilla(struct sctstr *sp)
     }
 
     target = sp->sct_che_target;
-    if (target == 0) {
-       /* the deity can't be a target! */
+    if (CANT_HAPPEN(target == 0))
        return;
-    }
     tnat = getnatp(target);
     if (tnat->nat_stat == STAT_UNUSED) {
        /* target nation has dissolved: che's retire.  */
@@ -296,11 +294,6 @@ guerrilla(struct sctstr *sp)
         */
        if (chance(ratio * 0.10)) {
            n = (mil / 5) + 1;
-           if ((n + che) == 0) {
-               logerror("n=%d che=%d\n", n, che);
-               if (che == 0)
-                   return;
-           }
            odds = (double)che / (n + che);
            odds /= hap_fact(tnat, getnatp(sp->sct_oldown));
            while (che > 0 && n > 0) {