Units Attacking from Transporter Use Wrong Tile Size

Bug #1424945 reported by Andre Novellino Gouvêa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stratagus
Fix Released
Low
cybermind

Bug Description

Units attacking from a transporter seemingly use their own tile size to calculate whether the enemy is within range, rather than the container's tile size.

I changed the CUnit::MapDistanceTo function to use the container's tile size instead of the unit's own tile size if it is inside a container, but that didn't fix the issue with range not being calculated correctly.

Related branches

Revision history for this message
cybermind (iddqd-mail) wrote :

Check, if this was fixed in rev.8959

Changed in stratagus:
status: New → Fix Committed
importance: Undecided → Low
assignee: nobody → cybermind (iddqd-mail)
Revision history for this message
Andre Novellino Gouvêa (andre-ng) wrote :

I tried out the fix, but unfortunately it seems that it didn't work :( I tried putting archers (range 4) in a garrisonable building of 4x4 tile size, and they could still only attack units to the south of the building that were adjacent to the building (meaning that the range is being counted without taking into account the building's larger tile size).

Revision history for this message
cybermind (iddqd-mail) wrote :

Another fix in rev.8961, check, if that bug has been fixed.

Revision history for this message
Andre Novellino Gouvêa (andre-ng) wrote :

cybermind, thanks for your attention in trying to fix this bug. I tested the fix in revision 8961, and unfortunately it did not solve the issue. Everything happens exactly the same as before.

Revision history for this message
cybermind (iddqd-mail) wrote :

Could you upload a test map or something to show this bug?

Revision history for this message
Andre Novellino Gouvêa (andre-ng) wrote :

I managed to pinpoint the reason for the bug. It was in the function MapDistanceTo(const CUnit &dst) in unit.h. Here is a fixed version of the function:

 int MapDistanceTo(const CUnit &dst) const
 {
  const CUnitType *distance_unit_type = Container ? Container->Type : Type;
  return MapDistanceBetweenTypes(*distance_unit_type, tilePos, *dst.Type, dst.tilePos);
 }

I have tested it and can confirm this fix works.

cybermind (iddqd-mail)
Changed in stratagus:
status: Fix Committed → Fix Released
milestone: none → 2.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.