X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=prvm_execprogram.h;h=82f1a97a3c60793fe5d9627fd9a2163b8c1f3719;hp=e1159c8fa725ebd7f08d59596cb5104d4ae9baf7;hb=bf7fdc26371e2823650c8af6d78ef1e28513f7eb;hpb=79ee8371768d8933af77721764286fa885ddb197 diff --git a/prvm_execprogram.h b/prvm_execprogram.h index e1159c8f..82f1a97a 100644 --- a/prvm_execprogram.h +++ b/prvm_execprogram.h @@ -47,7 +47,21 @@ 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; @@ -229,10 +243,11 @@ prog->xfunction->profile += (st - startst); st += st->b - 1; // offset the s++ startst = st; - if (++jumpcount == 1000000000) + 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; @@ -243,10 +258,11 @@ prog->xfunction->profile += (st - startst); st += st->b - 1; // offset the s++ startst = st; - if (++jumpcount == 1000000000) + 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; @@ -255,10 +271,11 @@ prog->xfunction->profile += (st - startst); st += st->a - 1; // offset the s++ startst = st; - if (++jumpcount == 1000000000) + 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;