]> git.localhorst.tv Git - l2e.git/blobdiff - src/menu/PartyMenu.cpp
added 'change' menu state
[l2e.git] / src / menu / PartyMenu.cpp
index 79b2be06d7dc436c27d9be5d264ef77a639fad86..e605c193255a4b92ac92255b5fb5deadac9b1e44 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "PartyMenu.h"
 
+#include "ChangeHero.h"
 #include "Resources.h"
 #include "SelectHero.h"
 #include "StatusMenu.h"
@@ -29,7 +30,7 @@ PartyMenu::PartyMenu(GameConfig *game)
 : game(game)
 , mainMenu(*game->menuResources->mainMenuProperties) {
        for (int i(0); i < 4; ++i) {
-               status[i].SetHero(game->state->party[i]);
+               status[i].SetHero(game->state->party, i);
                status[i].SetResources(game->menuResources);
        }
        statusPositions[0] = Vector<int>(0, 0);
@@ -101,9 +102,10 @@ void PartyMenu::HandleEvents(const Input &input) {
                        case MENU_ITEM_EQUIP:
                                break;
                        case MENU_ITEM_STATUS:
-                               Ctrl().PushState(new SelectHero(this, OnStatusSelect));
+                               Ctrl().PushState(new SelectHero(this, this, this, OnStatusSelect));
                                break;
                        case MENU_ITEM_CHANGE:
+                               Ctrl().PushState(new ChangeHero(this));
                                break;
                        case MENU_ITEM_CONFIG:
                                break;
@@ -196,8 +198,10 @@ const Resources &PartyMenu::Res() const {
        return *game->menuResources;
 }
 
-void PartyMenu::OnStatusSelect(PartyMenu *self, int index) {
-       self->Ctrl().ChangeState(new StatusMenu(self, index));
+void PartyMenu::OnStatusSelect(void *ref, int index) {
+       PartyMenu *self(reinterpret_cast<PartyMenu *>(ref));
+       self->Ctrl().ChangeState(
+                       new StatusMenu(self, index));
 }
 
 }