aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.h
diff options
context:
space:
mode:
authorAnubisss <none@none>2010-03-27 16:08:14 +0100
committerAnubisss <none@none>2010-03-27 16:08:14 +0100
commitce8cc85dfabeb57c30f2f2e6deb577abeaabaf37 (patch)
tree55dbae80d50737b77b869013552e78701e8e5201 /src/game/Unit.h
parent769f54eedfd979101ecc9bd94dea0a274c569ed3 (diff)
Make a function(ToTempSummon()) which can convert Creature to TempSummon with a C++ cast(reinterpret_cast) and with a type check(isSummon()).
This function is like ToPlayer(), ToTotem(), etc. This commit is like ede831bdd6f0cff481acc33f269fa7f8c78befd4 / r7496: http://code.google.com/p/trinitycore/source/detail?r=ede831bdd6f0cff481acc33f269fa7f8c78befd4 As a result, this commit has the advantages and the "disadvantages" too, like r7496. Please try to be polite if this commit causes some crashes. --HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.h')
-rw-r--r--src/game/Unit.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/game/Unit.h b/src/game/Unit.h
index d98c9730049..88db4527727 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1957,8 +1957,10 @@ class Unit : public WorldObject
void OutDebugInfo() const;
virtual bool isBeingLoaded() const { return false;}
- Pet* ToPet(){ if(isPet()) return reinterpret_cast<Pet*>(this); else return NULL; }
+ Pet* ToPet(){ if(isPet()) return reinterpret_cast<Pet*>(this); else return NULL; }
Totem* ToTotem(){ if(isTotem()) return reinterpret_cast<Totem*>(this); else return NULL; }
+ TempSummon* ToTempSummon() { if(isSummon()) return reinterpret_cast<TempSummon*>(this); else return NULL; }
+ const TempSummon* ToTempSummon() const { if(isSummon()) return reinterpret_cast<const TempSummon*>(this); else return NULL; }
protected:
explicit Unit ();