From e35f98822d760ff3e4b4e8ed210ef14776a0e30c Mon Sep 17 00:00:00 2001 From: jsalmon3 <> Date: Thu, 6 Mar 2003 00:49:13 +0000 Subject: [PATCH] Fixed divide by 0 --- src/ui/mainscr.cpp | 5 ++++- src/unit/unit_draw.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ui/mainscr.cpp b/src/ui/mainscr.cpp index 1184af402..2788f5692 100644 --- a/src/ui/mainscr.cpp +++ b/src/ui/mainscr.cpp @@ -10,7 +10,7 @@ // /**@name mainscr.c - The main screen. */ // -// (c) Copyright 1998,2000-2002 by Lutz Sammer and Valery Shchedrin +// (c) Copyright 1998,2000-2003 by Lutz Sammer and Valery Shchedrin // // FreeCraft is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -133,6 +133,9 @@ local void UiDrawCompleted(int full,int ready) { int f; + if( !full ) { + return; + } f=(100*ready)/full; f=(f*152)/100; VideoFillRectangleClip(TheUI.CompleteBarColor diff --git a/src/unit/unit_draw.cpp b/src/unit/unit_draw.cpp index f67ce3c28..54ba5c23e 100644 --- a/src/unit/unit_draw.cpp +++ b/src/unit/unit_draw.cpp @@ -787,8 +787,12 @@ local void DrawManaSprite(int x,int y,const UnitType* type,int full,int ready) */ local void DrawManaBar(int x,int y,const UnitType* type,int full,int ready) { - int f, w; + int f; + int w; + if( !full ) { + return; + } f=(100*ready)/full; if ( ShowManaHorizontal == 0) { VideoFillRectangleClip(ColorBlue