Skip to content

Commit

Permalink
Convert CAvaraApp Dispose to C++ destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-voss committed Feb 1, 2024
1 parent 505d0db commit d800df6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/game/CAvaraApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ CAvaraAppImpl::CAvaraAppImpl() : CApplication("Avara") {
}

CAvaraAppImpl::~CAvaraAppImpl() {
itsGame->Dispose();
DeallocParser();
}

Expand Down
4 changes: 1 addition & 3 deletions src/game/CAvaraGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ CSoundHub* CAvaraGame::CreateSoundHub() {
return soundHub;
}

void CAvaraGame::Dispose() {
CAvaraGame::~CAvaraGame() {
CAbstractActor *nextActor;

spectatePlayer = NULL;
Expand Down Expand Up @@ -184,8 +184,6 @@ void CAvaraGame::Dispose() {

// DisposePolyWorld(&itsPolyWorld);
DisposePtr((Ptr)locatorTable);

CDirectObject::Dispose();
}

CAbstractActor *CAvaraGame::FindIdent(long ident) {
Expand Down
4 changes: 2 additions & 2 deletions src/game/CAvaraGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CIncarnator;
class CScoreKeeper;
class CAbstractYon;

class CAvaraGame : public CDirectObject {
class CAvaraGame {
public:
std::string loadedFilename = "";
std::string loadedLevel = "";
Expand Down Expand Up @@ -229,7 +229,7 @@ class CAvaraGame : public CDirectObject {
virtual void GameStart();
virtual bool GameTick();
virtual void GameStop();
virtual void Dispose();
virtual ~CAvaraGame();

virtual void SpectateNext();
virtual void SpectatePrevious();
Expand Down
9 changes: 8 additions & 1 deletion src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ class TestGame : public CAvaraGame {
}
};

class TestWalkerActor : public CWalkerActor {
void ResetCamera() {

}
};

class HectorTestScenario {
public:
TestApp app;
Expand All @@ -205,7 +211,7 @@ class HectorTestScenario {
game->EndScript();
app.GetNet()->ChangeNet(kNullNet, "");
game->LevelReset(false);
hector = new CWalkerActor();
hector = new TestWalkerActor();
hector->BeginScript();
hector->EndScript();
game->itsNet->playerTable[0]->SetPlayer(hector);
Expand All @@ -215,6 +221,7 @@ class HectorTestScenario {
hector->location[2] = hectorZ;
hector->location[3] = FIX1;
game->AddActor(hector);
game->freshPlayerList = 0;
game->GameStart();
}
};
Expand Down

0 comments on commit d800df6

Please sign in to comment.