SaveTool: add tier display to the research inventory.

Closes #11.
This commit is contained in:
Guillaume Jacquemin 2021-08-18 15:37:03 +02:00
parent ded5e9bcb7
commit c4fc910ab0

View file

@ -292,22 +292,26 @@ void SaveTool::drawResearchInventory() {
return; return;
} }
#define unavRow(name) \ #define unavRow(name, tier) \
ImGui::TableNextRow(); \ ImGui::TableNextRow(); \
ImGui::TableSetColumnIndex(0); \ ImGui::TableSetColumnIndex(0); \
ImGui::TextUnformatted("T" #tier); \
ImGui::TableSetColumnIndex(1); \
ImGui::TextUnformatted(name); \ ImGui::TextUnformatted(name); \
ImGui::TableSetColumnIndex(1); \ ImGui::TableSetColumnIndex(2); \
ImGui::TextDisabled("Unavailable as of M.A.S.S. Builder version " SUPPORTED_GAME_VERSION); ImGui::TextDisabled("Unavailable as of game version " SUPPORTED_GAME_VERSION);
#define matRow(name, var, getter, setter) \ #define matRow(name, tier, var, getter, setter) \
ImGui::TableNextRow(); \ ImGui::TableNextRow(); \
ImGui::TableSetColumnIndex(0); \ ImGui::TableSetColumnIndex(0); \
ImGui::TextUnformatted((name)); \ ImGui::TextUnformatted("T" #tier); \
ImGui::TableSetColumnIndex(1); \ ImGui::TableSetColumnIndex(1); \
ImGui::TextUnformatted(name); \
ImGui::TableSetColumnIndex(2); \
if(_currentProfile->getter() != -1) { \ if(_currentProfile->getter() != -1) { \
ImGui::Text("%i", _currentProfile->getter()); \ ImGui::Text("%i", _currentProfile->getter()); \
if(_cheatMode) { \ if(_cheatMode) { \
ImGui::TableSetColumnIndex(2); \ ImGui::TableSetColumnIndex(3); \
ImGui::PushID(#setter); \ ImGui::PushID(#setter); \
static Int var = _currentProfile->getter(); \ static Int var = _currentProfile->getter(); \
if(drawUnsafeWidget([]{ return ImGui::SmallButton(ICON_FA_EDIT); })) { \ if(drawUnsafeWidget([]{ return ImGui::SmallButton(ICON_FA_EDIT); })) { \
@ -327,60 +331,61 @@ void SaveTool::drawResearchInventory() {
ImGui::TextDisabled("Not found in the save file"); \ ImGui::TextDisabled("Not found in the save file"); \
} }
if(ImGui::BeginTable("##ResearchInventoryTable", 3, if(ImGui::BeginTable("##ResearchInventoryTable", 4,
ImGuiTableFlags_BordersOuter|ImGuiTableFlags_ScrollY|ImGuiTableFlags_RowBg)) ImGuiTableFlags_BordersOuter|ImGuiTableFlags_ScrollY|ImGuiTableFlags_RowBg))
{ {
ImGui::TableSetupColumn("##Tier", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("##Name", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("##Name", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("##Value", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##Value", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("##Edit", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("##Edit", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(1);
ImGui::Text("Engine materials"); ImGui::Text("Engine materials");
matRow("Verse steel", verse_steel, verseSteel, VerseSteel) matRow("Verse steel", 1, verse_steel, verseSteel, VerseSteel)
matRow("Undinium", undinium, undinium, Undinium) matRow("Undinium", 2, undinium, undinium, Undinium)
matRow("Necrium alloy", necrium_alloy, necriumAlloy, NecriumAlloy) matRow("Necrium alloy", 3, necrium_alloy, necriumAlloy, NecriumAlloy)
matRow("Lunarite", lunarite, lunarite, Lunarite) matRow("Lunarite", 4, lunarite, lunarite, Lunarite)
matRow("Asterite", asterite, asterite, Asterite) matRow("Asterite", 5, asterite, asterite, Asterite)
unavRow("Hallite fragma") unavRow("Hallite fragma", 6)
unavRow("Unnoctinium") unavRow("Unnoctinium", 7)
ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(1);
ImGui::Text("OS materials"); ImGui::Text("OS materials");
matRow("Ednil", ednil, ednil, Ednil) matRow("Ednil", 1, ednil, ednil, Ednil)
matRow("Nuflalt", nuflalt, nuflalt, Nuflalt) matRow("Nuflalt", 2, nuflalt, nuflalt, Nuflalt)
matRow("Aurelene", aurelene, aurelene, Aurelene) matRow("Aurelene", 3, aurelene, aurelene, Aurelene)
matRow("Soldus", soldus, soldus, Soldus) matRow("Soldus", 4, soldus, soldus, Soldus)
matRow("Synthesized N", synthesized_n, synthesizedN, SynthesizedN) matRow("Synthesized N", 5, synthesized_n, synthesizedN, SynthesizedN)
unavRow("Nanoc") unavRow("Nanoc", 6)
unavRow("Abyssillite") unavRow("Abyssillite", 7)
ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(1);
ImGui::Text("Architect materials"); ImGui::Text("Architect materials");
matRow("Alcarbonite", alcarbonite, alcarbonite, Alcarbonite) matRow("Alcarbonite", 1, alcarbonite, alcarbonite, Alcarbonite)
matRow("Keriphene", keriphene, keriphene, Keriphene) matRow("Keriphene", 2, keriphene, keriphene, Keriphene)
matRow("Nitinol-CM", nitinol_cm, nitinolCM, NitinolCM) matRow("Nitinol-CM", 3, nitinol_cm, nitinolCM, NitinolCM)
matRow("Quarkium", quarkium, quarkium, Quarkium) matRow("Quarkium", 4, quarkium, quarkium, Quarkium)
matRow("Alterene", alterene, alterene, Alterene) matRow("Alterene", 5, alterene, alterene, Alterene)
unavRow("Cosmium") unavRow("Cosmium", 6)
unavRow("Purified quarkium") unavRow("Purified quarkium", 7)
ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(1);
ImGui::Text("Quark data"); ImGui::Text("Quark data");
matRow("Mixed composition", mixed_composition, mixedComposition, MixedComposition) matRow("Mixed composition", 1, mixed_composition, mixedComposition, MixedComposition)
matRow("Void residue", void_residue, voidResidue, VoidResidue) matRow("Void residue", 2, void_residue, voidResidue, VoidResidue)
matRow("Muscular construction", muscular_construction, muscularConstruction, MuscularConstruction) matRow("Muscular construction", 3, muscular_construction, muscularConstruction, MuscularConstruction)
matRow("Mineral exoskeletology", mineral_exoskeletology, mineralExoskeletology, MineralExoskeletology) matRow("Mineral exoskeletology", 4, mineral_exoskeletology, mineralExoskeletology, MineralExoskeletology)
matRow("Carbonized skin", carbonized_skin, carbonizedSkin, CarbonizedSkin) matRow("Carbonized skin", 5, carbonized_skin, carbonizedSkin, CarbonizedSkin)
unavRow("Isolated void particle") unavRow("Isolated void particle", 6)
unavRow("Weaponised physiology") unavRow("Weaponised physiology", 7)
ImGui::EndTable(); ImGui::EndTable();
} }