Merge branch 'master' of git://github.com/wesnoth/wesnoth
This commit is contained in:
commit
c7c69f260b
4 changed files with 12 additions and 7 deletions
|
@ -131,8 +131,9 @@ const std::string carryover::to_string(){
|
|||
return side;
|
||||
}
|
||||
|
||||
void carryover::set_gold(int gold){
|
||||
void carryover::set_gold(int gold, bool add){
|
||||
gold_ = gold;
|
||||
add_ = add;
|
||||
}
|
||||
|
||||
void carryover::to_config(config& cfg){
|
||||
|
@ -171,11 +172,12 @@ carryover_info::carryover_info(const config& cfg, bool from_snpashot)
|
|||
if(from_snpashot)
|
||||
{
|
||||
//adjust gold
|
||||
int finishing_bonus_per_turn = cfg["map_villages_num"] * side["village_gold"] + side["income"];
|
||||
//base_income is side["income"] + game_config::base_income;
|
||||
int finishing_bonus_per_turn = cfg["map_villages_num"] * side["village_gold"] + side["income"] + game_config::base_income;
|
||||
int finishing_bonus = std::max(0, finishing_bonus_per_turn * turns_left);
|
||||
if(end_level_.gold_bonus)
|
||||
{
|
||||
carryover_sides_.back().set_gold(div100rounded((finishing_bonus + side["gold"]) * end_level_.carryover_percentage));
|
||||
carryover_sides_.back().set_gold(div100rounded((finishing_bonus + side["gold"]) * end_level_.carryover_percentage), end_level_.carryover_add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,9 @@ public:
|
|||
void initialize_team(config& side_cfg);
|
||||
const std::string to_string();
|
||||
void to_config(config& cfg);
|
||||
void set_gold(int gold);
|
||||
/// @param gold sets the gold of the team, always overwrites current gold.
|
||||
/// @param add whether the gold should be added to the next scenario gold.
|
||||
void set_gold(int gold, bool add);
|
||||
private:
|
||||
bool add_;
|
||||
std::string color_;
|
||||
|
|
|
@ -1000,8 +1000,6 @@ WML_HANDLER_FUNCTION(message, event_info, cfg)
|
|||
boxes, but display the error message only if side_for is
|
||||
used for an inactive side. */
|
||||
bool side_for_show = has_input;
|
||||
if (has_input && side_for_raw != str_cast(resources::controller->current_side()))
|
||||
lg::wml_error << "[message]side_for= cannot query any user input out of turn.\n";
|
||||
|
||||
std::vector<std::string> side_for =
|
||||
utils::split(side_for_raw, ',', utils::STRIP_SPACES | utils::REMOVE_EMPTY);
|
||||
|
@ -1082,7 +1080,7 @@ WML_HANDLER_FUNCTION(message, event_info, cfg)
|
|||
}
|
||||
else
|
||||
{
|
||||
config choice = mp_sync::get_user_choice("input", msg);
|
||||
config choice = mp_sync::get_user_choice("input", msg, cfg["side_for"].to_int(0));
|
||||
option_chosen = choice["value"];
|
||||
text_input_result = choice["text"].str();
|
||||
}
|
||||
|
|
|
@ -91,6 +91,9 @@ static void show_carryover_message(saved_game& gamestate, playsingle_controller&
|
|||
gamestate.classification().campaign_type == game_classification::TEST))
|
||||
{
|
||||
gamemap map = playcontroller.get_map_const();
|
||||
// NOTE: this function uses game_config::village_income/game_config::base_income which is teh same for all teams
|
||||
// the function that actualy does the carryover (carryover.cpp) uses team.base_income() / team.village_gold() since 1.13
|
||||
// which can be different for every team
|
||||
int finishing_bonus_per_turn =
|
||||
map.villages().size() * game_config::village_income +
|
||||
game_config::base_income;
|
||||
|
|
Loading…
Add table
Reference in a new issue