Support C++11 and update Eluna

Set compilation to use C++11
Updated Eluna version and applied all core modifications needed by the update
This commit is contained in:
Rochet2 2016-01-24 19:25:25 +02:00
parent 1be0b35125
commit f81e455e3a
7 changed files with 54 additions and 23 deletions

View File

@ -1,7 +1,7 @@
language: cpp language: cpp
before_install: # use docker in travis
- bash .travis.sh sudo: false
# reduce clone time by only getting the latest commit and not the whole history (default for travis is 100) # reduce clone time by only getting the latest commit and not the whole history (default for travis is 100)
git: git:
@ -11,12 +11,6 @@ git:
notifications: notifications:
slack: getmangos:yRgNBSgRQVh8WdfGEbT08Hit slack: getmangos:yRgNBSgRQVh8WdfGEbT08Hit
# only run travis on the master branch
branches:
only:
- release20
- develop21
# build on both Linux and OSX (finally) # build on both Linux and OSX (finally)
os: os:
- linux - linux
@ -27,6 +21,19 @@ compiler:
- gcc - gcc
- clang - clang
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- clang
before_install:
- bash .travis.sh
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CC" = "gcc" ] ; then export CC=gcc-4.8 CXX=g++-4.8 ; fi
script: script:
- test -d _build || mkdir _build - test -d _build || mkdir _build
- test -d _install || mkdir _install - test -d _install || mkdir _install

View File

@ -119,11 +119,12 @@ elseif(UNIX)
if(NOT DEBUG) if(NOT DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --no-warnings") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --no-warnings")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --no-warnings") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --no-warnings -std=c++11 -Wno-narrowing -Wno-deprecated-register")
else() else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wall -Wextra -Winit-self -Winvalid-pch -Wfatal-errors -g3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wall -Wextra -Winit-self -Winvalid-pch -Wfatal-errors -g3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -Winit-self -Winvalid-pch -Wfatal-errors -Woverloaded-virtual -g3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -Winit-self -Winvalid-pch -Wfatal-errors -Woverloaded-virtual -g3 -std=c++11 -Wno-narrowing -Wno-deprecated-register")
endif() endif()
elseif(CMAKE_C_COMPILER MATCHES "icc") elseif(CMAKE_C_COMPILER MATCHES "icc")
if(PLATFORM EQUAL 32) if(PLATFORM EQUAL 32)
add_definitions(-axSSE2) add_definitions(-axSSE2)

View File

@ -173,6 +173,7 @@ typedef uint32 DWORD;
#define CONCAT1(x, y) x##y #define CONCAT1(x, y) x##y
#define STATIC_ASSERT_WORKAROUND(expr, msg) typedef char CONCAT(static_assert_failed_at_line_, __LINE__) [(expr) ? 1 : -1] #define STATIC_ASSERT_WORKAROUND(expr, msg) typedef char CONCAT(static_assert_failed_at_line_, __LINE__) [(expr) ? 1 : -1]
#ifndef COMPILER_HAS_CPP11_SUPPORT
#if COMPILER == COMPILER_GNU #if COMPILER == COMPILER_GNU
# if !defined(__GXX_EXPERIMENTAL_CXX0X__) || (__GNUC__ < 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ < 7) # if !defined(__GXX_EXPERIMENTAL_CXX0X__) || (__GNUC__ < 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ < 7)
# define override # define override
@ -188,6 +189,7 @@ typedef uint32 DWORD;
# define static_assert(a, b) STATIC_ASSERT_WORKAROUND(a, b) # define static_assert(a, b) STATIC_ASSERT_WORKAROUND(a, b)
# endif # endif
#endif #endif
#endif
/** /**
* @brief * @brief

View File

@ -183,8 +183,7 @@ Creature::~Creature()
void Creature::AddToWorld() void Creature::AddToWorld()
{ {
#ifdef ENABLE_ELUNA #ifdef ENABLE_ELUNA
if (!IsInWorld()) bool inWorld = IsInWorld();
sEluna->OnAddToWorld(this);
#endif /* ENABLE_ELUNA */ #endif /* ENABLE_ELUNA */
///- Register the creature for guid lookup ///- Register the creature for guid lookup
@ -197,6 +196,11 @@ void Creature::AddToWorld()
std::set<uint32> const* mapList = sWorld.getConfigForceLoadMapIds(); std::set<uint32> const* mapList = sWorld.getConfigForceLoadMapIds();
if ((mapList && mapList->find(GetMapId()) != mapList->end()) || (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE)) if ((mapList && mapList->find(GetMapId()) != mapList->end()) || (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE))
{ SetActiveObjectState(true); } { SetActiveObjectState(true); }
#ifdef ENABLE_ELUNA
if (!inWorld)
sEluna->OnAddToWorld(this);
#endif /* ENABLE_ELUNA */
} }
void Creature::RemoveFromWorld() void Creature::RemoveFromWorld()

View File

@ -85,8 +85,7 @@ GameObject::~GameObject()
void GameObject::AddToWorld() void GameObject::AddToWorld()
{ {
#ifdef ENABLE_ELUNA #ifdef ENABLE_ELUNA
if (!IsInWorld()) bool inWorld = IsInWorld();
sEluna->OnAddToWorld(this);
#endif /* ENABLE_ELUNA */ #endif /* ENABLE_ELUNA */
///- Register the gameobject for guid lookup ///- Register the gameobject for guid lookup
@ -100,6 +99,11 @@ void GameObject::AddToWorld()
// After Object::AddToWorld so that for initial state the GO is added to the world (and hence handled correctly) // After Object::AddToWorld so that for initial state the GO is added to the world (and hence handled correctly)
UpdateCollisionState(); UpdateCollisionState();
#ifdef ENABLE_ELUNA
if (!inWorld)
sEluna->OnAddToWorld(this);
#endif /* ENABLE_ELUNA */
} }
void GameObject::RemoveFromWorld() void GameObject::RemoveFromWorld()

View File

@ -62,6 +62,11 @@ Map::~Map()
if (m_persistentState) if (m_persistentState)
{ m_persistentState->SetUsedByMapState(NULL); } // field pointer can be deleted after this { m_persistentState->SetUsedByMapState(NULL); } // field pointer can be deleted after this
#ifdef ENABLE_ELUNA
if (Instanceable())
sEluna->FreeInstanceId(GetInstanceId());
#endif /* ENABLE_ELUNA */
delete i_data; delete i_data;
i_data = NULL; i_data = NULL;
@ -1192,7 +1197,14 @@ void Map::CreateInstanceData(bool load)
if (i_data != NULL) if (i_data != NULL)
{ return; } { return; }
uint32 i_script_id = GetScriptId(); #ifdef ENABLE_ELUNA
i_data = sEluna->GetInstanceData(this);
#endif /* ENABLE_ELUNA */
uint32 i_script_id = 0;
if (!i_data)
{
i_script_id = GetScriptId();
if (!i_script_id) if (!i_script_id)
{ return; } { return; }
@ -1200,6 +1212,7 @@ void Map::CreateInstanceData(bool load)
i_data = sScriptMgr.CreateInstanceData(this); i_data = sScriptMgr.CreateInstanceData(this);
if (!i_data) if (!i_data)
{ return; } { return; }
}
if (load) if (load)
{ {

@ -1 +1 @@
Subproject commit 48e5d45d9c504d0da83e015374b92bb36f97821b Subproject commit 33e3bf9de270e916b5bacd5b329486e265eec609