Lephisto/src/serializer.h
2018-04-14 16:51:33 +01:00

54 lines
1.2 KiB
C++

#pragma once
#include <vector>
#include "libs.h"
#include "star_system.h"
#define SAVEFILE_VERSION 1
class Frame;
class Body;
class StarSystem;
namespace Serializer {
void IndexFrames(void);
Frame* LookupFrame(size_t index);
int LookupFrame(Frame* f);
void IndexBodies(void);
Body* LookupBody(size_t index);
int LookupBody(Body*);
void IndexSystemBodies(StarSystem*);
StarSystem::SBody* LookupSystemBody(size_t index);
int LookupSystemBody(StarSystem::SBody*);
namespace Write {
bool Game(const char* filename);
void wr_bool(bool x);
void wr_byte(unsigned char x);
void wr_short(short x);
void wr_int(int x);
void wr_float(float f);
void wr_double(double f);
void wr_cstring(const char* s);
void wr_string(std::string& s);
void wr_vector3d(vector3d vec);
}
namespace Read {
bool Game(const char* filename);
bool is_olderthan(int version);
bool rd_bool(void);
unsigned char rd_byte(void);
short rd_short(void);
int rd_int(void);
float rd_float(void);
double rd_double(void);
std::string rd_string(void);
char* rd_cstring(void);
void rd_cstring2(char* buf, int len);
vector3d rd_vector3d(void);
}
}