Commit Graph

278 Commits

Author SHA1 Message Date
jackpoz
2585e799f9 Core/Misc: Change how Position struct is retrieved
Update Position::GetPosition() and similar methods signatures to reflect 2a4c9bcaf9 changes by return a Position object instead of accepting a Position parameter by reference.
2014-04-25 21:19:30 +02:00
jackpoz
8ca6371793 Core/Misc: Ensure GetVictim() returns a valid reference when expected
Add a new method EnsureVictim() which asserts a valid not NULL reference will be returned to the caller. Use this whenever the GetVictim() would be dereferenced .
2014-04-19 21:48:22 +02:00
jackpoz
8927a04253 Core/Movement: Fix LoS issue of NPCs chasing targets
Add Line of Sight checks to WorldObject::GetNearPoint(), fixing to TargetedMovementGenerator not reaching a point with valid LoS to the target and MotionMaster::MoveKnockbackFrom() knocking creatures inside walls.
Remove unused code.
2014-04-07 22:16:31 +02:00
Shauren
c3d2236d14 Core/Misc: Removed unused defines, added missing include and removed a few warnings 2014-03-23 22:14:25 +01:00
Shauren
ada0598bb0 Core/Transports: Fixed creatures micro movement on transport when attacking something (fixes interrupting melee animation) 2014-03-21 21:11:20 +01:00
jackpoz
d5d2805771 Core/MMAPs: Replace an assert with error log
Replace an assert in PathGenerator::BuildPolyPath() about invalid poly reference with an error log.
Fixes #11493 .
2014-02-27 21:03:57 +01:00
jackpoz
272009ebee Core/MMAPs: Add support for raycast
Add an optional parameter "straightLine" to PathGenerator::CalculatePath() which will use raycast instead of path finding and will return only complete path from start to end position.
Implement this new type of path in SPELL_EFFECT_CHARGE , fixing strange behaviors when using Charge with mmaps enabled.
2014-02-24 21:01:50 +01:00
jackpoz
f7bc86a17c Core/MMAPs: Update recast
Update recast from 1be9de72d8 to 740a7ba516 .
This differs from aa645683b8 because it includes a fix 77ebf64353 which correctly extract tile connections when using rcMergePolyMeshes(), used by mmaps_generator.
MMAPs version is now set to 5.

Re-extract MMAPs using mmaps_generator , any old extracted MMAPs will not work.
2014-02-23 12:39:16 +01:00
jackpoz
006d72a828 Core/MMAPS: Fix invisible wall issue in MMAPS.
Fix invisible wall issues in MMAPS caused by tile connections not being extracted correctly.
This reverts aa645683b8 and restores an old version of recastnavigation, most likely 1be9de72d8 .

Re-extracting MMAPS is required.
2014-02-13 22:19:56 +01:00
jackpoz
378d27f9bc Core/Splines: Fix "velocity > 0.1f" error
Updates #6191.
2014-01-30 20:03:13 +01:00
zengwf
23acf75d3b Core/Movement: Add LOS check for fleeingmovement target point.
Prevents fleeing or feared units from going to upper floor ignoring walls/ceilings with mmaps on(and usually get stucked).

Current implementation just randomly selects a distance and angle against the frighting unit, when in narrow circumstance such as underground caves, such targeting point would be at another floor.

Closes #11300
Ref #9475 (needs fixed confirmation)
2014-01-12 00:33:33 +00:00
Shauren
15cbe5858c Core/Movement: Fixed vehicle passengers disappearing clientside
Closes #11411
2014-01-06 13:51:40 +01:00
Vincent_Michael
20004050bc Update copyright note for 2014.
Happy new year.
2014-01-01 00:07:53 +01:00
Nawuko
3209a32fa4 Core/Waypoints: Revert partly f1a82a578b to fix a crash caused by accessing uninitialized splines 2013-12-31 19:22:10 +01:00
Shauren
1cdc2e8c2a Core/Movement: Fixed creature movement on transports 2013-12-31 14:12:02 +01:00
Shauren
079905e29a Core/Transports
* Fixed transport orientation
* Fixed transport position desynchronization for stoppable transports
* Ignore spawnMask errors for objects spawned on transports
2013-12-29 14:59:06 +01:00
Malcrom
f1a82a578b Core/Waypoints: Stop creatures from skipping at waypoint nodes
and add smoothing to pathing.
2013-12-15 20:26:11 -03:30
jackpoz
1c0903e286 Core/Misc: Fix some static analysis issues
Fix some static analysis issues about uninitialized values. Most of them are false positives, always initialized before being accessed, while some of them are real issues spotted by valgrind too.
2013-12-14 18:41:26 +01:00
jackpoz
e28cc4660b Core/Movement: Fix invalid memory access
Fix the stack implementation used in MotionMaster and added few sanity checks to ensure no underflows will be made.

Valgrind log:
 Invalid read of size 8
  at : MotionMaster::top() const (MotionMaster.h:115)
  by : MotionMaster::pop() (MotionMaster.h:91)
  by : MotionMaster::~MotionMaster() (MotionMaster.cpp:74)
  by : Unit::~Unit() (Unit.cpp:296)
  by : Player::~Player() (Player.cpp:880)
  by : WorldSession::HandleCharCreateCallback(Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex>, CharacterCreateInfo*) (CharacterHandler.cpp:665)
  by : WorldSession::HandleCharCreateCallback(Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex>, CharacterCreateInfo*) (CharacterHandler.cpp:516)
