meant to move those functions into GameSave class
This commit is contained in:
parent
5ce60b5f5f
commit
8d492ef549
@ -6,7 +6,6 @@
|
|||||||
#include <bzlib.h>
|
#include <bzlib.h>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "bson/BSON.h"
|
|
||||||
#include "GameSave.h"
|
#include "GameSave.h"
|
||||||
#include "simulation/SimulationData.h"
|
#include "simulation/SimulationData.h"
|
||||||
#include "ElementClasses.h"
|
#include "ElementClasses.h"
|
||||||
@ -406,7 +405,7 @@ void bson_error_handler(const char *err)
|
|||||||
throw ParseException(ParseException::Corrupt, "BSON error when parsing save");
|
throw ParseException(ParseException::Corrupt, "BSON error when parsing save");
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkBsonFieldUser(bson_iterator iter, const char *field, unsigned char **data, unsigned int *fieldLen)
|
void GameSave::CheckBsonFieldUser(bson_iterator iter, const char *field, unsigned char **data, unsigned int *fieldLen)
|
||||||
{
|
{
|
||||||
if (!strcmp(bson_iterator_key(&iter), field))
|
if (!strcmp(bson_iterator_key(&iter), field))
|
||||||
{
|
{
|
||||||
@ -421,7 +420,7 @@ void checkBsonFieldUser(bson_iterator iter, const char *field, unsigned char **d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkBsonFieldBool(bson_iterator iter, const char *field, bool *flag)
|
void GameSave::CheckBsonFieldBool(bson_iterator iter, const char *field, bool *flag)
|
||||||
{
|
{
|
||||||
if (!strcmp(bson_iterator_key(&iter), field))
|
if (!strcmp(bson_iterator_key(&iter), field))
|
||||||
{
|
{
|
||||||
@ -436,7 +435,7 @@ void checkBsonFieldBool(bson_iterator iter, const char *field, bool *flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkBsonFieldInt(bson_iterator iter, const char *field, int *setting)
|
void GameSave::CheckBsonFieldInt(bson_iterator iter, const char *field, int *setting)
|
||||||
{
|
{
|
||||||
if (!strcmp(bson_iterator_key(&iter), field))
|
if (!strcmp(bson_iterator_key(&iter), field))
|
||||||
{
|
{
|
||||||
@ -522,23 +521,23 @@ void GameSave::readOPS(char * data, int dataLength)
|
|||||||
|
|
||||||
while (bson_iterator_next(&iter))
|
while (bson_iterator_next(&iter))
|
||||||
{
|
{
|
||||||
checkBsonFieldUser(iter, "parts", &partsData, &partsDataLen);
|
CheckBsonFieldUser(iter, "parts", &partsData, &partsDataLen);
|
||||||
checkBsonFieldUser(iter, "partsPos", &partsPosData, &partsPosDataLen);
|
CheckBsonFieldUser(iter, "partsPos", &partsPosData, &partsPosDataLen);
|
||||||
checkBsonFieldUser(iter, "wallMap", &wallData, &wallDataLen);
|
CheckBsonFieldUser(iter, "wallMap", &wallData, &wallDataLen);
|
||||||
checkBsonFieldUser(iter, "pressMap", &pressData, &pressDataLen);
|
CheckBsonFieldUser(iter, "pressMap", &pressData, &pressDataLen);
|
||||||
checkBsonFieldUser(iter, "vxMap", &vxData, &vxDataLen);
|
CheckBsonFieldUser(iter, "vxMap", &vxData, &vxDataLen);
|
||||||
checkBsonFieldUser(iter, "vyMap", &vyData, &vyDataLen);
|
CheckBsonFieldUser(iter, "vyMap", &vyData, &vyDataLen);
|
||||||
checkBsonFieldUser(iter, "ambientMap", &ambientData, &ambientDataLen);
|
CheckBsonFieldUser(iter, "ambientMap", &ambientData, &ambientDataLen);
|
||||||
checkBsonFieldUser(iter, "fanMap", &fanData, &fanDataLen);
|
CheckBsonFieldUser(iter, "fanMap", &fanData, &fanDataLen);
|
||||||
checkBsonFieldUser(iter, "soapLinks", &soapLinkData, &soapLinkDataLen);
|
CheckBsonFieldUser(iter, "soapLinks", &soapLinkData, &soapLinkDataLen);
|
||||||
checkBsonFieldBool(iter, "legacyEnable", &legacyEnable);
|
CheckBsonFieldBool(iter, "legacyEnable", &legacyEnable);
|
||||||
checkBsonFieldBool(iter, "gravityEnable", &gravityEnable);
|
CheckBsonFieldBool(iter, "gravityEnable", &gravityEnable);
|
||||||
checkBsonFieldBool(iter, "aheat_enable", &aheatEnable);
|
CheckBsonFieldBool(iter, "aheat_enable", &aheatEnable);
|
||||||
checkBsonFieldBool(iter, "waterEEnabled", &waterEEnabled);
|
CheckBsonFieldBool(iter, "waterEEnabled", &waterEEnabled);
|
||||||
checkBsonFieldBool(iter, "paused", &paused);
|
CheckBsonFieldBool(iter, "paused", &paused);
|
||||||
checkBsonFieldInt(iter, "gravityMode", &gravityMode);
|
CheckBsonFieldInt(iter, "gravityMode", &gravityMode);
|
||||||
checkBsonFieldInt(iter, "airMode", &airMode);
|
CheckBsonFieldInt(iter, "airMode", &airMode);
|
||||||
checkBsonFieldInt(iter, "edgeMode", &edgeMode);
|
CheckBsonFieldInt(iter, "edgeMode", &edgeMode);
|
||||||
if (!strcmp(bson_iterator_key(&iter), "signs"))
|
if (!strcmp(bson_iterator_key(&iter), "signs"))
|
||||||
{
|
{
|
||||||
if (bson_iterator_type(&iter)==BSON_ARRAY)
|
if (bson_iterator_type(&iter)==BSON_ARRAY)
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Misc.h"
|
#include "Misc.h"
|
||||||
|
|
||||||
|
#include "bson/BSON.h"
|
||||||
#include "simulation/Sign.h"
|
#include "simulation/Sign.h"
|
||||||
#include "simulation/Particle.h"
|
#include "simulation/Particle.h"
|
||||||
|
|
||||||
@ -101,6 +102,9 @@ private:
|
|||||||
|
|
||||||
void InitData();
|
void InitData();
|
||||||
void InitVars();
|
void InitVars();
|
||||||
|
void CheckBsonFieldUser(bson_iterator iter, const char *field, unsigned char **data, unsigned int *fieldLen);
|
||||||
|
void CheckBsonFieldBool(bson_iterator iter, const char *field, bool *flag);
|
||||||
|
void CheckBsonFieldInt(bson_iterator iter, const char *field, int *setting);
|
||||||
template <typename T> T ** Allocate2DArray(int blockWidth, int blockHeight, T defaultVal);
|
template <typename T> T ** Allocate2DArray(int blockWidth, int blockHeight, T defaultVal);
|
||||||
template <typename T> void Deallocate2DArray(T ***array, int blockHeight);
|
template <typename T> void Deallocate2DArray(T ***array, int blockHeight);
|
||||||
void dealloc();
|
void dealloc();
|
||||||
|
Reference in New Issue
Block a user