mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-23 22:55:31 -07:00
Use another nested method instead of one at the top level to fetch the table
This commit is contained in:
parent
f47f27c19e
commit
4dd9c99c11
4 changed files with 11 additions and 4 deletions
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
using namespace Logic;
|
using namespace Logic;
|
||||||
|
|
||||||
|
static std::array<Item, KEY_ENUM_MAX> itemTable;
|
||||||
|
|
||||||
void ItemTable_Init() { // RandomizerGet English name French Spanish Item Type getItemID advancement logic hint key
|
void ItemTable_Init() { // RandomizerGet English name French Spanish Item Type getItemID advancement logic hint key
|
||||||
itemTable[NONE] = Item(RG_NONE, Text{"No Item", "Rien", "Sin Objeto"}, ITEMTYPE_EVENT, GI_RUPEE_GREEN, false, &noVariable, NONE);
|
itemTable[NONE] = Item(RG_NONE, Text{"No Item", "Rien", "Sin Objeto"}, ITEMTYPE_EVENT, GI_RUPEE_GREEN, false, &noVariable, NONE);
|
||||||
itemTable[KOKIRI_SWORD] = Item(RG_KOKIRI_SWORD, Text{"Kokiri Sword", "Épée Kokiri", "Espada Kokiri"}, ITEMTYPE_ITEM, GI_SWORD_KOKIRI, true, &KokiriSword, KOKIRI_SWORD);
|
itemTable[KOKIRI_SWORD] = Item(RG_KOKIRI_SWORD, Text{"Kokiri Sword", "Épée Kokiri", "Espada Kokiri"}, ITEMTYPE_ITEM, GI_SWORD_KOKIRI, true, &KokiriSword, KOKIRI_SWORD);
|
||||||
|
@ -287,3 +289,7 @@ void NewItem(const uint32_t itemKey, const Item item) {
|
||||||
|
|
||||||
itemTable[itemKey] = item;
|
itemTable[itemKey] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::array<Item, KEY_ENUM_MAX>* GetFullItemTable_() {
|
||||||
|
return &itemTable;
|
||||||
|
}
|
|
@ -3,8 +3,7 @@
|
||||||
#include "item.hpp"
|
#include "item.hpp"
|
||||||
#include "keys.hpp"
|
#include "keys.hpp"
|
||||||
|
|
||||||
static std::array<Item, KEY_ENUM_MAX> itemTable;
|
|
||||||
|
|
||||||
void ItemTable_Init();
|
void ItemTable_Init();
|
||||||
Item& ItemTable(uint32_t itemKey);
|
Item& ItemTable(uint32_t itemKey);
|
||||||
void NewItem(uint32_t itemKey, Item item);
|
void NewItem(uint32_t itemKey, Item item);
|
||||||
|
std::array<Item, KEY_ENUM_MAX>* GetFullItemTable_();
|
||||||
|
|
|
@ -30,5 +30,5 @@ void RandoMain::GenerateRando(std::unordered_map<RandomizerSettingKey, u8> cvarS
|
||||||
std::array<Item, KEY_ENUM_MAX>* RandoMain::GetFullItemTable() {
|
std::array<Item, KEY_ENUM_MAX>* RandoMain::GetFullItemTable() {
|
||||||
ItemTable_Init();
|
ItemTable_Init();
|
||||||
|
|
||||||
return &itemTable;
|
return GetFullItemTable_();
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,9 @@ Randomizer::Randomizer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto item: *RandoMain::GetFullItemTable()) {
|
for (auto item: *RandoMain::GetFullItemTable()) {
|
||||||
SohImGui::GetConsole()->SendInfoMessage("GetFullItemTable %d %s", item.GetRandomizerGet(), item.GetName().english.c_str());
|
// Easiest way to filter out all the empty values from the array, since we still technically want the 0/RG_NONE entry
|
||||||
|
if (item.GetName().english.empty()) continue;
|
||||||
|
SohImGui::GetConsole()->SendInfoMessage("GetFullItemTable %d %s %d", item.GetRandomizerGet(), item.GetName().english.c_str(), item.GetItemID());
|
||||||
SpoilerfileGetNameToEnum[item.GetName().english] = item.GetRandomizerGet();
|
SpoilerfileGetNameToEnum[item.GetName().english] = item.GetRandomizerGet();
|
||||||
SpoilerfileGetNameToEnum[item.GetName().french] = item.GetRandomizerGet();
|
SpoilerfileGetNameToEnum[item.GetName().french] = item.GetRandomizerGet();
|
||||||
EnumToSpoilerfileGetName[item.GetRandomizerGet()] = {
|
EnumToSpoilerfileGetName[item.GetRandomizerGet()] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue