Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
63 changes: 63 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Language: Cpp
Standard: c++20

# 1. Non-Destructive Core Setting
# ------------------------------------------------------------------------------
# Completely disable automatic line wrapping to preserve manual formatting.
ColumnLimit: 0

# 2. Indentation & Tabs
# ------------------------------------------------------------------------------
UseTab: ForIndentation
IndentWidth: 2
TabWidth: 2
ContinuationIndentWidth: 2
AccessModifierOffset: -2
IndentCaseLabels: true
AlignTrailingComments: false
SpacesBeforeTrailingComments: 4

# 3. Braces Style: Allman
# ------------------------------------------------------------------------------
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
AllowShortEnumsOnASingleLine: false

# 4. Pointers & Spaces
# ------------------------------------------------------------------------------
PointerAlignment: Left
SpacesInParentheses: false
BreakConstructorInitializers: BeforeComma
SpacesInAngles: Leave

# 5. Legacy & Compatibility (VC6 / Custom Macros)
# ------------------------------------------------------------------------------
# Prevent expanding/collapsing short blocks and functions to minimize diffs
AllowShortFunctionsOnASingleLine: All
AllowShortBlocksOnASingleLine: Always
AlignEscapedNewlines: DontAlign
Cpp11BracedListStyle: false

# Handle custom legacy macros so the parser doesn't break
Macros:
- CPP_11(x)=x

IndentPPDirectives: BeforeHash
ConstructorInitializerIndentWidth: 2

# 6. Includes
# ------------------------------------------------------------------------------
SortIncludes: false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ CPackSourceConfig.cmake
thumbs.db
/CMakeUserPresets.json
/.cache
.clang-format
/.vscode
/Dependencies/MaxSDK/maxsdk
/tmp/
Expand Down
137 changes: 67 additions & 70 deletions Core/GameEngine/Include/Common/AcademyStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,43 +61,41 @@ class ThingTemplate;

struct AcademyAdviceInfo
{
UnicodeString advice[ MAX_ADVICE_TIPS ];
UnicodeString advice[MAX_ADVICE_TIPS];
UnsignedInt numTips;
};

enum AcademyClassificationType CPP_11(: Int)
enum AcademyClassificationType CPP_11( : Int)
{
//Don't forget to update the strings too!
// Don't forget to update the strings too!
ACT_NONE,
ACT_UPGRADE_RADAR,
ACT_SUPERPOWER,

ACT_COUNT
};
extern const char *const TheAcademyClassificationTypeNames[]; //Change above, change this!

extern const char* const TheAcademyClassificationTypeNames[]; // Change above, change this!

