Skip to content

Commit

Permalink
Unify defines
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Jul 20, 2024
1 parent d9212c3 commit c67e4a7
Show file tree
Hide file tree
Showing 37 changed files with 270 additions and 278 deletions.
2 changes: 1 addition & 1 deletion ElunaCompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int lua_absindex(lua_State* L, int i) {
return i;
}

#ifndef LUAJIT_VERSION
#if !defined LUAJIT_VERSION
void* luaL_testudata(lua_State* L, int index, const char* tname) {
void* ud = lua_touserdata(L, index);
if (ud)
Expand Down
2 changes: 1 addition & 1 deletion ElunaCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern "C"
#define lua_load(L, buf_read, dec_buf, str, NULL) \
lua_load(L, buf_read, dec_buf, str)

#ifndef LUAJIT_VERSION
#if !defined LUAJIT_VERSION
void* luaL_testudata(lua_State* L, int index, const char* tname);
void luaL_setmetatable(lua_State* L, const char* tname);
#define luaL_setfuncs(L, l, n) luaL_register(L, NULL, l)
Expand Down
10 changes: 5 additions & 5 deletions ElunaConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ void ElunaConfig::Initialize()

void ElunaConfig::SetConfig(ElunaConfigBoolValues index, char const* fieldname, bool defvalue)
{
#ifdef TRINITY
#if defined TRINITY
SetConfig(index, sConfigMgr->GetBoolDefault(fieldname, defvalue));
#elif defined CMANGOS || defined VMANGOS || defined MANGOS
#else
SetConfig(index, sConfig.GetBoolDefault(fieldname, defvalue));
#endif
}

void ElunaConfig::SetConfig(ElunaConfigStringValues index, char const* fieldname, std::string defvalue)
{
#ifdef TRINITY
#if defined TRINITY
SetConfig(index, sConfigMgr->GetStringDefault(fieldname, defvalue));
#elif CMANGOS
#elif defined CMANGOS
SetConfig(index, sConfig.GetStringDefault(fieldname, defvalue));
#elif defined VMANGOS || defined MANGOS
#else
SetConfig(index, sConfig.GetStringDefault(fieldname, defvalue.c_str()));
#endif
}
Expand Down
26 changes: 13 additions & 13 deletions ElunaCreatureAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _ELUNA_CREATURE_AI_H

#include "LuaEngine.h"
#ifdef CMANGOS
#if defined CMANGOS
#include "AI/BaseAI/CreatureAI.h"
#endif

Expand All @@ -32,7 +32,7 @@ struct ElunaCreatureAI : NativeScriptedAI
bool justSpawned;
// used to delay movementinform hook (WP hook)
std::vector< std::pair<uint32, uint32> > movepoints;
#ifndef TRINITY
#if !defined TRINITY
#define me m_creature
#endif
ElunaCreatureAI(Creature* creature) : NativeScriptedAI(creature), justSpawned(true)
Expand All @@ -41,13 +41,13 @@ struct ElunaCreatureAI : NativeScriptedAI
~ElunaCreatureAI() { }

//Called at World update tick
#ifndef TRINITY
#if !defined TRINITY
void UpdateAI(const uint32 diff) override
#else
void UpdateAI(uint32 diff) override
#endif
{
#ifndef TRINITY
#if !defined TRINITY
if (justSpawned)
{
justSpawned = false;
Expand All @@ -67,7 +67,7 @@ struct ElunaCreatureAI : NativeScriptedAI

if (!me->GetEluna()->UpdateAI(me, diff))
{
#ifdef MANGOS
#if defined MANGOS
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE))
#else
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
Expand All @@ -76,7 +76,7 @@ struct ElunaCreatureAI : NativeScriptedAI
}
}

#ifdef TRINITY
#if defined TRINITY
// Called for reaction when initially engaged - this will always happen _after_ JustEnteredCombat
// Called at creature aggro either by MoveInLOS or Attack Start
void JustEngagedWith(Unit* target) override
Expand Down Expand Up @@ -154,7 +154,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::AttackStart(target);
}

