• Tracker

    Spaces
    Browse
    Statistics
  • /
  • /Reforger Modding
  • /ARMD-123
Back
1

Potential Bug: SCR_CampaignBuildingBudgetEditorComponent Selects Highest Rank Using Object Array Sort

1

State

Open
Issue key
ARMD-123
Access
Public
Space
Arma Reforger
Project
Reforger Modding
Creator
forged_in_fire
Created
Nov 9, 2026
Views
4
Platform
PC Steam
Game Version

1.9.0.37

Modlist

WarhawksCommandCenter {6AB2CA70BF0D28B6}

Description

Product: Arma Reforger Tools
Version: 1.9.0.37 (Production)
Component: SCR_CampaignBuildingBudgetEditorComponent
Method: EOnEditorActivateServer()
Category: Reforger Modding / Game Script

Summary

The vanilla implementation of SCR_CampaignBuildingBudgetEditorComponent.EOnEditorActivateServer() uses array.Sort() to sort an array of SCR_RankInfo objects, then assumes that the final element represents the highest-ranking entry.

However, sorting an array of objects does not necessarily order them by their rank identifiers or required XP values.

This potentially causes m_eHighestRank to be initialized with an incorrect rank.

Attachment1 file · visible to everyone

Screenshot_2026_11_09_072213.webp

61 KB

Reactions

Activity

    24 minutes ago
  • forged_in_fire
    created issue24 minutes ago
  • forged_in_firecommented
    19 minutes ago
    forged_in_firecommented
    19 minutes ago

    Relevant Vanilla Implementation

    array<ref SCR_RankInfo> ranks =
        factionManager.GetFactionRanks(m_Manager.GetPlayerID()).GetAllRanks();
    
    if (!ranks)
        return;
    
    ranks.Sort();
    
    SCR_RankInfo highestRankID = ranks[ranks.Count() - 1];
    
    if (!highestRankID)
        return;
    
    m_eHighestRank = highestRankID.GetRankID();
    
    RefreshBudgetSettings();

    The implementation appears to assume that sorting the array produces an ascending rank hierarchy.

    That assumption requires verification.

    Supporting Experiment

    Using the Workbench Script Editor's Run Console, I created an array of five SCR_EntityBudgetValue objects with different budget values.

    The objects were inserted in a fixed order:

    GENERAL   80
    PRIVATE   10
    CAPTAIN   50
    SERGEANT  30
    COLONEL   70

    I executed array.Sort() and printed the resulting order.

    Three executions produced the following results:

    Execution 1:

    PRIVATE   10
    GENERAL   80
    CAPTAIN   50
    SERGEANT  30
    COLONEL   70

    Execution 2:

    COLONEL   70
    SERGEANT  30
    CAPTAIN   50
    PRIVATE   10
    GENERAL   80

    Execution 3:

    COLONEL   70
    SERGEANT  30
    CAPTAIN   50
    PRIVATE   10
    GENERAL   80

    The results demonstrate that sorting these objects does not produce an ordering based on their budget values or enum identifiers.

    The results also differ between executions despite identical insertion order.

    Although this experiment uses SCR_EntityBudgetValue rather than SCR_RankInfo, it demonstrates why an object array should not be assumed to sort according to an application's intended numerical hierarchy.

    Potential Impact

    If SCR_RankInfo objects exhibit the same sorting behavior, selecting the last element may return an arbitrary configured rank rather than the highest rank.

    This could affect construction budget calculations that depend on m_eHighestRank.

    The potential issue exists independently of modifications to the game's rank hierarchy.

You are not signed in. Please sign in to see more details and to reply.

State

Open
Issue key
ARMD-123
Access
Public
Space
Arma Reforger
Project
Reforger Modding
Creator
forged_in_fire
Created
Nov 9, 2026
Views
4