Skip to content
Open
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
  •  
  •  
  •  
22 changes: 11 additions & 11 deletions src/OpenSHC/AI/AIC/AICSpecification.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ namespace AI {
typedef struct AICSpecification {

dword flagType; // 0x00000000 length: 4
dword unknown001; // 0x00000004 length: 4
dword unknown002; // 0x00000008 length: 4
dword unknown003; // 0x0000000C length: 4
dword unknown004; // 0x00000010 length: 4
dword unknown005; // 0x00000014 length: 4
dword aicReserved0; // 0x00000004 length: 4
dword aicReserved1; // 0x00000008 length: 4
dword aicReserved2; // 0x0000000C length: 4
dword aicPerLordFlag4; // 0x00000010 length: 4
dword aicPerLordFlag5; // 0x00000014 length: 4
dword criticalPopularity; // 0x00000018 length: 4
dword lowestPopularity; // 0x0000001C length: 4
dword highestPopularity; // 0x00000020 length: 4
dword taxesMin; // 0x00000024 length: 4
dword taxesMax; // 0x00000028 length: 4
dword unknown011; // 0x0000002C length: 4
dword aicPerLordParam11; // 0x0000002C length: 4
dword farm1; // 0x00000030 length: 4
dword farm2; // 0x00000034 length: 4
dword farm3; // 0x00000038 length: 4
Expand Down Expand Up @@ -92,8 +92,8 @@ namespace AI {
dword defWallPatrolGroups; // 0x00000114 length: 4
dword defSiegeEngineGoldThreshold; // 0x00000118 length: 4
dword defSiegeEngineBuildDelay; // 0x0000011C length: 4
dword unknown072; // 0x00000120 length: 4
dword unknown073; // 0x00000124 length: 4
dword aicPerLordParam72; // 0x00000120 length: 4
dword aicPerLordParam73; // 0x00000124 length: 4
dword recruitProbDefDefault; // 0x00000128 length: 4
dword recruitProbDefWeak; // 0x0000012C length: 4
dword recruitProbDefStrong; // 0x00000130 length: 4
Expand Down Expand Up @@ -149,10 +149,10 @@ namespace AI {
dword AttForceRandom; // 0x000001F8 length: 4
dword AttForceSupportAllyThreshold; // 0x000001FC length: 4
dword AttForceRallyPercentage; // 0x00000200 length: 4
dword Unknown129; // 0x00000204 length: 4
dword dwMinRalliedTribesPercent; // 0x00000204 length: 4
dword AttAssaultDelay; // 0x00000208 length: 4
dword AttUnitPatrolRecommandDelay; // 0x0000020C length: 4
dword Unknown132; // 0x00000210 length: 4
dword dwAttackWillingnessBase; // 0x00000210 length: 4
dword SiegeEngine1; // 0x00000214 length: 4
dword SiegeEngine2; // 0x00000218 length: 4
dword SiegeEngine3; // 0x0000021C length: 4
Expand All @@ -162,7 +162,7 @@ namespace AI {
dword SiegeEngine7; // 0x0000022C length: 4
dword SiegeEngine8; // 0x00000230 length: 4
dword CowThrowInterval; // 0x00000234 length: 4
dword Unknown142; // 0x00000238 length: 4
dword aicUnused142; // 0x00000238 length: 4
dword AttMaxEngineers; // 0x0000023C length: 4
dword AttDiggingUnit; // 0x00000240 length: 4
dword AttDiggingUnitMax; // 0x00000244 length: 4
Expand Down
146 changes: 69 additions & 77 deletions src/OpenSHC/AI/AICState.func.hpp

Large diffs are not rendered by default.

94 changes: 45 additions & 49 deletions src/OpenSHC/AI/AICState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@
#pragma once

#include "OpenSHC/AI/AIC/AICSpecification.hpp"
#include "OpenSHC/AI/AINervousDestroyBuildingCategory.hpp"
#include "OpenSHC/AI/AIUnitBehaviourType.hpp"
#include "OpenSHC/AI/AIVUnitType.hpp"
#include "OpenSHC/AI/AINervousDestroyBuildingCategoryInt.hpp"
#include "OpenSHC/AI/AIUnitBehaviourTypeInt.hpp"
#include "OpenSHC/AI/AIVUnitTypeInt.hpp"
#include "OpenSHC/AI/TileDistancePair.hpp"
#include "OpenSHC/Commands/CommandBuildingType.hpp"
#include "OpenSHC/Commands/CommandBuildingTypeInt.hpp"
#include "OpenSHC/Game/Player/PlayerID.hpp"
#include "OpenSHC/Game/Resources/ResourceType.hpp"
#include "OpenSHC/Map/Units/UnitType.hpp"
#include "OpenSHC/Game/Resources/ResourceTypeInt.hpp"
#include "OpenSHC/Map/Units/UnitTypeInt.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

namespace OpenSHC {
namespace AI {

using OpenSHC::AI::AINervousDestroyBuildingCategory;
using OpenSHC::AI::AIUnitBehaviourType;
using OpenSHC::AI::AIVUnitType;
using OpenSHC::AI::AINervousDestroyBuildingCategoryInt;
using OpenSHC::AI::AIUnitBehaviourTypeInt;
using OpenSHC::AI::AIVUnitTypeInt;
using OpenSHC::AI::TileDistancePair;
using OpenSHC::AI::AIC::AICSpecification;
using OpenSHC::Commands::CommandBuildingType;
using OpenSHC::Commands::CommandBuildingTypeInt;
using OpenSHC::Game::Player::PlayerID;
using OpenSHC::Game::Resources::ResourceType;
using OpenSHC::Map::Units::UnitType;
using OpenSHC::Game::Resources::ResourceTypeInt;
using OpenSHC::Map::Units::UnitTypeInt;
using OpenSHC::WindowsHelper::Enums::BOOLEnum;

#pragma pack(push, 1)
Expand Down Expand Up @@ -120,31 +120,31 @@ namespace AI {

uint aiShouldBuildPitchrig(PlayerID param_1);

BOOLEnum shouldNotBeBuildingHovel(PlayerID playerID, CommandBuildingType param_2);
BOOLEnum shouldNotBeBuildingHovel(PlayerID playerID, CommandBuildingTypeInt param_2);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before I try to look at 300 files: Is this intended, that the Enums are replaced here again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it isn't. I guess this was done on and old SARIF export before switched the enum stuff. Luckily I use python scripts to do that enum change so I can run it again and improve this PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know when you did the last sarif export, but after the renaming and this one, you should do another one.


BOOLEnum shouldWaitWithBuildingNegativeFearFactor(int param_1, CommandBuildingType param_2);
BOOLEnum shouldWaitWithBuildingNegativeFearFactor(int param_1, CommandBuildingTypeInt param_2);

BOOLEnum shouldWaitWithBuildingAPositiveFearFactor(int playerID, CommandBuildingType param_2);
BOOLEnum shouldWaitWithBuildingAPositiveFearFactor(int playerID, CommandBuildingTypeInt param_2);

BOOLEnum destroyHouse(int playerID);

undefined4 shouldDestroyWoodCutterUnk(int playerID);
undefined4 aiMaybeDestroyWoodcutterHut(int playerID);

undefined4 destroyBuildingIfNoWorker(int buildingID);

BOOLEnum shouldNotBuildMarketArmoryGranaryBarracksMercenarypost(int playerID, CommandBuildingType param_2);
BOOLEnum shouldNotBuildMarketArmoryGranaryBarracksMercenarypost(int playerID, CommandBuildingTypeInt param_2);

void planToBuyWhenLowOnResourceAndSnoozeBuildings(int playerID);

void setupWorkshopProductionType(int playerID, int buildingID);

void sellGoods(int playerID, ResourceType resourceType, int amount);
void sellGoods(int playerID, ResourceTypeInt resourceType, int amount);

BOOLEnum buyGoods(int playerID, ResourceType resourceType, int amount);
BOOLEnum buyGoods(int playerID, ResourceTypeInt resourceType, int amount);

AIUnitBehaviourType randomlySelectAttackUnitTypeToRecruit(int playerID);
AIUnitBehaviourTypeInt randomlySelectAttackUnitTypeToRecruit(int playerID);

UnitType getUnitTypeForUnitBehaviourType(int playerID, AIUnitBehaviourType unitBehaviourType);
UnitTypeInt getUnitTypeForUnitBehaviourType(int playerID, AIUnitBehaviourTypeInt unitBehaviourType);

void generateSiegeCreationInformation(int playerID, int buildingID, int unitID);

Expand All @@ -158,7 +158,7 @@ namespace AI {

void syncBehaviourType7UnitTribes(int param_1);

void addUnitToTribeType10_moatdiggersUnk(int unitID);
void aiAddUnitToMoatDiggerTribe(int unitID);

undefined4 unitIDIsRangedOrArmored(int unitID);

Expand Down Expand Up @@ -207,13 +207,13 @@ namespace AI {

void setAttackPrimeInfo(int playerID, int attackedPlayerID);

void recomputeDistancesToAttackedKeepRelated(int playerID, int useBorderDistance);
void recomputeAIPathCostToAttackedKeep(int playerID, int useBorderDistance);

void recomputeAttackAIZone();

void recomputeAIZonerLayer();

void computeAndStoreShortestDistanceToKeepUnk(int playerID);
void computeEnemyKeepApproachTile(int playerID);

void setNextMoveLocationForUnits(int playerID);

Expand All @@ -223,7 +223,7 @@ namespace AI {

void sendUnitsToPlayerIDsKeepIfPossible(int playerID1, short* playerID2);

void setRallyRelatedFlagOnAllAIAttackTribes(int param_1);
void clearRallyFlagOnAllAIAttackTribes(int param_1);

void moveAttackTribesToLocations(short* playerID);

Expand All @@ -239,25 +239,25 @@ namespace AI {

BOOLEnum processAttForceRallyPercentage(int playerID);

void useAITribe_0x12_toPlaceSiegeTentsAndAssignEngineers(CommandBuildingType playerID);
void useAITribe_0x12_toPlaceSiegeTentsAndAssignEngineers(CommandBuildingTypeInt playerID);

void useAITribe_0xe_toPlaceTunnels(int playerID);

void aiAttackWave_tribe13Unk(int param_1);
void aiCommandTribe13DefensiveWave(int param_1);

void aiAttackWave_tribe12Unk(int param_1);
void aiCommandTribe12AggressiveApproach(int param_1);

void setTribe0xCtoAggressiveAndAttack(int playerID);

void aiAttackWave_tribe11Unk(int playerID);
void aiCommandTribe11StandGroundToGate(int playerID);

void sendAITribe_0xf_toAttackPatrol(int playerID);

void setTribe0x11ToAggressiveAndAttackIfConditionMet(int param_1);

void setEightTribe0xc0TribesToAggressiveAndAttack(int playerID);

void aiAttackWallsSmthUnk(int param_1);
void aiCommandWallAssaultTribes(int param_1);

void setTribe0xbToAggressiveAndAttack(int playerID);

Expand All @@ -275,22 +275,22 @@ namespace AI {

int countSiegeEngineUnits(int playerID);

void aiAttackWaveSiegeUnitsUnk(int playerID);
void aiCommandSiegeEngineTribes(int playerID);

BOOLEnum yieldCowThrow(int playerID);

BOOLEnum hasNoTroopsOrAllAreDiggers(int playerID);

BOOLEnum hasNotEnoughSupplies(int playerID);

void setAttackWillingnessUnk(int param_1);
void aiRollAttackWillingness(int param_1);

BOOLEnum teamIsWeakRelativeToEnemy(int playerID, BOOLEnum param_2);

void destroyAnyBuildingInCategory(int playerID, AINervousDestroyBuildingCategory buildingCategory);
void destroyAnyBuildingInCategory(int playerID, AINervousDestroyBuildingCategoryInt buildingCategory);

BOOLEnum isResourceLargerOrEqualThanMinimumGoodsRequiredAfterTrade(
int playerID, ResourceType resourceType, int buffer);
int playerID, ResourceTypeInt resourceType, int buffer);

BOOLEnum aiOfTypeInCurrentGame(int param_1);

Expand Down Expand Up @@ -332,19 +332,17 @@ namespace AI {

void someChatMessageSelection();

int getCurrentDesiredAttackRaidUnitCount(int aiType, int playerID);
undefined getCurrentDesiredAttackRaidUnitCount();

void renderDebugDataAiInfo(int x, int y, int width, int height);

void setInitialAIC();

void aiGiveCommandToOutpostTribesUnk(int tribeID, int tribeUID);
void aiRegisterTribeAndAssignTarget(int tribeID, int tribeUID);

void decideOnTribeAttackLocation(uint tribeID__moatWasHit);

void sellExcessGoods(int param_1);

void requestGoods(int playerID, ResourceType resourceType, undefined4 amount);
void requestGoods(int playerID, ResourceTypeInt resourceType, undefined4 amount);

void aiCreateSiegeUnits(int playerID);

Expand All @@ -354,7 +352,7 @@ namespace AI {

void addUnitToSmallestPatrolTribe(int unitID);

void addUnitToDefensiveTroopsTribeUnk(int unitID);
void aiAssignUnitToDefensiveTribe(int unitID);

void addUnitToItsTribe(int unitID, int aiUnitBehaviourType);

Expand All @@ -366,7 +364,7 @@ namespace AI {

void aiGiveRaidInstructions(int playerID);

void sendTribeToAIVLocationSlot(int tribeID, AIVUnitType aivUnitType, int slotIndex);
void sendTribeToAIVLocationSlot(int tribeID, AIVUnitTypeInt aivUnitType, int slotIndex);

void computeAttackPossibilities(int playerID);

Expand All @@ -384,15 +382,13 @@ namespace AI {

void makeOutpostTribesAttack();

void buyRequiredGoods(int param_1);

void aiRecruitUnits(int playerID);

void assignMoatDiggersUnk(int playerID);
void aiAssignCombatUnitsToTribesOrMoat(int playerID);

void addEngineersToTribe(int playerID);

void redirectTunnelersUnk(int param_1);
void aiReassignTunnelersToTribe(int param_1);

void sendRangedUnitTribesToAIVSlotsOrKeepIfNervous(int playerID);

Expand All @@ -416,13 +412,13 @@ namespace AI {

void updateAIBehaviour();

BOOLEnum shouldNotBeBuildingGranary(int playerID, CommandBuildingType param_2);
BOOLEnum shouldNotBeBuildingGranary(int playerID, CommandBuildingTypeInt param_2);

BOOLEnum shouldNotBeBuildingArmoury(PlayerID playerID, CommandBuildingType param_2);
BOOLEnum shouldNotBeBuildingArmoury(PlayerID playerID, CommandBuildingTypeInt param_2);

BOOLEnum shouldNotBuildKillingPits(int playerID, CommandBuildingType commandBuildingType);
BOOLEnum shouldNotBuildKillingPits(int playerID, CommandBuildingTypeInt commandBuildingType);

BOOLEnum woodCuttersHutWhileNoWoodAvailable(undefined4 playerID, CommandBuildingType param_2);
BOOLEnum woodCuttersHutWhileNoWoodAvailable(undefined4 playerID, CommandBuildingTypeInt param_2);
};

static_assert_cpp98_obj(sizeof(AICState) == 28048, AICState);
Expand Down
20 changes: 10 additions & 10 deletions src/OpenSHC/AI/AIVState.func.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
path: 'OpenSHC/AI/AIVState.func.hpp'
*/

#include "OpenSHC/AI/AIGridComputationResourceType.hpp"
#include "OpenSHC/AI/AIV/AIVBuildingType2.hpp"
#include "OpenSHC/AI/AIGridComputationResourceTypeInt.hpp"
#include "OpenSHC/AI/AIV/AIVBuildingType2Int.hpp"
#include "OpenSHC/AI/AIVState.hpp"
#include "OpenSHC/Commands/CommandBuildingType.hpp"
#include "OpenSHC/Commands/CommandBuildingTypeInt.hpp"
#include "OpenSHC/Game/Player/PlayerID.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"
namespace OpenSHC {
namespace AI {
namespace AIVState_Func {

using OpenSHC::AI::AIGridComputationResourceType;
using OpenSHC::AI::AIV::AIVBuildingType2;
using OpenSHC::Commands::CommandBuildingType;
using OpenSHC::AI::AIGridComputationResourceTypeInt;
using OpenSHC::AI::AIV::AIVBuildingType2Int;
using OpenSHC::Commands::CommandBuildingTypeInt;
using OpenSHC::Game::Player::PlayerID;
using OpenSHC::WindowsHelper::Enums::BOOLEnum;

Expand Down Expand Up @@ -42,7 +42,7 @@ namespace AI {
&AIVState::setKeepOffsetAndOrientation)
setKeepOffsetAndOrientation;

MACRO_FUNCTION_RESOLVER(CommandBuildingType (AIVState::*)(AIVBuildingType2), false,
MACRO_FUNCTION_RESOLVER(CommandBuildingTypeInt (AIVState::*)(AIVBuildingType2Int), false,
Address::SHC_3BB0A8C1_0x004ECFE0, &AIVState::convertAIVBuildingTypeToCommandBuildingType)
convertAIVBuildingTypeToCommandBuildingType;

Expand Down Expand Up @@ -73,15 +73,15 @@ namespace AI {
void (AIVState::*)(int, int), false, Address::SHC_3BB0A8C1_0x004EDCB0, &AIVState::set0x13ValueTo10InHeatMap)
set0x13ValueTo10InHeatMap;

MACRO_FUNCTION_RESOLVER(int (AIVState::*)(PlayerID, CommandBuildingType), false,
MACRO_FUNCTION_RESOLVER(int (AIVState::*)(PlayerID, CommandBuildingTypeInt), false,
Address::SHC_3BB0A8C1_0x004EDDF0, &AIVState::findSuitableLocationCloseToKeepAndPlaceBuilding)
findSuitableLocationCloseToKeepAndPlaceBuilding;

MACRO_FUNCTION_RESOLVER(void (AIVState::*)(int), false, Address::SHC_3BB0A8C1_0x004EE140,
&AIVState::findAppropriateWoodCutterLocation)
findAppropriateWoodCutterLocation;

MACRO_FUNCTION_RESOLVER(void (AIVState::*)(int, AIGridComputationResourceType), false,
MACRO_FUNCTION_RESOLVER(void (AIVState::*)(int, AIGridComputationResourceTypeInt), false,
Address::SHC_3BB0A8C1_0x004EE430, &AIVState::findAppropriateBuildingLocationForResourceType)
findAppropriateBuildingLocationForResourceType;

Expand Down Expand Up @@ -109,7 +109,7 @@ namespace AI {
int (AIVState::*)(int), false, Address::SHC_3BB0A8C1_0x004EF8C0, &AIVState::computeAIVPlacementFit)
computeAIVPlacementFit;

MACRO_FUNCTION_RESOLVER(int (AIVState::*)(int, CommandBuildingType), false, Address::SHC_3BB0A8C1_0x004EFA60,
MACRO_FUNCTION_RESOLVER(int (AIVState::*)(int, CommandBuildingTypeInt), false, Address::SHC_3BB0A8C1_0x004EFA60,
&AIVState::aiPlaceFarm)
aiPlaceFarm;

Expand Down
Loading
Loading