Commit Graph

22 Commits

Author SHA1 Message Date
Tartalo
81127a5df4 Eastern Kingdoms, Alterac Valley: Add forgotten file from previous commit
--HG--
branch : trunk
2010-04-06 21:35:11 +02:00
Tartalo
48b1ecf08f Eastern Kingdoms, Alterac Valley: Scripts for Marshalls, Warmasters and bosses
Unknown author code contribution from issue #954.

--HG--
branch : trunk
2010-04-06 21:34:37 +02:00
Anubisss
08b4748e62 Use GUIDs instead of "global" pointers in zone scripts.
This commit is like that: 7714 / rce505237e4aa

And use const_iterators where it is possible.

--HG--
branch : trunk
2010-04-02 15:41:37 +02:00
Anubisss
f78b766705 Use ToTempSummon() in a case instead of a C style cast.
Use correct Unit::GetCreature() instead of Unit::GetUnit() with casting the object to Creature pointer.
Remove some usless casts.
Fix a possible crash in pyrewood_ambushAI.

TODO: Remove ugly cast macros(like CAST_PLR(), CAST_CRE()) from scripts and use the correct ToX() functions(like ToPlayer(), ToCreature()).

--HG--
branch : trunk
2010-04-01 19:09:56 +02:00
Anubisss
be739e9900 Use GUIDs instead of "global" pointers in ~all boss/instance scripts.
GUIDs are most safer than pointers and in some cases can avoid segmentation faults.

== - ==

Let me show a simple example:

We have a pointer to a creature: Creature *pCreature;

and try to search a creature and store it in the pointer:
pCreature = SearchCreature(ID);

We can check simply if the creature found or not:
if(pCreature)
- if this give true: creature found and we have a memory address which points to the creature
- if this give false: creature not found and this is a NULL pointer

Suppose that we have a valid pointer, so creature found.
We wanna use that pointer somewhere, for example in script phase 3.
But we delete the creature(from world) in phase 1.
In phase 3:
if(pCreature)
    pCreature->DoSomeShit();
The if condition gives true, but pCreature points to an _invalid_ address.
In that address maybe have "nothing" or another creature's object or a player or anything else, dont know that.

~~ - ~~

Let me show the correct way:
Creature's GUID: uint64 CreatureGUID;

search the creature and set the GUID:
Creature *pCreature = SearchCreature(ID);
CreatureGUID = pCreature ? pCreature->GetGUID() : 0; // if pCreature is NULL set the GUID to 0

So we have a GUID and not a pointer.
We can get the creature from that GUID:
Creature *pCreature = GetCreature(CreatureGUID);
and we can simply check it is valid or not(found or not):
if(pCreature)

So we deleted the creature in phase 1 and try to use it in phase 3:
Creature *pCreature = GetCreature(CreatureGUID);
And this gives NULL because GetCreature() can't find the creature which GUID is CreatureGUID.

if(pCreature) // pCreature is NULL
    pCreature->DoSomeShit(); // DoSomeShit() not called

== - ==

Remove some not used variables.
Some clean.

TODO: Should search/fix these in zones scripts.

--HG--
branch : trunk
2010-03-27 13:54:38 +01:00
Tartalo
7d6923d8c7 BlackRock Depths: Some improvements, by antihrists
Fix Tomb of Seven event
Fix Shadowforge braziers
GO handling for Magmus

--HG--
branch : trunk
2010-03-25 13:33:49 +01:00
Spp
8034a6c48e Rename 'Hostil' to 'Hostile'
Credits to NoFantasy (Mangos)
Closes issue #411

--HG--
branch : trunk
2010-03-09 11:11:10 +01:00
Trazom62
80b531a413 Fix infinite loop.
Fixes issue #945.

--HG--
branch : trunk
2010-03-01 20:30:52 +01:00
Trazom62
6fdb1bfb4f Fix Script Stratholme.
- fix doors opening/closing when encounters are completed or during instance reload.

--HG--
branch : trunk
2010-02-27 16:54:32 +01:00
n0n4m3
bcd4a48328 Removed stupid/not needed file Spellid.h.
--HG--
branch : trunk
2010-02-15 18:23:39 +01:00
Rat
8344eea132 *Kraz should not be un-hexed from a forest frog
--HG--
branch : trunk
2010-02-07 22:59:00 +01:00
Trazom62
4e500f7227 Fix The Dwarven Spy text. Thanks zthoreen.
Fixes issue #616.

--HG--
branch : trunk
2010-02-07 12:16:35 +01:00
Xanadu
a5d1bc77ab A great purge of obsolete macros.
--HG--
branch : trunk
2010-02-05 00:31:28 +01:00
Xanadu
b0b261585f Move the EvilID.h includes to pch.
--HG--
branch : trunk
2010-02-04 21:07:12 +01:00
Trazom62
b1cc10aaf0 Quest Support All Along the Watchtowers (5097,5098). Thanks Retriman.
Fixes issue #519.

--HG--
branch : trunk
2010-02-03 22:27:35 +01:00
XTZGZoReX
9f00ca3eb8 * Remove CellLock class and all cell-level thread locking.
** It was wasting CPU power as cell-level locking is not needed.
** Our multithreading is on map-level, not cell-level.
** CellLock was just a 'proxy' between Cell and CellPair and in some cases carried redundant data.
** Some minor cleanup in Cell::Visit/Map::Visit.

--HG--
branch : trunk
2010-01-23 22:24:41 +01:00
Trazom62
7b3691ac9e Fix irand(min,max) usage (min shall always be lower than max)
--HG--
branch : trunk
2010-01-22 18:38:33 +01:00
Brian
7162dcd475 * Backed out changeset c7c6faf26cbd
* A different solution to damage will be implemented
* You will need data from your DB provider if you don't have a backup

--HG--
branch : trunk
2010-01-21 18:38:49 -07:00
win32
2572e9ef8e * Add support for basedmg and baserangeddmg values in creature_classlevelstats.
* Remove mindmg, maxdmg, attackpower and ranged field in creature_template and add Dmg_Mod, Rangeddmg_Mod field.

--HG--
branch : trunk
2010-01-21 13:48:27 +02:00
Rat
14805ff0b4 *small visual fix for Valkyer Battle Maidens
--HG--
branch : trunk
2010-01-19 15:56:30 +01:00
Rat
727fbbef07 *fix event reset bug for quest The Light of Dawn, Fixes issue #108.
--HG--
branch : trunk
2010-01-19 12:07:51 +01:00
Rat
0cc053ea4d *Integrate Script system to Core
-added ScriptMgr for loading scripts
-removed bindings
-moved script system to src/game
-moved scripts to src/scripts
-VC project files updated
-cmakes updated (not 100% done yet)

NOTE to Devs:
-file locations changed
-precompiled renamed to ScriptedPch
-ecsort_ai renamed to ScriptedEscortAI
-follower_ai renamed to ScriptedFollowerAI
-guard_ai renamed to ScriptedGuardAI
-simple_ai renamed to ScriptedSimpleAI
-sc_creature renamed to ScriptedCreature
-sc_gossip renamed to ScriptedGossip
-sc_instance  renamed to ScriptedInstance

*use the new headers in scripts, thank you

NOTE to ALL:
cmake not fully tested, please report any errors with it
could make creashes, incompability
USE AT YOUR OWN RISK before further tests!!

--HG--
branch : trunk
2010-01-19 11:36:05 +01:00