Index: source/simulation2/components/CCmpRangeManager.cpp =================================================================== --- source/simulation2/components/CCmpRangeManager.cpp +++ source/simulation2/components/CCmpRangeManager.cpp @@ -44,6 +44,7 @@ #define LOS_TILES_RATIO 8 #define DEBUG_RANGE_MANAGER_BOUNDS 0 +#define MAX_NUMBER_OF_PLAYERS 16 /** * Representation of a range query. @@ -68,7 +69,7 @@ */ static inline u32 CalcOwnerMask(player_id_t owner) { - if (owner >= -1 && owner < 31) + if (owner >= -1 && owner < 2*MAX_NUMBER_OF_PLAYERS - 1) return 1 << (1+owner); else return 0; // owner was invalid @@ -79,7 +80,7 @@ */ static inline u32 CalcPlayerLosMask(player_id_t player) { - if (player > 0 && player <= 16) + if (player > 0 && player <= MAX_NUMBER_OF_PLAYERS) return ICmpRangeManager::LOS_MASK << (2*(player-1)); return 0; } @@ -102,7 +103,7 @@ */ static bool SetPlayerSharedDirtyVisibilityBit(u16& mask, player_id_t player, bool enable) { - if (player <= 0 || player > 16) + if (player <= 0 || player > MAX_NUMBER_OF_PLAYERS) return false; u16 oldMask = mask; @@ -120,7 +121,7 @@ */ static inline u8 GetPlayerVisibility(u32 visibilities, player_id_t player) { - if (player > 0 && player <= 16) + if (player > 0 && player <= MAX_NUMBER_OF_PLAYERS) return (visibilities >> (2 *(player-1))) & 0x3; return 0; } @@ -130,7 +131,7 @@ */ static inline bool IsVisibilityDirty(u16 dirty, player_id_t player) { - if (player > 0 && player <= 16) + if (player > 0 && player <= MAX_NUMBER_OF_PLAYERS) return (dirty >> (player - 1)) & 0x1; return false; } @@ -371,7 +372,7 @@ std::vector m_SubdivisionResults; // LOS state: - static const player_id_t MAX_LOS_PLAYER_ID = 16; + static const player_id_t MAX_LOS_PLAYER_ID = MAX_NUMBER_OF_PLAYERS; std::vector m_LosRevealAll; bool m_LosCircular;