summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/save.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/save.c b/src/save.c
index 2e81869..a73440c 100644
--- a/src/save.c
+++ b/src/save.c
@@ -1,4 +1,5 @@
#include <bzlib.h>
+#include <math.h>
#include "defines.h"
#include "powder.h"
#include "save.h"
@@ -56,7 +57,9 @@ pixel *prerender_save_OPS(void *save, int size, int *width, int *height)
int i, x, y, j;
int blockX, blockY, blockW, blockH, fullX, fullY, fullW, fullH;
pixel * vidBuf = NULL;
-
+ bson b;
+ bson_iterator iter;
+
//Block sizes
blockX = 0;
blockY = 0;
@@ -115,8 +118,6 @@ pixel *prerender_save_OPS(void *save, int size, int *width, int *height)
goto fail;
}
- bson b;
- bson_iterator iter;
bson_init_data(&b, bsonData);
bson_iterator_init(&iter, &b);
while(bson_iterator_next(&iter))
@@ -311,7 +312,8 @@ void *build_save_OPS(int *size, int orig_x0, int orig_y0, int orig_w, int orig_h
int blockX, blockY, blockW, blockH, fullX, fullY, fullW, fullH;
int x, y, i, wallDataFound = 0;
int posCount, signsCount;
-
+ bson b;
+
//Get coords in blocks
blockX = orig_x0/CELL;
blockY = orig_y0/CELL;
@@ -542,7 +544,6 @@ void *build_save_OPS(int *size, int orig_x0, int orig_y0, int orig_w, int orig_h
partsData = NULL;
}
- bson b;
bson_init(&b);
bson_append_bool(&b, "waterEEnabled", water_equal_test);
bson_append_bool(&b, "legacyEnable", legacy_enable);
@@ -640,7 +641,9 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c
int i, freeIndicesCount, x, y, returnCode = 0, j;
int *freeIndices = NULL;
int blockX, blockY, blockW, blockH, fullX, fullY, fullW, fullH;
-
+ bson b;
+ bson_iterator iter;
+
//Block sizes
blockX = x0/CELL;
blockY = y0/CELL;
@@ -701,8 +704,6 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c
clear_sim();
}
- bson b;
- bson_iterator iter;
bson_init_data(&b, bsonData);
bson_iterator_init(&iter, &b);
while(bson_iterator_next(&iter))