Commit Graph

8159 Commits

Author SHA1 Message Date
Baeumchen
3ffbd27cdd Update wrong Escape state
Found by w5860363 : http://www.trinitycore.org/f/topic/9112-halls-of-reflectioncpp-question%EF%BC%9F/
2013-10-02 19:08:14 +02:00
Shauren
993513ce8d Core/Vehicles: Fixed a crash happening when a minion vehicle despawns with passenger on it
Ref #9738
2013-10-02 00:13:00 +02:00
Shauren
770f69d4e6 Core/Vehicles: Fixed calling Vehicle::Uninstall on freed memory
Valgrind log:
    ==7723== Invalid read of size 8
    ==7723==    at 0x10753CE: Vehicle::GetBase() const (Vehicle.h:51)
    ==7723==    by 0x1072449: Vehicle::Uninstall() (Vehicle.cpp:159)
    ==7723==    by 0x10B1E3C: Unit::RemoveVehicleKit() (Unit.cpp:15946)
    ==7723==    by 0x10A8F32: Unit::RemoveFromWorld() (Unit.cpp:13441)
    ==7723==    by 0x11A4703: Creature::RemoveFromWorld() (Creature.cpp:203)
    ==7723==    by 0x11B9AB7: TempSummon::RemoveFromWorld() (TemporarySummon.cpp:279)
    ==7723==    by 0x11B9C6C: Minion::RemoveFromWorld() (TemporarySummon.cpp:308)
    ==7723==    by 0x10A917C: Unit::CleanupBeforeRemoveFromMap(bool) (Unit.cpp:13482)
    ==7723==    by 0x10A926C: Unit::CleanupsBeforeDelete(bool) (Unit.cpp:13504)
    ==7723==    by 0x12DBB89: Map::AddObjectToRemoveList(WorldObject*) (Map.cpp:2108)
    ==7723==    by 0x10F4556: WorldObject::AddObjectToRemoveList() (Object.cpp:2140)
    ==7723==    by 0x11B99C5: TempSummon::UnSummon(unsigned int) (TemporarySummon.cpp:256)
    ==7723==  Address 0x3bd20530 is 64 bytes inside a block of size 168 free'd
    ==7723==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==7723==    by 0x1071FD3: Vehicle::~Vehicle() (Vehicle.cpp:66)
    ==7723==    by 0x10B1E71: Unit::RemoveVehicleKit() (Unit.cpp:15947)
    ==7723==    by 0x10A8F32: Unit::RemoveFromWorld() (Unit.cpp:13441)
    ==7723==    by 0x11A4703: Creature::RemoveFromWorld() (Creature.cpp:203)
    ==7723==    by 0x11B9AB7: TempSummon::RemoveFromWorld() (TemporarySummon.cpp:279)
    ==7723==    by 0x11B9C6C: Minion::RemoveFromWorld() (TemporarySummon.cpp:308)
    ==7723==    by 0x10A917C: Unit::CleanupBeforeRemoveFromMap(bool) (Unit.cpp:13482)
    ==7723==    by 0x10A926C: Unit::CleanupsBeforeDelete(bool) (Unit.cpp:13504)
    ==7723==    by 0x12DBB89: Map::AddObjectToRemoveList(WorldObject*) (Map.cpp:2108)
    ==7723==    by 0x10F4556: WorldObject::AddObjectToRemoveList() (Object.cpp:2140)
    ==7723==    by 0x11B99C5: TempSummon::UnSummon(unsigned int) (TemporarySummon.cpp:256)
2013-10-01 22:06:39 +02:00
Ellie
c803cc1f5c Merge branch 'master' of github.com:TrinityCore/TrinityCore into string_concatenation 2013-10-01 01:14:32 -07:00
Ellie
1fae858645 Whitespace between string literals and user-defined literals is now mandatory for concatenation in C++11 2013-10-01 01:13:13 -07:00
Discover-
11d9a44508 Core/SAI: Properly implement the second parameter of SMART_ACTION_CALL_TIMED_ACTIONLIST to reflect the wiki (which also makes more sense) 2013-10-01 10:08:05 +02:00
Discover-
80ce30ac7d Core/SAI: Add 'playerOnly' parameters to SMART_TARGET_CLOSEST_ENEMY and SMART_TARGET_CLOSEST_FRIENDLY. Wiki is updated accordingly. 2013-09-30 10:11:02 +02:00
Spp
ad29676c27 Fix compile under linux and update auth db with latest changes 2013-09-29 14:15:58 +02:00
Spp
ea2fe0217d Core/RBAC: Simplify RBAC implementation
- Drop groups (roles than can have inherited roles) and roles (set of
  permissions)
