Commit 6797b554 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Great cleanup

parent 2a639a9e
......@@ -14,10 +14,8 @@ using namespace std;
GameController::GameController()
{
gameController = nullptr;
controllerMessage = shared_ptr<Message>();
listener = nullptr;
}
void GameController::beforeStart()
......@@ -59,14 +57,6 @@ void GameController::receivedActionFromSender(int, Object *)
}
void GameController::notifyListenerAboutControllerDidFinish(GameController *gameController, shared_ptr<string> message)
{
if (listener)
{
listener->controllerDidFinish(gameController, message);
}
}
void GameController::setGameController(MainGameController* gameController)
{
this->gameController = gameController;
......
......@@ -52,18 +52,16 @@ public:
void setIOSystem(shared_ptr<FSEGTIOSystem> ioSystem);
GameController *listener;
virtual void controllerDidFinish(Controller *controller, shared_ptr<string> message) = 0;
MainGameController *mainGameController;
virtual void receivedActionFromSender(int action, Object *sender);
shared_ptr<Message> getControllerMessage();
void clearMessage();
shared_ptr<FSEGTObjectsContext> objectsContext;
protected:
virtual void notifyListenerAboutControllerDidFinish(GameController *controller, shared_ptr<string> message = nullptr);
shared_ptr<FSEGTIOSystem> ioSystem;
shared_ptr<FSEGTRenderer> renderer;
......@@ -75,9 +73,7 @@ protected:
virtual void handleControllerMessage();
virtual void clearControllerMessage();
public:
shared_ptr<FSEGTObjectsContext> objectsContext;
};
......
......@@ -238,7 +238,6 @@ void MainGameController::setCurrentController(shared_ptr<GameController> newCurr
if (currentController.get() != nullptr)
{
currentController->beforeStop();
}
......@@ -250,7 +249,7 @@ void MainGameController::setCurrentController(shared_ptr<GameController> newCurr
currentController->setGameData(this->getGameData());
currentController->objectsContext = objectsContext;
currentController->setGameController(this);
currentController->listener = this;
currentController->mainGameController = this;
currentController->beforeStart();
}
}
......
......@@ -44,6 +44,8 @@ public:
void switchToState(int state);
void startGameLoop();
void controllerDidFinish(Controller *controller, shared_ptr<string> message);
protected:
shared_ptr<ResourcesLoader> resourcesLoader;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment