Skip to content

Commit 4dc2cfb

Browse files
committed
Change expansion defines to have prefix and add MaNGOS defines
MaNGOS uses the CLASSIC, TBC, etc defines as a way to control their multiversion core code so redefining them in Eluna was causing issues.
1 parent 5ca638f commit 4dc2cfb

21 files changed

+120
-124
lines changed

ElunaCreatureAI.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#if defined ELUNA_TRINITY
1616
struct ScriptedAI;
1717
typedef ScriptedAI NativeScriptedAI;
18-
#elif defined ELUNA_CMANGOS
18+
#elif defined ELUNA_CMANGOS || ELUNA_MANGOS
1919
class CreatureAI;
2020
typedef CreatureAI NativeScriptedAI;
2121
#elif defined ELUNA_VMANGOS
@@ -64,7 +64,11 @@ struct ElunaCreatureAI : NativeScriptedAI
6464

6565
if (!me->GetEluna()->UpdateAI(me, diff))
6666
{
67+
#if !defined ELUNA_MANGOS
6768
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
69+
#else
70+
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE))
71+
#endif
6872
NativeScriptedAI::UpdateAI(diff);
6973
}
7074
}

ElunaIncludes.h

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@
5555
#elif defined ELUNA_VMANGOS
5656
#include "BasicAI.h"
5757
#include "SQLStorages.h"
58+
#elif defined ELUNA_MANGOS
59+
#include "SQLStorages.h"
5860
#endif // ELUNA_TRINITY
59-
#if ELUNA_EXPANSION > CLASSIC
61+
#if ELUNA_EXPANSION > EXP_CLASSIC
6062
#include "ArenaTeam.h"
6163
#endif
62-
#if ELUNA_EXPANSION >= WOTLK
64+
#if ELUNA_EXPANSION >= EXP_WOTLK
6365
#include "Vehicle.h"
6466
#endif
6567
#else
@@ -94,13 +96,13 @@
9496
#include "Spells/SpellMgr.h"
9597
#include "Tools/Language.h"
9698
#include "Server/SQLStorages.h"
97-
#if ELUNA_EXPANSION > CLASSIC
99+
#if ELUNA_EXPANSION > EXP_CLASSIC
98100
#include "Arena/ArenaTeam.h"
99101
#endif
100-
#if ELUNA_EXPANSION >= WOTLK
102+
#if ELUNA_EXPANSION >= EXP_WOTLK
101103
#include "Entities/Vehicle.h"
102104
#endif
103-
#if ELUNA_EXPANSION >= CATA
105+
#if ELUNA_EXPANSION >= EXP_CATA
104106
#include "AI/BaseAI/AggressorAI.h"
105107
#else
106108
#include "AI/BaseAI/UnitAI.h"
@@ -110,10 +112,15 @@
110112
#if !defined ELUNA_TRINITY
111113
#include "Config/Config.h"
112114
#include "BattleGroundMgr.h"
115+
#if !defined ELUNA_MANGOS
113116
#include "revision.h"
117+
#else
118+
#include "GitRevision.h"
119+
#include "revision_data.h"
120+
#endif
114121
#endif
115122

116-
#if ELUNA_EXPANSION > CLASSIC
123+
#if ELUNA_EXPANSION > EXP_CLASSIC
117124
typedef Opcodes OpcodesList;
118125
#endif
119126

@@ -124,7 +131,7 @@ typedef Opcodes OpcodesList;
124131
#if defined ELUNA_CMANGOS
125132
#define CORE_NAME "cMaNGOS"
126133
#define CORE_VERSION REVISION_DATE " " REVISION_ID
127-
#if ELUNA_EXPANSION == CATA
134+
#if ELUNA_EXPANSION == EXP_CATA
128135
#define NUM_MSG_TYPES MAX_OPCODE_TABLE_SIZE
129136
#endif
130137
#endif
@@ -135,6 +142,14 @@ typedef Opcodes OpcodesList;
135142
#define DEFAULT_LOCALE LOCALE_enUS
136143
#endif
137144

145+
#if defined ELUNA_MANGOS
146+
#define CORE_NAME "MaNGOS"
147+
#define CORE_VERSION PROJECT_REVISION_NR
148+
#if ELUNA_EXPANSION >= EXP_CATA
149+
#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS
150+
#endif
151+
#endif
152+
138153
#if defined ELUNA_TRINITY
139154
#define CORE_NAME "TrinityCore"
140155
#define REGEN_TIME_FULL
@@ -169,15 +184,15 @@ typedef Opcodes OpcodesList;
169184
#endif
170185

