incorporated trunk changes to playlevel.cpp and playturn.cpp since 2006-03-09T16:32:07Z!jhinrichs
watch out, this does not compile!
This commit is contained in:
parent
48cf5672d9
commit
e433a699a6
9 changed files with 87 additions and 60 deletions
|
@ -1430,6 +1430,14 @@ bool will_heal(const gamemap::location& loc, int side, const std::vector<team>&
|
|||
|
||||
}
|
||||
|
||||
void reset_resting(std::map<gamemap::location,unit>& units, unsigned int side)
|
||||
{
|
||||
for (unit_map::iterator i = units.begin(); i != units.end(); ++i) {
|
||||
if (i->second.side() == side)
|
||||
i->second.set_resting(true);
|
||||
}
|
||||
}
|
||||
|
||||
void calculate_healing(display& disp, const gamestatus& status, const gamemap& map,
|
||||
std::map<gamemap::location,unit>& units, int side,
|
||||
const std::vector<team>& teams, bool update_display)
|
||||
|
|
|
@ -120,6 +120,10 @@ unit_map::iterator find_leader(unit_map& units, int side);
|
|||
|
||||
unit_map::const_iterator find_leader(const unit_map& units, int side);
|
||||
|
||||
// Resets resting for all units on this side: should be called after calculate_healing().
|
||||
// FIXME: Try moving this to unit::new_turn, then move it above calculate_healing().
|
||||
void reset_resting(std::map<gamemap::location,unit>& units, unsigned int side);
|
||||
|
||||
//calculates healing for all units for the given side. Should be called
|
||||
//at the beginning of a side's turn.
|
||||
void calculate_healing(display& disp, const gamestatus& status, const gamemap& map,
|
||||
|
|
|
@ -147,7 +147,7 @@ namespace gui{
|
|||
best_match = *i;
|
||||
} else {
|
||||
int j;
|
||||
while(best_match[j] == (*i)[j]) j++;
|
||||
while(toupper(best_match[j]) == toupper((*i)[j])) j++;
|
||||
best_match.erase(best_match.begin()+j,best_match.end());
|
||||
}
|
||||
matches.push_back(*i);
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace events{
|
|||
//if the unit is of level > 1, or is close to advancing, we warn the player
|
||||
//about it
|
||||
std::string message = "";
|
||||
if(u.type().level() > 1) {
|
||||
if(u.level() > 1) {
|
||||
message = _("My lord, this unit is an experienced one, having advanced levels! Do you really want to dismiss $noun?");
|
||||
} else if(u.experience() > u.max_experience()/2) {
|
||||
message = _("My lord, this unit is close to advancing a level! Do you really want to dismiss $noun?");
|
||||
|
@ -234,7 +234,7 @@ namespace events{
|
|||
continue;
|
||||
|
||||
std::stringstream row;
|
||||
row << i->second.type().language_name() << COLUMN_SEPARATOR
|
||||
row << i->second.language_name() << COLUMN_SEPARATOR
|
||||
<< i->second.description() << COLUMN_SEPARATOR
|
||||
<< i->second.hitpoints() << "/" << i->second.max_hitpoints() << COLUMN_SEPARATOR
|
||||
<< i->second.experience() << "/";
|
||||
|
@ -321,7 +321,7 @@ namespace events{
|
|||
//output the number of the side first, and this will
|
||||
//cause it to be displayed in the correct colour
|
||||
if(leader != units_.end()) {
|
||||
str << IMAGE_PREFIX << leader->second.type().image() << COLUMN_SEPARATOR
|
||||
str << IMAGE_PREFIX << leader->second.absolute_image() << COLUMN_SEPARATOR
|
||||
<< "\033[3" << lexical_cast<char, size_t>(n+1) << 'm' << leader->second.description() << COLUMN_SEPARATOR;
|
||||
} else {
|
||||
str << ' ' << COLUMN_SEPARATOR << "\033[3" << lexical_cast<char, size_t>(n+1) << "m-" << COLUMN_SEPARATOR;
|
||||
|
@ -409,7 +409,7 @@ namespace events{
|
|||
buf << side_num;
|
||||
side["side"] = buf.str();
|
||||
|
||||
for(std::map<gamemap::location,unit>::const_iterator i = units_.begin(); i != units_.end(); ++i) {
|
||||
for(units_map::const_iterator i = units_.begin(); i != units_.end(); ++i) {
|
||||
if(i->second.side() == side_num) {
|
||||
config& u = side.add_child("unit");
|
||||
i->first.write(u);
|
||||
|
@ -525,7 +525,7 @@ namespace events{
|
|||
<< prefix << type.language_name() << "\n"
|
||||
<< prefix << type.cost() << " " << sgettext("unit^Gold");
|
||||
items.push_back(description.str());
|
||||
sample_units.push_back(unit(&type,team_num));
|
||||
sample_units.push_back(unit(&gameinfo_,&units_,&map_,&status_,&teams_,&type,team_num_));
|
||||
}
|
||||
|
||||
if(sample_units.empty()) {
|
||||
|
@ -588,13 +588,16 @@ namespace events{
|
|||
|
||||
//create a unit with traits
|
||||
recorder.add_recruit(recruit_num, last_hex);
|
||||
unit new_unit(&(u_type->second),team_num,true);
|
||||
unit new_unit(&gameinfo_,&units_,&map_,&status_,&teams_,&(u_type->second),team_num_,true);
|
||||
gamemap::location loc = last_hex;
|
||||
const std::string& msg = recruit_unit(map_,team_num,units_,new_unit,loc,gui_);
|
||||
if(msg.empty()) {
|
||||
current_team.spend_gold(u_type->second.cost());
|
||||
statistics::recruit_unit(new_unit);
|
||||
|
||||
//MP_COUNTDOWN grant time bonus for recruiting
|
||||
current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
|
||||
|
||||
clear_undo_stack(team_num);
|
||||
redo_stack_.clear();
|
||||
|
||||
|
@ -651,10 +654,10 @@ namespace events{
|
|||
std::stringstream option;
|
||||
const std::string& description = u->description().empty() ? "-" : u->description();
|
||||
option << IMAGE_PREFIX << u->absolute_image() << COLUMN_SEPARATOR
|
||||
<< u->type().language_name() << COLUMN_SEPARATOR
|
||||
<< description << COLUMN_SEPARATOR
|
||||
<< u->type().level() << COLUMN_SEPARATOR
|
||||
<< u->experience() << "/";
|
||||
<< u->language_name() << COLUMN_SEPARATOR
|
||||
<< description << COLUMN_SEPARATOR
|
||||
<< u->level() << COLUMN_SEPARATOR
|
||||
<< u->experience() << "/";
|
||||
|
||||
if(u->can_advance() == false) {
|
||||
option << "-";
|
||||
|
@ -696,6 +699,7 @@ namespace events{
|
|||
unit& un = recall_list[res];
|
||||
gamemap::location loc = last_hex;
|
||||
recorder.add_recall(res,loc);
|
||||
un.set_game_context(&gameinfo_,&units_,&map_,&status_,&teams_);
|
||||
const std::string err = recruit_unit(map_,team_num,units_,un,loc,gui_);
|
||||
if(!err.empty()) {
|
||||
recorder.undo();
|
||||
|
@ -760,6 +764,11 @@ namespace events{
|
|||
|
||||
if(map_.is_village(route.front())) {
|
||||
get_village(route.front(),teams_,action.original_village_owner,units_);
|
||||
//MP_COUNTDOWN take away bonus
|
||||
if(action.countdown_time_bonus)
|
||||
{
|
||||
teams_[team_num_-1].set_action_bonus_count(teams_[team_num_-1].action_bonus_count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
action.starting_moves = u->second.movement_left();
|
||||
|
@ -767,9 +776,9 @@ namespace events{
|
|||
unit un = u->second;
|
||||
un.set_goto(gamemap::location());
|
||||
|
||||
gui_->hide_unit(u->first,true);
|
||||
u->second.set_hidden(true);
|
||||
unit_display::move_unit(*gui_,map_,route,un,status_.get_time_of_day(),units_,teams_);
|
||||
gui_->hide_unit(gamemap::location());
|
||||
u->second.set_hidden(false);
|
||||
|
||||
units_.erase(u);
|
||||
un.set_movement(starting_moves);
|
||||
|
@ -818,9 +827,10 @@ namespace events{
|
|||
} else {
|
||||
// Redo recall
|
||||
std::vector<unit>& recall_list = player->available_units;
|
||||
unit& un = recall_list[action.recall_pos];
|
||||
unit un = recall_list[action.recall_pos];
|
||||
|
||||
recorder.add_recall(action.recall_pos,action.recall_loc);
|
||||
un.set_game_context(&gameinfo_,&units_,&map_,&status_,&teams_);
|
||||
const std::string& msg = recruit_unit(map_,team_num,units_,un,action.recall_loc,gui_);
|
||||
if(msg.empty()) {
|
||||
statistics::recall_unit(un);
|
||||
|
@ -848,9 +858,9 @@ namespace events{
|
|||
unit un = u->second;
|
||||
un.set_goto(gamemap::location());
|
||||
|
||||
gui_->hide_unit(u->first,true);
|
||||
u->second.set_hidden(true);
|
||||
unit_display::move_unit(*gui_,map_,route,un,status_.get_time_of_day(),units_,teams_);
|
||||
gui_->hide_unit(gamemap::location());
|
||||
u->second.set_hidden(false);
|
||||
|
||||
units_.erase(u);
|
||||
un.set_movement(starting_moves);
|
||||
|
@ -858,6 +868,11 @@ namespace events{
|
|||
|
||||
if(map_.is_village(route.back())) {
|
||||
get_village(route.back(),teams_,un.side()-1,units_);
|
||||
//MP_COUNTDOWN restore bonus
|
||||
if(action.countdown_time_bonus)
|
||||
{
|
||||
teams_[team_num_-1].set_action_bonus_count(1 + teams_[team_num_-1].action_bonus_count());
|
||||
}
|
||||
}
|
||||
|
||||
gui_->draw_tile(route.back().x,route.back().y);
|
||||
|
@ -897,10 +912,10 @@ namespace events{
|
|||
.lawful_bonus,
|
||||
u->first, units_, teams_);
|
||||
|
||||
if(teams_[team_num - 1].is_enemy(u->second.side()) && !gui_->fogged(u->first.x,u->first.y) && !u->second.stone() && !invisible) {
|
||||
if(current_team().is_enemy(u->second.side()) && !gui_.fogged(u->first.x,u->first.y) && u->second.get_state("stoned")!="yes" && !invisible) {
|
||||
const unit_movement_resetter move_reset(u->second);
|
||||
const bool is_skirmisher = u->second.type().is_skirmisher();
|
||||
const bool teleports = u->second.type().teleports();
|
||||
const bool is_skirmisher = u->second.get_ability_bool("skirmisher",u->first);
|
||||
const bool teleports = u->second.get_ability_bool("teleport",u->first);
|
||||
unit_map units;
|
||||
units.insert(*u);
|
||||
const paths& path = paths(map_,status_,gameinfo_,ignore_units?units:units_,
|
||||
|
@ -1043,8 +1058,8 @@ namespace events{
|
|||
std::vector<unit> unit_choices;
|
||||
for(game_data::unit_type_map::const_iterator i = gameinfo_.unit_types.begin(); i != gameinfo_.unit_types.end(); ++i) {
|
||||
options.push_back(i->second.language_name());
|
||||
unit_choices.push_back(unit(&i->second,1,false));
|
||||
unit_choices.back().new_turn();
|
||||
unit_choices.push_back(unit(&gameinfo_,&units_,&map_,&status_,&teams_,&i->second,1,false));
|
||||
unit_choices.back().new_turn(gamemap::location());
|
||||
}
|
||||
|
||||
int choice = 0;
|
||||
|
@ -1125,7 +1140,7 @@ namespace events{
|
|||
const std::set<gamemap::location>* teleports = NULL;
|
||||
|
||||
std::set<gamemap::location> allowed_teleports;
|
||||
if(u.type().teleports()) {
|
||||
if(u.get_ability_bool("teleport",ui->first)) {
|
||||
allowed_teleports = vacant_villages(teams_[team_num - 1].villages(),units_);
|
||||
teleports = &allowed_teleports;
|
||||
if(teams_[team_num - 1].villages().count(ui->first))
|
||||
|
@ -1454,7 +1469,7 @@ namespace events{
|
|||
config cfg;
|
||||
i->second.write(cfg);
|
||||
cfg[name] = value;
|
||||
i->second = unit(gameinfo_,cfg);
|
||||
i->second = unit(&gameinfo_,&units_,&map_,&status_,&teams_,cfg);
|
||||
|
||||
gui_->invalidate(i->first);
|
||||
gui_->invalidate_unit();
|
||||
|
@ -1467,7 +1482,7 @@ namespace events{
|
|||
}
|
||||
|
||||
units_.erase(mousehandler.get_last_hex());
|
||||
units_.insert(std::pair<gamemap::location,unit>(mousehandler.get_last_hex(),unit(&i->second,1,false)));
|
||||
units_.insert(std::pair<gamemap::location,unit>(last_hex_,unit(&gameinfo_,&units_,&map_,&status_,&teams_,&i->second,1,false)));
|
||||
gui_->invalidate(mousehandler.get_last_hex());
|
||||
gui_->invalidate_unit();
|
||||
} else if(game_config::debug && cmd == "gold") {
|
||||
|
|
|
@ -208,7 +208,7 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse)
|
|||
attack_from.valid())) {
|
||||
if(mouseover_unit == units_.end()) {
|
||||
cursor::set(cursor::MOVE);
|
||||
} else if(current_team().is_enemy(mouseover_unit->second.side()) && !mouseover_unit->second.stone()) {
|
||||
} else if(viewing_team().is_enemy(mouseover_unit->second.side()) && mouseover_unit->second.get_state("stoned")!="yes") {
|
||||
cursor::set(cursor::ATTACK);
|
||||
} else {
|
||||
cursor::set(cursor::NORMAL);
|
||||
|
@ -233,9 +233,9 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse)
|
|||
|
||||
unit_map::const_iterator un = find_unit(selected_hex_);
|
||||
|
||||
if((new_hex != last_hex_ || attack_from.valid()) && un != units_.end() && !un->second.stone()) {
|
||||
if((new_hex != last_hex_ || attack_from.valid()) && un != units_.end() && un->second.get_state("stoned")!="yes") {
|
||||
const shortest_path_calculator calc(un->second,current_team(), visible_units(),teams_,map_,status_);
|
||||
const bool can_teleport = un->second.type().teleports();
|
||||
const bool can_teleport = un->second.get_ability_bool("teleport",un->first);
|
||||
|
||||
const std::set<gamemap::location>* teleports = NULL;
|
||||
|
||||
|
@ -265,8 +265,8 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse)
|
|||
unit un2 = un->second;
|
||||
unit_movement_resetter move_reset(un2);
|
||||
|
||||
const bool ignore_zocs = un->second.type().is_skirmisher();
|
||||
const bool teleport = un->second.type().teleports();
|
||||
const bool ignore_zocs = un->second.get_ability_bool("skirmisher",un->first);
|
||||
const bool teleport = un->second.get_ability_bool("teleport",un->first);
|
||||
current_paths_ = paths(map_,status_,gameinfo_,units_,new_hex,teams_,
|
||||
ignore_zocs,teleport,viewing_team(),path_turns_);
|
||||
gui_->highlight_reach(current_paths_);
|
||||
|
@ -381,7 +381,10 @@ void mouse_handler::mouse_press(const SDL_MouseButtonEvent& event, const int pla
|
|||
} else if(is_left_click(event) && event.state == SDL_PRESSED) {
|
||||
left_click(event, browse);
|
||||
} else if(is_right_click(event) && event.state == SDL_PRESSED) {
|
||||
if(!current_paths_.routes.empty()) {
|
||||
// FIXME: when it's not our turn, movement gets highlighted
|
||||
// merely by mousing over. This hack means we don't require a
|
||||
// two clicks to access right menu.
|
||||
if (gui_->viewing_team() == team_num_-1 && !current_paths_.routes.empty()) {
|
||||
selected_hex_ = gamemap::location();
|
||||
gui_->select_hex(gamemap::location());
|
||||
gui_->unhighlight_reach();
|
||||
|
@ -496,7 +499,7 @@ void mouse_handler::left_click(const SDL_MouseButtonEvent& event, const bool bro
|
|||
u = find_unit(attack_from);
|
||||
// enemy = find_unit(hex);
|
||||
if(u != units_.end() && u->second.side() == team_num_ &&
|
||||
enemy != units_.end() && current_team().is_enemy(enemy->second.side()) && !enemy->second.stone()) {
|
||||
enemy != units_.end() && current_team().is_enemy(enemy->second.side()) && enemy->second.get_state("stoned")!="yes") {
|
||||
if(attack_enemy(u,enemy) == false) {
|
||||
undo_ = true;
|
||||
selected_hex_ = src;
|
||||
|
@ -545,8 +548,8 @@ void mouse_handler::left_click(const SDL_MouseButtonEvent& event, const bool bro
|
|||
const unit_map::iterator it = find_unit(hex);
|
||||
|
||||
if(it != units_.end() && it->second.side() == team_num_ && !gui_->fogged(it->first.x,it->first.y)) {
|
||||
const bool ignore_zocs = it->second.type().is_skirmisher();
|
||||
const bool teleport = it->second.type().teleports();
|
||||
const bool ignore_zocs = it->second.get_ability_bool("skirmisher",it->first);
|
||||
const bool teleport = it->second.get_ability_bool("teleport",it->first);
|
||||
current_paths_ = paths(map_,status_,gameinfo_,units_,hex,teams_,
|
||||
ignore_zocs,teleport,viewing_team(),path_turns_);
|
||||
|
||||
|
@ -565,7 +568,7 @@ void mouse_handler::left_click(const SDL_MouseButtonEvent& event, const bool bro
|
|||
const std::set<gamemap::location>* teleports = NULL;
|
||||
|
||||
std::set<gamemap::location> allowed_teleports;
|
||||
if(u.type().teleports()) {
|
||||
if(u.get_ability_bool("teleport",it->first)) {
|
||||
allowed_teleports = vacant_villages(current_team().villages(),units_);
|
||||
teleports = &allowed_teleports;
|
||||
if(current_team().villages().count(it->first))
|
||||
|
@ -663,7 +666,7 @@ bool mouse_handler::attack_enemy(unit_map::iterator attacker, unit_map::iterator
|
|||
weapons.push_back(a);
|
||||
battle_stats_strings sts;
|
||||
battle_stats st = evaluate_battle_stats(map_, teams_, attacker_loc, defender_loc,
|
||||
a, units_, status_, 0, &sts);
|
||||
a, units_, status_, gameinfo_, 0, &sts);
|
||||
stats.push_back(sts);
|
||||
|
||||
simple_attack_rating weapon_rating(st);
|
||||
|
@ -744,6 +747,9 @@ bool mouse_handler::attack_enemy(unit_map::iterator attacker, unit_map::iterator
|
|||
|
||||
recorder.add_attack(attacker_loc,defender_loc,weapons[res]);
|
||||
|
||||
//MP_COUNTDOWN grant time bonus for attacking
|
||||
current_team().set_action_bonus_count(1 + current_team().action_bonus_count());
|
||||
|
||||
try {
|
||||
attack(*gui_,map_,teams_,attacker_loc,defender_loc,weapons[res],units_,status_,gameinfo_);
|
||||
} catch(end_level_exception&) {
|
||||
|
@ -776,12 +782,12 @@ void mouse_handler::show_attack_options(unit_map::const_iterator u)
|
|||
{
|
||||
team& current_team = teams_[team_num_-1];
|
||||
|
||||
if(u == units_.end() || u->second.can_attack() == false)
|
||||
if(u == units_.end() || u->second.attacks_left() == 0)
|
||||
return;
|
||||
|
||||
for(unit_map::const_iterator target = units_.begin(); target != units_.end(); ++target) {
|
||||
if(current_team.is_enemy(target->second.side()) &&
|
||||
distance_between(target->first,u->first) == 1 && !target->second.stone()) {
|
||||
distance_between(target->first,u->first) == 1 && target->second.get_state("stoned")!="yes") {
|
||||
current_paths_.routes[target->first] = paths::route();
|
||||
}
|
||||
}
|
||||
|
@ -818,8 +824,8 @@ void mouse_handler::cycle_units()
|
|||
}
|
||||
|
||||
if(it != units_.end() && !gui_->fogged(it->first.x,it->first.y)) {
|
||||
const bool ignore_zocs = it->second.type().is_skirmisher();
|
||||
const bool teleport = it->second.type().teleports();
|
||||
const bool ignore_zocs = it->second.get_ability_bool("skirmisher",it->first);
|
||||
const bool teleport = it->second.get_ability_bool("teleport",it->first);
|
||||
current_paths_ = paths(map_,status_,gameinfo_,units_,it->first,teams_,ignore_zocs,teleport,viewing_team(),path_turns_);
|
||||
gui_->highlight_reach(current_paths_);
|
||||
|
||||
|
@ -864,8 +870,8 @@ void mouse_handler::cycle_back_units()
|
|||
}
|
||||
|
||||
if(it != units_.begin() && !gui_->fogged(it->first.x,it->first.y)) {
|
||||
const bool ignore_zocs = it->second.type().is_skirmisher();
|
||||
const bool teleport = it->second.type().teleports();
|
||||
const bool ignore_zocs = it->second.get_ability_bool("skirmisher",it->first);
|
||||
const bool teleport = it->second.get_ability_bool("teleport",it->first);
|
||||
current_paths_ = paths(map_,status_,gameinfo_,units_,it->first,teams_,ignore_zocs,teleport,viewing_team(),path_turns_);
|
||||
gui_->highlight_reach(current_paths_);
|
||||
|
||||
|
|
|
@ -333,6 +333,7 @@ void play_controller::init_side(const int team_index){
|
|||
}
|
||||
|
||||
calculate_healing((*gui_),status_,map_,units_,player_number_,teams_, !recorder.is_skipping());
|
||||
reset_resting(units_, player_number_);
|
||||
}
|
||||
|
||||
current_team.set_time_of_day(int(status_.turn()),status_.get_time_of_day());
|
||||
|
@ -367,18 +368,6 @@ bool play_controller::do_replay(const bool replaying){
|
|||
return result;
|
||||
}
|
||||
|
||||
void play_controller::check_music(const bool replaying){
|
||||
if(!replaying && current_team().music().empty() == false &&
|
||||
(teams_[gui_->viewing_team()].knows_about_team(player_number_-1) || teams_[gui_->viewing_team()].has_seen(player_number_-1))) {
|
||||
LOG_NG << "playing music: '" << current_team().music() << "'\n";
|
||||
sound::play_music_repeatedly(current_team().music());
|
||||
} else if(!replaying && current_team().music().empty() == false){
|
||||
LOG_NG << "playing music: '" << game_config::anonymous_music<< "'\n";
|
||||
sound::play_music_repeatedly(game_config::anonymous_music);
|
||||
}
|
||||
// else leave old music playing, it's a scenario specific music
|
||||
}
|
||||
|
||||
void play_controller::finish_side_turn(){
|
||||
for(unit_map::iterator uit = units_.begin(); uit != units_.end(); ++uit) {
|
||||
if(uit->second.side() == player_number_)
|
||||
|
@ -537,8 +526,8 @@ void play_controller::handle_event(const SDL_Event& event)
|
|||
const unit_map::iterator u = mouse_handler_.selected_unit();
|
||||
|
||||
if(u != units_.end() && u->second.side() == player_number_) {
|
||||
const bool ignore_zocs = u->second.type().is_skirmisher();
|
||||
const bool teleport = u->second.type().teleports();
|
||||
const bool ignore_zocs = u->second.get_ability_bool("skirmisher",u->first);
|
||||
const bool teleport = u->second.get_ability_bool("teleport",u->first);
|
||||
mouse_handler_.set_current_paths(paths(map_,status_,gameinfo_,units_,u->first,
|
||||
teams_,ignore_zocs,teleport, teams_[gui_->viewing_team()],
|
||||
mouse_handler_.get_path_turns()));
|
||||
|
|
|
@ -82,7 +82,6 @@ protected:
|
|||
virtual void init_side(const int team_index);
|
||||
void place_sides_in_preferred_locations(gamemap& map, const config::child_list& sides);
|
||||
bool do_replay(const bool replaying);
|
||||
void check_music(const bool replaying);
|
||||
virtual void finish_side_turn();
|
||||
void finish_turn();
|
||||
bool clear_shroud();
|
||||
|
|
|
@ -92,8 +92,10 @@ void playmp_controller::play_human_turn(){
|
|||
}
|
||||
} else {
|
||||
// Clock time ended
|
||||
// If no turn bonus -> defeat
|
||||
if ( lexical_cast_default<int>(level_["mp_countdown_turn_bonus"],0) == 0){
|
||||
// If no turn bonus or action bonus -> defeat
|
||||
const int action_increment = lexical_cast_default<int>(level["mp_countdown_action_bonus"],0);
|
||||
if ( lexical_cast_default<int>(level["mp_countdown_turn_bonus"],0) == 0
|
||||
&& (action_increment == 0 || teams[team_num -1].action_bonus_count() == 0)) {
|
||||
// Not possible to end level in MP with throw end_level_exception(DEFEAT);
|
||||
// because remote players only notice network disconnection
|
||||
// Current solution end remaining turns automatically
|
||||
|
@ -103,7 +105,12 @@ void playmp_controller::play_human_turn(){
|
|||
turn_data_->send_data();
|
||||
throw end_turn_exception();
|
||||
} else {
|
||||
current_team().set_countdown_time(1000 * lexical_cast_default<int>(level_["mp_countdown_turn_bonus"],0));
|
||||
const int maxtime = lexical_cast_default<int>(level["mp_countdown_reservoir_time"],0);
|
||||
int secs = lexical_cast_default<int>(level["mp_countdown_turn_bonus"],0);
|
||||
secs += action_increment * teams[team_num -1].action_bonus_count();
|
||||
teams[team_num -1].set_action_bonus_count(0);
|
||||
secs = (secs > maxtime) ? maxtime : secs;
|
||||
teams[team_num -1].set_countdown_time(1000 * secs);
|
||||
recorder.add_countdown_update(current_team().countdown_time(),player_number_);
|
||||
recorder.end_turn();
|
||||
turn_data_->send_data();
|
||||
|
|
|
@ -315,7 +315,6 @@ void playsingle_controller::play_turn(){
|
|||
}
|
||||
LOG_NG << "result of replay: " << (replaying_?"true":"false") << "\n";
|
||||
}
|
||||
check_music(replaying_);
|
||||
|
||||
if (!replaying_){
|
||||
play_side(player_number_);
|
||||
|
|
Loading…
Add table
Reference in a new issue