From 19f5b1dea129e586a2359132d398420829eef0c4 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 4 Apr 2010 02:58:58 +0000 Subject: [PATCH] - Removed the RUNTIME_TYPE macro. I just included it because MFC has one, but it's pretty pointless here. SVN r2267 (scripting) --- src/actor.h | 2 +- src/dobject.h | 1 - src/farchive.cpp | 2 +- src/g_hexen/a_heresiarch.cpp | 8 ++++---- src/g_shared/a_specialspot.cpp | 8 ++++---- src/g_shared/shared_hud.cpp | 2 +- src/p_acs.cpp | 2 +- src/p_enemy.cpp | 3 +-- src/p_mobj.cpp | 2 +- 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/actor.h b/src/actor.h index d1d7f4a0f..50b15d48c 100644 --- a/src/actor.h +++ b/src/actor.h @@ -524,7 +524,7 @@ public: inline AActor *GetDefault () const { - return (AActor *)(RUNTIME_TYPE(this)->Defaults); + return (AActor *)(this->GetClass()->Defaults); } DDropItem *GetDropItems() const; diff --git a/src/dobject.h b/src/dobject.h index 23c284513..93667f9c2 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -80,7 +80,6 @@ class DPillar; class PClassActor; -#define RUNTIME_TYPE(object) (object->GetClass()) // Passed an object, returns the type of that object #define RUNTIME_CLASS_CASTLESS(cls) (cls::RegistrationInfo.MyClass) // Passed a native class name, returns a PClass representing that class #define RUNTIME_CLASS(cls) ((cls::MetaClass *)RUNTIME_CLASS_CASTLESS(cls)) // Like above, but returns the true type of the meta object #define NATIVE_TYPE(object) (object->StaticType()) // Passed an object, returns the type of the C++ class representing the object diff --git a/src/farchive.cpp b/src/farchive.cpp index f2aff5a45..3920479e7 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -1043,7 +1043,7 @@ FArchive &FArchive::WriteObject (DObject *obj) } else { - PClass *type = RUNTIME_TYPE(obj); + PClass *type = obj->GetClass(); if (type == RUNTIME_CLASS(DObject)) { diff --git a/src/g_hexen/a_heresiarch.cpp b/src/g_hexen/a_heresiarch.cpp index 62cecea14..2f2065826 100644 --- a/src/g_hexen/a_heresiarch.cpp +++ b/src/g_hexen/a_heresiarch.cpp @@ -285,7 +285,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit) if (!self->IsKindOf (RUNTIME_CLASS(ASorcBall))) { - I_Error ("Corrupted sorcerer:\nTried to use a %s", RUNTIME_TYPE(self)->TypeName.GetChars()); + I_Error ("Corrupted sorcerer:\nTried to use a %s", self->GetClass()->TypeName.GetChars()); } actor = static_cast (self); @@ -317,7 +317,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit) break; case SORC_STOPPING: // Balls stopping - if ((parent->StopBall == RUNTIME_TYPE(actor)) && + if ((parent->StopBall == actor->GetClass()) && (parent->args[1] > SORCBALL_SPEED_ROTATIONS) && (abs(angle - (parent->angle>>ANGLETOFINESHIFT)) < (30<<5))) { @@ -334,7 +334,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit) break; case SORC_FIRESPELL: // Casting spell - if (parent->StopBall == RUNTIME_TYPE(actor)) + if (parent->StopBall == actor->GetClass()) { // Put sorcerer into special throw spell anim if (parent->health > 0) @@ -345,7 +345,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit) break; case SORC_FIRING_SPELL: - if (parent->StopBall == RUNTIME_TYPE(actor)) + if (parent->StopBall == actor->GetClass()) { if (actor->special2-- <= 0) { diff --git a/src/g_shared/a_specialspot.cpp b/src/g_shared/a_specialspot.cpp index 8bf280e78..2e9e5d849 100644 --- a/src/g_shared/a_specialspot.cpp +++ b/src/g_shared/a_specialspot.cpp @@ -263,7 +263,7 @@ FSpotList *DSpotState::FindSpotList(const PClass *type) bool DSpotState::AddSpot(ASpecialSpot *spot) { - FSpotList *list = FindSpotList(RUNTIME_TYPE(spot)); + FSpotList *list = FindSpotList(spot->GetClass()); if (list != NULL) return list->Add(spot); return false; } @@ -276,7 +276,7 @@ bool DSpotState::AddSpot(ASpecialSpot *spot) bool DSpotState::RemoveSpot(ASpecialSpot *spot) { - FSpotList *list = FindSpotList(RUNTIME_TYPE(spot)); + FSpotList *list = FindSpotList(spot->GetClass()); if (list != NULL) return list->Remove(spot); return false; } @@ -393,7 +393,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnSingleItem) AActor *spot = NULL; DSpotState *state = DSpotState::GetSpotState(); - if (state != NULL) spot = state->GetRandomSpot(RUNTIME_TYPE(self), true); + if (state != NULL) spot = state->GetRandomSpot(self->GetClass(), true); if (spot == NULL) return 0; if (!multiplayer && pr_spawnmace() < fail_sp) @@ -429,7 +429,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnSingleItem) } if (spawned->IsKindOf(RUNTIME_CLASS(AInventory))) { - static_cast(spawned)->SpawnPointClass = RUNTIME_TYPE(self); + static_cast(spawned)->SpawnPointClass = self->GetClass(); } } return 0; diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 385971d59..f84dc6a8b 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -556,7 +556,7 @@ static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon) // Powered up weapons and inherited sister weapons are not displayed. if (weapon->WeaponFlags & WIF_POWERED_UP) return; - if (weapon->SisterWeapon && weapon->IsKindOf(RUNTIME_TYPE(weapon->SisterWeapon))) return; + if (weapon->SisterWeapon && weapon->IsKindOf(weapon->SisterWeapon->GetClass())) return; trans=0x6666; if (CPlayer->ReadyWeapon) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 202eb24ab..9d774493e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4822,7 +4822,7 @@ int DLevelScript::RunScript () } else if (activator) { - work += RUNTIME_TYPE(activator)->TypeName.GetChars(); + work += activator->GetClass()->TypeName.GetChars(); } else { diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 69146fd99..d71aff711 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1178,8 +1178,7 @@ bool P_LookForMonsters (AActor *actor) { // Stop searching return false; } - if (mo->IsKindOf (RUNTIME_TYPE(actor)) || - actor->IsKindOf (RUNTIME_TYPE(mo))) + if (mo->IsKindOf (actor->GetClass()) || actor->IsKindOf (mo->GetClass())) { // [RH] Don't go after same species continue; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 4b38cb93a..2078f9e6c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2499,7 +2499,7 @@ void P_NightmareRespawn (AActor *mobj) // spawn it x = mobj->SpawnPoint[0]; y = mobj->SpawnPoint[1]; - mo = Spawn (RUNTIME_TYPE(mobj), x, y, z, NO_REPLACE); + mo = Spawn (mobj->GetClass(), x, y, z, NO_REPLACE); if (z == ONFLOORZ) mo->z += mo->SpawnPoint[2];