aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent_Michael <Vincent_Michael@gmx.de>2013-03-27 13:19:56 +0100
committerVincent_Michael <Vincent_Michael@gmx.de>2013-03-27 13:19:56 +0100
commit1b8d917ea9ba4cb7190a8da94d9128cb9bd561a4 (patch)
tree9479c21968ddf6b267cdc51b8586deb6986dd73d
parentc97c381ea0b63963b3756f531b8c64636cb5d66b (diff)
parentb78885622078bcf56b21694b39964c25ae4794f6 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
-rw-r--r--cmake/macros/FindPCHSupport.cmake2
-rw-r--r--sql/updates/world/2013_03_26_00_world_a_heros_headgear.sql14
-rw-r--r--src/server/collision/CMakeLists.txt4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp12
-rw-r--r--src/server/game/Grids/GridStates.cpp45
-rw-r--r--src/server/game/Grids/GridStates.h27
-rw-r--r--src/server/game/Maps/MapManager.h9
-rw-r--r--src/server/shared/Debugging/Errors.cpp25
-rw-r--r--src/server/shared/Packets/ByteBuffer.cpp19
-rw-r--r--src/server/shared/Packets/ByteBuffer.h6
10 files changed, 112 insertions, 51 deletions
diff --git a/cmake/macros/FindPCHSupport.cmake b/cmake/macros/FindPCHSupport.cmake
index a93182cd8f6..b068b69c26b 100644
--- a/cmake/macros/FindPCHSupport.cmake
+++ b/cmake/macros/FindPCHSupport.cmake
@@ -3,7 +3,7 @@ FUNCTION(GET_COMMON_PCH_PARAMS PCH_HEADER PCH_FE INCLUDE_PREFIX)
GET_DIRECTORY_PROPERTY(TARGET_INCLUDES INCLUDE_DIRECTORIES)
FOREACH(ITEM ${TARGET_INCLUDES})
- LIST(APPEND INCLUDE_FLAGS_LIST "${INCLUDE_PREFIX}${ITEM} ")
+ LIST(APPEND INCLUDE_FLAGS_LIST "${INCLUDE_PREFIX}\"${ITEM}\" ")
ENDFOREACH(ITEM)
SET(PCH_HEADER_NAME ${PCH_HEADER_N} PARENT_SCOPE)
diff --git a/sql/updates/world/2013_03_26_00_world_a_heros_headgear.sql b/sql/updates/world/2013_03_26_00_world_a_heros_headgear.sql
new file mode 100644
index 00000000000..9a0ccd58fb2
--- /dev/null
+++ b/sql/updates/world/2013_03_26_00_world_a_heros_headgear.sql
@@ -0,0 +1,14 @@
+UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=28877;
+
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=28877;
+
+DELETE FROM `smart_scripts` WHERE `entryorguid`=28877 AND `source_type`=0;
+INSERT INTO `smart_scripts`(`entryorguid`,`id`,`link`,`event_type`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`target_type`,`comment`) VALUES
+(28877,0,0,0,3000,5000,3000,5000,11,32018,2,'Stormwatcher - In combat - Cast Call Lightning'),
+(28877,1,2,8,53145,0,0,0,11,53162,1,'Stormwatcher - On spellhit - Summon Stormwatchers Head'),
+(28877,2,0,61,0,0,0,0,41,0,1,'Stormwatcher - Linked with id 1 - Despawn');
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=53145;
+INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`NegativeCondition`,`Comment`) VALUES
+(17,53145,31,1,3,28877,0,'Target needs to be Stormwatcher'),
+(17,53145,36,1,0,0,1,'Target needs to be dead');
diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt
index b4012b63812..f254ffda94c 100644
--- a/src/server/collision/CMakeLists.txt
+++ b/src/server/collision/CMakeLists.txt
@@ -83,6 +83,10 @@ add_library(collision STATIC
${collision_STAT_PCH_SRC}
)
+target_link_libraries(collision
+ shared
+)
+
# Generate precompiled header
if (USE_COREPCH)
add_cxx_pch(collision ${collision_STAT_PCH_HDR} ${collision_STAT_PCH_SRC})
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 9c476ea55fc..f5a75de73f8 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1023,8 +1023,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsSmart())
break;
- CAST_AI(SmartAI, me->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1);//next tick
- CAST_AI(SmartAI, me->AI())->StartDespawn();
+ // The AI is only updated if the creature is alive
+ if (me->isAlive())
+ {
+ CAST_AI(SmartAI, me->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick
+ CAST_AI(SmartAI, me->AI())->StartDespawn();
+ }
+ // Otherwise we call the despawn directly
+ else
+ me->DespawnOrUnsummon(e.action.forceDespawn.delay);
+
break;
}
case SMART_ACTION_SET_INGAME_PHASE_MASK:
diff --git a/src/server/game/Grids/GridStates.cpp b/src/server/game/Grids/GridStates.cpp
index e4f995cd8d2..c4db919c51b 100644
--- a/src/server/game/Grids/GridStates.cpp
+++ b/src/server/game/Grids/GridStates.cpp
@@ -18,53 +18,58 @@
#include "GridStates.h"
#include "GridNotifiers.h"
-#include "Grid.h"
#include "Log.h"
-void InvalidState::Update(Map &, NGridType &, GridInfo &, const uint32) const
+#ifdef TRINITY_DEBUG
+bool GridState::checkMagic()
{
+ if (i_Magic != MAGIC_TESTVAL)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!");
+ return false;
+ }
+ return true;
}
+#endif
+
+void InvalidState::Update(Map&, NGridType&, GridInfo&, uint32) const
+{ }
-void ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 t_diff) const
+void ActiveState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff) const
{
// Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle
- info.UpdateTimeTracker(t_diff);
+ info.UpdateTimeTracker(diff);
if (info.getTimeTracker().Passed())
{
- if (!grid.GetWorldObjectCountInNGrid<Player>() && !m.ActiveObjectsNearGrid(grid))
+ if (!grid.GetWorldObjectCountInNGrid<Player>() && !map.ActiveObjectsNearGrid(grid))
{
ObjectGridStoper worker;
TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer> visitor(worker);
grid.VisitAllGrids(visitor);
grid.SetGridState(GRID_STATE_IDLE);
- sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), m.GetId());
+ sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), map.GetId());
}
else
- {
- m.ResetGridExpiry(grid, 0.1f);
- }
+ map.ResetGridExpiry(grid, 0.1f);
}
}
-void IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32) const
+void IdleState::Update(Map& map, NGridType& grid, GridInfo&, uint32) const
{
- m.ResetGridExpiry(grid);
+ map.ResetGridExpiry(grid);
grid.SetGridState(GRID_STATE_REMOVAL);
- sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), m.GetId());
+ sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), map.GetId());
}
-void RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 t_diff) const
+void RemovalState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff) const
{
if (!info.getUnloadLock())
{
- info.UpdateTimeTracker(t_diff);
- if (info.getTimeTracker().Passed())
+ info.UpdateTimeTracker(diff);
+ if (info.getTimeTracker().Passed() && !map.UnloadGrid(grid, false))
{
- if (!m.UnloadGrid(grid, false))
- {
- sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", grid.getX(), grid.getY(), m.GetId());
- m.ResetGridExpiry(grid);
- }
+ sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", grid.getX(), grid.getY(), map.GetId());
+ map.ResetGridExpiry(grid);
}
}
}
diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h
index 54fe0d62378..09682c716a9 100644
--- a/src/server/game/Grids/GridStates.h
+++ b/src/server/game/Grids/GridStates.h
@@ -19,8 +19,10 @@
#ifndef TRINITY_GRIDSTATES_H
#define TRINITY_GRIDSTATES_H
-#include "Map.h"
-#include "Object.h"
+#include "GridDefines.h"
+#include "NGrid.h"
+
+class Map;
class GridState
{
@@ -28,44 +30,35 @@ class GridState
#ifdef TRINITY_DEBUG
#define MAGIC_TESTVAL 0xFBE823BA
GridState() { i_Magic = MAGIC_TESTVAL; }
- bool checkMagic()
- {
- if (i_Magic != MAGIC_TESTVAL)
- {
- sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!");
- return false;
- }
- return true;
- }
+ bool checkMagic();
void setMagic() { i_Magic = MAGIC_TESTVAL; }
unsigned int i_Magic;
#endif
virtual ~GridState() {};
- virtual void Update(Map &, NGridType&, GridInfo &, const uint32 t_diff) const = 0;
+ virtual void Update(Map &, NGridType&, GridInfo &, uint32 t_diff) const = 0;
};
class InvalidState : public GridState
{
public:
- void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
+ void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
};
class ActiveState : public GridState
{
public:
- void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
+ void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
};
class IdleState : public GridState
{
public:
- void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
+ void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
};
class RemovalState : public GridState
{
public:
- void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
+ void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
};
#endif
-
diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h
index 09e09a80148..8af609c61e2 100644
--- a/src/server/game/Maps/MapManager.h
+++ b/src/server/game/Maps/MapManager.h
@@ -19,14 +19,15 @@
#ifndef TRINITY_MAPMANAGER_H
#define TRINITY_MAPMANAGER_H
-#include "Define.h"
-#include <ace/Singleton.h>
-#include <ace/Thread_Mutex.h>
-#include "Common.h"
+#include "Object.h"
#include "Map.h"
#include "GridStates.h"
#include "MapUpdater.h"
+#include <ace/Singleton.h>
+#include <ace/Thread_Mutex.h>
+
+
class Transport;
struct TransportCreatureProto;
diff --git a/src/server/shared/Debugging/Errors.cpp b/src/server/shared/Debugging/Errors.cpp
index bd299906de0..10ede3ae402 100644
--- a/src/server/shared/Debugging/Errors.cpp
+++ b/src/server/shared/Debugging/Errors.cpp
@@ -1,5 +1,22 @@
+/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "Errors.h"
-#include "Log.h"
#include <ace/Stack_Trace.h>
#include <ace/OS_NS_unistd.h>
@@ -16,7 +33,7 @@ void Assert(char const *file, int line, char const *function, char const *messag
void Fatal(char const *file, int line, char const *function, char const *message)
{
- sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n",
+ fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n %s\n",
file, line, function, message);
ACE_OS::sleep(10);
*((volatile int*)NULL) = 0;
@@ -24,14 +41,14 @@ void Fatal(char const *file, int line, char const *function, char const *message
void Error(char const *file, int line, char const *function, char const *message)
{
- sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s ERROR:\n %s\n",
+ fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n",
file, line, function, message);
*((volatile int*)NULL) = 0;
}
void Warning(char const *file, int line, char const *function, char const *message)
{
- sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n",
+ fprintf(stderr, "\n%s:%i in %s WARNING:\n %s\n",
file, line, function, message);
}
diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp
index a14cf3477af..3b4be003858 100644
--- a/src/server/shared/Packets/ByteBuffer.cpp
+++ b/src/server/shared/Packets/ByteBuffer.cpp
@@ -1,4 +1,23 @@
+/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "ByteBuffer.h"
+#include "Common.h"
#include "Log.h"
#include <ace/Stack_Trace.h>
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 0f4221b53ff..0bbaff38be1 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -20,16 +20,16 @@
#define _BYTEBUFFER_H
#include "Define.h"
-#include "Debugging/Errors.h"
-#include "Utilities/ByteConverter.h"
+#include "Errors.h"
+#include "ByteConverter.h"
#include <exception>
#include <list>
#include <map>
#include <string>
#include <vector>
-
#include <cstring>
+#include <time.h>
// Root of ByteBuffer exception hierarchy
class ByteBufferException : public std::exception