bugFreeciv - Bugs: bug #20747, Units in nested transport...

 
 
Show feedback again

bug #20747: Units in nested transport considered defensive units

Submitted by:  Emmet Hikory <persia>
Submitted on:  Sat 20 Apr 2013 04:48:01 AM UTC  
 
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Release: 2.4.99-r22731Operating System: GNU/Linux
Planned Release: 2.4.0, 2.5.0, 2.6.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 30 Apr 2013 08:13:22 AM UTC, SVN revision 22793:

Transported unit that cannot be unloaded cannot be chosen as defender.

Patch by Emmet Hikory

See bug #20747

(Browse SVN revision 22793)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Tue 30 Apr 2013 08:13:16 AM UTC, SVN revision 22792:

Transported unit that cannot be unloaded cannot be chosen as defender.

Patch by Emmet Hikory

See bug #20747

(Browse SVN revision 22792)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 21 Apr 2013 12:45:05 AM UTC, comment #3:

The same patch applies to S2_4 with a 1-line offset, and should be suitable there as well.

Emmet Hikory <persia>
Project Member
Sat 20 Apr 2013 11:53:46 PM UTC, comment #2:

From code inspection, it appears that the same patch could also be applied to S2_4 (I'll test when my current autogames are complete), and that it would provide a similar benefit.

About combat.c:

get_virtual_defense_power() uses can_unit_exist_at_tile as a proxy for being able to defend, but in this function we don't know the actual unit (and it may not even currently exist for calls from advmilitary.c), so can't check to see if it happens to be transported when under attack. The specific unit certainly doesn't exist in unittools.c:find_a_good_partisan_spot(), although these aren't likely to be placed in transport, so it matters less.

can_unit_attack_all_at_tile() and can_unit_attack_any_at_tile() are potentially open to gameplay irregularities from players choosing when to load/unload unreachable units if unreachable protects/doesn't protect, and depending on the targets vectors of potential attackers. It would take a lot more than this type of check to work around that.

It may be that can_unit_attack_unit_at_tile() should check to see if the potential defender is capable of defense, but I suspect it is better not to do this, as units that can't defend just die, which is likely the desired behaviour, rather than anything that might prevent the attack.

Am I missing something else that might be related to this?

Emmet Hikory <persia>
Project Member
Sat 20 Apr 2013 11:03:40 PM UTC, comment #1:

This affects both S2_4 and TRUNK, or? Also, I remember there being equivalent logic of "transported unit stepping out to defend" in defense value calculation in combat.c. Have you checked if it's ok in this respect?

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sat 20 Apr 2013 04:48:01 AM UTC, original submission:

Units in nested transport are considered potential defensive units, although they are unable to unload or attack. Test case is to alter experimental ruleset to give Cruise Missile a defensive rating of 4, then load Cruise Missile in Mech. Inf. in Transport. Attack with something, and the missile is considered the defender.

From comments in the code, I suspect that having Missiles be potential defenders of Submarines and Stealth Fighters|Bombers being potential defenders of Carriers may similarly be bugs (these also don't happen because of the coincidental relation between the defense ratings of the transport and the cargo).

Discovered when considering allowing AttFromNonNative units to be able to also defend when non-native: thoughts on that idea appreciated, but the attached bugfix patch likely gets priority.

Emmet Hikory <persia>
Project Member

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #17778:  check-unload-to-defend.patch added by persia (1kB - application/octet-stream)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by persia (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 30 Apr 2013 08:13:42 AM UTCcazfiStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Sun 28 Apr 2013 11:38:10 PM UTCcazfiDependencies-=>bugs #20722 is dependent
    Sun 28 Apr 2013 09:08:42 AM UTCcazfiAssigned toNone=>cazfi
      Planned Release=>2.4.0, 2.5.0, 2.6.0
    Sun 28 Apr 2013 09:08:41 AM UTCcazfiStatusNone=>Ready For Test
    Sat 20 Apr 2013 04:48:02 AM UTCpersiaAttached File-=>Added check-unload-to-defend.patch, #17778
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup