]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.cpp
moved monster's position to Monster
[l2e.git] / src / battle / BattleState.cpp
index aae4635be3687bf578533a925778cc20ef0e7f4b..fe1b309a3a65b36543de7d8585290f6503b9139f 100644 (file)
@@ -78,7 +78,6 @@ void BattleState::Resize(int w, int h) {
 
 
 void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) {
-       monstersLayout->CalculatePositions(background->w, background->h, monsterPositions);
        for (int i(0); i < 4; ++i) {
                heroes[i].Position() = heroesLayout->CalculatePosition(i, background->w, background->h);
                heroes[i].SpellMenu() = res->spellMenuPrototype;
@@ -89,6 +88,10 @@ void BattleState::EnterState(Application &ctrl, SDL_Surface *screen) {
                smallHeroTags[i] = SmallHeroTag(this, i);
        }
 
+       for (int i(0); i < int(monsters.size()); ++i) {
+               monsters[i].Position() = monstersLayout->CalculatePosition(i, background->w, background->h);
+       }
+
        int tagHeight(attackTypeMenu.Height());
        int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2);
        int xOffset((Width() - 2 * tagWidth) / 2);
@@ -369,9 +372,9 @@ void BattleState::RenderMonsters(SDL_Surface *screen, const Vector<int> &offset)
        for (vector<Monster>::size_type i(0), end(monsters.size()); i < end; ++i) {
                if (MonsterPositionOccupied(i)) {
                        if (monsters[i].GetAnimation().Running()) {
-                               monsters[i].GetAnimation().DrawCenter(screen, monsterPositions[i] + offset);
+                               monsters[i].GetAnimation().DrawCenter(screen, monsters[i].Position() + offset);
                        } else {
-                               monsters[i].Sprite()->DrawCenter(screen, monsterPositions[i] + offset);
+                               monsters[i].Sprite()->DrawCenter(screen, monsters[i].Position() + offset);
                        }
                }
        }