diff --git a/src/network/network.cpp b/src/network/network.cpp index 377b28846a..2bc9b132df 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -988,8 +988,11 @@ void Network::Server_Send_MAP(NetworkConnection* connection) { int buffersize = 0x600000; std::vector buffer(buffersize); + bool RLEState = gUseRLE; + gUseRLE = false; SDL_RWops* rw = SDL_RWFromMem(&buffer[0], buffersize); scenario_save_network(rw); + gUseRLE = RLEState; int size = (int)SDL_RWtell(rw); size_t chunksize = 1000; size_t out_size; diff --git a/src/util/sawyercoding.c b/src/util/sawyercoding.c index 4d725f99ea..1a6ba9b15d 100644 --- a/src/util/sawyercoding.c +++ b/src/util/sawyercoding.c @@ -22,6 +22,7 @@ #include "../platform/platform.h" #include "sawyercoding.h" #include "../scenario.h" +#include "util.h" static size_t decode_chunk_rle(const uint8* src_buffer, uint8* dst_buffer, size_t length); static size_t decode_chunk_repeat(uint8 *buffer, size_t length); @@ -138,6 +139,11 @@ size_t sawyercoding_read_chunk(SDL_RWops* rw, uint8 *buffer) size_t sawyercoding_write_chunk_buffer(uint8 *dst_file, uint8* buffer, sawyercoding_chunk_header chunkHeader){ uint8 *encode_buffer, *encode_buffer2; + if (gUseRLE == false) { + if (chunkHeader.encoding == CHUNK_ENCODING_RLE || chunkHeader.encoding == CHUNK_ENCODING_RLECOMPRESSED) { + chunkHeader.encoding = CHUNK_ENCODING_NONE; + } + } switch (chunkHeader.encoding){ case CHUNK_ENCODING_NONE: memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header)); diff --git a/src/util/util.c b/src/util/util.c index c209032069..14ba1c4b3e 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -23,6 +23,8 @@ #include "../platform/platform.h" #include "zlib.h" +bool gUseRLE = true; + int squaredmetres_to_squaredfeet(int squaredMetres) { // 1 metre squared = 10.7639104 feet squared diff --git a/src/util/util.h b/src/util/util.h index ae769cea32..f89bf95fed 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -23,6 +23,8 @@ #include "../common.h" +extern bool gUseRLE; + int squaredmetres_to_squaredfeet(int squaredMetres); int metres_to_feet(int metres); int mph_to_kmph(int mph);