Skip to content

Commit

Permalink
CAbstractActor Dispose -> destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-voss committed Jan 15, 2024
1 parent ed6e926 commit bc9582a
Show file tree
Hide file tree
Showing 47 changed files with 65 additions and 88 deletions.
9 changes: 3 additions & 6 deletions src/game/CAbstractActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ CAbstractActor::CAbstractActor() {
traction = kDefaultTraction;
friction = kDefaultFriction;
}

void CAbstractActor::Dispose() {
CAbstractActor::~CAbstractActor() {
short i;
ActorAttachment *nextA;

Expand Down Expand Up @@ -281,8 +280,6 @@ void CAbstractActor::Dispose() {
if (itsSoundLink) {
gHub->ReleaseLinkAndKillSounds(itsSoundLink);
}

CDirectObject::Dispose();
}

void CAbstractActor::Shatter(short firstSliverType,
Expand Down Expand Up @@ -719,7 +716,7 @@ void CAbstractActor::PostMortemBlast(short scoreTeam, short scoreId, Boolean doD
}

if (doDispose)
Dispose();
delete this;
}

bool CAbstractActor::SecondaryDamage(short scoreTeam, short scoreColor, ScoreInterfaceReasons damageSource) {
Expand Down Expand Up @@ -1041,7 +1038,7 @@ void CAbstractActor::PauseLevel() {
** This method is called before the level is reset.
*/
void CAbstractActor::LevelReset() {
Dispose();
delete this;
}

void CAbstractActor::RegisterReceiver(MessageRecord *theMsg, MsgType messageNum) {
Expand Down
4 changes: 2 additions & 2 deletions src/game/CAbstractActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ typedef union {
CAbstractActor *a;
} ActorOrPartLink;

class CAbstractActor : public CDirectObject {
class CAbstractActor {
public:
CAbstractActor();
virtual ~CAbstractActor();
CAvaraGame *itsGame;

unsigned long searchCount;
Expand Down Expand Up @@ -154,7 +155,6 @@ class CAbstractActor : public CDirectObject {
virtual void LevelReset();
virtual void ResumeLevel();
virtual void PauseLevel();
virtual void Dispose(); // Simply go away

virtual void Shatter(short firstSliverType, short sizesCount, short *sCounts, short *sLives, Fixed speedFactor);

Expand Down
1 change: 1 addition & 0 deletions src/game/CAbstractMissile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void CAbstractMissile::FrameAction() {
}
}


void CAbstractMissile::MoveForward() {
partList[0]->isTransparent = false;
partList[0]->extraAmbient = energy;
Expand Down
1 change: 0 additions & 1 deletion src/game/CAbstractMissile.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class CAbstractMissile : public CAbstractActor {
CAbstractMissile *nextMissile;
long ownerIdent;
CDepot *itsDepot;

short frameCount;
short maxFrameCount;

Expand Down
5 changes: 2 additions & 3 deletions src/game/CAbstractPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ void CAbstractPlayer::AdaptableSettings() {
&motorFriction, &motorAcceleration);
}

void CAbstractPlayer::Dispose() {
CAbstractPlayer::~CAbstractPlayer() {
short i;
CBSPWorld *hudWorld;

Expand All @@ -315,7 +315,7 @@ void CAbstractPlayer::Dispose() {
}

if (itsScout) {
itsScout->Dispose();
delete itsScout;
scoutIdent = 0;
}

Expand All @@ -334,7 +334,6 @@ void CAbstractPlayer::Dispose() {

gHub->ReleaseLink(teleportSoundLink);

CRealMovers::Dispose();
}

void CAbstractPlayer::DisposeDashboard() {
Expand Down
2 changes: 1 addition & 1 deletion src/game/CAbstractPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class CAbstractPlayer : public CRealMovers {
virtual void StartSystems();
virtual void LevelReset();

virtual void Dispose();
virtual ~CAbstractPlayer();
virtual void DisposeDashboard();

virtual void ReturnWeapon(short theKind);
Expand Down
6 changes: 3 additions & 3 deletions src/game/CAvaraGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ void CAvaraGame::Dispose() {

while (actorList) {
nextActor = actorList->nextActor;
actorList->Dispose();
delete actorList;
actorList = nextActor;
}

while (freshPlayerList) {
nextActor = freshPlayerList->nextActor;
freshPlayerList->Dispose();
delete freshPlayerList;
freshPlayerList = (CAbstractPlayer *)nextActor;
}

Expand Down Expand Up @@ -570,7 +570,7 @@ void CAvaraGame::LevelReset(Boolean clearReset) {

while (freshPlayerList) {
nextActor = freshPlayerList->nextActor;
freshPlayerList->Dispose();
delete freshPlayerList;
freshPlayerList = (CAbstractPlayer *)nextActor;
}

Expand Down
4 changes: 1 addition & 3 deletions src/game/CBall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,9 @@ CAbstractActor *CBall::EndScript() {
return NULL;
}
}
void CBall::Dispose() {
CBall::~CBall() {
BuzzControl(false);
ReleaseAttachment();

CRealShooters::Dispose();
}

void CBall::AdaptableSettings() {
Expand Down
2 changes: 1 addition & 1 deletion src/game/CBall.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CBall : public CRealShooters {
CBall();
virtual void BeginScript();
virtual CAbstractActor *EndScript();
virtual void Dispose();
virtual ~CBall();
virtual void AdaptableSettings(); // Read settings that can change with frame rate

virtual void ChangeOwnership(short ownerId, short ownerTeamColor);
Expand Down
4 changes: 2 additions & 2 deletions src/game/CDepot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void CDepot::DisposeMissiles() {
mList = missileList[j];
while (mList) {
nextMissile = mList->nextMissile;
mList->Dispose();
delete mList;
mList = nextMissile;
}
}
Expand Down Expand Up @@ -353,7 +353,7 @@ void CDepot::DisposeWeapons() {
wList = weaponList[j];
while (wList) {
nextWeapon = wList->nextWeapon;
wList->Dispose();
delete wList;
wList = nextWeapon;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/game/CDoorActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,9 @@ void CDoorActor::AdaptableSettings() {
FPS_DEBUG("openSpeed = " << openSpeed << ", closeSpeed = " << closeSpeed << "\n");
}

void CDoorActor::Dispose() {
CDoorActor::~CDoorActor() {
itsGame->RemoveReceiver(&openActivator);
itsGame->RemoveReceiver(&closeActivator);

CGlowActors::Dispose();
}

void CDoorActor::DoorSound() {
Expand Down
4 changes: 2 additions & 2 deletions src/game/CDoorActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class CDoorActor : public CGlowActors {
virtual void BeginScript();
virtual CAbstractActor *EndScript();
virtual void AdaptableSettings();
virtual void Dispose();

virtual ~CDoorActor();
virtual CSmartPart *CollisionTest();
virtual void TouchDamage();
virtual void PlaceParts();
Expand Down
4 changes: 2 additions & 2 deletions src/game/CForceField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ CAbstractActor *CForceField::EndScript() {
heading = 0;
lastWallActor->partList[0] = NULL;
lastWallActor->partCount = 0;
lastWallActor->Dispose();
delete lastWallActor;
lastWallActor = NULL;
} else {
Dispose();
delete this;
return NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions src/game/CFreeSolid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ CAbstractActor *CFreeSolid::EndScript() {
heading = 0;
lastWallActor->partList[0] = NULL;
lastWallActor->partCount = 0;
lastWallActor->Dispose(); // Destroy wall actor (now without shape).
delete lastWallActor; // Destroy wall actor (now without shape).
lastWallActor = NULL;
} else {
Dispose();
delete this;
return NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/CGroundColorAdjuster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ CAbstractActor *CGroundColorAdjuster::EndScript() {
theShader = gCurrentGame->worldShader;
theShader->groundColor = GetPixelColor();

Dispose();
delete this;
return NULL;
}
4 changes: 1 addition & 3 deletions src/game/CGuardActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ CAbstractActor *CGuardActor::EndScript() {
return this;
}

void CGuardActor::Dispose() {
CGuardActor::~CGuardActor() {
itsGame->RemoveReceiver(&fireActivator);
itsGame->RemoveReceiver(&trackingActivator);
itsGame->RemoveReceiver(&trackingDeactivator);

CGlowActors::Dispose();
}

void CGuardActor::PlaceParts() {
Expand Down
2 changes: 1 addition & 1 deletion src/game/CGuardActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CGuardActor : public CGlowActors {

virtual void BeginScript();
virtual CAbstractActor *EndScript();
virtual void Dispose();
virtual ~CGuardActor();

virtual void PlaceParts();
virtual CSmartPart *FindClosestTarget();
Expand Down
2 changes: 1 addition & 1 deletion src/game/CHologramActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ CAbstractActor *CHologramActor::EndScript() {
theWorld->AddPart(thePart);
}

Dispose();
delete this;
return NULL;
}
4 changes: 1 addition & 3 deletions src/game/CLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void CLogic::Trigger() {
}
}

void CLogic::Dispose() {
CLogic::~CLogic() {
short i;

itsGame->RemoveReceiver(&startMsg);
Expand All @@ -76,8 +76,6 @@ void CLogic::Dispose() {
for (i = 0; i < LOGIC_IN; i++) {
itsGame->RemoveReceiver(&in[i]);
}

CAbstractActor::Dispose();
}

void CLogic::FrameAction() {
Expand Down
2 changes: 1 addition & 1 deletion src/game/CLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class CLogic : public CAbstractActor {
virtual void BeginScript();
virtual CAbstractActor *EndScript();
virtual void Trigger();
virtual void Dispose();
virtual ~CLogic();
virtual void FrameAction();
};
2 changes: 1 addition & 1 deletion src/game/CLogicAnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void CLogicAnd::FrameAction() {
Trigger();

if (!restart) {
Dispose();
delete this;
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/CLogicBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void CLogicBase::FrameAction() {
}

if (!restart) {
Dispose();
delete this;
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/CLogicCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void CLogicCounter::FrameAction() {
Trigger();

if (!restart) {
Dispose();
delete this;
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/CLogicDelay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CAbstractActor *CLogicDelay::EndScript() {
return this;
}

Dispose();
delete this;
return NULL;
}

Expand All @@ -51,7 +51,7 @@ void CLogicDelay::FrameAction() {
sleepTimer = 0;
Trigger();
if (!restart) {
Dispose();
delete this;
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/CLogicDistributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CAbstractActor *CLogicDistributor::EndScript() {
}
}

Dispose();
delete this;
return NULL;
}

Expand Down Expand Up @@ -50,7 +50,7 @@ void CLogicDistributor::FrameAction() {
if (sendNext == LOGIC_OUT) {
sendNext = 0;
if (!restart) {
Dispose();
delete this;
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/CLogicTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CAbstractActor *CLogicTimer::EndScript() {
return this;
}

Dispose();
delete this;
return NULL;
}

Expand Down Expand Up @@ -57,7 +57,7 @@ void CLogicTimer::FrameAction() {
Trigger();

if (!restart) {
Dispose();
delete this;
return;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/game/CMineActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,13 @@ void CMineActor::Activate() {
}
}

void CMineActor::Dispose() {
CMineActor::~CMineActor() {
itsGame->RemoveReceiver(&activator);

if (itsSoundLink) {
gHub->ReleaseLinkAndKillSounds(itsSoundLink);
itsSoundLink = NULL;
}

CGlowActors::Dispose();
}

void CMineActor::FrameAction() {
Expand Down
2 changes: 1 addition & 1 deletion src/game/CMineActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CMineActor : public CGlowActors {
virtual void BeginScript();
virtual CAbstractActor *EndScript();
virtual void Activate();
virtual void Dispose();
virtual ~CMineActor();
virtual void FrameAction();
virtual void WasHit(RayHitRecord *theHit, Fixed hitEnergy);
};
Loading

0 comments on commit bc9582a

Please sign in to comment.