From 064ff3a403095243f2aa780191be5061a4c8d300 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 23 May 2018 05:58:03 +0000 Subject: [PATCH] CON: Fix two regressions completely breaking the correctness of the copy command, introduced in r6343. git-svn-id: https://svn.eduke32.com/eduke32@6898 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gameexec.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 9a37a2249..61cee2d41 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -5075,27 +5075,38 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) { case 0: for (; numElements > 0; --numElements) - aGameArrays[destArray].pValues[destArrayIndex += destInc] = Gv_GetArrayValue(srcArray, srcArrayIndex += srcInc); + { + aGameArrays[destArray].pValues[destArrayIndex] = Gv_GetArrayValue(srcArray, srcArrayIndex++); + destArrayIndex += destInc; + } break; case GAMEARRAY_INT16: for (; numElements > 0; --numElements) - ((int16_t *)aGameArrays[destArray].pValues)[destArrayIndex += destInc] - = Gv_GetArrayValue(srcArray, srcArrayIndex += srcInc); + { + ((int16_t *) aGameArrays[destArray].pValues)[destArrayIndex] = Gv_GetArrayValue(srcArray, srcArrayIndex++); + destArrayIndex += destInc; + } break; case GAMEARRAY_INT8: for (; numElements > 0; --numElements) - ((int8_t *)aGameArrays[destArray].pValues)[destArrayIndex += destInc] - = Gv_GetArrayValue(srcArray, srcArrayIndex += srcInc); + { + ((int8_t *) aGameArrays[destArray].pValues)[destArrayIndex] = Gv_GetArrayValue(srcArray, srcArrayIndex++); + destArrayIndex += destInc; + } break; case GAMEARRAY_UINT16: for (; numElements > 0; --numElements) - ((uint16_t *)aGameArrays[destArray].pValues)[destArrayIndex += destInc] - = Gv_GetArrayValue(srcArray, srcArrayIndex += srcInc); + { + ((uint16_t *) aGameArrays[destArray].pValues)[destArrayIndex] = Gv_GetArrayValue(srcArray, srcArrayIndex++); + destArrayIndex += destInc; + } break; case GAMEARRAY_UINT8: for (; numElements > 0; --numElements) - ((uint8_t *)aGameArrays[destArray].pValues)[destArrayIndex += destInc] - = Gv_GetArrayValue(srcArray, srcArrayIndex += srcInc); + { + ((uint8_t *) aGameArrays[destArray].pValues)[destArrayIndex] = Gv_GetArrayValue(srcArray, srcArrayIndex++); + destArrayIndex += destInc; + } break; }