171186

172-
#if ELUNA_EXPANSION >= CATA || defined ELUNA_VMANGOS
187+
#if ELUNA_EXPANSION >= EXP_CATA || defined ELUNA_VMANGOS
173188
#define PLAYER_FIELD_LIFETIME_HONORABLE_KILLS PLAYER_FIELD_LIFETIME_HONORBALE_KILLS
174189
#endif
175190

176-
#if ELUNA_EXPANSION == TBC
191+
#if ELUNA_EXPANSION == EXP_TBC
177192
#define SPELL_AURA_MOD_KILL_XP_PCT SPELL_AURA_MOD_XP_PCT
178193
#endif
179194

180-
#if ELUNA_EXPANSION >= WOTLK
195+
#if ELUNA_EXPANSION >= EXP_WOTLK
181196
#define UNIT_BYTE2_FLAG_SANCTUARY UNIT_BYTE2_FLAG_SUPPORTABLE
182197
#endif
183198

ElunaLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace fs = std::filesystem;
2525
#include <Windows.h>
2626
#endif
2727

28-
#if defined ELUNA_TRINITY
28+
#if defined ELUNA_TRINITY || ELUNA_MANGOS
2929
#include "MapManager.h"
3030
#elif defined ELUNA_CMANGOS
3131
#include "Maps/MapManager.h"

ElunaUtility.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
uint32 ElunaUtil::GetCurrTime()
2424
{
25-
#if defined ELUNA_TRINITY
25+
#if defined ELUNA_TRINITY || ELUNA_MANGOS
2626
return getMSTime();
2727
#else
2828
return WorldTimer::getMSTime();
@@ -31,7 +31,7 @@ uint32 ElunaUtil::GetCurrTime()
3131

3232
uint32 ElunaUtil::GetTimeDiff(uint32 oldMSTime)
3333
{
34-
#if defined ELUNA_TRINITY
34+
#if defined ELUNA_TRINITY || ELUNA_MANGOS
3535
return GetMSTimeDiffToNow(oldMSTime);
3636
#else
3737
return WorldTimer::getMSTimeDiff(oldMSTime, WorldTimer::getMSTime());
@@ -98,7 +98,11 @@ bool ElunaUtil::WorldObjectInRangeCheck::operator()(WorldObject* u)
9898
{
9999
if (i_obj_fact)
100100
{
101+
#if !defined ELUNA_MANGOS
101102
if ((i_obj_fact->IsHostileTo(*target->GetFactionTemplateEntry())) != (i_hostile == 1))
103+
#else
104+
if ((i_obj_fact->IsHostileTo(*target->getFactionTemplateEntry())) != (i_hostile == 1))
105+
#endif
102106
return false;
103107
}
104108
else if (i_hostile == 1)

ElunaUtility.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
#include "Common.h"
1111

12-
#define CLASSIC 0
13-
#define TBC 1
14-
#define WOTLK 2
15-
#define CATA 3
12+
#define EXP_CLASSIC 0
13+
#define EXP_TBC 1
14+
#define EXP_WOTLK 2
15+
#define EXP_CATA 3
1616

1717
#if !defined ELUNA_CMANGOS
1818
#include "SharedDefines.h"
@@ -35,7 +35,7 @@
3535
#include <mutex>
3636
#include <memory>
3737

38-
#if !defined ELUNA_VMANGOS
38+
#if defined ELUNA_TRINITY || ELUNA_CMANGOS
3939
#define USING_BOOST
4040
#endif
4141

LuaEngine.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ class TemporarySpawn;
8585
typedef TemporarySpawn TempSummon;
8686
#endif
8787

88-
#if defined ELUNA_VMANGOS
88+
#if defined ELUNA_VMANGOS || ELUNA_MANGOS
8989
class TemporarySummon;
9090
typedef TemporarySummon TempSummon;
9191
#endif
9292

93-
#if ELUNA_EXPANSION == CLASSIC
93+
#if ELUNA_EXPANSION == EXP_CLASSIC
9494
typedef int Difficulty;
9595
#endif
9696

97-
#if ELUNA_EXPANSION >= WOTLK
97+
#if ELUNA_EXPANSION >= EXP_WOTLK
9898
class VehicleInfo;
9999
typedef VehicleInfo Vehicle;
100100
#endif
@@ -461,7 +461,7 @@ class ELUNA_GAME_API Eluna
461461
bool OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest);
462462
bool OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt);
463463
void GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject);
464-
#if ELUNA_EXPANSION >= WOTLK
464+
#if ELUNA_EXPANSION >= EXP_WOTLK
465465
void OnDestroyed(GameObject* pGameObject, WorldObject* attacker);
466466
void OnDamaged(GameObject* pGameObject, WorldObject* attacker);
467467
#endif
@@ -489,7 +489,7 @@ class ELUNA_GAME_API Eluna
489489
void OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints);
490490
void OnTalentsReset(Player* pPlayer, bool noCost);
491491
void OnMoneyChanged(Player* pPlayer, int32& amount);
492-
#if ELUNA_EXPANSION >= CATA
492+
#if ELUNA_EXPANSION >= EXP_CATA
493493
void OnMoneyChanged(Player* pPlayer, int64& amount);
494494
#endif
495495
void OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim);
@@ -517,7 +517,7 @@ class ELUNA_GAME_API Eluna
517517
void HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code);
518518
void OnAchievementComplete(Player* pPlayer, uint32 achievementId);
519519

