implemented 'village gold' option in multiplayer
This commit is contained in:
parent
1e23032373
commit
327776908a
5 changed files with 20 additions and 7 deletions
|
@ -267,8 +267,8 @@ int play_multiplayer(display& disp, game_data& units_data, config cfg,
|
|||
int height=290;
|
||||
|
||||
int cur_selection = -1;
|
||||
int cur_villagegold = 2;
|
||||
int new_villagegold = 2;
|
||||
int cur_villagegold = 1;
|
||||
int new_villagegold = 1;
|
||||
int cur_turns = 50;
|
||||
int new_turns = 50;
|
||||
|
||||
|
@ -327,10 +327,10 @@ int play_multiplayer(display& disp, game_data& units_data, config cfg,
|
|||
rect.h = 12;
|
||||
//SDL_Surface* village_bg=get_surface_portion(disp.video().getSurface(), rect);
|
||||
font::draw_text(&disp,disp.screen_area(),12,font::GOOD_COLOUR,
|
||||
"Village Gold: 2",rect.x,rect.y);
|
||||
"Village Gold: 1",rect.x,rect.y);
|
||||
rect.y = (disp.y()-height)/2+147;
|
||||
rect.h = name_entry.width();
|
||||
gui::slider villagegold_slider(disp,rect,0.1);
|
||||
gui::slider villagegold_slider(disp,rect,0.0);
|
||||
|
||||
//FOG of war
|
||||
gui::button fog_game(disp,"Fog Of War",gui::button::TYPE_CHECK);
|
||||
|
@ -440,7 +440,7 @@ int play_multiplayer(display& disp, game_data& units_data, config cfg,
|
|||
|
||||
//set the number of turns here
|
||||
std::stringstream turns;
|
||||
turns << new_turns;
|
||||
turns << cur_turns;
|
||||
(*level_ptr)["turns"] = turns.str();
|
||||
}
|
||||
|
||||
|
@ -461,6 +461,10 @@ int play_multiplayer(display& disp, game_data& units_data, config cfg,
|
|||
std::vector<config*>::iterator sd;
|
||||
for(sd = sides.begin(); sd != sides.end(); ++sd) {
|
||||
|
||||
std::stringstream village_gold;
|
||||
village_gold << cur_villagegold;
|
||||
(**sd)["village_gold"] = village_gold.str();
|
||||
|
||||
if((**sd)["fog"].empty())
|
||||
(**sd)["fog"] = fog_game.checked() ? "yes" : "no";
|
||||
|
||||
|
|
|
@ -494,6 +494,8 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
|
|||
const size_t moves = move_unit(&gui_,map_,units_,teams_,
|
||||
current_route_.steps,&recorder,&undo_stack_);
|
||||
|
||||
gui_.invalidate_game_status();
|
||||
|
||||
selected_hex_ = gamemap::location();
|
||||
gui_.set_route(NULL);
|
||||
gui_.select_hex(gamemap::location());
|
||||
|
|
|
@ -29,6 +29,12 @@ team::team_info::team_info(const config& cfg)
|
|||
income = cfg["income"];
|
||||
name = cfg["name"];
|
||||
|
||||
const std::string& village_income = cfg["village_gold"];
|
||||
if(village_income.empty())
|
||||
income_per_village = game_config::tower_income;
|
||||
else
|
||||
income_per_village = atoi(village_income.c_str());
|
||||
|
||||
const std::string& aggression_val = cfg["aggression"];
|
||||
if(aggression_val.empty())
|
||||
aggression = 0.5;
|
||||
|
@ -133,7 +139,7 @@ int team::gold() const
|
|||
int team::income() const
|
||||
{
|
||||
return atoi(info_.income.c_str()) +
|
||||
towers_.size()*game_config::tower_income+game_config::base_income;
|
||||
towers_.size()*info_.income_per_village+game_config::base_income;
|
||||
}
|
||||
|
||||
void team::new_turn()
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
std::string name;
|
||||
std::string gold;
|
||||
std::string income;
|
||||
int income_per_village;
|
||||
std::set<std::string> can_recruit;
|
||||
std::vector<std::string> recruitment_pattern;
|
||||
double aggression;
|
||||
|
|
|
@ -741,7 +741,7 @@ team_data calculate_team_data(const team& tm, int side, const unit_map& units)
|
|||
res.upkeep = team_upkeep(units,side);
|
||||
res.villages = tm.towers().size();
|
||||
res.expenses = maximum<int>(0,res.upkeep - res.villages);
|
||||
res.net_income = game_config::base_income + res.villages - res.expenses;
|
||||
res.net_income = tm.income() - res.expenses;
|
||||
res.gold = tm.gold();
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue