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:
parent
4d1dd6fa6a
commit
27d37f35a9
3 changed files with 6 additions and 9 deletions
|
@ -560,10 +560,12 @@ doland(char op, int arg, char *p, struct sctstr *sect)
|
||||||
case 'X':
|
case 'X':
|
||||||
old = sect->sct_che_target;
|
old = sect->sct_che_target;
|
||||||
new = errcheck(arg, 0, MAXNOC - 1);
|
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),
|
xyas(sect->sct_x, sect->sct_y, player->cnum),
|
||||||
cname(old), old, cname(new), new);
|
cname(old), old, cname(new), new);
|
||||||
sect->sct_che_target = new;
|
sect->sct_che_target = new;
|
||||||
|
if (new == 0)
|
||||||
|
sect->sct_che = 0;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
old = sect->sct_pstage;
|
old = sect->sct_pstage;
|
||||||
|
|
|
@ -141,6 +141,8 @@ takeover(struct sctstr *sp, natid newown)
|
||||||
sp->sct_che = che_count;
|
sp->sct_che = che_count;
|
||||||
if (newown != sp->sct_oldown)
|
if (newown != sp->sct_oldown)
|
||||||
sp->sct_che_target = newown;
|
sp->sct_che_target = newown;
|
||||||
|
if (sp->sct_che_target == 0)
|
||||||
|
sp->sct_che = 0;
|
||||||
sp->sct_item[I_CIVIL] = civ;
|
sp->sct_item[I_CIVIL] = civ;
|
||||||
if (sp->sct_oldown == newown || civ == 0) {
|
if (sp->sct_oldown == newown || civ == 0) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -203,10 +203,8 @@ guerrilla(struct sctstr *sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
target = sp->sct_che_target;
|
target = sp->sct_che_target;
|
||||||
if (target == 0) {
|
if (CANT_HAPPEN(target == 0))
|
||||||
/* the deity can't be a target! */
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
tnat = getnatp(target);
|
tnat = getnatp(target);
|
||||||
if (tnat->nat_stat == STAT_UNUSED) {
|
if (tnat->nat_stat == STAT_UNUSED) {
|
||||||
/* target nation has dissolved: che's retire. */
|
/* target nation has dissolved: che's retire. */
|
||||||
|
@ -296,11 +294,6 @@ guerrilla(struct sctstr *sp)
|
||||||
*/
|
*/
|
||||||
if (chance(ratio * 0.10)) {
|
if (chance(ratio * 0.10)) {
|
||||||
n = (mil / 5) + 1;
|
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 = (double)che / (n + che);
|
||||||
odds /= hap_fact(tnat, getnatp(sp->sct_oldown));
|
odds /= hap_fact(tnat, getnatp(sp->sct_oldown));
|
||||||
while (che > 0 && n > 0) {
|
while (che > 0 && n > 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue