Refactor generator to support future features (#7214)

Co-authored-by: Akkarinage <mike.langford@industrial-illusions.net>
Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
Vincent Stumpf
2022-09-25 00:37:21 -07:00
committed by GitHub
parent c2e19bcf06
commit 47c9a36215
15 changed files with 777 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
#include "../config/core.hpp"
#ifdef GENERATE_NAVI
#ifdef MAP_GENERATOR
#include <sys/stat.h>
#include <algorithm>
@@ -12,8 +12,9 @@
#include <vector>
#include "../common/db.hpp"
#include "../common/showmsg.hpp"
#include "../common/malloc.hpp"
#include "../common/showmsg.hpp"
#include "../common/utils.hpp"
#include "map.hpp"
#include "mob.hpp"
#include "navi.hpp"
@@ -424,6 +425,13 @@ void write_object_lists() {
auto npc_file = std::ofstream(filePrefix + "./navi_npc_krpri.lub");
auto map_file = std::ofstream(filePrefix + "./navi_map_krpri.lub");
if (!mob_file) {
ShowError("Failed to create mobfile.\n");
ShowError("Maybe the file directory \"%s\" does not exist?\n", filePrefix.c_str());
ShowInfo("Create the directory and rerun map-server-generator\n");
exit(1);
}
int warp_count = 0;
int npc_count = 0;
int spawn_count = 0;
@@ -623,12 +631,6 @@ void navi_create_lists() {
auto starttime = std::chrono::system_clock::now();
if (!fileExists(filePrefix)) {
ShowError("File directory %s does not exist.\n", filePrefix.c_str());
ShowInfo("Create the directory and rerun map-server");
exit(1);
}
npc_event_runall(script_config.navi_generate_name);
write_object_lists();
@@ -646,4 +648,4 @@ void navi_create_lists() {
BHEAP_CLEAR(g_open_set);
}
#endif
#endif