Opened 10 years ago

Closed 10 years ago

#2242 closed enhancement (fixed)

[PATCH] Units garrisoned inside a ship should not always be killed when the ship is destroyed

Reported by: mimo Owned by: mimo
Priority: Should Have Milestone: Alpha 16
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

When the ship is destroyed near the shoreline, we may expect that some of the garrisoned units would not be killed when the ship is destroyed. Here is a patch to do that. For the time being, female and infantry will survive if near the shoreline.

This patch includes the fix to #2238 as it was needed to work properly.

Attachments (2)

swimmer.diff (6.3 KB ) - added by mimo 10 years ago.
added missing word in the help text of EjectSwimmingEntitiesOnDestroy
swimmer-v2.diff (29.6 KB ) - added by mimo 10 years ago.
with EjectEntitiesOnDestroy removed and replaced by the new tag

Download all attachments as: .zip

Change History (12)

comment:1 by Josh, 10 years ago

Component: Core engineUI & Simulation
Keywords: review removed
Milestone: BacklogAlpha 15
Owner: set to mimo

As for a quick review, code looks great but the help text for "EjectSwimmingEntitiesOnDestroy" doesn't really make any sense.

by mimo, 10 years ago

Attachment: swimmer.diff added

added missing word in the help text of EjectSwimmingEntitiesOnDestroy

comment:2 by Josh, 10 years ago

Keywords: reviewed added

comment:4 by sanderd17, 10 years ago

Type: defectenhancement

comment:5 by leper, 10 years ago

Keywords: review added; reviewed removed

comment:6 by mimo, 10 years ago

Keywords: review removed
Milestone: Alpha 15Alpha 16

comment:7 by mimo, 10 years ago

I've uploaded a new version of the patch, following the previous comments. The EjectEntitiesOnDestroy works as usual : when true, all entities are ejected on destroy (or when the health goes below a given threshold). But when false, there is a new EjectClassesOnDestroy which list the classes which can nonetheless be ejected when the garrisonholder is destroyed: typical use case is a ship not far from the shoreline.

comment:8 by sanderd17, 10 years ago

I don't like the tag duplication. Just a tag to decide by class is enough. As you can put "Unit" if you mean everything.

Also, did you duplicate the PickSpawnPoint method? Won't it be possible/better to overload it with some argument?

in reply to:  8 comment:9 by mimo, 10 years ago

Replying to sanderd17:

I don't like the tag duplication. Just a tag to decide by class is enough. As you can put "Unit" if you mean everything.

I agree. If we go with this EjectClassesOnDestroy, it can fulfil the role of the old EjectEntitiesOnDestroy is and replace it.

Also, did you duplicate the PickSpawnPoint method? Won't it be possible/better to overload it with some argument?

Part of the needed initialisations are the same, but the logic to find the spawning point is quite different (even if they look the same). So there is not much to gain by trying to combine, and it will be less readable.

by mimo, 10 years ago

Attachment: swimmer-v2.diff added

with EjectEntitiesOnDestroy removed and replaced by the new tag

comment:10 by mimo, 10 years ago

Resolution: fixed
Status: newclosed

In 14550:

add more flexibility to eject units when garrisonHolder is destroyed, fixes #2242

Note: See TracTickets for help on using tickets.