1
This commit is contained in:
parent
37edea5346
commit
66b0cd9f06
31
server/gameserver/config.cc
Normal file
31
server/gameserver/config.cc
Normal file
@ -0,0 +1,31 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
void Config::Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Config::UnInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Config::GetSysParamAsInt(const std::string& param_name, int def_val)
|
||||
{
|
||||
auto itr = parameter_hash.find(param_name);
|
||||
return itr != parameter_hash.end() ? itr->second->int_val: def_val;
|
||||
}
|
||||
|
||||
double Config::GetSysParamAsFloat(const std::string& param_name, double def_val)
|
||||
{
|
||||
auto itr = parameter_hash.find(param_name);
|
||||
return itr != parameter_hash.end() ? itr->second->float_val: def_val;
|
||||
}
|
||||
|
||||
std::string Config::GetSysParamAsString(const std::string& param_name, const char* def_val)
|
||||
{
|
||||
auto itr = parameter_hash.find(param_name);
|
||||
return itr != parameter_hash.end() ? itr->second->str_val: def_val;
|
||||
}
|
97
server/gameserver/config.h
Normal file
97
server/gameserver/config.h
Normal file
@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
|
||||
#include "metadata.h"
|
||||
|
||||
class Config : public a8::Singleton<Config>
|
||||
{
|
||||
private:
|
||||
Config() {};
|
||||
friend class a8::Singleton<Config>;
|
||||
|
||||
public:
|
||||
void Init();
|
||||
void UnInit();
|
||||
|
||||
int GetSysParamAsInt(const std::string& param_name, int def_val = 0);
|
||||
double GetSysParamAsFloat(const std::string& param_name, double def_val = 0.0f);
|
||||
std::string GetSysParamAsString(const std::string& param_name, const char* def_val = "");
|
||||
|
||||
int gas_inactive_time = 10;
|
||||
float kill_param = 0.0f;
|
||||
float rank_param = 0.0f;
|
||||
int fighting_mode = 0;
|
||||
float max_oil = 0.0f;
|
||||
float max_mount_horse_distance = 100.0f;
|
||||
|
||||
int downed_relive_recover_hp = 0;
|
||||
|
||||
int level0room_shua_robot_min_time = 0;
|
||||
int level0room_shua_robot_max_time = 0;
|
||||
int level0room_shua_robot_min_num = 0;
|
||||
int level0room_shua_robot_max_num = 0;
|
||||
int level0room_die_robot_min_time = 0;
|
||||
int level0room_die_robot_max_time = 0;
|
||||
int level0room_die_robot_min_num = 0;
|
||||
int level0room_die_robot_max_num = 0;
|
||||
int level0room_robot_water = 0;
|
||||
int level0room_robot_protect_time = 0;
|
||||
int level0room_robot_autodie_time = 0;
|
||||
int level0room_robot_autodie_distance = 0;
|
||||
|
||||
int level1room_shua_robot_min_time = 0;
|
||||
int level1room_shua_robot_max_time = 0;
|
||||
int level1room_shua_robot_min_num = 0;
|
||||
int level1room_shua_robot_max_num = 0;
|
||||
int level1room_die_robot_min_time = 0;
|
||||
int level1room_die_robot_max_time = 0;
|
||||
int level1room_die_robot_min_num = 0;
|
||||
int level1room_die_robot_max_num = 0;
|
||||
int level1room_robot_water = 0;
|
||||
int level1room_robot_autodie_time = 0;
|
||||
int level1room_robot_autodie_distance = 0;
|
||||
std::string level1room_born_point;
|
||||
|
||||
double water_move_coefficient = 0.75f;
|
||||
|
||||
int view_objects_out_distance = 580;
|
||||
int view_objects_in_distance = 580;
|
||||
|
||||
int incubator_base_length = 580;
|
||||
int incubator_rand_length = 100;
|
||||
int incubator_canset_distance = 100;
|
||||
|
||||
int refresh_view_time = 8;
|
||||
|
||||
int teammate_kill_color = 0xFFFF00;
|
||||
int teammate_bekill_color = 0xFF0000;
|
||||
|
||||
int self_kill_color = 0xFFFF00;
|
||||
int self_bekill_color = 0xFF0000;
|
||||
|
||||
int map_cell_width = 64 * 8;
|
||||
int bullet_planck_step_length = 15;
|
||||
MetaData::Player* human_meta = nullptr;
|
||||
MetaData::Player* android_meta = nullptr;
|
||||
|
||||
int prebattle_can_use_skill = 0;
|
||||
int watchable = 0;
|
||||
int prebattle_combine_team = 1;
|
||||
|
||||
int match_team_time = 0;
|
||||
int match_robot_time = 0;
|
||||
int match_choose_time = 0;
|
||||
int match_lock_time = 0;
|
||||
|
||||
int dive_oxygen_total = 0;
|
||||
int dive_oxygen_consume = 0;
|
||||
int dive_hp_consume = 0;
|
||||
int dive_explosion_dmg_switch = 0;
|
||||
int inwater_oxygen_recover = 0;
|
||||
|
||||
int revive_time = 15;
|
||||
|
||||
private:
|
||||
std::list<metatable::Parameter> parameter_meta_list;
|
||||
std::list<MetaData::Parameter> parameter_list;
|
||||
std::map<std::string, MetaData::Parameter*> parameter_hash;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user