]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Use PreError() for warnings too. Simpler code!
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 8 Jan 2014 16:01:58 +0000 (16:01 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 8 Jan 2014 16:01:58 +0000 (16:01 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12045 d7cf8633-e32d-0410-b094-e92efae38249

prvm_execprogram.h

index 5e94073d6fc09125f972c0682d99a435b0828052..3e3ceef0bac2fa0cae57da2d436b2e6eb628bdf7 100644 (file)
@@ -3,11 +3,14 @@
        prog->xstatement = st - cached_statements; \
        tm = Sys_DirtyTime(); \
        prog->xfunction->profile += (st - startst); \
-       prog->xfunction->tprofile += (tm - starttm >= 0 && tm - starttm < 1800) ? (tm - starttm) : 0;
+       prog->xfunction->tprofile += (tm - starttm >= 0 && tm - starttm < 1800) ? (tm - starttm) : 0; \
+       startst = st; \
+       starttm = tm
 #else
 #define PreError() \
        prog->xstatement = st - cached_statements; \
-       prog->xfunction->profile += (st - startst);
+       prog->xfunction->profile += (st - startst); \
+       startst = st
 #endif
 
 // This code isn't #ifdef/#define protectable, don't try.
                                {
                                        if (developer.integer)
                                        {
-                                               prog->xfunction->profile += (st - startst);
-                                               startst = st;
-                                               prog->xstatement = st - cached_statements;
+                                               PreError();
                                                VM_Warning(prog, "Attempted division by zero in %s\n", prog->name );
                                        }
                                        OPC->_float = 0.0f;
                                        }
                                        if ((prvm_uint_t)OPB->_int < cached_entityfields && !cached_allowworldwrites)
                                        {
-                                               prog->xstatement = st - cached_statements;
+                                               PreError();
                                                VM_Warning(prog, "assignment to world.%s (field %i) in %s\n", PRVM_GetString(prog, PRVM_ED_FieldAtOfs(prog, OPB->_int)->s_name), (int)OPB->_int, prog->name);
                                        }
                                }
                                        }
                                        if ((prvm_uint_t)OPB->_int < cached_entityfields && !cached_allowworldwrites)
                                        {
-                                               prog->xstatement = st - cached_statements;
+                                               PreError();
                                                VM_Warning(prog, "assignment to world.%s (field %i) in %s\n", PRVM_GetString(prog, PRVM_ED_FieldAtOfs(prog, OPB->_int)->s_name), (int)OPB->_int, prog->name);
                                        }
                                }