diff --git a/server/gameserver/mt/MetaMgr.cc b/server/gameserver/mt/MetaMgr.cc
index ce1fe0a5..ddbf3a5f 100644
--- a/server/gameserver/mt/MetaMgr.cc
+++ b/server/gameserver/mt/MetaMgr.cc
@@ -2,12 +2,31 @@
#include "mt/MetaMgr.h"
#include "mt/Param.h"
+#include "app.h"
namespace mt
{
void MetaMgr::Init()
{
+ if (!f8::IsOnlineEnv()) {
+ if (f8::IsTestEnv()) {
+ res_path_ = a8::Format("../../../conf_test/game%d/gameserver.test/res%d/",
+ {
+ GAME_ID,
+ App::Instance()->instance_id
+ });
+ } else {
+ res_path_ = a8::Format("../../../conf_test/game%d/gameserver.dev/res%d/",
+ {
+ GAME_ID,
+ App::Instance()->instance_id
+ });
+ }
+ } else {
+ res_path_ = "../res/";
+ }
+
RegMetaTable();
}
diff --git a/server/gameserver/mt/MetaMgr.h b/server/gameserver/mt/MetaMgr.h
index d82225ed..776b74f3 100644
--- a/server/gameserver/mt/MetaMgr.h
+++ b/server/gameserver/mt/MetaMgr.h
@@ -133,6 +133,7 @@ namespace mt
private:
std::vector meta_tables;
+ std::string res_path_;
};
}
diff --git a/server/gameserver/mt/Param.h b/server/gameserver/mt/Param.h
index 11733531..c3aeffa7 100644
--- a/server/gameserver/mt/Param.h
+++ b/server/gameserver/mt/Param.h
@@ -1,50 +1,14 @@
#pragma once
+#include "mt/macro.h"
#include "mtb/Parameter.h"
namespace mt
{
-#define DECLARE_COMMON_HEAD(classname, base, filename, key, tbl_type) \
-class classname : public base \
-{ \
- protected: \
- friend class MetaMgr; \
- static constexpr int table_type = tbl_type; \
- static constexpr const char* prim_key = #key; \
- static constexpr const char* table_name= #filename; \
- static std::vector raw_list; \
- static std::map id_hash; \
- static std::map name_hash;
-
-#define DECLARE_ID_TABLE(classname, base, filename, key) \
-DECLARE_COMMON_HEAD(classname, base, filename, key, 1) \
- public: \
- static classname* GetById(long long id) \
- { \
- auto itr = id_hash.find(id); \
- return itr != id_hash.end() ? itr->second : nullptr; \
- };
-
-#define DECLARE_AUTO_ID_TABLE(classname, base, filename) \
- DECLARE_COMMON_HEAD(classname, base, filename, key, 0) \
- public: \
- static classname* GetById(long long id) \
- { \
- auto itr = id_hash.find(id); \
- return itr != id_hash.end() ? itr->second : nullptr; \
- };
-
-#define DECLARE_NAME_TABLE(classname, base, filename, key) \
-DECLARE_COMMON_HEAD(classname, base, filename, key, 2) \
- public: \
- static classname* GetByName(const std::string& name) \
- { \
- auto itr = name_hash.find(name); \
- return itr != name_hash.end() ? itr->second : nullptr; \
- };
-
- DECLARE_ID_TABLE(Param, mtb::Parameter, "", "")
+ DECLARE_ID_TABLE(Param, mtb::Parameter,
+ "parameter@parameter.csv",
+ "param_name")
public:
int gas_inactive_time = 10;
float kill_param = 0.0f;
diff --git a/server/gameserver/mt/macro.h b/server/gameserver/mt/macro.h
new file mode 100644
index 00000000..af98c405
--- /dev/null
+++ b/server/gameserver/mt/macro.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#define DECLARE_COMMON_HEAD(classname, base, filename, key, tbl_type) \
+class classname : public base \
+{ \
+ protected: \
+ friend class MetaMgr; \
+ static constexpr int table_type = tbl_type; \
+ static constexpr const char* prim_key = #key; \
+ static constexpr const char* table_name= #filename; \
+ static std::vector raw_list; \
+ static std::map id_hash; \
+ static std::map name_hash;
+
+#define DECLARE_ID_TABLE(classname, base, filename, key) \
+DECLARE_COMMON_HEAD(classname, base, filename, key, 1) \
+ public: \
+ static classname* GetById(long long id) \
+ { \
+ auto itr = id_hash.find(id); \
+ return itr != id_hash.end() ? itr->second : nullptr; \
+ };
+
+#define DECLARE_AUTO_ID_TABLE(classname, base, filename) \
+ DECLARE_COMMON_HEAD(classname, base, filename, key, 0) \
+ public: \
+ static classname* GetById(long long id) \
+ { \
+ auto itr = id_hash.find(id); \
+ return itr != id_hash.end() ? itr->second : nullptr; \
+ };
+
+#define DECLARE_NAME_TABLE(classname, base, filename, key) \
+DECLARE_COMMON_HEAD(classname, base, filename, key, 2) \
+ public: \
+ static classname* GetByName(const std::string& name) \
+ { \
+ auto itr = name_hash.find(name); \
+ return itr != name_hash.end() ? itr->second : nullptr; \
+ };