- Permissions can now have inherited permissions (those act as roles)

RBAC DB structure is now limited to four tables
- rbac_permissions: Contains permissions and roles
- rbac_linked_permissions: Contains the relation between permissions and
  linked permissions (those permissions that have linked permissions are
  called roles)
- rbac_default_permissions: Contains the list of permissions to be granted
  to each security level [Added to maintain compatibility in an easy way]
- rbac_account_permissions: Contains the list of permissions granted or
  denied for a particular account.

NOTE: IF YOU ARE USING CUSTOM PERMISSIONS, ROLES OR GROUPS CHECK THE SQL
BEFORE APPLYING...
2013-09-29 13:19:05 +02:00
jackpoz
ac5b6f337e Core/Scripts: Fix uninitialized values in The Black Morass
Valgrind log:
 Conditional jump or move depends on uninitialised value(s)
  at 0x1798C2C: npc_medivh_bm::npc_medivh_bmAI::UpdateAI(unsigned int) (the_black_morass.cpp:192)
  by 0x11AEFC0: Creature::Update(unsigned int) (Creature.cpp:542)
  by 0x12E96F8: Trinity::ObjectUpdater::Visit(GridRefManager<Creature>&) (GridNotifiersImpl.h:45)

 Conditional jump or move depends on uninitialised value(s)
  at 0x1798C7E: npc_medivh_bm::npc_medivh_bmAI::UpdateAI(unsigned int) (the_black_morass.cpp:200)
  by 0x11AEFC0: Creature::Update(unsigned int) (Creature.cpp:542)
  by 0x12E96F8: Trinity::ObjectUpdater::Visit(GridRefManager<Creature>&) (GridNotifiersImpl.h:45)

 Conditional jump or move depends on uninitialised value(s)
  at 0x1798CB0: npc_medivh_bm::npc_medivh_bmAI::UpdateAI(unsigned int) (the_black_morass.cpp:205)
  by 0x11AEFC0: Creature::Update(unsigned int) (Creature.cpp:542)
  by 0x12E96F8: Trinity::ObjectUpdater::Visit(GridRefManager<Creature>&) (GridNotifiersImpl.h:45)

 Conditional jump or move depends on uninitialised value(s)
  at 0x1798CE2: npc_medivh_bm::npc_medivh_bmAI::UpdateAI(unsigned int) (the_black_morass.cpp:210)
  by 0x11AEFC0: Creature::Update(unsigned int) (Creature.cpp:542)
  by 0x12E96F8: Trinity::ObjectUpdater::Visit(GridRefManager<Creature>&) (GridNotifiersImpl.h:45)
2013-09-28 22:18:19 +02:00
Spp
895a23df11 Core/RBAC: Add default groups to accounts based on their security level.
- Removed config option RBAC.DefaultGroups

Use the table rbac_security_level_groups to configure the groups to be added to the account at load time.

Note: Those groups are only used at run time, never saved to DB
2013-09-27 13:35:45 +02:00
Spp
cfaea769bc Core/RBAC: Move RBAC code to namespace rbac 2013-09-27 13:35:45 +02:00
Kirkhammett
89085f7d57 DB/Core: The Storm King's Vengeance 2013-09-27 12:50:34 +02:00
jackpoz
2cca3982d4 Core/Movement: Port Ascent r1637 http://sourceforge.net/p/ascentemubackup/code/1637/ to TrinityCore
Port some movement packet fixes, taking into account client/server connection lag.
Credits to original author, check http://sourceforge.net/p/ascentemubackup/code/1637/ for more details.
MOVEMENT_PACKET_TIME_DELAY default value is currently set to 0, feel free to set it to different values and report feedback.
2013-09-26 20:09:50 +02:00
joschiwald
a0c637f52a Core/Scripts: added some OVERRIDEs 2013-09-25 16:37:43 +02:00
joschiwald
1887fa28a0 Merge pull request #10933 from MitchesD/SteamVault
Scripts/SteamVault: reworked InstanceScript
2013-09-25 07:13:35 -07:00
Discover-
a5c248b60f Core/SAI: Get rid of unused parameter 'storageId' (third) in SMART_ACTION_SUMMON_CREATURE. This means the 4th parameter (actionInvoker 0/1) must move back one parameter. On a clean TDB there is not a single case of this parameter being used.
Updated wiki accordingly.
2013-09-25 11:46:51 +02:00
jackpoz
c256a0330a Merge branch 'master' of github.com:TrinityCore/TrinityCore 2013-09-24 23:35:11 +02:00
jackpoz
ec3832c2c1 Core/AI: Fix uninitialized values and array overflows in SAI
Proper initialize POD struct members to 0 in SMART_ACTION_CREATE_TIMED_EVENT action type.
Fix array overflows and access uninitialized values in SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST, SMART_ACTION_RANDOM_PHASE and SMART_ACTION_RANDOM_EMOTE .

