Clean up misuse of mpr() in pln_damage()
Don't use multiple calls of mpr() to print a single line, because that creates a separate bulletin for each part. The read command normally merges the bulletins, but if the bulletins are more than five seconds apart (clock jumped somehow), we get a bulletin header in the middle of a line. While there, wrap long "blam" lines. Can only happen for bomb loads above 16. Stock game needs a tech 406 jhb for that. The mpr() misuse was introduced in Empire 2.
This commit is contained in:
parent
47dd33698c
commit
e002bf207f
1 changed files with 16 additions and 10 deletions
|
@ -985,12 +985,11 @@ int
|
||||||
pln_damage(struct plnstr *pp, char type, int noisy)
|
pln_damage(struct plnstr *pp, char type, int noisy)
|
||||||
{
|
{
|
||||||
struct plchrstr *pcp = plchr + pp->pln_type;
|
struct plchrstr *pcp = plchr + pp->pln_type;
|
||||||
int load, i;
|
int load, i, hitroll, aim, len;
|
||||||
int hitroll;
|
|
||||||
int dam = 0;
|
int dam = 0;
|
||||||
int aim;
|
|
||||||
int effective = 1;
|
int effective = 1;
|
||||||
int pinbomber = 0;
|
int pinbomber = 0;
|
||||||
|
char buf[80];
|
||||||
|
|
||||||
if (CANT_HAPPEN(nuk_on_plane(pp) >= 0))
|
if (CANT_HAPPEN(nuk_on_plane(pp) >= 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1018,27 +1017,34 @@ pln_damage(struct plnstr *pp, char type, int noisy)
|
||||||
aim = 100 - aim;
|
aim = 100 - aim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
len = 0;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
dam += roll(6);
|
dam += roll(6);
|
||||||
hitroll = roll(100);
|
hitroll = roll(100);
|
||||||
if (hitroll >= 90) {
|
if (hitroll >= 90) {
|
||||||
dam += 8;
|
dam += 8;
|
||||||
if (noisy)
|
if (noisy)
|
||||||
mpr(pp->pln_own, "BLAM");
|
len += sprintf(buf + len, "BLAM");
|
||||||
} else if (hitroll < aim) {
|
} else if (hitroll < aim) {
|
||||||
dam += 5;
|
dam += 5;
|
||||||
if (noisy)
|
if (noisy)
|
||||||
mpr(pp->pln_own, "Blam");
|
len += sprintf(buf + len, "Blam");
|
||||||
} else {
|
} else {
|
||||||
dam += 1;
|
dam += 1;
|
||||||
if (noisy)
|
if (noisy)
|
||||||
mpr(pp->pln_own, "blam");
|
len += sprintf(buf + len, "blam");
|
||||||
|
}
|
||||||
|
if (noisy) {
|
||||||
|
if (len > 75) {
|
||||||
|
mpr(pp->pln_own, "%s\n", buf);
|
||||||
|
len = 0;
|
||||||
|
}
|
||||||
|
if (i)
|
||||||
|
len += sprintf(buf + len, "-");
|
||||||
}
|
}
|
||||||
if (i && noisy)
|
|
||||||
mpr(pp->pln_own, "-");
|
|
||||||
}
|
}
|
||||||
if (noisy)
|
if (noisy && len)
|
||||||
mpr(pp->pln_own, "\n");
|
mpr(pp->pln_own, "%s\n", buf);
|
||||||
if (effective)
|
if (effective)
|
||||||
dam *= 2;
|
dam *= 2;
|
||||||
return dam;
|
return dam;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue