summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-08-26 17:01:00 +0200
committerGitHub <noreply@github.com>2018-08-26 17:01:00 +0200
commit0630ea01ef687ba22f4600a2f32fb4d3e448dcb8 (patch)
treefc4889ced078a4b11ea5b507ee0b0eee3e7b9942 /src/map/map.c
parentadae3d4518a4eae5424a3bbff40d11d3eb90a52a (diff)
parent3a8705a28c5c9577e5a86584224d6252d0620ed8 (diff)
downloadhercules-0630ea01ef687ba22f4600a2f32fb4d3e448dcb8.tar.gz
hercules-0630ea01ef687ba22f4600a2f32fb4d3e448dcb8.tar.bz2
hercules-0630ea01ef687ba22f4600a2f32fb4d3e448dcb8.tar.xz
hercules-0630ea01ef687ba22f4600a2f32fb4d3e448dcb8.zip
Merge pull request #2162 from mekolat/setzone
add atcommand_setzone, and fix #2133
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/map/map.c b/src/map/map.c
index ce8f4cdf5..343f219b8 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3690,6 +3690,33 @@ static void do_final_maps(void)
map->zone_db_clear();
}
+
+static void map_zonedb_reload(void)
+{
+ // first, reset maps to their initial zones:
+ for (int i = 0; i < map->count; i++) {
+ map->zone_remove(i);
+
+ if (battle_config.pk_mode) {
+ map->list[i].flag.pvp = 1;
+ map->list[i].zone = &map->zone_pk;
+ } else {
+ map->list[i].flag.pvp = 0;
+ map->list[i].zone = &map->zone_all;
+ }
+
+ map->list[i].prev_zone = map->list[i].zone;
+ }
+
+ // now it's safe to remove the zones:
+ map->zone_db_clear();
+
+ // then reload everything from scratch:
+ map->zone_db = strdb_alloc(DB_OPT_DUP_KEY | DB_OPT_RELEASE_DATA, MAP_ZONE_NAME_LENGTH);
+ map->read_zone_db();
+}
+
+
/// Initializes map flags and adjusts them depending on configuration.
static void map_flags_init(void)
{
@@ -6804,6 +6831,7 @@ void map_defaults(void)
map->zone_apply = map_zone_apply;
map->zone_change = map_zone_change;
map->zone_change2 = map_zone_change2;
+ map->zone_reload = map_zonedb_reload;
map->getcell = map_getcell;
map->setgatcell = map_setgatcell;