Valgrind log for SMART_ACTION_RANDOM_PHASE case:
 Conditional jump or move depends on uninitialised value(s)
   at : SmartScript::UpdateTimer(SmartScriptHolder&, unsigned int) (SmartScript.cpp:3086)
   by : SmartScript::OnUpdate(unsigned int) (SmartScript.cpp:3176)
   by : SmartAI::UpdateAI(unsigned int) (SmartAI.cpp:335)
   by : Creature::Update(unsigned int) (Creature.cpp:542)
   by : TempSummon::Update(unsigned int) (TemporarySummon.cpp:47)

 Uninitialised value was created by a stack allocation
   at : SmartScript::ProcessAction(SmartScriptHolder&, Unit*, unsigned int, unsigned int, bool, SpellInfo const*, GameObject*) (SmartScript.cpp:143)
2013-09-24 23:33:28 +02:00
Vincent-Michael
20d070172b Core/Logs: Random changes 2013-09-23 22:55:35 +02:00
MitchesD
ae221b0f02 Scripts/SteamVault: reworked InstanceScript 2013-09-23 22:00:42 +02:00
Discover-
a0db0728f2 Merge branch 'master' of https://github.com/TrinityCore/TrinityCore 2013-09-23 16:47:47 +02:00
Discover-
9653576cb4 Core/SAI: Using SMART_TARGET_NONE no longer works the same way as SMART_TARGET_ACTION_INVOKER but rather return NULL instead.
Fixes #10908
2013-09-23 16:47:22 +02:00
Shauren
3aa9446d54 Merge pull request #10875 from zorix/PR2
Core/Script:
2013-09-22 07:58:42 -07:00
zorix
8b2c40e0f9 Core/Script:
ICC: Convert possible non valid pointer to guid

Close #9954
2013-09-22 16:38:15 +02:00
jackpoz
9579d0a3e7 Scripts/ScarletEnclave: Fix uninitialized values in Highlord Darion Mograine
Reset() has if checks on values that are initialized after them so it's required to initialize these fields in the constructor.

Valgrind log:
 Conditional jump or move depends on uninitialised value(s)
  by 0x11CF472: HashMapHolder<Creature>::Find(unsigned long) (ObjectAccessor.h:67)
  by 0x11CE36F: Creature* ObjectAccessor::GetObjectInWorld<Creature>(unsigned long, Creature*) (ObjectAccessor.h:114)
  by 0x1257C13: Creature* ObjectAccessor::GetObjectInMap<Creature>(unsigned long, Map*, Creature*) (ObjectAccessor.h:135)
  by 0x12E64F1: Map::GetCreature(unsigned long) (Map.cpp:2767)
  by 0x10AF4DE: Unit::GetCreature(WorldObject&, unsigned long) (Unit.cpp:13021)
  by 0x16F8F81: npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::Reset() (chapter5.cpp:386)
  by 0x16F8D36: npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::npc_highlord_darion_mograineAI(Creature*) (chapter5.cpp:314)
  by 0x16F8CD6: npc_highlord_darion_mograine::GetAI(Creature*) const (chapter5.cpp:307)
  by 0x132AF6C: ScriptMgr::GetCreatureAI(Creature*) (ScriptMgr.cpp:796)
  by 0x1441D45: FactorySelector::selectAI(Creature*) (CreatureAISelector.cpp:41)
2013-09-21 22:36:23 +02:00
jackpoz
af63c8783e Core/Guild: Fix withdraw money from bank overflowing int32 limit
Clamp amount of money withdrawn from bank to MAX_MONEY_AMOUNT to avoid int32 overflow which would remove money from Player instead of adding it.
2013-09-21 19:44:15 +02:00
jackpoz
9c336cc32e Core/DB: Make a26a24a consistent with Trinity code style
Change DatabaseWorkerPool<T>::DirectExecute() to handle PreparedStatement disposal in the same way of DatabaseWorkerPool<T>::Query() , thanks Joschiwald for patch.
2013-09-21 17:45:46 +02:00
jackpoz
a26a24adf1 Core/AccountMgr: Fix memory leak on account creation
Fix .account create command not deleting a MySql PreparedStatement .