// ----------------------------------------------------------------------------------------------
class AcademyStats : public Snapshot
{

public:

AcademyStats();

void init( const Player *player );
void init(const Player* player);
void update();

Bool isFirstUpdate() const { return m_firstUpdate; }
void setFirstUpdate( Bool set ) { m_firstUpdate = set; }
void setFirstUpdate(Bool set) { m_firstUpdate = set; }

void recordProduction( const Object *obj, const Object *constructor );
void recordUpgrade( const UpgradeTemplate *upgrade, Bool granted );
void recordSpecialPowerUsed( const SpecialPowerTemplate *spTemplate );
void recordProduction(const Object* obj, const Object* constructor);
void recordUpgrade(const UpgradeTemplate* upgrade, Bool granted);
void recordSpecialPowerUsed(const SpecialPowerTemplate* spTemplate);
void recordIncome();

void recordBuildingCapture() { m_structuresCaptured++; }
void recordGeneralsPointsSpent( Int points ) { m_generalsPointsSpent += points; }
void recordGeneralsPointsSpent(Int points) { m_generalsPointsSpent += points; }
void recordBuildingGarrisoned() { m_structuresGarrisoned++; }
void recordDragSelection() { m_dragSelectUnits++; }
void recordStrategyCenter() { m_hadAStrategyCenter = TRUE; }
Expand All @@ -108,169 +106,168 @@ class AcademyStats : public Snapshot
void recordVehicleDisguised() { m_vehiclesDisguised++; }
void recordFirestormCreated() { m_firestormsCreated++; }
void recordGuardAbilityUsed() { m_guardAbilityUsedCount++; }
void recordSalvageCollected() { m_salvageCollected++;}
void recordSalvageCollected() { m_salvageCollected++; }
void recordDoubleClickAttackMoveOrderGiven() { m_doubleClickAttackMoveOrdersGiven++; }
void recordMineCleared() { m_minesCleared++; }

//Returns the natural command center template (you may capture others in a game...)
// Returns the natural command center template (you may capture others in a game...)
const ThingTemplate* getCommandCenterTemplate() const { return m_commandCenterTemplate; }

//Use these functions for the Neutral player only!
// Use these functions for the Neutral player only!
void recordVehicleSniped() { m_vehiclesSniped++; }
UnsignedInt getVehiclesSniped() const { return m_vehiclesSniped; }
void recordMine() { m_mines++; }
UnsignedInt getMines() const { return m_mines; }

const Player *getPlayer() { return m_player; }
const Player* getPlayer() { return m_player; }
Bool hadASupplyCenter() const { return m_supplyCentersBuilt > 0; }

Bool calculateAcademyAdvice( AcademyAdviceInfo *info );
Bool calculateAcademyAdvice(AcademyAdviceInfo* info);

protected:
// snapshot methods
virtual void crc( Xfer *xfer ) override;
virtual void xfer( Xfer *xfer ) override;
virtual void crc(Xfer* xfer) override;
virtual void xfer(Xfer* xfer) override;
virtual void loadPostProcess() override;

private:
void evaluateTier1Advice(AcademyAdviceInfo* info, Int numAvailableTips = -1);
void evaluateTier2Advice(AcademyAdviceInfo* info, Int numAvailableTips = -1);
void evaluateTier3Advice(AcademyAdviceInfo* info, Int numAvailableTips = -1);

void evaluateTier1Advice( AcademyAdviceInfo *info, Int numAvailableTips = -1 );
void evaluateTier2Advice( AcademyAdviceInfo *info, Int numAvailableTips = -1 );
void evaluateTier3Advice( AcademyAdviceInfo *info, Int numAvailableTips = -1 );

const Player *m_player;
const Player* m_player;
UnsignedInt m_nextUpdateFrame;
Bool m_firstUpdate;
const CommandSet *m_dozerCommandSet;
const CommandSet* m_dozerCommandSet;
Bool m_unknownSide;
const ThingTemplate *m_commandCenterTemplate;
const ThingTemplate* m_commandCenterTemplate;

//+-----------------------+
//| Tier 1 (Basic advice) |
//+-----------------------+

//1) Did player build at least one of each structure type available?
//CUT!!!
// 1) Did player build at least one of each structure type available?
// CUT!!!

//2) Did player run out of money before building a supply center?
// 2) Did player run out of money before building a supply center?
Bool m_spentCashBeforeBuildingSupplyCenter;
UnsignedInt m_supplyCentersBuilt;
const ThingTemplate *m_supplyCenterTemplate;
const ThingTemplate* m_supplyCenterTemplate;
UnsignedInt m_supplyCenterCost;

//3) Did player build radar (if applicable)?
// 3) Did player build radar (if applicable)?
Bool m_researchedRadar;

//4) Did player build any dozers/workers?
// 4) Did player build any dozers/workers?
UnsignedInt m_peonsBuilt;

//5) Did player ever capture a structure?
// 5) Did player ever capture a structure?
UnsignedInt m_structuresCaptured;

//6) Did player spend any generals points?
// 6) Did player spend any generals points?
UnsignedInt m_generalsPointsSpent;

//7) Did player ever use a generals power or superweapon?
// 7) Did player ever use a generals power or superweapon?
UnsignedInt m_specialPowersUsed;

//8) Did player garrison any structures?
// 8) Did player garrison any structures?
UnsignedInt m_structuresGarrisoned;

//9) How idle was the player in building military units?
// 9) How idle was the player in building military units?
UnsignedInt m_idleBuildingUnitsMaxFrames;
UnsignedInt m_lastUnitBuiltFrame;

//10) Did player drag select units?
// 10) Did player drag select units?
UnsignedInt m_dragSelectUnits;

//11) Did player upgrade anything?
// 11) Did player upgrade anything?
UnsignedInt m_upgradesPurchased;

//12) Was player out of power for more than 10 minutes?
// 12) Was player out of power for more than 10 minutes?
UnsignedInt m_powerOutMaxFrames;
UnsignedInt m_oldestPowerOutFrame;
Bool m_hadPowerLastCheck;
Bool m_hadPowerLastCheck;

//13) Extra gathers built?
// 13) Extra gathers built?
UnsignedInt m_gatherersBuilt;

//14) Heroes built?
// 14) Heroes built?
UnsignedInt m_heroesBuilt;

//+------------------------------+
//| Tier 2 (Intermediate advice) |
//+------------------------------+

//15) Selected a strategy center battle plan?
// 15) Selected a strategy center battle plan?
Bool m_hadAStrategyCenter;
Bool m_choseAStrategyForCenter;

//16) Placed units inside tunnel network?
// 16) Placed units inside tunnel network?
UnsignedInt m_unitsEnteredTunnelNetwork;
Bool m_hadATunnelNetwork;

//17) Player used control groups?
// 17) Player used control groups?
UnsignedInt m_controlGroupsUsed;

//18) Built secondary income unit (hacker, dropzone, blackmarket)?
// 18) Built secondary income unit (hacker, dropzone, blackmarket)?
UnsignedInt m_secondaryIncomeUnitsBuilt;

//19) Cleared out garrisoned buildings?
// 19) Cleared out garrisoned buildings?
UnsignedInt m_clearedGarrisonedBuildings;

//20) Did the Player pick up salvage (as GLA)?
// 20) Did the Player pick up salvage (as GLA)?
UnsignedInt m_salvageCollected;

//21) Did the player ever use the "Guard" ability?
// 21) Did the player ever use the "Guard" ability?
UnsignedInt m_guardAbilityUsedCount;

//22) Did the player build more than one Supply Center (that is, did he expand out)?
//Uses m_supplyCentersBuilt!
// 22) Did the player build more than one Supply Center (that is, did he expand out)?
// Uses m_supplyCentersBuilt!

//23) Did the player ever garrison a vehicle?
//CUT!!!
// 23) Did the player ever garrison a vehicle?
// CUT!!!

//24) Did the player ever use the hotkey to grab all of one unit type (change to use any hotkeys)?
//CUT!!!
// 24) Did the player ever use the hotkey to grab all of one unit type (change to use any hotkeys)?
// CUT!!!

//+--------------------------+
//| Tier 3 (Advanced advice) |
//+--------------------------+

//25) Did the player use the new alternate interface in the options?
//Uses TheGlobalData->m_useAlternateMouse
// 25) Did the player use the new alternate interface in the options?
// Uses TheGlobalData->m_useAlternateMouse

//26) Player did not use the new "double click location attack move/guard"
// 26) Player did not use the new "double click location attack move/guard"
UnsignedInt m_doubleClickAttackMoveOrdersGiven;

//27) Built barracks within 5 minutes?
// 27) Built barracks within 5 minutes?
Bool m_builtBarracksWithinFiveMinutes;

//28) Built war factory within 10 minutes?
// 28) Built war factory within 10 minutes?
Bool m_builtWarFactoryWithinTenMinutes;

//29) Built tech structure within 15 minutes?
// 29) Built tech structure within 15 minutes?
Bool m_builtTechStructureWithinFifteenMinutes;

//30) No income for 2 minutes?
// 30) No income for 2 minutes?
UnsignedInt m_lastIncomeFrame;
UnsignedInt m_maxFramesBetweenIncome;

//31) Did the Player ever use Dozers/Workers to clear out traps/mines/booby traps?
UnsignedInt m_mines; //Neutral player stat
// 31) Did the Player ever use Dozers/Workers to clear out traps/mines/booby traps?
UnsignedInt m_mines; // Neutral player stat
UnsignedInt m_minesCleared;

//32) Captured any sniped vehicles?
// 32) Captured any sniped vehicles?
UnsignedInt m_vehiclesRecovered;
UnsignedInt m_vehiclesSniped;

//33) Did the player ever build a "disguisable" unit and never used the disguise ability?
// 33) Did the player ever build a "disguisable" unit and never used the disguise ability?
UnsignedInt m_disguisableVehiclesBuilt;
UnsignedInt m_vehiclesDisguised;

//34) Did the player never build a "stealth" upgrade?
//CUT!!!
// 34) Did the player never build a "stealth" upgrade?
// CUT!!!

//35) Did the player ever create a "Firestorm" with his MiGs or Inferno Cannons?
// 35) Did the player ever create a "Firestorm" with his MiGs or Inferno Cannons?
UnsignedInt m_firestormsCreated;
};
2 changes: 1 addition & 1 deletion Core/GameEngine/Include/Common/AddonCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ namespace addon
{
extern Bool HasFullviewportDat();

} // namespace addon
} // namespace addon
Loading
Loading