summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-18 13:38:26 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-18 13:38:26 +0000
commit8192b22f355b8e0bce5a49bf0ddaeaf754f1682d (patch)
treedb52cbf0686111be6a110aa4a2018560ab4e410a
parent890239c175ed319f0ed7b0b77fdce833426db698 (diff)
downloadhercules-8192b22f355b8e0bce5a49bf0ddaeaf754f1682d.tar.gz
hercules-8192b22f355b8e0bce5a49bf0ddaeaf754f1682d.tar.bz2
hercules-8192b22f355b8e0bce5a49bf0ddaeaf754f1682d.tar.xz
hercules-8192b22f355b8e0bce5a49bf0ddaeaf754f1682d.zip
Fixed a crash when a castle from [0..MAX-1] wasn't in the db
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9668 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/guild.c24
2 files changed, 14 insertions, 12 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index e2d0aec68..7c9446dd0 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,8 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2007/01/18
+ * Fixed a crash when a castle from [0..MAX-1] wasn't in the db [ultramage]
2007/01/17
* Corrected atcommand @homstats so it shows the correct minimum/maximum
possible values.
diff --git a/src/map/guild.c b/src/map/guild.c
index b71b6344b..b75af5bea 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1908,18 +1908,18 @@ int guild_agit_break(struct mob_data *md)
return 0;
}
-// [MouseJstr]
-// How many castles does this guild have?
-int guild_checkcastles(struct guild *g) {
- int i,nb_cas=0, id,cas_id=0;
- struct guild_castle *gc;
- id=g->guild_id;
- for(i=0;i<MAX_GUILDCASTLE;i++){
- gc=guild_castle_search(i);
- cas_id=gc->guild_id;
- if(g->guild_id==cas_id)
- nb_cas=nb_cas+1;
- } //end for
+// How many castles does this guild have?
+int guild_checkcastles(struct guild *g)
+{
+ int i, nb_cas = 0;
+ struct guild_castle* gc;
+
+ for(i = 0; i < MAX_GUILDCASTLE; i++) {
+ gc = guild_castle_search(i);
+ if(gc && gc->guild_id == g->guild_id)
+ nb_cas++;
+ }
+
return nb_cas;
}