From 87a8c776c9fcef97a8ab5f6603101c9f0484976a Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Sun, 16 May 2021 15:10:59 +0300 Subject: [PATCH] Nullkiller: reduce memory usage for x86 --- AI/Nullkiller/AIUtility.h | 18 ++++++++++++++++++ AI/Nullkiller/Pathfinding/AINodeStorage.cpp | 8 ++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/AI/Nullkiller/AIUtility.h b/AI/Nullkiller/AIUtility.h index de432dc8a..0c5a1e86e 100644 --- a/AI/Nullkiller/AIUtility.h +++ b/AI/Nullkiller/AIUtility.h @@ -9,6 +9,24 @@ */ #pragma once + // Check windows +#if _WIN32 || _WIN64 +#if _WIN64 +#define ENVIRONMENT64 +#else +#define ENVIRONMENT32 +#endif +#endif + +// Check GCC +#if __GNUC__ +#if __x86_64__ || __ppc64__ +#define ENVIRONMENT64 +#else +#define ENVIRONMENT32 +#endif +#endif + /*********************** TBB.h ********************/ #include "tbb/atomic.h" diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp index a00b14f68..a98da1d23 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp @@ -23,14 +23,18 @@ std::shared_ptr> AISharedStorage::shared; std::set commitedTiles; std::set commitedTilesInitial; -const uint64_t FirstActorMask = 1; +#ifdef ENVIRONMENT64 const int BUCKET_COUNT = 11; +#else +const int BUCKET_COUNT = 7; +#endif // ENVIRONMENT64 + +const uint64_t FirstActorMask = 1; const int BUCKET_SIZE = GameConstants::MAX_HEROES_PER_PLAYER; const int NUM_CHAINS = BUCKET_COUNT * BUCKET_SIZE; const uint64_t MIN_ARMY_STRENGTH_FOR_CHAIN = 5000; const uint64_t MIN_ARMY_STRENGTH_FOR_NEXT_ACTOR = 1000; - AISharedStorage::AISharedStorage(int3 sizes) { if(!shared){