From 8ab558f0b003b27f1efe6b5c18305fe7a9ea3fe5 Mon Sep 17 00:00:00 2001 From: meag Date: Wed, 7 Nov 2018 12:20:07 +0000 Subject: [PATCH] SERVER: Fix for 64-bit save-game files Ensure all "" references are set to string ref 0 (should fix any affected save-game files) Looks like dimman's previous fix for 64-bit load/save (https://github.com/ezQuake/ezquake-source/commit/21b5ddc585ba5425415a96638094e4f53509f75e) didn't ever make it into mvdsv, so was removed again during sync to 3.1 - this led to extra fields being written out that didn't need to be included. Fixes #297 --- pr_edict.c | 9 ++++----- pr_exec.c | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pr_edict.c b/pr_edict.c index 9ab810f23..8e809b18b 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -43,16 +43,15 @@ static int pr_globaloffsetpatch_nq[62] = {0,0,0,0,0,666,-4,-4,8,8, 8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8, 8,8}; #endif -int type_size[8] = -{ +int type_size[8] = { 1, // void - sizeof(void *)/4, // string_t + 1, // string_t 1, // float 3, // vector 1, // entity 1, // field - sizeof(void *)/4, // func_t - sizeof(void *)/4 // pointer (its an int index) + 1, // func_t + 1 // pointer (its an int index) }; ddef_t *ED_FieldAtOfs (int ofs); diff --git a/pr_exec.c b/pr_exec.c index ca6bef20e..b764da61b 100644 --- a/pr_exec.c +++ b/pr_exec.c @@ -700,6 +700,11 @@ void PR1_SetString(string_t* address, char* s) return; } + if (!s || !s[0]) { + *address = 0; + return; + } + if (s - pr_strings < 0) { for (i = 0; i < num_prstr; i++) { if (pr_strtbl[i] == s) {