fix DIV-by-0 bug (re:fps display)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5233 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2010-06-25 20:16:05 +00:00
parent f98f388ad0
commit 3d28c2be86
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -954,7 +954,7 @@ int main(int argc, char **argv)
serverslice(0);
fps = (1000.0f/elapsed+fps*10)/11;
if(elapsed) fps = (1000.0f/elapsed+fps*10)/11; // avoid DIV-by-0
frames++;
audiomgr.updateaudio();
+2 -2
View File
@@ -272,7 +272,7 @@ void blendbox(int x1, int y1, int x2, int y2, bool border, int tex, color *c)
if(tex>=0)
{
glBindTexture(GL_TEXTURE_2D, tex);
if(c)
if(c)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(c->r, c->g, c->b, c->alpha);
@@ -1027,7 +1027,7 @@ void gl_drawframe(int w, int h, float changelod, float curfps)
}
extern vector<vertex> verts;
gl_drawhud(w, h, (int)round(curfps), nquads, verts.length(), underwater);
gl_drawhud(w, h, (int)roundf(curfps), nquads, verts.length(), underwater);
glEnable(GL_CULL_FACE);
glEnable(GL_FOG);