diff --git a/src/client/Client.cpp b/src/client/Client.cpp index cf830a85f..e446f738a 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -576,7 +576,7 @@ void Client::Tick() json::Boolean sessionStatus = objDocument["Session"]; if(!sessionStatus.Value()) { - authUser = User(0, ""); + SetAuthUser(User(0, "")); } //MOTD diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index c929f3aea..154d99b8d 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -28,18 +28,6 @@ using namespace std; -class GameController::LoginCallback: public ControllerCallback -{ - GameController * cc; -public: - LoginCallback(GameController * cc_) { cc = cc_; } - virtual void ControllerExit() - { - cc->gameModel->SetUser(cc->loginWindow->GetUser()); - } -}; - - class GameController::SearchCallback: public ControllerCallback { GameController * cc; @@ -1015,7 +1003,7 @@ void GameController::OpenLocalBrowse() void GameController::OpenLogin() { - loginWindow = new LoginController(new LoginCallback(this)); + loginWindow = new LoginController(); ui::Engine::Ref().ShowWindow(loginWindow->GetView()); } @@ -1263,6 +1251,12 @@ std::string GameController::WallName(int type) return ""; } +void GameController::NotifyAuthUserChanged(Client * sender) +{ + User newUser = sender->GetAuthUser(); + gameModel->SetUser(newUser); +} + void GameController::NotifyUpdateAvailable(Client * sender) { class UpdateConfirmation: public ConfirmDialogueCallback { diff --git a/src/game/GameController.h b/src/game/GameController.h index a5c441639..984cfd6db 100644 --- a/src/game/GameController.h +++ b/src/game/GameController.h @@ -46,7 +46,6 @@ private: CommandInterface * commandInterface; public: bool HasDone; - class LoginCallback; class SearchCallback; class RenderCallback; class SSaveCallback; @@ -142,6 +141,7 @@ public: void RemoveNotification(Notification * notification); virtual void NotifyUpdateAvailable(Client * sender); + virtual void NotifyAuthUserChanged(Client * sender); void RunUpdater(); }; diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index b0178af9e..813781f7a 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -777,7 +777,7 @@ ui::Colour GameModel::GetColourSelectorColour() void GameModel::SetUser(User user) { currentUser = user; - Client::Ref().SetAuthUser(user); + //Client::Ref().SetAuthUser(user); notifyUserChanged(); }