Skip to content

XComGameState_WorldRegion.CanBeStartingRegion calls event with wrong region #1529

@copyrite

Description

@copyrite

https://discord.com/channels/165245941664710656/273238884433788928/1433919428017524859

The current iteration of XComGameState_WorldRegion.CanBeStartingRegion reads

function bool CanBeStartingRegion(XComGameState StartState)
{
    local XComGameState_WorldRegion RegionState;
    local int idx, Count;

    // Variable for issue #1303
    local bool bEligible;

    Count = 0;

    for(idx = 0; idx < LinkedRegions.Length; idx++)
    {
        RegionState = XComGameState_WorldRegion(StartState.GetGameStateForObjectID(LinkedRegions[idx].ObjectID));
        if(RegionState != none &&
            !class'XComGameState_RegionLink'.static.TriggerOverrideAllowStartingRegionLink(StartState, self, RegionState) /* Issue #774 */)
        {
            return false;
        }
        else
        {
            Count++;
        }
    }

    // Start Issue #1303
    bEligible = (Count > 1);

    return class'XComGameState_RegionLink'.static.TriggerOverrideEligibleStartingRegion(RegionState, bEligible);
    // End Issue #1303
}

We should be returning whether the object calling the method (self) can be a starting region. Instead, we're triggering the event with RegionState, which is a leftover from the for-loop, one of self.LinkedRegions. The effect is that any setups where this event is being fired is flagging wrong regions eligible for starting.

Fix is simple, replace the return line with

    return class'XComGameState_RegionLink'.static.TriggerOverrideEligibleStartingRegion(self, bEligible);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions