summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-02 18:50:34 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-02 18:50:34 +0000
commitb8b21edf63e58270e7744548c73e1c5ef64b7950 (patch)
tree9e1f1d5f5047e2bfb112f451a498e03b588e56b2
parent48f6cbbd88f70c4ef4cb1ce711053009b666164a (diff)
downloadhercules-b8b21edf63e58270e7744548c73e1c5ef64b7950.tar.gz
hercules-b8b21edf63e58270e7744548c73e1c5ef64b7950.tar.bz2
hercules-b8b21edf63e58270e7744548c73e1c5ef64b7950.tar.xz
hercules-b8b21edf63e58270e7744548c73e1c5ef64b7950.zip
* Fixed mapflags not getting initialized upon @reloadscript (bugreport:2247, since r1275).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14548 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/map.c19
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc.c3
4 files changed, 22 insertions, 2 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 4bf971e79..5b1ce23a9 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,7 @@
Date Added
2010/12/02
+ * Fixed mapflags not getting initialized upon @reloadscript (bugreport:2247, since r1275). [Ai4rei]
* Removed redundant check in food vs. cash food status change overriding code, partially suggested by xazax (related r14437 and r14510). [Ai4rei]
* Added an error message when a client connection exceeds the socket write buffer, so that it does not appear to be closed for no apparent reason (follow up to r13469). [Ai4rei]
* Random clif.c fixes and cleanups. [Ai4rei]
diff --git a/src/map/map.c b/src/map/map.c
index 7fa7d4f7a..be2c53526 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2797,6 +2797,20 @@ int map_delmap(char* mapname)
return 0;
}
+/// Initializes map flags and adjusts them depending on configuration.
+void map_flags_init(void)
+{
+ int i;
+
+ for( i = 0; i < map_num; i++ )
+ {
+ memset(&map[i].flag, 0, sizeof(map[i].flag));
+
+ if( battle_config.pk_mode )
+ map[i].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
+ }
+}
+
#define NO_WATER 1000000
/*
@@ -2958,8 +2972,6 @@ int map_readallmaps (void)
map[i].m = i;
memset(map[i].moblist, 0, sizeof(map[i].moblist)); //Initialize moblist [Skotlex]
map[i].mob_delete_timer = INVALID_TIMER; //Initialize timer [Skotlex]
- if(battle_config.pk_mode)
- map[i].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
map[i].bxs = (map[i].xs + BLOCK_SIZE - 1) / BLOCK_SIZE;
map[i].bys = (map[i].ys + BLOCK_SIZE - 1) / BLOCK_SIZE;
@@ -2973,6 +2985,9 @@ int map_readallmaps (void)
map[i].block_mob = (struct block_list**)aCalloc(size, 1);
}
+ // intialization and configuration-dependent adjustments of mapflags
+ map_flags_init();
+
if( !enable_grf ) {
fclose(fp);
diff --git a/src/map/map.h b/src/map/map.h
index 08cb3aada..3b1775e46 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -630,6 +630,7 @@ int cleanup_sub(struct block_list *bl, va_list ap);
void map_helpscreen(int flag); // [Valaris]
int map_delmap(char* mapname);
+void map_flags_init(void);
bool map_iwall_set(int m, int x, int y, int size, int dir, bool shootable, const char* wall_name);
void map_iwall_get(struct map_session_data *sd);
diff --git a/src/map/npc.c b/src/map/npc.c
index 893b3c871..92425f585 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3314,6 +3314,9 @@ int npc_reload(void)
npc_warp = npc_shop = npc_script = 0;
npc_mob = npc_cache_mob = npc_delay_mob = 0;
+ // reset mapflags
+ map_flags_init();
+
//TODO: the following code is copy-pasted from do_init_npc(); clean it up
// Reloading npcs now
for (nsl = npc_src_files; nsl; nsl = nsl->next)