Add persistent cross-game player bank (Refs #3)

This commit is contained in:
2026-10-12 20:45:41 -04:00
parent eda2c7e76d
commit 9cce0be438
19 changed files with 1646 additions and 15 deletions
@@ -0,0 +1,30 @@
#pragma once
#include <filesystem>
#include <string>
#include <vector>
namespace utils::bank
{
struct report { std::string id, decision, body; };
struct acknowledgement
{
bool valid = false;
std::string state, code, id;
int amount = 0, balance = 0;
};
acknowledgement parse_acknowledgement(const std::string& response);
// One game-thread writer; cancel intent is replaced by commit before points move.
class outbox
{
public:
outbox(std::filesystem::path root, std::string server, std::string endpoint);
std::vector<report> load() const;
void store(const std::string& body) const;
void erase(const std::string& id) const;
private:
std::filesystem::path file_;
std::string server_, endpoint_;
report decode(const std::string& body) const;
void save(const std::vector<report>& reports) const;
};
}