Start refactoring the core to C++ (#7303)
This commit is contained in:
@@ -17,6 +17,24 @@
|
||||
#include "../common/showmsg.hpp"
|
||||
#include "../common/utils.hpp"
|
||||
|
||||
using namespace rathena::server_core;
|
||||
|
||||
namespace rathena{
|
||||
namespace tool_mapcache{
|
||||
class MapcacheTool : public Core{
|
||||
protected:
|
||||
bool initialize( int argc, char* argv[] ) override;
|
||||
|
||||
public:
|
||||
MapcacheTool() : Core( e_core_type::TOOL ){
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
using namespace rathena::tool_mapcache;
|
||||
|
||||
std::string grf_list_file = "conf/grf-files.txt";
|
||||
std::string map_list_file = "map_index.txt";
|
||||
std::string map_cache_file;
|
||||
@@ -185,8 +203,7 @@ void process_args(int argc, char *argv[])
|
||||
|
||||
}
|
||||
|
||||
int do_init(int argc, char** argv)
|
||||
{
|
||||
bool MapcacheTool::initialize( int argc, char* argv[] ){
|
||||
/* setup pre-defined, #define-dependant */
|
||||
map_cache_file = std::string(db_path) + "/" + std::string(DBPATH) + "map_cache.dat";
|
||||
|
||||
@@ -212,7 +229,7 @@ int do_init(int argc, char** argv)
|
||||
map_cache_fp = fopen(map_cache_file.c_str(), "r+b");
|
||||
if(map_cache_fp == NULL) {
|
||||
ShowError("Failure when opening map cache file %s\n", map_cache_file.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Open the map list
|
||||
@@ -226,7 +243,7 @@ int do_init(int argc, char** argv)
|
||||
list = fopen(filename.c_str(), "r");
|
||||
if (list == NULL) {
|
||||
ShowError("Failure when opening maps list file %s\n", filename.c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the main header
|
||||
@@ -285,9 +302,9 @@ int do_init(int argc, char** argv)
|
||||
|
||||
ShowInfo("%d maps now in cache\n", header.map_count);
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void do_final(void)
|
||||
{
|
||||
int main( int argc, char *argv[] ){
|
||||
return main_core<MapcacheTool>( argc, argv );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user