2013-12-14 16:51:47 +01:00
Shauren
54fd53f7e3 Core/Movement: Fixed possible invalid memory access 2013-12-12 09:50:52 +01:00
jackpoz
04cc51a6cf Core/Misc: Fix some static analysis issues
Fix some static analysis issues, mostly false positive about fields not initialized in the constructor. It's good practice anyway to always initialize them.
2013-12-01 16:19:30 +01:00
Shauren
e0138abaac Fixed build 2013-11-10 19:21:24 +01:00
Shauren
1966a78b9f Core/Movement: Backported spline stop fix from 4.3.4 branch - use Stop spline type for stopping movement instead of starting movement that ends in creature's current position 2013-11-10 18:52:20 +01:00
Spp
94e2b9332a Core/Logging: Remove LOG_FILTER_XXX defines with it's value (remember logger names are case-sensitive) 2013-11-08 10:50:51 +01:00
leguybrush
0a308144a8 Core/Code: Unify [more] codestyle for brackets: )\n{\n} to ) { }. 2013-10-28 14:36:07 -04:00
Ascathor
2607738990 Core/Code: Unify codestyle for brackets: {} to { }.
Also added missing copyright to some files.
2013-10-27 23:46:02 +01:00
Shauren
ce55647c41 Core/Transports
* Rewritten path generation, now uses splines - timers are a lot more accurate now
* Implemented stopping transports
* Implemented spawning transports in instances
* Implemented spawning gameobjects as transport passengers
* Transport passengers are now stored in creature/gameobject table using gameobject_template.data6 from transport's template as map id
2013-10-16 18:37:29 +02: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
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
jackpoz
be7d82ba8d Core/Maps: Fix Spline triggered assert
Fix an assert triggered by float to int32 cast overflowing to -1, now it replaces -1 with max int32 value.
Fix another assert triggered by Vector3 magnitude float overflow to max/infinity in StaticMapTree::isInLineOfSight(), in this case return false.

Both asserts can be reproduced by casting Mind Control to a NPC, tele to z: 1.0e+38 using client hack tools, move to allow the server to register the new position and stop Mind Control.

Closes #8970
Closes #10578
Closes #10355
Closes #10673
2013-08-30 21:27:04 +01:00
Discover-
77f1d3a328 Core/Misc: Implement CMSG_SET_TAXI_BENCHMARK_MODE to toggle PLAYER_FLAGS_TAXI_BENCHMARK based on arguments. To enable/disable this, call '/script SetTaxiBenchmarkMode(1)' (1 = on, 0 = off). Basically debugs the taxi flight and outputs min, max and avg FPS during flight. Automatically toggled off when flight ends. 2013-08-17 14:17:38 +02:00
Shauren
112bc49c9a Core/Units: Removed most calls to SendMovementFlagUpdate for creatures 2013-06-30 16:31:24 +02:00
Malcrom
0b00481b84 Core/WaypointMovementGenerator: Make error message more useful. 2013-06-22 01:43:33 -02:30
Shauren
d9df460694 Core/Movement
* Added wrapper methods for setting various movement flags and sending correct movement opcodes
* Made flying and falling spline flags exclusive with each other
2013-06-18 16:47:12 +02:00
kaelima
78a78a03d7 Core/Movement: Fixed computeFallTime results with safefall enabled (it's still unused however) 2013-06-17 05:16:30 +02:00
kaelima
aa645683b8 Core/MMAPS: Update recastnavigation!
* Complete changelog can be found at http://code.google.com/p/recastnavigation/
* Adjusted a few config values

Important:
* New mmaps extraction is required
* Folder size will be increased
2013-06-17 05:11:56 +02:00
Malcrom
ec474a62e5 Core: More Function Renaming. 2013-06-11 21:25:12 -02:30
Malcrom
66978cfc3b Core: Some function renaming. 2013-06-11 19:54:27 -02:30
Malcrom
047608e7de Core/SAI: Add check so npc will not send text to pet. Also updated isPet() to IsPet(). 2013-06-11 18:39:51 -02:30
Shauren
88bbff2236 Core/Creatures
* Refactored setting movement flags into separate method
* Falling creatures are no longer treated as flying for movement flag setting purposes
2013-06-07 16:05:39 +02:00
Vincent-Michael
872c0c9c73 Core Whitespace cleanup 2013-06-03 20:37:59 +02:00
Shauren
891d97ec4c Core/Movement
* Changed speed selection for flying creatures - use MOVE_RUN by default.
* Do not add MOVEMENTFLAG_WALKING to creatures that did not have it but called .SetWalk for their movement
2013-06-01 17:47:02 +02:00
Subv
16e1703872 Core/Build: Missing include. 2013-05-31 12:59:33 -05:00
Subv
905ca8e1e4 Core/Movement: Follower creatures in a formation will now follow their leader when the leader was moved with PointMovementGenerator 2013-05-31 12:38:05 -05:00
Shauren
3a697d4c9f Core/Transports: Refactored methods used to calculate passenger offsets (made orientation argument optional) 2013-05-30 20:32:33 +02:00
Shauren
3a955f5141 Core/Movement: Added generatePath argument to MovePoint overload accepting Position arg 2013-05-30 20:29:49 +02:00
Spp
00c1168897 Core/Misc: Remove trailing whitespace, compile warnings and minor cosmetic changes 2013-05-21 08:37:28 +02:00
Spp
d1677b2db0 Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
    Memleak fix
2013-05-13 15:07:36 +02:00
Spp
243c325ca4 Core: Declare some functions const and remove use of "using" directive in a couple of files 2013-05-13 15:04:05 +02:00
Shauren
199f8b7140 Core/Movement: Use spline id generator for movement packets 2013-04-07 16:02:27 +02:00