520-
#if ELUNA_EXPANSION >= WOTLK
520+
#if ELUNA_EXPANSION >= EXP_WOTLK
521521
/* Vehicle */
522522
void OnInstall(Vehicle* vehicle);
523523
void OnUninstall(Vehicle* vehicle);
@@ -547,7 +547,7 @@ class ELUNA_GAME_API Eluna
547547
void OnDisband(Guild* guild);
548548
void OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair);
549549
void OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount);
550-
#if ELUNA_EXPANSION >= CATA
550+
#if ELUNA_EXPANSION >= EXP_CATA
551551
void OnMemberWitdrawMoney(Guild* guild, Player* player, uint64& amount, bool isRepair);
552552
void OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount);
553553
#endif

LuaFunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void RegisterFunctions(Eluna* E)
185185
ElunaTemplate<Item>::SetMethods(E, LuaObject::ObjectMethods);
186186
ElunaTemplate<Item>::SetMethods(E, LuaItem::ItemMethods);
187187

188-
#if ELUNA_EXPANSION >= WOTLK
188+
#if ELUNA_EXPANSION >= EXP_WOTLK
189189
ElunaTemplate<Vehicle>::Register(E, "Vehicle");
190190
ElunaTemplate<Vehicle>::SetMethods(E, LuaVehicle::VehicleMethods);
191191
#endif

hooks/GameObjectHooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject
6969
CallAllFunctions(GameObjectEventBindings, key);
7070
}
7171

72-
#if ELUNA_EXPANSION >= WOTLK
72+
#if ELUNA_EXPANSION >= EXP_WOTLK
7373
void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker)
7474
{
7575
START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry());

hooks/GuildHooks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, b
9494
CleanUpStack(4);
9595
}
9696

97-
#if ELUNA_EXPANSION >= CATA
97+
#if ELUNA_EXPANSION >= EXP_CATA
9898
void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint64& amount, bool isRepair)
9999
{
100100
START_HOOK(GUILD_EVENT_ON_MONEY_WITHDRAW);
@@ -149,7 +149,7 @@ void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount)
149149
CleanUpStack(3);
150150
}
151151

152-
#if ELUNA_EXPANSION >= CATA
152+
#if ELUNA_EXPANSION >= EXP_CATA
153153
void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount)
154154
{
155155
START_HOOK(GUILD_EVENT_ON_MONEY_DEPOSIT);

hooks/PlayerHooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void Eluna::OnMoneyChanged(Player* pPlayer, int32& amount)
280280
CleanUpStack(2);
281281
}
282282

283-
#if ELUNA_EXPANSION >= CATA
283+
#if ELUNA_EXPANSION >= EXP_CATA
284284
void Eluna::OnMoneyChanged(Player* pPlayer, int64& amount)
285285
{
286286
START_HOOK(PLAYER_EVENT_ON_MONEY_CHANGE);

hooks/VehicleHooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "BindingMap.h"
1111
#include "ElunaTemplate.h"
1212

13-
#if ELUNA_EXPANSION >= WOTLK
13+
#if ELUNA_EXPANSION >= EXP_WOTLK
1414

1515
using namespace Hooks;
1616

0 commit comments

Comments
 (0)