diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-12-02 00:54:23 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2012-01-09 06:58:35 +0100 |
commit | 9a702e64449ba54fab28706c5b9c5ff9f2a41f8a (patch) | |
tree | 311b1a8aac33a4796a2a4f12d6aad6b543246f7f /src/playerrelations.h | |
parent | f54cd905f49d08116bf988bcb4451beb168cbd48 (diff) | |
download | mana-9a702e64449ba54fab28706c5b9c5ff9f2a41f8a.tar.gz mana-9a702e64449ba54fab28706c5b9c5ff9f2a41f8a.tar.bz2 mana-9a702e64449ba54fab28706c5b9c5ff9f2a41f8a.tar.xz mana-9a702e64449ba54fab28706c5b9c5ff9f2a41f8a.zip |
Hopefully fixed the crash related to player relations.
I removed all the misuse of std::map::operator[]
I could find, especially there:
if (!(*container)[name])
where the [] was creating the entry while checking
for its existence.
This should avoid the memory corruption problem
seen in the Mana-Mantis #400.
Patch tested in game by: Ablu.
Resolves: Mana Mantis #400
Reviewed-by: Ablu.
Diffstat (limited to 'src/playerrelations.h')
-rw-r--r-- | src/playerrelations.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/playerrelations.h b/src/playerrelations.h index fd76aa03..653b4c63 100644 --- a/src/playerrelations.h +++ b/src/playerrelations.h @@ -37,6 +37,10 @@ struct PlayerRelation static const unsigned int WHISPER = (1 << 3); static const unsigned int TRADE = (1 << 4); + /** + * There are four types of relations: + * NEUTRAL, FRIEND, DISREGARDED, and IGNORED. + */ static const unsigned int RELATIONS_NR = 4; static const unsigned int RELATION_PERMISSIONS[RELATIONS_NR]; |