sots-engine/tests/game_design/stock_designs.h

27 lines
1.3 KiB
C++

// Reads the owner's designs extract ($SOTS_DESIGNS_JSON): every design of
// every player in the real saves, decoded into the save-record shape
// (`raw_slots`: species index, section id, one weapon id/file per bank, the
// DOpts list) plus the player's researched techs and the reference reader's
// resolved view (section stems, stripped options) that the test cross-checks.
// The file is game-derived and never enters the repo.
#pragma once
#include <array>
#include <string>
#include <vector>
#include "game/design/design.h"
struct StockDesign {
int player_index = 0, design_index = 0;
std::string save, player, race_text, list;
bool npc = false;
game::design::Design design; // options hold the raw DOpts until stripped
std::array<std::string, 3> expect_stem{}; // reference view: section stem per used slot ("" = empty)
std::array<std::vector<std::string>, 3> expect_options{}; // reference view: chosen options
std::array<std::vector<std::string>, 3> dopts{}; // the save's DOpts per used slot
std::array<int, 3> bank_count{}; // the save's bank count per used slot
};
// False (and `err`) when the file cannot be read or has an unexpected shape.
bool load_stock_designs(const std::string& path, std::vector<StockDesign>& out, std::string& err);