allow snapshots to still publish saves, as long as they don't use new features

This commit is contained in:
jacob1 2016-08-07 15:31:28 -04:00
parent b8e2113b05
commit cd41aac1f7
5 changed files with 25 additions and 2 deletions

View File

@ -33,6 +33,11 @@
#ifndef MOD_ID
#define MOD_ID 0
#endif
#ifdef SNAPSHOT
#define FUTURE_SAVE_VERSION 92
#define FUTURE_MINOR_VERSION 0
#endif
//VersionInfoEnd
//#define IGNORE_UPDATES //uncomment this for mods, to not get any update notifications

View File

@ -991,6 +991,13 @@ RequestStatus Client::UploadSave(SaveInfo & save)
lastError = "Cannot upload game save";
return RequestFailure;
}
#ifdef SNAPSHOT
else if (save.gameSave->fromNewerVersion && save.GetPublished())
{
lastError = "Cannot publish save";
return RequestFailure;
}
#endif
char *saveName = new char[save.GetName().length() + 1];
std::strcpy (saveName, save.GetName().c_str());

View File

@ -740,7 +740,11 @@ void GameSave::readOPS(char * data, int dataLength)
fprintf(stderr, "Wrong type for %s\n", bson_iterator_key(&iter));
}
}
#ifdef SNAPSHOT
if (major > FUTURE_SAVE_VERSION || (major == FUTURE_SAVE_VERSION && minor > FUTURE_MINOR_VERSION))
#else
if (major > SAVE_VERSION || (major == SAVE_VERSION && minor > MINOR_VERSION))
#endif
{
std::stringstream errorMessage;
errorMessage << "Save from a newer version: Requires version " << major << "." << minor;
@ -2123,6 +2127,13 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
{
RESTRICTVERSION(91, 5);
}
#ifdef SNAPSHOT
if (particles[i].type == PT_E180 || particles[i].type == PT_E181)
{
RESTRICTVERSION(92, 0);
fromNewerVersion = true;
}
#endif
//Get the pmap entry for the next particle in the same position
i = partsPosLink[i];

View File

@ -8,7 +8,7 @@ Element_E180::Element_E180()
Colour = PIXPACK(0xCB6351);
MenuVisible = 1;
MenuSection = SC_SOLIDS;
#ifdef DEBUG
#if defined(DEBUG) || defined(SNAPSHOT)
Enabled = 1;
#else
Enabled = 0;

View File

@ -7,7 +7,7 @@ Element_E181::Element_E181()
Colour = PIXPACK(0xF0F0A0);
MenuVisible = 1;
MenuSection = SC_POWDERS;
#ifdef DEBUG
#if defined(DEBUG) || defined(SNAPSHOT)
Enabled = 1;
#else
Enabled = 0;