#ifdef TRINITY
#if defined TRINITY
// Called for reaction at stopping attack at no attackers or targets
void EnterEvadeMode(EvadeReason /*why*/) override
#else
Expand All @@ -165,7 +165,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::EnterEvadeMode();
}

#ifdef TRINITY
#if defined TRINITY
// Called when creature appears in the world (spawn, respawn, grid load etc...)
void JustAppeared() override
{
Expand Down Expand Up @@ -202,7 +202,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::CorpseRemoved(respawnDelay);
}

#if !defined(TRINITY) && !defined(VMANGOS)
#if !defined TRINITY && !defined VMANGOS
// Enables use of MoveInLineOfSight
bool IsVisible(Unit* who) const override
{
Expand All @@ -217,9 +217,9 @@ struct ElunaCreatureAI : NativeScriptedAI
}

// Called when hit by a spell
#ifdef TRINITY
#if defined TRINITY
void SpellHit(WorldObject* caster, SpellInfo const* spell) override
#elif VMANGOS
#elif defined VMANGOS
void SpellHit(Unit* caster, SpellInfo const* spell)
#else
void SpellHit(Unit* caster, SpellInfo const* spell) override
Expand All @@ -230,7 +230,7 @@ struct ElunaCreatureAI : NativeScriptedAI
}

// Called when spell hits a target
#ifdef TRINITY
#if defined TRINITY
void SpellHitTarget(WorldObject* target, SpellInfo const* spell) override
#else
void SpellHitTarget(Unit* target, SpellInfo const* spell) override
Expand All @@ -240,7 +240,7 @@ struct ElunaCreatureAI : NativeScriptedAI
NativeScriptedAI::SpellHitTarget(target, spell);
}

