2025-07-17 23:37 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000460Spring engineGeneralpublic2007-03-10 19:31
Reporteryuritch 
Assigned ToILMTitan 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000460: Units with hover movetype cannot be loaded into a transport
DescriptionUnits with hover movetype cannot be loaded into a transport, no matter their size and mass. Looks like an unwanted feature.
Digging through the code reveals that this also applies for ships and aircraft.
Additional InformationThis is caused by the following code in TransportCAI.cpp:
bool CTransportCAI::CanTransport(CUnit* unit)
{
    CTransportUnit* transport=(CTransportUnit*)owner;

    if(unit->mass>=100000 || unit->beingBuilt)
        return false;
    // don't transport cloaked enemies
    if (unit->isCloaked && !gs->AlliedTeams(unit->team, owner->team))
        return false;
    if(unit->unitDef->canhover || unit->unitDef->floater || unit->unitDef->canfly)
        return false;
    if(unit->xsize > owner->unitDef->transportSize*2)
        return false;
    if(!transport->CanTransport(unit))
        return false;
    if(unit->mass+transport->transportMassUsed > owner->unitDef->transportMass)
        return false;

    return true;
}
Attached file contains a patch that completely disables movetype check in that function, so that all units can be loaded if their size and mass allow for that.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • diff file icon noMovetypeCheck.diff (516 bytes) 2007-03-05 17:45 -
    Index: TransportCAI.cpp
    ===================================================================
    --- TransportCAI.cpp	(revision 3456)
    +++ TransportCAI.cpp	(working copy)
    @@ -273,8 +273,6 @@
     	// don't transport cloaked enemies
     	if (unit->isCloaked && !gs->AlliedTeams(unit->team, owner->team))
     		return false;
    -	if(unit->unitDef->canhover || unit->unitDef->floater || unit->unitDef->canfly)
    -		return false;
     	if(unit->xsize > owner->unitDef->transportSize*2)
     		return false;
     	if(!transport->CanTransport(unit))
    
    diff file icon noMovetypeCheck.diff (516 bytes) 2007-03-05 17:45 +
  • zip file icon transportation_diffs2.zip (2,733 bytes) 2007-03-08 18:38
  • zip file icon transportation_patch.zip (1,957 bytes) 2007-03-09 11:12

-Relationships
+Relationships

-Notes

~0000758

yuritch (reporter)

I compiled Spring with that change to test it and was able to load/unload hovers and small aircraft with air and sea transports. Haven't tried to load ships as they seem to have enough mass (or too big a size) to not be loadable anyway.

~0000766

el_matarife (reporter)

Apparently air transport for ships used to work in Spring, so this code must have been inserted a while back. Does the transport code check to see if it is dropping off on water which we'd need to check for with transporting sea units/hovers? Also, we may want to make this a mod definable option with the default set to no transport of these units so we don't break any of the current mods.

~0000773

yuritch (reporter)

Last edited: 2007-03-08 18:43

I made a new patch (transportation_diffs2.zip contains it). This one is much more flexible - it allows per-mod control of what unit types are transportable.
A new section should be added to modrules.tdf:
[TRANSPORTABILITY]
{
transportGround=1;
transportHover=1;
transportShip=1;
transportAir=1;
}
Each value controls the transportability of the corresponding unit type. Defaults are 1 for ground and 0 for everything else. I wanted to add buildings also, but that proved a bit too much for me :)
Also I changed unload function so that units can be unloaded into water (needed for ships). It checks for ground height and unit's minWaterDepth, so land units won't be unloaded into water and ships won't be dropped on land.
Problems found while testing this: if you load an aircraft into an air transport, it will start to accend and will do so indefinitely without a way to stop it or unload the cargo. Loading/unloading aircraft with non-air transport works ok, though.
Edit: the first zip (transportation_diffs.zip) contains incomplete path (unloading into water only works for air transports). Look into the second zip (transportation_diffs2.zip) for a complete one (works for all transports). I cannot find a way to delete the first file.

~0000775

ILMTitan (reporter)

I deleted the first zip for you. In the future, unified diffs are the preferred method. I don't know if you are using TortoiseSVN, but you would create the patch by right clicking on base spring source directory.

~0000776

yuritch (reporter)

Last edited: 2007-03-09 11:17

I have modified the patch to be a bit simpler. Now unload position check function just checks for minWaterDepth and maxWaterDepth without special conditions for ships, hovers etc. (min/maxWaterDepth is sufficient, and this also allows to unload TA-style amphibious tanks to the water). Also, it is all in one unified diff now.

~0000777

ILMTitan (reporter)

Revision 0003467: Committed. Thank you.

I did add the slope check you wanted to do. You do unit->unitDef->movedata->maxSlope < slope.

Thank you for the unified diff.
+Notes

-Issue History
Date Modified Username Field Change
2007-03-05 17:45 yuritch New Issue
2007-03-05 17:45 yuritch File Added: noMovetypeCheck.diff
2007-03-05 17:51 yuritch Note Added: 0000758
2007-03-06 15:03 el_matarife Note Added: 0000766
2007-03-08 18:23 yuritch File Added: transportation_diffs.zip
2007-03-08 18:37 yuritch Note Added: 0000773
2007-03-08 18:38 yuritch File Added: transportation_diffs2.zip
2007-03-08 18:42 yuritch Note Edited: 0000773
2007-03-08 18:43 yuritch Note Edited: 0000773
2007-03-09 05:59 ILMTitan Status new => assigned
2007-03-09 05:59 ILMTitan Assigned To => ILMTitan
2007-03-09 06:01 ILMTitan File Deleted: transportation_diffs.zip
2007-03-09 06:04 ILMTitan Note Added: 0000775
2007-03-09 11:12 yuritch File Added: transportation_patch.zip
2007-03-09 11:14 yuritch Note Added: 0000776
2007-03-09 11:17 yuritch Note Edited: 0000776
2007-03-10 19:31 ILMTitan Status assigned => resolved
2007-03-10 19:31 ILMTitan Resolution open => fixed
2007-03-10 19:31 ILMTitan Note Added: 0000777
+Issue History