]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_execprogram.h
added vid_stereobuffer cvar based on patch from syschuck on the alientrap forums
[xonotic/darkplaces.git] / prvm_execprogram.h
index aa72801c45bca0f9c714d7c71f1218053f38da55..82f1a97a3c60793fe5d9627fd9a2163b8c1f3719 100644 (file)
                                OPC->vector[2] = OPB->_float * OPA->vector[2];
                                break;
                        case OP_DIV_F:
-                               OPC->_float = OPA->_float / OPB->_float;
+                               if( OPB->_float != 0.0f )
+                               {
+                                       OPC->_float = OPA->_float / OPB->_float;
+                               }
+                               else
+                               {
+                                       if( developer.integer >= 1 )
+                                       {
+                                               prog->xfunction->profile += (st - startst);
+                                               startst = st;
+                                               prog->xstatement = st - prog->statements;
+                                               VM_Warning( "Attempted division by zero in %s\n", PRVM_NAME );
+                                       }
+                                       OPC->_float = 0.0f;
+                               }
                                break;
                        case OP_BITAND:
                                OPC->_float = (int)OPA->_float & (int)OPB->_float;
                                        if (++jumpcount == 10000000)
                                        {
                                                prog->xstatement = st - prog->statements;
-                                               PRVM_ERROR("runaway loop counter hit limit of %d jumps\ntip: if having trouble identifying the problem, try typing profile now in %s", jumpcount, PRVM_NAME);
+                                               PRVM_Profile(1<<30, 1000000);
+                                               PRVM_ERROR("runaway loop counter hit limit of %d jumps\ntip: read above for list of most-executed functions", jumpcount, PRVM_NAME);
                                        }
                                }
                                break;
                                        if (++jumpcount == 10000000)
                                        {
                                                prog->xstatement = st - prog->statements;
-                                               PRVM_ERROR("runaway loop counter hit limit of %d jumps\ntip: if having trouble identifying the problem, try typing profile now in %s", jumpcount, PRVM_NAME);
+                                               PRVM_Profile(1<<30, 1000000);
+                                               PRVM_ERROR("runaway loop counter hit limit of %d jumps\ntip: read above for list of most-executed functions", jumpcount, PRVM_NAME);
                                        }
                                }
                                break;
                                if (++jumpcount == 10000000)
                                {
                                        prog->xstatement = st - prog->statements;
-                                       PRVM_ERROR("runaway loop counter hit limit of %d jumps\ntip: if having trouble identifying the problem, try typing profile now in %s", jumpcount, PRVM_NAME);
+                                       PRVM_Profile(1<<30, 1000000);
+                                       PRVM_ERROR("runaway loop counter hit limit of %d jumps\ntip: read above for list of most-executed functions", jumpcount, PRVM_NAME);
                                }
                                break;