The gcc 2.95 problem was in fact OP_STORE_V doing nasty things to numbers that were...
authorwarp <warp@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 27 Jan 2003 09:38:31 +0000 (09:38 +0000)
committerwarp <warp@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 27 Jan 2003 09:38:31 +0000 (09:38 +0000)
This allows us to make the string handling /much/ cleaner again.

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

pr_exec.c
pr_execprogram.h
progs.h

index 259b5cb..640140f 100644 (file)
--- a/pr_exec.c
+++ b/pr_exec.c
@@ -427,34 +427,6 @@ chooseexecprogram:
        }
 }
 
-// LordHavoc: grabbed these from QWSV, works around a gcc 2.95.3 compiler bug
-#define MAX_PRSTR 65536
-static char *pr_strtbl[MAX_PRSTR];
-static int num_prstr;
-
-char *PR_GetString (int num)
-{
-       return num >= 0 ? pr_strings + num : pr_strtbl[-num];
-}
-
-int PR_SetString (char *s)
-{
-       if (s >= pr_strings)
-               return (int) (s - pr_strings);
-       else
-       {
-               int i;
-               for (i = 0; i <= num_prstr; i++)
-                       if (pr_strtbl[i] == s)
-                               return -i;
-               if (num_prstr >= (MAX_PRSTR - 1))
-                       Host_Error ("PR_Setstring: ran out of string table slots");
-               pr_strtbl[++num_prstr] = s;
-               return -num_prstr;
-       }
-}
-
 void PR_ReInitStrings (void)
 {
-       num_prstr = 0;
 }
index 33dc3e0..f421e22 100644 (file)
                                OPB->_int = OPA->_int;
                                break;
                        case OP_STORE_V:
-                               OPB->vector[0] = OPA->vector[0];
-                               OPB->vector[1] = OPA->vector[1];
-                               OPB->vector[2] = OPA->vector[2];
+                               OPB->ivector[0] = OPA->ivector[0];
+                               OPB->ivector[1] = OPA->ivector[1];
+                               OPB->ivector[2] = OPA->ivector[2];
                                break;
 
                        case OP_STOREP_F:
diff --git a/progs.h b/progs.h
index f08a73f..7ba47c3 100644 (file)
--- a/progs.h
+++ b/progs.h
@@ -30,6 +30,7 @@ typedef union eval_s
        float                   _float;
        float                   vector[3];
        func_t                  function;
+       int                             ivector[3];
        int                             _int;
        int                             edict;
 } eval_t;
@@ -183,8 +184,8 @@ void PR_Execute_ProgsLoaded(void);
 void ED_PrintEdicts (void);
 void ED_PrintNum (int ent);
 
-char *PR_GetString (int num);
-int PR_SetString (char *s);
+#define PR_GetString(num) (pr_strings + num)
+#define PR_SetString(s) ((int) (s - pr_strings))
 
 #endif