summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}