]> git.localhorst.tv Git - l2e.git/commitdiff
load capsule in battles created by MapState
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 4 Dec 2012 19:33:41 +0000 (20:33 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 4 Dec 2012 19:33:41 +0000 (20:33 +0100)
src/common/GameState.cpp
src/common/GameState.h
src/main.cpp
src/map/MapState.cpp

index 2d9fd3e72ff6ac00f7a491d73dd165a44ec1ac8f..b08724bd8ee1f7048bbe66feded18afecba9a6c3 100644 (file)
@@ -4,6 +4,7 @@ namespace common {
 
 GameState::GameState()
 : partySize(1)
+, capsule(0)
 , money(0)
 , time(0)
 , messageSpeed(MESSAGE_SPEED_NORMAL)
index bcaea523ab497d3cc376a4e87cdea7b5010c37ed..4e2570d8fb8ea90c336169cb8e6a6b1c2ebf161e 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef COMMON_GAMESTATE_H_
 #define COMMON_GAMESTATE_H_
 
+#include "Capsule.h"
 #include "Hero.h"
 #include "Inventory.h"
 
@@ -16,6 +17,9 @@ struct GameState {
        Hero *party[4];
        int partySize;
 
+       Capsule capsules[7];
+       Capsule *capsule;
+
        Inventory inventory;
 
        Uint32 money;
index 8c099918aa5fac8586d88db10ba58e7baef673c5..2611a722aeba9b20ebf2431e33606e846be645e8 100644 (file)
@@ -194,6 +194,9 @@ int main(int argc, char **argv) {
                gameState.party[3] = &gameState.heroes[3];
                gameState.partySize = 4;
 
+               gameState.capsules[0] = *caster.GetCapsule("flash");
+               gameState.capsule = gameState.capsules;
+
                GameConfig gameConfig;
                gameConfig.state = &gameState;
                gameConfig.heroesLayout = caster.GetPartyLayout("heroesLayout");
index d678dab965d573c7722a963a9cc5936ac57af5c6..35c0c5c76f9a09a53b38e68ac5f8228d524c8449 100644 (file)
@@ -296,6 +296,9 @@ bool MapState::CheckMonster() {
                                                battleState->AddHero(*game->state->party[i]);
                                        }
                                }
+                               if (game->state->capsule) {
+                                       battleState->SetCapsule(game->state->capsule);
+                               }
                                for (battle::Monster **monster((*e)->MonstersBegin()); monster != (*e)->MonstersEnd(); ++monster) {
                                        battleState->AddMonster(**monster);
                                }
@@ -311,9 +314,6 @@ bool MapState::CheckMonster() {
                                // TODO: move entity erase to happen after the transition or battle
                                entities.erase(e);
                                return true;
-                               // needed information here:
-                               //  - battle background (from tile/area/map)
-                               //  - monsters + layout (from entity)
                        }
                }
        }