Newbie Spellweaver
- Joined
- Jun 19, 2021
- Messages
- 78
- Reaction score
- 3
Pls help me understand how to config these:
You must be registered to see links
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
bool CountryBattleMan::Initialize(bool arrange_country_by_zoneid)
{
char domain2_type = DOMAIN2_TYPE_SINGLE;
if(arrange_country_by_zoneid) domain2_type = DOMAIN2_TYPE_CROSS;
//µ¼ÈëdomainÊý¾Ý
if(!InitDomainInfo(domain2_type)) return false;
//_status = ST_OPEN;
_servers.clear();
Conf* conf = Conf::GetInstance();
std::string key = "COUNTRYBATTLE";
_occupation_fac_list.clear();
for(unsigned int i = 0; i < MAX_OCCUPATION_CNT; ++i) {
OccupationFactor factor;
std::string num = "";
std::stringstream ss;
ss << i;
ss >> num;
std::string value = conf->find(key, "occupation" + num);
int n = sscanf(value.c_str(), "%f;%f;%f;%f;%f;%f",
&factor.win_fac, &factor.fail_fac, &factor.attend_time_fac, &factor.kill_cnt_fac, &factor.death_cnt_fac, &factor.combat_time_fac);
if(n != 6) {
Log::log( LOG_ERR, "InitCountryBattle, occupations factor error." );
return false;
}
_occupation_fac_list.push_back(factor);
}
_bonus_limit.score_limit = atof(conf->find(key, "score_limit").c_str());
_bonus_limit.win_cnt_limit = atoi(conf->find(key, "win_count_limit").c_str());
_bonus_limit.death_cnt_limit = atoi(conf->find(key, "death_count_limit").c_str());
_bonus_limit.combat_time_limit = atoi(conf->find(key, "combat_time_limit").c_str());
_bonus_limit.contribute_val_limit = atoi(conf->find(key, "contribute_val_limit").c_str());
_bonus_limit.total_bonus = atoi(conf->find(key, "total_bonus").c_str());
if(arrange_country_by_zoneid) {
_arrange_country_type = ARRANGE_COUNTRY_BY_ZONEID;
std::vector<int> zone_list;
CentralDeliveryServer::GetInstance()->GetAcceptedZone(zone_list);
//¿ç·þ¹úÕ½£¬¹ú¼ÒÊýÁ¿Ó¦¸ÃÔÚ[2, COUNTRY_MAX_CNT]Ö®¼ä
if(zone_list.size() < 2 || zone_list.size() > COUNTRY_MAX_CNT) {
return false;
}
for(unsigned int i = 0; i < zone_list.size(); ++i) {
int zoneid = zone_list;
_zone_country_map[zoneid] = 0;
}
} else {
_arrange_country_type = ARRANGE_COUNTRY_RANDOM;
}
std::string open_day_str = conf->find(key, "open_day");
std::vector<string> open_day_list;
if(!ParseStrings(open_day_str, open_day_list)) {
Log::log( LOG_ERR, "InitCountryBattle, open_day error." );
return false;
}
if(open_day_list.size() > WEEK_DAY_CNT) {
Log::log( LOG_ERR, "InitCountryBattle, open_day_list count is invalid." );
return false;
}
for(unsigned int i = 0; i < open_day_list.size(); ++i) {
int day = atoi(open_day_list.c_str());
if(day < 0 || day >= WEEK_DAY_CNT) {
Log::log( LOG_ERR, "InitCountryBattle, open_day is invalid." );
return false;
}
_open_days[day] = 1;
}
IntervalTimer::Attach(this, 1000000/IntervalTimer::Resolution());
LOG_TRACE( "CountryBattle Init Successfully!!\n");
return true;
}