Permalink
Browse files

Remove unused code in src/Config.h (Fixes #516)

- Remove commented out code as it was not used anywhere in the code
  • Loading branch information...
wolfy1339 authored and jacob1 committed Nov 15, 2017
1 parent 87f3ada commit 255ca13fab1abd72dcee3f25c186bbac4f2bce99
Showing with 7 additions and 18 deletions.
  1. +0 −12 src/Config.h
  2. +7 −6 src/client/GameSave.cpp
@@ -163,18 +163,6 @@
#define GLASS_IOR 1.9
#define GLASS_DISP 0.07

#if defined(_MSC_VER)
#if _MSC_VER < 1800
#define fmin min
#define fminf min
#define fmax max
#define fmaxf max
#else
#include <algorithm>
#endif
#endif

#define SDEUT
//#define REALHEAT

#endif /* CONFIG_H */
@@ -2,6 +2,7 @@
#include <iostream>
#include <sstream>
#include <cmath>
#include <climits>
#include <vector>
#include <set>
#include <bzlib.h>
@@ -592,12 +593,12 @@ void GameSave::readOPS(char * data, int dataLength)
bsonDataLen |= ((unsigned)inputData[9]) << 8;
bsonDataLen |= ((unsigned)inputData[10]) << 16;
bsonDataLen |= ((unsigned)inputData[11]) << 24;

//Check for overflows, don't load saves larger than 200MB
unsigned int toAlloc = bsonDataLen+1;
if (toAlloc > 209715200 || !toAlloc)
throw ParseException(ParseException::InvalidDimensions, "Save data too large, refusing");

bsonData = (unsigned char*)malloc(toAlloc);
if (!bsonData)
throw ParseException(ParseException::InternalError, "Unable to allocate memory");
@@ -1329,10 +1330,10 @@ void GameSave::readPSv(char * data, int dataLength)
i |= ((unsigned)c[9])<<8;
i |= ((unsigned)c[10])<<16;
i |= ((unsigned)c[11])<<24;

if(i > 209715200 || !i)
throw ParseException(ParseException::InvalidDimensions, "Save data too large");

d = (unsigned char *)malloc(i);
if (!d)
throw ParseException(ParseException::Corrupt, "Cannot allocate memory");
@@ -1411,7 +1412,7 @@ void GameSave::readPSv(char * data, int dataLength)
if (ver>=44)
{
/* The numbers used to save walls were changed, starting in v44.
* The new numbers are ignored for older versions due to some corruption of bmap in saves from older versions.
* The new numbers are ignored for older versions due to some corruption of bmap in saves from older versions.
*/
if (blockMap[y][x]==O_WL_WALLELEC)
blockMap[y][x]=WL_WALLELEC;
@@ -2321,7 +2322,7 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
bson_append_int(&b, "major", minimumMajorVersion);
bson_append_int(&b, "minor", minimumMinorVersion);
bson_append_finish_object(&b);


bson_append_bool(&b, "waterEEnabled", waterEEnabled);
bson_append_bool(&b, "legacyEnable", legacyEnable);

0 comments on commit 255ca13

Please sign in to comment.