#ifdef TRINITY
#if defined TRINITY
// Called when the creature is summoned successfully by other creature
void IsSummonedBy(WorldObject* summoner) override
{
Expand Down
2 changes: 1 addition & 1 deletion ElunaEventMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "ElunaEventMgr.h"
#include "LuaEngine.h"
#ifndef CMANGOS
#if !defined CMANGOS
#include "Object.h"
#else
#include "Entities/Object.h"
Expand Down
6 changes: 3 additions & 3 deletions ElunaEventMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

#include "ElunaUtility.h"
#include "Common.h"
#ifdef TRINITY
#if defined TRINITY
#include "Random.h"
#elif CMANGOS
#elif defined CMANGOS
#include "Util/Util.h"
#else
#include "Util.h"
#endif
#include <map>

#ifdef TRINITY
#if defined TRINITY
#include "Define.h"
#else
#include "Platform/Define.h"
Expand Down
45 changes: 21 additions & 24 deletions ElunaIncludes.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _ELUNA_INCLUDES_H

// Required
#ifndef CMANGOS
#if !defined CMANGOS
#include "AccountMgr.h"
#include "AuctionHouseMgr.h"
#include "Cell.h"
Expand Down Expand Up @@ -72,7 +72,7 @@
#include "Tools/Language.h"
#endif

#ifdef TRINITY
#if defined TRINITY
#include "Bag.h"
#include "Battleground.h"
#include "Config.h"
Expand Down Expand Up @@ -102,70 +102,67 @@
#include "SQLStorages.h"
#endif
#include "BattleGroundMgr.h"
#ifndef CMANGOS
#if !defined CMANGOS
#include "SQLStorages.h"
#else
#include "Server/SQLStorages.h"
#endif
#ifdef MANGOS
#if defined MANGOS
#include "GitRevision.h"
#else
#include "revision.h"
#endif
#endif

#if !defined(TBC) && !defined(CLASSIC)
#ifndef CMANGOS
#if !defined TBC && !defined CLASSIC
#if !defined CMANGOS
#include "Vehicle.h"
#else
#include "Entities/Vehicle.h"
#endif
#endif

#ifndef CLASSIC
#ifndef CMANGOS
#if !defined CLASSIC
typedef Opcodes OpcodesList;
#if !defined CMANGOS
#include "ArenaTeam.h"
#else
#include "Arena/ArenaTeam.h"
#endif
#endif

#if !defined CLASSIC
typedef Opcodes OpcodesList;
#endif

/*
* Note: if you add or change a CORE_NAME or CORE_VERSION #define,
* please update LuaGlobalFunctions::GetCoreName or LuaGlobalFunctions::GetCoreVersion documentation example string.
*/
#ifdef MANGOS
#if defined MANGOS
#define CORE_NAME "MaNGOS"
#define CORE_VERSION REVISION_NR
#ifdef CATA
#if defined CATA
#define NUM_MSG_TYPES NUM_OPCODE_HANDLERS
#endif
#endif

#ifdef CMANGOS
#if defined CMANGOS
#define CORE_NAME "cMaNGOS"
#define CORE_VERSION REVISION_DATE " " REVISION_ID
#ifdef CATA
#if defined CATA
#define NUM_MSG_TYPES MAX_OPCODE_TABLE_SIZE
#endif
#endif

#ifdef VMANGOS
#if defined VMANGOS
#define CORE_NAME "vMaNGOS"
#define CORE_VERSION REVISION_HASH
#define DEFAULT_LOCALE LOCALE_enUS
#endif

#ifdef TRINITY
#if defined TRINITY
#define CORE_NAME "TrinityCore"
#define REGEN_TIME_FULL
#endif

#ifdef TRINITY
#if defined TRINITY
#define CORE_VERSION (GitRevision::GetFullVersion())
#define eWorld (sWorld)
#define eMapMgr (sMapMgr)
Expand All @@ -189,24 +186,24 @@ typedef Opcodes OpcodesList;
#define TOTAL_LOCALES MAX_LOCALE
#define TARGETICONCOUNT TARGET_ICON_COUNT
#define MAX_TALENT_SPECS MAX_TALENT_SPEC_COUNT
#ifndef VMANGOS
#if !defined VMANGOS
#define TEAM_NEUTRAL TEAM_INDEX_NEUTRAL
#endif


#if ((defined(CATA) && !defined(MANGOS)) || defined VMANGOS)
#if (defined CATA && !defined MANGOS) || defined VMANGOS
#define PLAYER_FIELD_LIFETIME_HONORABLE_KILLS PLAYER_FIELD_LIFETIME_HONORBALE_KILLS
#endif

#ifdef TBC
#if defined TBC
#define SPELL_AURA_MOD_KILL_XP_PCT SPELL_AURA_MOD_XP_PCT
#endif

#if defined(CATA) || defined(MISTS) || (defined(WOTLK) && !defined(MANGOS))
#if defined CATA || defined MISTS || (defined WOTLK && !defined MANGOS)
#define UNIT_BYTE2_FLAG_SANCTUARY UNIT_BYTE2_FLAG_SUPPORTABLE
#endif

#ifndef CMANGOS
#if !defined CMANGOS
typedef TemporarySummon TempSummon;
#else
typedef TemporarySpawn TempSummon;
Expand Down
8 changes: 4 additions & 4 deletions ElunaInstanceAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "lmarshal.h"


#ifndef TRINITY
#if !defined TRINITY
void ElunaInstanceAI::Initialize()
{
ASSERT(!instance->GetEluna()->HasInstanceData(instance));
Expand Down Expand Up @@ -80,7 +80,7 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1);
// Stack: (empty)

#ifndef TRINITY
#if !defined TRINITY
Initialize();
#endif
}
Expand All @@ -92,7 +92,7 @@ void ElunaInstanceAI::Load(const char* data)
lua_pop(L, 1);
// Stack: (empty)

#ifndef TRINITY
#if !defined TRINITY
Initialize();
#endif
}
Expand All @@ -103,7 +103,7 @@ void ElunaInstanceAI::Load(const char* data)
{
ELUNA_LOG_ERROR("Error while decoding instance data: Data is not valid base-64");

#ifndef TRINITY
#if !defined TRINITY
Initialize();
#endif
}
Expand Down
Loading

0 comments on commit c67e4a7

Please sign in to comment.