Files
smack-a-brother/src/state.h
T
shweetandClaude Opus 5.5 465f75f6d7 Split the simulation from presentation into an SDL-free library
Sim holds one whole game (tick, snapshots, checksum) and talks to the screen only
through Cues, which the client's Scene plays and the server ignores. All drawing
moved to scene.cpp. Match takes this screen's wishes as request flags instead of
reading the menu, input and settings. The sim library builds without SDL and the
server links it, ready to run games itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:46:07 -05:00

14 lines
723 B
C++

#pragma once
#include <string>
struct Sim;
// The whole simulation as bytes, to hand a player joining a game already running. The game state is plain data that
// lays out the same on every platform (no pointers or heap inside the structs; see Attack and FixedList), so most of it
// goes as it sits in memory, and the few lists as a count and their items. It starts with a layout signature (the sizes
// of everything), so a build that lays things out differently refuses it rather than loading garbage. The menu and
// everything else this screen alone sees isn't part of it, nor is the bots' map of the world, rebuilt on loading.
std::string state_save(Sim& sim);
bool state_load(Sim& sim, const std::string& bytes);