void tod_manager::add_time_area(const gamemap & map, const config& cfg) { areas_.push_back(area_time_of_day()); area_time_of_day &area = areas_.back(); area.id = cfg["id"].str(); area.xsrc = cfg["x"].str(); area.ysrc = cfg["y"].str(); area.currentTime = cfg["current_time"].to_int(0); std::vector<map_location> const& locs (map.parse_location_range(area.xsrc, area.ysrc, true)); area.hexes.insert(locs.begin(), locs.end()); time_of_day::parse_times(cfg, area.times); has_tod_bonus_changed_ = true; }
void team::build(const config& cfg, const gamemap& map, int gold) { gold_ = gold; info_.read(cfg); fog_.set_enabled(cfg["fog"].to_bool()); fog_.read(cfg["fog_data"]); shroud_.set_enabled(cfg["shroud"].to_bool()); shroud_.read(cfg["shroud_data"]); auto_shroud_updates_ = cfg["auto_shroud"].to_bool(auto_shroud_updates_); LOG_NG << "team::team(...): team_name: " << info_.team_name << ", shroud: " << uses_shroud() << ", fog: " << uses_fog() << ".\n"; // Load the WML-cleared fog. const config& fog_override = cfg.child("fog_override"); if(fog_override) { const std::vector<map_location> fog_vector = map.parse_location_range(fog_override["x"], fog_override["y"], true); fog_clearer_.insert(fog_vector.begin(), fog_vector.end()); } // To ensure some minimum starting gold, // gold is the maximum of 'gold' and what is given in the config file gold_ = std::max(gold, info_.gold); if(gold_ != info_.gold) { info_.start_gold = gold; } // Old code was doing: // info_.start_gold = std::to_string(gold) + " (" + info_.start_gold + ")"; // Was it correct? // Load in the villages the side controls at the start for(const config& v : cfg.child_range("village")) { map_location loc(v); if(map.is_village(loc)) { villages_.insert(loc); } else { WRN_NG << "[side] " << current_player() << " [village] points to a non-village location " << loc << std::endl; } } countdown_time_ = cfg["countdown_time"]; action_bonus_count_ = cfg["action_bonus_count"]; planned_actions_.reset(new wb::side_actions()); planned_actions_->set_team_index(info_.side - 1); }