Ticket #44416

Number of units reported killed is wrong when unreachable units were on the tile.

Open Date: 2022-04-18 19:49 Last Update: 2022-05-22 09:05

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
1

Details

this bug is in unittools.c line 2283: https://github.com/freeciv/freeciv/blob/c638e472ea3e99c08e22caf7e6abae89649618ee/server/unittools.c#L2283

The solution to this bug is easy. Everywhere else we check TWO conditions, e.g. line 2313

if (pplayers_at_war(pvictor, vplayer)
&& is_unit_reachable_at(vunit, pkiller, deftile))

But on line 2283 we only check if pplayers_at_war and not if the unit is reachable. Not surprisingly then, any unreachable units on the tile get counted as killed when it is reported "You killed the whatever and x other units". x is wrongly inflated by exactly how many unreachable units were on that tile.

Ticket History (3/5 Histories)

2022-04-18 19:49 Updated by: lexxie9952
  • New Ticket "Number of units reported killed is wrong when unreachable units were on the tile." created
2022-05-04 13:06 Updated by: cazfi
  • Milestone Update from (None) to 3.0.2 (closed)
  • Component Update from (None) to Server
2022-05-08 12:25 Updated by: cazfi
  • Owner Update from (None) to cazfi
  • Resolution Update from None to Accepted
2022-05-22 09:05 Updated by: cazfi
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Edit

Please login to add comment to this ticket » Login