summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-02 03:02:59 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-02 03:02:59 +0300
commitd0df36406220717545221b0ed94b9ab4ebb908b3 (patch)
tree80e033ab6b2691dadef1e3d2e98e9fa0826dde90
parentb96e34946aa326a9f8dfb80ce34cce9fc219405e (diff)
downloadplus-d0df36406220717545221b0ed94b9ab4ebb908b3.tar.gz
plus-d0df36406220717545221b0ed94b9ab4ebb908b3.tar.bz2
plus-d0df36406220717545221b0ed94b9ab4ebb908b3.tar.xz
plus-d0df36406220717545221b0ed94b9ab4ebb908b3.zip
Some fixes after automatic code checking.
-rw-r--r--src/graphicsvertexes.cpp6
-rw-r--r--src/gui/widgets/layout.h11
-rw-r--r--src/gui/widgets/table.cpp4
-rw-r--r--src/guild.cpp15
-rw-r--r--src/party.cpp71
-rw-r--r--src/units.cpp2
6 files changed, 72 insertions, 37 deletions
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp
index 7242269f2..8b03368fd 100644
--- a/src/graphicsvertexes.cpp
+++ b/src/graphicsvertexes.cpp
@@ -54,21 +54,21 @@ OpenGLGraphicsVertexes::~OpenGLGraphicsVertexes()
void OpenGLGraphicsVertexes::clear()
{
- for(std::vector<GLfloat*>::iterator it = mFloatTexPool.begin();
+ for (std::vector<GLfloat*>::iterator it = mFloatTexPool.begin();
it != mFloatTexPool.end(); ++ it)
{
delete [] (*it);
}
mFloatTexPool.clear();
- for(std::vector<GLint*>::iterator it = mIntVertPool.begin();
+ for (std::vector<GLint*>::iterator it = mIntVertPool.begin();
it != mIntVertPool.end(); ++ it)
{
delete [] (*it);
}
mIntVertPool.clear();
- for(std::vector<GLint*>::iterator it = mIntTexPool.begin();
+ for (std::vector<GLint*>::iterator it = mIntTexPool.begin();
it != mIntTexPool.end(); ++ it)
{
delete [] (*it);
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 49b4815d7..2621f018a 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -173,8 +173,17 @@ class LayoutCell
LayoutCell():
mWidget(0),
+ mHPadding(0),
+ mVPadding(0),
mType(NONE)
- { }
+ {
+ mExtent[0] = 0;
+ mExtent[1] = 0;
+ mAlign[0] = 0;
+ mAlign[1] = 0;
+ mNbFill[0] = 0;
+ mNbFill[1] = 0;
+ }
~LayoutCell();
diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp
index 00f41a760..81efa5d12 100644
--- a/src/gui/widgets/table.cpp
+++ b/src/gui/widgets/table.cpp
@@ -355,8 +355,8 @@ void GuiTable::draw(gcn::Graphics* graphics)
&& c == (unsigned)mSelectedColumn
&& r == (unsigned)mSelectedRow)
{
- graphics->fillRectangle(gcn::Rectangle(x_offset, y_offset,
- width, height));
+ graphics->fillRectangle(gcn::Rectangle(
+ x_offset, y_offset, width, height));
}
}
graphics->pushClipArea(bounds);
diff --git a/src/guild.cpp b/src/guild.cpp
index c7a9c0cdc..2e1b3d78c 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -148,8 +148,9 @@ void Guild::removeMember(GuildMember *member)
(*itr)->mCharId == member->mCharId &&
(*itr)->getName() == member->getName())
{
+ GuildMember *member = *itr;
mMembers.erase(itr);
- delete *itr;
+ delete member;
return;
}
++itr;
@@ -159,16 +160,18 @@ void Guild::removeMember(GuildMember *member)
void Guild::removeMember(int id)
{
bool deleted = true;
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
while (deleted)
{
deleted = false;
+ MemberList::iterator itr = mMembers.begin(),
+ itr_end = mMembers.end();
while (itr != itr_end)
{
if ((*itr)->mId == id)
{
+ GuildMember *member = *itr;
mMembers.erase(itr);
+ delete member;
deleted = true;
break;
}
@@ -180,16 +183,18 @@ void Guild::removeMember(int id)
void Guild::removeMember(const std::string &name)
{
bool deleted = true;
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
while (deleted)
{
deleted = false;
+ MemberList::iterator itr = mMembers.begin(),
+ itr_end = mMembers.end();
while (itr != itr_end)
{
if ((*itr)->getName() == name)
{
+ GuildMember *member = *itr;
mMembers.erase(itr);
+ delete member;
deleted = true;
break;
}
diff --git a/src/party.cpp b/src/party.cpp
index dbf29f3ab..2b491edb9 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -106,50 +106,71 @@ void Party::removeMember(PartyMember *member)
if (!member)
return;
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
- while (itr != itr_end)
+ bool deleted = true;
+ while (deleted)
{
- if ((*itr)->mId == member->mId &&
- (*itr)->getName() == member->getName())
+ deleted = false;
+ MemberList::iterator itr = mMembers.begin(),
+ itr_end = mMembers.end();
+ while (itr != itr_end)
{
- PartyMember *member = (*itr);
- mMembers.erase(itr);
- delete member;
+ if ((*itr)->mId == member->mId &&
+ (*itr)->getName() == member->getName())
+ {
+ PartyMember *member = (*itr);
+ mMembers.erase(itr);
+ delete member;
+ deleted = true;
+ break;
+ }
+ ++itr;
}
- ++itr;
}
}
void Party::removeMember(int id)
{
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
- while (itr != itr_end)
+ bool deleted = true;
+ while (deleted)
{
- if ((*itr)->mId == id)
+ deleted = false;
+ MemberList::iterator itr = mMembers.begin(),
+ itr_end = mMembers.end();
+ while (itr != itr_end)
{
- PartyMember *member = (*itr);
- mMembers.erase(itr);
- delete member;
+ if ((*itr)->mId == id)
+ {
+ PartyMember *member = (*itr);
+ mMembers.erase(itr);
+ delete member;
+ deleted = true;
+ break;
+ }
+ ++itr;
}
- ++itr;
}
}
void Party::removeMember(const std::string &name)
{
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
- while (itr != itr_end)
+ bool deleted = true;
+ while (deleted)
{
- if ((*itr)->getName() == name)
+ deleted = false;
+ MemberList::iterator itr = mMembers.begin(),
+ itr_end = mMembers.end();
+ while (itr != itr_end)
{
- PartyMember *member = (*itr);
- mMembers.erase(itr);
- delete member;
+ if ((*itr)->getName() == name)
+ {
+ PartyMember *member = (*itr);
+ mMembers.erase(itr);
+ delete member;
+ deleted = true;
+ break;
+ }
+ ++itr;
}
- ++itr;
}
}
diff --git a/src/units.cpp b/src/units.cpp
index d1861b78b..6971a5445 100644
--- a/src/units.cpp
+++ b/src/units.cpp
@@ -181,7 +181,7 @@ std::string formatUnit(int value, int type)
double amount = ud.conversion * value;
// If only the first level is needed, act like mix if false
- if (ud.mix && ud.levels.size() > 0 && ud.levels[1].count < amount)
+ if (ud.mix && !ud.levels.empty() && ud.levels[1].count < amount)
{
std::string output;
struct UnitLevel pl = ud.levels[0];