+ heroesLayout->CalculatePositions(background->w, background->h, heroesPositions);
+ for (vector<Hero>::size_type i(0), end(heroes.size()); i < end; ++i) {
+ spellMenus.push_back(res->spellMenuPrototype);
+ // TODO: insert spell menu entries
+ ikariMenus.push_back(res->ikariMenuPrototype);
+ // TODO: insert ikari menu entries
+ heroTags[i] = HeroTag(&heroes[i], attackChoices + i, res, HeroTag::Alignment((i + 1) % 2));
+ }
+
+ int tagHeight(attackTypeMenu.Height());
+ int tagWidth(attackTypeMenu.Width() * 2 + attackTypeMenu.Width() / 2);
+ int xOffset((BackgroundWidth() - 2 * tagWidth) / 2);
+ heroTagPositions[0] = Point<int>(xOffset, BackgroundHeight() - 2 * tagHeight);
+ heroTagPositions[1] = Point<int>(xOffset + tagWidth, BackgroundHeight() - 2 * tagHeight);
+ heroTagPositions[2] = Point<int>(xOffset, BackgroundHeight() - tagHeight);
+ heroTagPositions[3] = Point<int>(xOffset + tagWidth, BackgroundHeight() - tagHeight);
+
+ // TODO: insert item menu entries
+ itemMenu = res->itemMenuPrototype;
+ LoadInventory();
+}
+
+void BattleState::LoadInventory() {
+ const Inventory &inv(*res->inventory);
+ itemMenu.Clear();
+ itemMenu.Reserve(inv.MaxItems());
+ for (int i(0); i < inv.MaxItems(); ++i) {
+ const Item *item(inv.ItemAt(i));
+ if (item) {
+ itemMenu.Add(item->Name(), item, item->CanUseInBattle(), item->MenuIcon(), inv.ItemCountAt(i));
+ } else {
+ itemMenu.AddEmptyEntry();
+ }
+ }