diff options
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/map/map.c b/src/map/map.c index 0124a3035..343f219b8 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -59,6 +59,7 @@ #include "map/rodex.h" #include "map/trade.h" #include "map/unit.h" +#include "map/achievement.h" #include "common/HPM.h" #include "common/cbasetypes.h" #include "common/conf.h" @@ -3689,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) { @@ -6134,6 +6162,7 @@ int do_final(void) map->list_final(); vending->final(); rodex->final(); + achievement->final(); HPM_map_do_final(); @@ -6338,6 +6367,7 @@ static void map_load_defaults(void) pet_defaults(); path_defaults(); quest_defaults(); + achievement_defaults(); npc_chat_defaults(); rodex_defaults(); } @@ -6653,6 +6683,7 @@ int do_init(int argc, char *argv[]) mercenary->init(minimal); elemental->init(minimal); quest->init(minimal); + achievement->init(minimal); npc->init(minimal); unit->init(minimal); bg->init(minimal); @@ -6800,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; |