summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-23 16:24:39 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-23 16:24:39 +0000
commit4e7be9f904f70e4a2e3d598602d03cddeaef8a74 (patch)
tree07d89ce6694ddff306093d9e2291c46dadbdb1ca
parente0a956b4045ca09631d9a9a616ca675f2c1f4a78 (diff)
downloadmana-4e7be9f904f70e4a2e3d598602d03cddeaef8a74.tar.gz
mana-4e7be9f904f70e4a2e3d598602d03cddeaef8a74.tar.bz2
mana-4e7be9f904f70e4a2e3d598602d03cddeaef8a74.tar.xz
mana-4e7be9f904f70e4a2e3d598602d03cddeaef8a74.zip
Uninitialized variable and free/delete/delete[] mismatch fixes.
-rw-r--r--src/being.cpp2
-rw-r--r--src/gui/char_server.cpp4
-rw-r--r--src/gui/gui.cpp3
-rw-r--r--src/gui/status.cpp15
-rw-r--r--src/main.cpp2
5 files changed, 15 insertions, 11 deletions
diff --git a/src/being.cpp b/src/being.cpp
index b9632424..67d8cd14 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -175,7 +175,7 @@ void Being::setPath(PATH_NODE *path)
}
PATH_NODE *pn = path;
this->path = path->next;
- free(pn);
+ delete pn;
x = this->path->x;
y = this->path->y;
action = WALK;
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index cb1d3659..c0f1c523 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -161,10 +161,10 @@ void server_char_server(int serverIndex) {
WFIFOB(16) = net_b_value(sex);
WFIFOSET(17);
- while ((in_size<4)||(out_size>0))flush();
+ while ((in_size < 4) || (out_size > 0))flush();
RFIFOSKIP(4);
- while (in_size<3)flush();
+ while (in_size < 3) flush();
if (RFIFOW(0) == 0x006b) {
while(in_size < RFIFOW(2))flush();
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c9742b05..4b084da9 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -31,7 +31,8 @@ Graphics *guiGraphics; // Graphics driver
gcn::SDLInput *guiInput; // GUI input
WindowContainer *guiTop; // The top container
-Gui::Gui(Graphics *graphics)
+Gui::Gui(Graphics *graphics):
+ topHasMouse(false)
{
// Set graphics
guiGraphics = graphics;
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 8465082f..70dbf083 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -99,21 +99,23 @@ void StatusWindow::update()
spValue->setCaption(tempstr);
spValue->adjustSize();
- sprintf(tempstr, "Exp: %d / %d", (int)char_info->xp, (int)char_info->xpForNextLevel);
+ sprintf(tempstr, "Exp: %d / %d",
+ (int)char_info->xp, (int)char_info->xpForNextLevel);
expLabel->setCaption(tempstr);
expLabel->adjustSize();
- sprintf(tempstr, "Job Exp: %d / %d", (int)char_info->job_xp, (int)char_info->jobXpForNextLevel);
+ sprintf(tempstr, "Job Exp: %d / %d",
+ (int)char_info->job_xp, (int)char_info->jobXpForNextLevel);
jobExpLabel->setCaption(tempstr);
jobExpLabel->adjustSize();
- if ( char_info->hp < int(char_info->max_hp / 3) )
+ if (char_info->hp < int(char_info->max_hp / 3))
{
healthBar->setColor(255, 0, 0); // Red
}
else
{
- if ( char_info->hp < int( (char_info->max_hp / 3)*2 ) )
+ if (char_info->hp < int((char_info->max_hp / 3) * 2))
{
healthBar->setColor(255, 181, 9); // orange
}
@@ -127,7 +129,8 @@ void StatusWindow::update()
healthBar->setProgress((float)char_info->hp / (float)char_info->max_hp);
xpBar->setProgress((float)char_info->xp / (float)char_info->xpForNextLevel);
- jobXpBar->setProgress((float)char_info->job_xp / (float)char_info->jobXpForNextLevel);
+ jobXpBar->setProgress(
+ (float)char_info->job_xp / (float)char_info->jobXpForNextLevel);
- delete tempstr;
+ delete[] tempstr;
}
diff --git a/src/main.cpp b/src/main.cpp
index c2f2f0fa..6f9eeeb0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -281,7 +281,7 @@ void init_engine() {
/** Clear the engine */
void exit_engine() {
config.write(dir);
- delete dir;
+ delete[] dir;
gui_exit();
ResourceManager::deleteInstance();
}