Classic bug: Empty-planet troop conquest
| Bug ID | GE-BUG-030 |
|---|---|
| Affected versions | Classic 3.2e and published classic source |
| Status | Verified in source |
| Fixed in | ge-next 0.3 |
| Primary source | GECMDS.C: attack_men() |
Summary
A classic troop attack against a planet with no defending troops or fighters can report a victory without transferring ownership to the attacker.
Symptoms
The attacker sees a successful assault, but the planet's owner remains unchanged. One workaround is to place at least one defending troop on the planet before attacking it: this gives the attack-ratio calculation a nonzero defender count, allowing the later ownership-transfer path to run.
Cause
attack_men() can set its local victory flag when attackers survive and the defenders are gone. The later block containing wonplnt() is guarded by an attack-ratio test, however. If the planet began with zero troops, classic explicitly sets that ratio to zero to avoid division by zero. The victory flag therefore reaches the command handler, but the ownership-transfer block is skipped.
Correction in ge-next 0.3
ge-next handles a planet with no defending troops or fighters as an undefended conquest before the normal casualty calculation. It also allows the victory flag, independently of the attack ratio, to enter the block that calls wonplnt() and sends the result notification. Thus the displayed result and the planet's owner agree. The change was introduced in the troop-attack fixes that became ge-next 0.3.
Porting guidance
Keep “did the attacker conquer the planet?” separate from “was a failed attack large enough to notify the owner?” A ratio based on the original defender count cannot safely govern ownership changes when that count can be zero.
Home · Play · Reference · Versions & history · Sysop · Development · Classic bugs