fix: remove double x() dereference in MIRV separation point calc (#3940)

mg.x() takes a TileRef and returns a number (x coordinate). The code was
calling mg.x(mg.x(tile)), feeding the numeric result back into x() which
expects a TileRef. This produces an incorrect midpoint for MIRV warhead
separation, causing warheads to spread from a wrong position on the map.

If this PR fixes an issue, link it below. If not, delete these two
lines.
Resolves #(issue number)

## Description:

Describe the PR.

## Please complete the following:

- [ ] I have added screenshots for all UI updates
- [ ] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [ ] I have added relevant tests to the test directory
- [ ] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

DISCORD_USERNAME
This commit is contained in:
Berk
2026-05-17 05:37:37 +03:00
committed by GitHub
parent 5fefc21cb8
commit 2e17fb5184
+1 -1
View File
@@ -82,7 +82,7 @@ export class MirvExecution implements Execution {
});
this.mg.stats().bombLaunch(this.player, this.targetPlayer, UnitType.MIRV);
const x = Math.floor(
(this.mg.x(this.dst) + this.mg.x(this.mg.x(this.nuke.tile()))) / 2,
(this.mg.x(this.dst) + this.mg.x(this.nuke.tile())) / 2,
);
const y = Math.max(0, this.mg.y(this.dst) - 500) + 50;
this.separateDst = this.mg.ref(x, y);