fix broken OFS_PARM0 + index code in VM_M_callfunction and
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 9 May 2007 09:29:56 +0000 (09:29 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 9 May 2007 09:29:56 +0000 (09:29 +0000)
VM_tokenizebyseparator, these were not multiplying by 3 as is required

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7254 d7cf8633-e32d-0410-b094-e92efae38249

mvm_cmds.c
prvm_cmds.c

index 80ea17e..7ed9c13 100644 (file)
@@ -134,7 +134,7 @@ void VM_M_callfunction(void)
 
        VM_SAFEPARMCOUNTRANGE(1, 8, VM_M_callfunction);
 
-       s = PRVM_G_STRING(OFS_PARM0 + (prog->argc - 1));
+       s = PRVM_G_STRING(OFS_PARM0+(prog->argc - 1)*3);
 
        VM_CheckEmptyString(s);
 
index 9b3dfb7..f4d62ce 100644 (file)
@@ -2021,10 +2021,11 @@ void VM_tokenizebyseparator (void)
        for (j = 1;j < prog->argc;j++)
        {
                // skip any blank separator strings
-               if (!PRVM_G_STRING(OFS_PARM0 + j)[0])
+               const char *s = PRVM_G_STRING(OFS_PARM0+j*3);
+               if (!s[0])
                        continue;
-               separators[numseparators] = PRVM_G_STRING(OFS_PARM0 + j);
-               separatorlen[numseparators] = strlen(separators[numseparators]);
+               separators[numseparators] = s;
+               separatorlen[numseparators] = strlen(s);
                numseparators++;
        }