Valgrind log:
 254 (40 direct, 214 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 8
  at 0x4C24DFA: operator new(unsigned long) (vg_replace_malloc.c:261)
  by 0x998EC2: DatabaseWorkerPool<LoginDatabaseConnection>::GetPreparedStatement(unsigned int) (DatabaseWorkerPool.h:437)
  by 0x99599B: AccountMgr::CreateAccount(std::string, std::string, std::string) (AccountMgr.cpp:49)
  by 0xF3ABAC: account_commandscript::HandleAccountCreateCommand(ChatHandler*, char const*)
2013-09-21 14:55:08 +02:00
Discover-
69b0a009c4 Core/SAI: Make SMART_ACTION_RANDOM_MOVE also work with SMART_TARGET_NONE and non-creature targets (if a non-creature target_type is specified and no creature target was found, the action is fired at the source)
Ref. #7431
2013-09-21 11:21:29 +02:00
jackpoz
6f9851ec13 Core/PathGenerator: Fix conditional jump on uninitialized value
Fix conditional jump on uninitialized value in PathGenerator::GetNavTerrain() by checking the result of getLiquidStatus() before accessing the LiquidData, uninitialized in case there's no water at all.

Valgrind log:
 Conditional jump or move depends on uninitialised value(s)
  at : PathGenerator::GetNavTerrain(float, float, float) (PathGenerator.cpp:553)
  by : PathGenerator::UpdateFilter() (PathGenerator.cpp:542)
  by : PathGenerator::CreateFilter() (PathGenerator.cpp:530)
  by : PathGenerator::PathGenerator(Unit const*) (PathGenerator.cpp:46)
  by : Spell::Spell(Unit*, SpellInfo const*, TriggerCastFlags, unsigned long, bool) (Spell.cpp:493)
  by : Unit::CastSpell(SpellCastTargets const&, SpellInfo const*, CustomSpellValues const*, TriggerCastFlags, Item*, AuraEffect const*, unsigned long) (Unit.cpp:846)
  by : Unit::CastSpell(Unit*, SpellInfo const*, TriggerCastFlags, Item*, AuraEffect const*, unsigned long) (Unit.cpp:882)
  by : Unit::CastSpell(Unit*, unsigned int, TriggerCastFlags, Item*, AuraEffect const*, unsigned long) (Unit.cpp:870)
  by : Unit::CastSpell(Unit*, unsigned int, bool, Item*, AuraEffect const*, unsigned long) (Unit.cpp:858)
  by : Player::SendInitialPacketsAfterAddToMap() (Player.cpp:22580)
  by : WorldSession::HandleMoveWorldportAckOpcode() (MovementHandler.cpp:121)
  by : WorldSession::HandleMoveWorldportAckOpcode(WorldPacket&) (MovementHandler.cpp:37)
2013-09-21 10:58:21 +02:00
raczman
1ae6538ea6 Merge pull request #10827 from jackpoz/restore_warnings
Shared/Build: Restore disabled warnings on Visual Studio
2013-09-20 16:08:26 -07:00
Vincent-Michael
eab10cc6ae Core/Achievement: Fix warning 2013-09-18 23:47:35 +02:00
Vincent-Michael
8af46f1c57 Core: Fix non pch build 2013-09-18 23:15:25 +02:00
joschiwald
05e72b4906 Core/Achievements: Implemented ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE 2013-09-18 22:55:10 +02:00
zorix
cac1968ab7 Core/Auras:
Fix removing auras when player reset talents or changing/leaving shapeshift

Close #10763
Close #10809
2013-09-18 18:09:29 +02:00
jackpoz
0a6db17125 Shared/Build: Restore disabled warnings on Visual Studio
Restore 2 disabled warnings, 1 already disabled in CMake with the WITH_WARNINGS flag set to False and the other disabled by default as stated in VS documentation http://msdn.microsoft.com/en-us/library/aa984150.aspx
2013-09-15 19:23:35 +02:00
Nay
0177d1c4d4 Merge pull request #10822 from jackpoz/collisions_nullterm_string
Tools/VMAP: Fix not null terminated string
2013-09-15 07:01:58 -07:00
Nay
478ec28e6d Merge pull request #10823 from jackpoz/icewall_overflow
Scripts/HoR: Fix possible array overflow
2013-09-15 06:58:24 -07:00
Nay
99f5a6c3d6 Core/BGs: Fix a TC_LOG_ERROR call 2013-09-15 14:57:12 +01:00
jackpoz
6477f8c453 Scripts/HoR: Fix possible array overflow
Fix possible array overflow reported by coverity, issue id 1062436 .
2013-09-15 14:12:54 +02:00
jackpoz
a5134971cb Tools/VMAP: Fix not null terminated string
Fix not null terminated string in vmap assembler tool, fix coverity issue id 1010351 .
2013-09-15 13:38:54 +02:00
Nay
b72fd4c209 Merge pull request #10819 from Ascathor/master
Core/Misc: Fixed some more issues found by static code analysis tools.
2013-09-15 04:31:29 -07:00
Ascathor
4782cc4650 Core/Misc: Fixed some more issues found by static code analysis tools. 2013-09-15 13:17:37 +02:00
raczman
aaff97db51 Merge pull request #10821 from jackpoz/blood_tap_overflow
Core/Spell: Fix Blood Tap array overflow
2013-09-15 03:37:49 -07:00
jackpoz
d0b42ee4ec Core/Spell: Fix Blood Tap array overflow
Fix Blood Tap spellid 45529 accessing the 7th element of a size 6 array.
Coverity issue id 1023095.
2013-09-15 12:31:48 +02:00
Jorge
f0cd684cd1 Merge pull request #10800 from jackpoz/log_race_condition
Core/Logs: Fix race condition in Log
2013-09-13 12:22:31 -07:00
jackpoz
6581d7db85 Core/Commands: Fix NULL dereference crash in .account password
Fix NULL dereference crash in .account password added in bd8d0cfbce
Fixes #10791
2013-09-13 20:57:53 +02:00
jackpoz
1b3575ba77 Core/Logs: Fix race condition in Log
Fix race condition in Log by using atomic operators.

Helgrind log:
 Possible data race during read of size 8 at 0x7379D98 by thread #1
 Locks held: none
  at 0x15AE9C7: AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:59)
  by 0x15ADFF8: Appender::write(LogMessage&) (Appender.cpp:106)
  by 0x159F14E: Logger::write(LogMessage&) (Logger.cpp:83)
  by 0x15A215B: Log::write(LogMessage*) (Log.cpp:290)
  by 0x15A200F: Log::vlog(LogFilterType, LogLevel, char const*, __va_list_tag*) (Log.cpp:272)
  by 0x15A2682: Log::outInfo(LogFilterType, char const*, ...) (Log.cpp:364)
  by 0xF7DA28: Master::Run() (Master.cpp:296)
  by 0xF835E8: main (Main.cpp:142)

 This conflicts with a previous write of size 8 by thread #10
 Locks held: none
  at 0x15AE9D7: AppenderFile::_write(LogMessage const&) (AppenderFile.cpp:59)
  by 0x15ADFF8: Appender::write(LogMessage&) (Appender.cpp:106)
  by 0x159F14E: Logger::write(LogMessage&) (Logger.cpp:83)
  by 0x15A215B: Log::write(LogMessage*) (Log.cpp:290)
  by 0x15A200F: Log::vlog(LogFilterType, LogLevel, char const*, __va_list_tag*) (Log.cpp:272)
  by 0x15A2682: Log::outInfo(LogFilterType, char const*, ...) (Log.cpp:364)
  by 0xF7EC1F: FreezeDetectorRunnable::run() (Master.cpp:98)
  by 0x15A5B3E: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)

 Address 0x7379D98 is 88 bytes inside a block of size 96 alloc'd
  at 0x4C2C857: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
  by 0x15A0FE3: Log::CreateAppenderFromConfig(char const*) (Log.cpp:150)
  by 0x15A1AED: Log::ReadAppendersFromConfig() (Log.cpp:244)
  by 0x15A31B4: Log::LoadFromConfig() (Log.cpp:469)
  by 0x15A053B: Log::Log() (Log.cpp:35)
  by 0xF75CD1: ACE_Singleton<Log, ACE_Thread_Mutex>::ACE_Singleton() (Singleton.inl:13)
  by 0xF754A4: ACE_Singleton<Log, ACE_Thread_Mutex>::instance() (Singleton.cpp:91)
  by 0xF8351A: main (Main.cpp:135)
2013-09-13 19:59:50 +02:00
Machiavelli
bd8d0cfbce Fix build 2013-09-12 16:42:22 +01:00