diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-02 03:02:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-02 03:02:59 +0300 |
commit | d0df36406220717545221b0ed94b9ab4ebb908b3 (patch) | |
tree | 80e033ab6b2691dadef1e3d2e98e9fa0826dde90 /src/party.cpp | |
parent | b96e34946aa326a9f8dfb80ce34cce9fc219405e (diff) | |
download | manaplus-d0df36406220717545221b0ed94b9ab4ebb908b3.tar.gz manaplus-d0df36406220717545221b0ed94b9ab4ebb908b3.tar.bz2 manaplus-d0df36406220717545221b0ed94b9ab4ebb908b3.tar.xz manaplus-d0df36406220717545221b0ed94b9ab4ebb908b3.zip |
Some fixes after automatic code checking.
Diffstat (limited to 'src/party.cpp')
-rw-r--r-- | src/party.cpp | 71 |
1 files changed, 46 insertions, 25 deletions
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; } } |