Che cannot target #0:

(guerrilla): Oops on it.
(doland, takeover): Clear them when che_target becomes 0.

(doland): Fix bogus message.

(guerrilla): Remove silly sanity check.
This commit is contained in:
Markus Armbruster 2006-06-16 20:01:30 +00:00
parent 4d1dd6fa6a
commit 27d37f35a9
3 changed files with 6 additions and 9 deletions

View 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;

View 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) {
/*

View 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) {