implements feature to skip mp replays for observer
(actually they are not really skipped but accelerated quite a lot)
This commit is contained in:
parent
80f9009101
commit
cb0392a6f3
17 changed files with 145 additions and 77 deletions
113
src/actions.cpp
113
src/actions.cpp
|
@ -691,7 +691,8 @@ void attack(display& gui, const gamemap& map,
|
|||
int attack_with,
|
||||
std::map<gamemap::location,unit>& units,
|
||||
const gamestatus& state,
|
||||
const game_data& info)
|
||||
const game_data& info,
|
||||
bool update_display)
|
||||
{
|
||||
//stop the user from issuing any commands while the units are fighting
|
||||
const command_disabler disable_commands;
|
||||
|
@ -804,7 +805,8 @@ void attack(display& gui, const gamemap& map,
|
|||
|
||||
bool dies = unit_display::unit_attack(gui,units,map,attacker,defender,
|
||||
damage_defender_takes,
|
||||
a->second.attacks()[attack_with]);
|
||||
a->second.attacks()[attack_with],
|
||||
update_display);
|
||||
if(hits) {
|
||||
const int defender_side = d->second.side();
|
||||
const int attacker_side = a->second.side();
|
||||
|
@ -826,10 +828,12 @@ void attack(display& gui, const gamemap& map,
|
|||
a = units.find(attacker);
|
||||
d = units.find(defender);
|
||||
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with)) >= d->second.attacks().size()) {
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
if (update_display){
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
}
|
||||
LOG_NG << "firing attack_end event\n";
|
||||
game_events::fire("attack_end",attacker,defender,dat);
|
||||
a = units.find(attacker);
|
||||
|
@ -857,10 +861,12 @@ void attack(display& gui, const gamemap& map,
|
|||
a = units.find(attacker);
|
||||
d = units.find(defender);
|
||||
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
if (update_display){
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
}
|
||||
LOG_NG << "firing attack_end event\n";
|
||||
game_events::fire("attack_end",attacker,defender,dat);
|
||||
a = units.find(attacker);
|
||||
|
@ -904,7 +910,9 @@ void attack(display& gui, const gamemap& map,
|
|||
amount_drained = stats.amount_attacker_drains;
|
||||
char buf[50];
|
||||
snprintf(buf,sizeof(buf),"%d",amount_drained);
|
||||
gui.float_label(a->first,buf,0,255,0);
|
||||
if (update_display){
|
||||
gui.float_label(a->first,buf,0,255,0);
|
||||
}
|
||||
a->second.heal(amount_drained);
|
||||
}
|
||||
}
|
||||
|
@ -958,25 +966,33 @@ void attack(display& gui, const gamemap& map,
|
|||
}
|
||||
|
||||
units.insert(std::pair<gamemap::location,unit>(loc,newunit));
|
||||
gui.draw_tile(loc.x,loc.y);
|
||||
if (update_display){
|
||||
gui.draw_tile(loc.x,loc.y);
|
||||
}
|
||||
}else{
|
||||
LOG_NG<<"unit not reanimated"<<std::endl;
|
||||
}
|
||||
}
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
if (update_display){
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
}
|
||||
break;
|
||||
} else if(hits) {
|
||||
if (stats.attacker_special == poison_string &&
|
||||
d->second.has_flag("poisoned") == false &&
|
||||
!d->second.type().not_living()) {
|
||||
gui.float_label(d->first,_("poisoned"),255,0,0);
|
||||
if (update_display){
|
||||
gui.float_label(d->first,_("poisoned"),255,0,0);
|
||||
}
|
||||
d->second.set_flag("poisoned");
|
||||
}
|
||||
|
||||
if(stats.attacker_slows && d->second.slowed() == false) {
|
||||
gui.float_label(d->first,_("slowed"),255,0,0);
|
||||
if (update_display){
|
||||
gui.float_label(d->first,_("slowed"),255,0,0);
|
||||
}
|
||||
d->second.set_flag("slowed");
|
||||
stats.damage_attacker_takes = round_damage(stats.damage_attacker_takes,1,2);
|
||||
}
|
||||
|
@ -984,7 +1000,9 @@ void attack(display& gui, const gamemap& map,
|
|||
//if the defender is turned to stone, the fight stops immediately
|
||||
static const std::string stone_string("stone");
|
||||
if (stats.attacker_special == stone_string) {
|
||||
gui.float_label(d->first,_("stone"),255,0,0);
|
||||
if (update_display){
|
||||
gui.float_label(d->first,_("stone"),255,0,0);
|
||||
}
|
||||
d->second.set_flag(stone_string);
|
||||
stats.ndefends = 0;
|
||||
stats.nattacks = 0;
|
||||
|
@ -1051,7 +1069,8 @@ void attack(display& gui, const gamemap& map,
|
|||
|
||||
bool dies = unit_display::unit_attack(gui,units,map,defender,attacker,
|
||||
damage_attacker_takes,
|
||||
d->second.attacks()[stats.defend_with]);
|
||||
d->second.attacks()[stats.defend_with],
|
||||
update_display);
|
||||
if(hits) {
|
||||
const int defender_side = d->second.side();
|
||||
const int attacker_side = a->second.side();
|
||||
|
@ -1073,10 +1092,12 @@ void attack(display& gui, const gamemap& map,
|
|||
a = units.find(attacker);
|
||||
d = units.find(defender);
|
||||
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
if (update_display){
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
}
|
||||
LOG_NG << "firing attack_end event\n";
|
||||
game_events::fire("attack_end",attacker,defender,dat);
|
||||
break;
|
||||
|
@ -1102,10 +1123,12 @@ void attack(display& gui, const gamemap& map,
|
|||
a = units.find(attacker);
|
||||
d = units.find(defender);
|
||||
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
if (update_display){
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
recalculate_fog(map,state,info,units,teams,defender_side-1);
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
}
|
||||
LOG_NG << "firing attack_end event\n";
|
||||
game_events::fire("attack_end",attacker,defender,dat);
|
||||
break;
|
||||
|
@ -1143,7 +1166,9 @@ void attack(display& gui, const gamemap& map,
|
|||
amount_drained = stats.amount_defender_drains;
|
||||
char buf[50];
|
||||
snprintf(buf,sizeof(buf),"%d",amount_drained);
|
||||
gui.float_label(d->first,buf,0,255,0);
|
||||
if (update_display){
|
||||
gui.float_label(d->first,buf,0,255,0);
|
||||
}
|
||||
d->second.heal(amount_drained);
|
||||
}
|
||||
}
|
||||
|
@ -1194,25 +1219,33 @@ void attack(display& gui, const gamemap& map,
|
|||
}
|
||||
|
||||
units.insert(std::pair<gamemap::location,unit>(loc,newunit));
|
||||
gui.draw_tile(loc.x,loc.y);
|
||||
if (update_display){
|
||||
gui.draw_tile(loc.x,loc.y);
|
||||
}
|
||||
}else{
|
||||
LOG_NG<<"unit not reanimated"<<std::endl;
|
||||
}
|
||||
}
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
if (update_display){
|
||||
gui.recalculate_minimap();
|
||||
gui.update_display();
|
||||
recalculate_fog(map,state,info,units,teams,attacker_side-1);
|
||||
}
|
||||
break;
|
||||
} else if(hits) {
|
||||
if (stats.defender_special == poison_string &&
|
||||
a->second.has_flag("poisoned") == false &&
|
||||
!a->second.type().not_living()) {
|
||||
gui.float_label(a->first,_("poisoned"),255,0,0);
|
||||
if (update_display){
|
||||
gui.float_label(a->first,_("poisoned"),255,0,0);
|
||||
}
|
||||
a->second.set_flag("poisoned");
|
||||
}
|
||||
|
||||
if(stats.defender_slows && a->second.slowed() == false) {
|
||||
gui.float_label(a->first,_("slowed"),255,0,0);
|
||||
if (update_display){
|
||||
gui.float_label(a->first,_("slowed"),255,0,0);
|
||||
}
|
||||
a->second.set_flag("slowed");
|
||||
stats.damage_defender_takes = round_damage(stats.damage_defender_takes,1,2);
|
||||
}
|
||||
|
@ -1221,7 +1254,9 @@ void attack(display& gui, const gamemap& map,
|
|||
//if the attacker is turned to stone, the fight stops immediately
|
||||
static const std::string stone_string("stone");
|
||||
if (stats.defender_special == stone_string) {
|
||||
gui.float_label(a->first,_("stone"),255,0,0);
|
||||
if (update_display){
|
||||
gui.float_label(a->first,_("stone"),255,0,0);
|
||||
}
|
||||
a->second.set_flag(stone_string);
|
||||
stats.ndefends = 0;
|
||||
stats.nattacks = 0;
|
||||
|
@ -1255,7 +1290,7 @@ void attack(display& gui, const gamemap& map,
|
|||
d->second.get_experience(defenderxp);
|
||||
}
|
||||
|
||||
if (!recorder.is_skipping()){
|
||||
if (update_display){
|
||||
gui.invalidate_unit();
|
||||
gui.invalidate(attacker);
|
||||
gui.invalidate(defender);
|
||||
|
@ -1394,7 +1429,7 @@ bool will_heal(const gamemap::location& loc, int side, const std::vector<team>&
|
|||
|
||||
void calculate_healing(display& disp, const gamestatus& status, const gamemap& map,
|
||||
std::map<gamemap::location,unit>& units, int side,
|
||||
const std::vector<team>& teams)
|
||||
const std::vector<team>& teams, bool update_display)
|
||||
{
|
||||
std::map<gamemap::location,int> healed_units, max_healing;
|
||||
|
||||
|
@ -1532,7 +1567,7 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
|
|||
unit& u = units.find(loc)->second;
|
||||
|
||||
const bool show_healing = !disp.turbo() && !recorder.is_skipping() &&
|
||||
!disp.fogged(loc.x,loc.y) &&
|
||||
!disp.fogged(loc.x,loc.y) && update_display &&
|
||||
(!u.invisible(map.underlying_union_terrain(map[h->first.x][h->first.y]),
|
||||
status.get_time_of_day().lawful_bonus,h->first,units,teams) ||
|
||||
teams[disp.viewing_team()].is_enemy(side) == false);
|
||||
|
@ -1587,8 +1622,8 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
|
|||
max_healing[h->first] >= game_config::cure_amount) {
|
||||
u.remove_flag("poisoned");
|
||||
|
||||
events::pump();
|
||||
if(show_healing) {
|
||||
events::pump();
|
||||
|
||||
sound::play_sound("heal.wav");
|
||||
SDL_Delay(DelayAmount);
|
||||
|
|
|
@ -102,7 +102,8 @@ void attack(display& gui, const gamemap& map,
|
|||
int attack_with,
|
||||
std::map<gamemap::location,unit>& units,
|
||||
const gamestatus& state,
|
||||
const game_data& info);
|
||||
const game_data& info,
|
||||
bool update_display = true);
|
||||
|
||||
//given the location of a village, will return the 0-based index of the team
|
||||
//that currently owns it, and -1 if it is unowned.
|
||||
|
@ -123,7 +124,7 @@ unit_map::const_iterator find_leader(const unit_map& units, int side);
|
|||
//at the beginning of a side's turn.
|
||||
void calculate_healing(display& disp, const gamestatus& status, const gamemap& map,
|
||||
std::map<gamemap::location,unit>& units, int side,
|
||||
const std::vector<team>& teams);
|
||||
const std::vector<team>& teams, bool update_display);
|
||||
|
||||
//function which, given the location of a unit that is advancing, and the
|
||||
//name of the unit it is advancing to, will return the advanced version of
|
||||
|
|
|
@ -366,7 +366,7 @@ void ai_interface::sync_network()
|
|||
config cfg;
|
||||
while(network::connection res = network::receive_data(cfg)) {
|
||||
std::deque<config> backlog;
|
||||
info_.turn_data_.process_network_data(cfg,res,backlog);
|
||||
info_.turn_data_.process_network_data(cfg,res,backlog,false);
|
||||
cfg.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ void enter_wait_mode(display& disp, const config& game_config, game_data& data,
|
|||
|
||||
switch (res) {
|
||||
case mp::ui::PLAY:
|
||||
play_game(disp, state, game_config, data, disp.video(), nolog, IO_CLIENT);
|
||||
play_game(disp, state, game_config, data, disp.video(), nolog, IO_CLIENT, mp::skip_mp_replay);
|
||||
recorder.clear();
|
||||
|
||||
break;
|
||||
|
@ -396,6 +396,8 @@ void enter_lobby_mode(display& disp, const config& game_config, game_data& data,
|
|||
|
||||
namespace mp {
|
||||
|
||||
bool skip_mp_replay = false;
|
||||
|
||||
void start_server(display& disp, const config& game_config, game_data& data,
|
||||
mp::controller default_controller, bool is_server)
|
||||
{
|
||||
|
|
|
@ -46,5 +46,6 @@ void start_server(display& disp, const config& game_config, game_data& data,
|
|||
void start_client(display& disp, const config& game_config, game_data& data,
|
||||
const std::string host);
|
||||
|
||||
extern bool skip_mp_replay;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -251,8 +251,8 @@ void wait::join_game(bool observe)
|
|||
network::send_data(response);
|
||||
}
|
||||
else{
|
||||
//const int res = gui::show_dialog(disp(),NULL,_("Skip replay"),_("Do you want to skip the replay?"),gui::YES_NO);
|
||||
//recorder.set_skip(res == 0);
|
||||
const int res = gui::show_dialog(disp(),NULL,_("Skip replay"),_("Do you want to skip the replay?"),gui::YES_NO);
|
||||
skip_mp_replay = (res == 0);
|
||||
}
|
||||
|
||||
generate_menu();
|
||||
|
|
|
@ -121,7 +121,7 @@ void play_replay(display& disp, game_state& state, const config& game_config,
|
|||
LEVEL_RESULT play_game(display& disp, game_state& state, const config& game_config,
|
||||
const game_data& units_data, CVideo& video,
|
||||
upload_log &log,
|
||||
io_type_t io_type)
|
||||
io_type_t io_type, bool skip_replay)
|
||||
{
|
||||
std::string type = state.campaign_type;
|
||||
if(type.empty())
|
||||
|
@ -203,7 +203,7 @@ LEVEL_RESULT play_game(display& disp, game_state& state, const config& game_conf
|
|||
if (state.label.empty())
|
||||
state.label = (*scenario)["name"];
|
||||
|
||||
LEVEL_RESULT res = play_level(units_data,game_config,scenario,video,state,story,log);
|
||||
LEVEL_RESULT res = play_level(units_data,game_config,scenario,video,state,story,log, skip_replay);
|
||||
//LEVEL_RESULT res = play_scenario(units_data,game_config,scenario,video,state,story);
|
||||
|
||||
state.snapshot = config();
|
||||
|
|
|
@ -33,7 +33,8 @@ enum io_type_t {
|
|||
LEVEL_RESULT play_game(display& disp, game_state& state, const config& game_config,
|
||||
const game_data& units_data, CVideo& video,
|
||||
upload_log &log,
|
||||
io_type_t io_type=IO_NONE);
|
||||
io_type_t io_type=IO_NONE,
|
||||
bool skip_replay = false);
|
||||
|
||||
|
||||
void play_replay(display& disp, game_state& state, const config& game_config,
|
||||
|
|
|
@ -110,7 +110,8 @@ LEVEL_RESULT play_level(const game_data& gameinfo, const config& game_config,
|
|||
config const* level, CVideo& video,
|
||||
game_state& state_of_game,
|
||||
const std::vector<config*>& story,
|
||||
upload_log &log)
|
||||
upload_log &log,
|
||||
bool skip_replay)
|
||||
{
|
||||
//if the recorder has no event, adds an "game start" event to the
|
||||
//recorder, whose only goal is to initialize the RNG
|
||||
|
@ -429,7 +430,7 @@ LEVEL_RESULT play_level(const game_data& gameinfo, const config& game_config,
|
|||
team_it->spend_gold(expense);
|
||||
}
|
||||
|
||||
calculate_healing(gui,status,map,units,player_number,teams);
|
||||
calculate_healing(gui,status,map,units,player_number,teams, !skip_replay);
|
||||
}
|
||||
|
||||
team_it->set_time_of_day(int(status.turn()),status.get_time_of_day());
|
||||
|
@ -438,7 +439,9 @@ LEVEL_RESULT play_level(const game_data& gameinfo, const config& game_config,
|
|||
|
||||
clear_shroud(gui,status,map,gameinfo,units,teams,player_number-1);
|
||||
|
||||
gui.scroll_to_leader(units, player_number);
|
||||
if (!skip_replay){
|
||||
gui.scroll_to_leader(units, player_number);
|
||||
}
|
||||
|
||||
if(replaying) {
|
||||
const hotkey::basic_handler key_events_handler(&gui);
|
||||
|
@ -473,7 +476,7 @@ redo_turn:
|
|||
try {
|
||||
play_turn(gameinfo,state_of_game,status,game_config,
|
||||
*level, key, gui, map, teams, player_number,
|
||||
units, textbox_info, replay_sender);
|
||||
units, textbox_info, replay_sender, skip_replay);
|
||||
} catch(end_turn_exception& end_turn) {
|
||||
if (end_turn.redo == player_number)
|
||||
goto redo_turn;
|
||||
|
@ -517,7 +520,6 @@ redo_turn:
|
|||
map,teams,player_number,units,
|
||||
turn_info::BROWSE_NETWORKED,
|
||||
textbox_info,replay_sender);
|
||||
|
||||
for(;;) {
|
||||
|
||||
bool have_data = false;
|
||||
|
@ -535,13 +537,16 @@ redo_turn:
|
|||
}
|
||||
|
||||
if(have_data) {
|
||||
const turn_info::PROCESS_DATA_RESULT result = turn_data.process_network_data(cfg,from,data_backlog);
|
||||
const turn_info::PROCESS_DATA_RESULT result = turn_data.process_network_data(cfg,from,data_backlog, skip_replay);
|
||||
if(result == turn_info::PROCESS_RESTART_TURN) {
|
||||
goto redo_turn;
|
||||
} else if(result == turn_info::PROCESS_END_TURN) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
skip_replay = false;
|
||||
}
|
||||
|
||||
turn_data.turn_slice();
|
||||
turn_data.send_data();
|
||||
|
|
|
@ -42,7 +42,8 @@ LEVEL_RESULT play_level(const game_data& gameinfo, const config& terrain_config,
|
|||
config const* level, CVideo& video,
|
||||
game_state& state_of_game,
|
||||
const std::vector<config*>& story,
|
||||
upload_log &log);
|
||||
upload_log &log,
|
||||
bool skip_replay);
|
||||
|
||||
namespace play{
|
||||
void place_sides_in_preferred_locations(gamemap& map, const config::child_list& sides);
|
||||
|
|
|
@ -70,7 +70,8 @@ void play_turn(const game_data& gameinfo, game_state& state_of_game,
|
|||
std::vector<team>& teams, unsigned int team_num,
|
||||
std::map<gamemap::location,unit>& units,
|
||||
turn_info::floating_textbox& textbox,
|
||||
replay_network_sender& network_sender)
|
||||
replay_network_sender& network_sender,
|
||||
bool skip_replay)
|
||||
{
|
||||
log_scope("player turn");
|
||||
|
||||
|
@ -129,7 +130,7 @@ void play_turn(const game_data& gameinfo, game_state& state_of_game,
|
|||
std::deque<config> backlog;
|
||||
|
||||
if(res != network::null_connection) {
|
||||
turn_data.process_network_data(cfg,res,backlog);
|
||||
turn_data.process_network_data(cfg,res,backlog,skip_replay);
|
||||
}
|
||||
|
||||
turn_data.turn_slice();
|
||||
|
@ -2845,7 +2846,7 @@ void turn_info::continue_move()
|
|||
move_unit_to_loc(i,i->second.get_interrupted_move(),true);
|
||||
}
|
||||
|
||||
turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg, network::connection from, std::deque<config>& backlog)
|
||||
turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg, network::connection from, std::deque<config>& backlog, bool skip_replay)
|
||||
{
|
||||
if(cfg.child("whisper") != NULL && is_observer()){
|
||||
sound::play_sound(game_config::sounds::receive_message);
|
||||
|
@ -2883,6 +2884,7 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
|
|||
|
||||
if(turn_end == false) {
|
||||
replay replay_obj(**t);
|
||||
replay_obj.set_skip(skip_replay);
|
||||
replay_obj.start_replay();
|
||||
|
||||
try {
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
//backlog.
|
||||
//data will be forwarded to all peers other than 'from', unless 'from' is null, in
|
||||
//which case data will not be forwarded
|
||||
PROCESS_DATA_RESULT process_network_data(const config& cfg,network::connection from,std::deque<config>& backlog);
|
||||
PROCESS_DATA_RESULT process_network_data(const config& cfg,network::connection from,std::deque<config>& backlog, bool skip_replay);
|
||||
|
||||
|
||||
|
||||
|
@ -257,7 +257,8 @@ void play_turn(const game_data& gameinfo, game_state& state_of_game,
|
|||
std::vector<team>& teams, unsigned int team_num,
|
||||
std::map<gamemap::location,unit>& units,
|
||||
turn_info::floating_textbox& textbox,
|
||||
replay_network_sender& network_sender);
|
||||
replay_network_sender& network_sender,
|
||||
bool skip_replay);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -191,6 +191,14 @@ void replay::set_skip(bool skip)
|
|||
|
||||
bool replay::is_skipping() const
|
||||
{
|
||||
//YogiHH, 03.03.2006
|
||||
//In multiplayer, skipping is implemented through the skip_ flag.
|
||||
//Since at_end() is always true in mp replays (process_network_data
|
||||
//creates a new replayer for every single command), we need a separate
|
||||
//condition for it
|
||||
//mp replay skipped or "skip_animation" in replay mode checked
|
||||
if (skip_) { return true; }
|
||||
//mp replay not skipped or "skip animation" in replay mode not checked
|
||||
return at_end() == false && skip_;
|
||||
}
|
||||
|
||||
|
@ -554,7 +562,7 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
|
|||
{
|
||||
log_scope("do replay");
|
||||
|
||||
const replay_source_manager replay_manager(obj);
|
||||
const replay_source_manager replaymanager(obj);
|
||||
|
||||
replay& replayer = (obj != NULL) ? *obj : recorder;
|
||||
|
||||
|
@ -898,7 +906,7 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
|
|||
if (!game_config::ignore_replay_errors) throw replay::error();
|
||||
}
|
||||
|
||||
attack(disp, map, teams, src, dst, weapon_num, units, state, gameinfo);
|
||||
attack(disp, map, teams, src, dst, weapon_num, units, state, gameinfo, !replayer.is_skipping());
|
||||
|
||||
u = units.find(src);
|
||||
tgt = units.find(dst);
|
||||
|
|
|
@ -433,7 +433,7 @@ void replay_controller::play_side(const int team_index){
|
|||
current_team.spend_gold(expense);
|
||||
}
|
||||
|
||||
calculate_healing((*gui_),status_,map_,units_,player_number_,teams_);
|
||||
calculate_healing((*gui_),status_,map_,units_,player_number_,teams_, !recorder.is_skipping());
|
||||
}
|
||||
|
||||
current_team.set_time_of_day(int(status_.turn()),status_.get_time_of_day());
|
||||
|
|
|
@ -315,10 +315,10 @@ namespace {
|
|||
|
||||
bool unit_attack_ranged(display& disp, unit_map& units,
|
||||
const gamemap::location& a, const gamemap::location& b,
|
||||
int damage, const attack_type& attack)
|
||||
int damage, const attack_type& attack, bool update_display)
|
||||
{
|
||||
const bool hide = disp.update_locked() || disp.fogged(a.x,a.y) && disp.fogged(b.x,b.y)
|
||||
|| preferences::show_combat() == false;
|
||||
|| preferences::show_combat() == false || (!update_display);
|
||||
|
||||
const unit_map::iterator att = units.find(a);
|
||||
const unit_map::iterator def = units.find(b);
|
||||
|
@ -575,7 +575,9 @@ bool unit_attack_ranged(display& disp, unit_map& units,
|
|||
|
||||
if(damage > 0 && shown_label == false) {
|
||||
shown_label = true;
|
||||
disp.float_label(b,lexical_cast<std::string>(damage),255,0,0);
|
||||
if (update_display){
|
||||
disp.float_label(b,lexical_cast<std::string>(damage),255,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
if(damage > 0 && def->second.gets_hit(damage)) {
|
||||
|
@ -592,7 +594,7 @@ bool unit_attack_ranged(display& disp, unit_map& units,
|
|||
|
||||
def->second.set_standing();
|
||||
|
||||
if(leader_loc.valid()){
|
||||
if(leader_loc.valid() && update_display){
|
||||
disp.draw_tile(leader_loc.x,leader_loc.y);
|
||||
}
|
||||
|
||||
|
@ -607,10 +609,10 @@ bool unit_attack_ranged(display& disp, unit_map& units,
|
|||
|
||||
bool unit_attack(display& disp, unit_map& units, const gamemap& map,
|
||||
const gamemap::location& a, const gamemap::location& b, int damage,
|
||||
const attack_type& attack)
|
||||
const attack_type& attack, bool update_display)
|
||||
{
|
||||
const bool hide = disp.update_locked() || disp.fogged(a.x,a.y) && disp.fogged(b.x,b.y)
|
||||
|| preferences::show_combat() == false;
|
||||
|| preferences::show_combat() == false || (!update_display);
|
||||
|
||||
if(!hide) {
|
||||
//we try to scroll the map if the unit is at the edge.
|
||||
|
@ -638,7 +640,7 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
|
|||
}
|
||||
|
||||
if(attack.range_type() == attack_type::LONG_RANGE) {
|
||||
return unit_attack_ranged(disp, units, a, b, damage, attack);
|
||||
return unit_attack_ranged(disp, units, a, b, damage, attack, update_display);
|
||||
}
|
||||
|
||||
const bool hits = damage > 0;
|
||||
|
@ -680,7 +682,9 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
|
|||
|
||||
int ticks = SDL_GetTicks();
|
||||
|
||||
disp.hide_unit(a);
|
||||
if (update_display){
|
||||
disp.hide_unit(a);
|
||||
}
|
||||
|
||||
const gamemap::TERRAIN src_terrain = map.get_terrain(a);
|
||||
const gamemap::TERRAIN dst_terrain = map.get_terrain(b);
|
||||
|
@ -828,10 +832,14 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
|
|||
|
||||
if(damage > 0 && shown_label == false) {
|
||||
shown_label = true;
|
||||
disp.float_label(b,lexical_cast<std::string>(damage),255,0,0);
|
||||
if (update_display){
|
||||
disp.float_label(b,lexical_cast<std::string>(damage),255,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
disp.hide_unit(gamemap::location());
|
||||
if (update_display){
|
||||
disp.hide_unit(gamemap::location());
|
||||
}
|
||||
|
||||
if(damage > 0 && def->second.gets_hit(damage)) {
|
||||
dead = true;
|
||||
|
@ -844,8 +852,11 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
|
|||
|
||||
disp.invalidate(a);
|
||||
disp.invalidate(b);
|
||||
if(leader_loc.valid()) {
|
||||
disp.draw_tile(leader_loc.x,leader_loc.y);
|
||||
|
||||
if (update_display){
|
||||
if(leader_loc.valid()) {
|
||||
disp.draw_tile(leader_loc.x,leader_loc.y);
|
||||
}
|
||||
}
|
||||
|
||||
def->second.set_standing();
|
||||
|
|
|
@ -39,7 +39,7 @@ void unit_die(display& disp, const gamemap::location& loc, const unit& u, const
|
|||
///playing field.
|
||||
bool unit_attack(display& disp, unit_map& units, const gamemap& map,
|
||||
const gamemap::location& a, const gamemap::location& b, int damage,
|
||||
const attack_type& attack);
|
||||
const attack_type& attack, bool update_display);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL.lib SDLmain.lib SDL_mixer.lib SDL_net.lib SDL_image.lib libintl.lib freetype.lib Ws2_32.lib fribidi.lib python24.lib /nologo /subsystem:windows /debug /machine:I386 /out:"wesnoth.exe" /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL.lib SDLmain.lib SDL_mixer.lib SDL_net.lib SDL_image.lib libintl.lib freetype.lib Ws2_32.lib fribidi.lib python24.lib /nologo /subsystem:windows /debug /machine:I386 /out:"wesnoth_work.exe" /pdbtype:sept
|
||||
|
||||
!ELSEIF "$(CFG)" == "wesnoth - Win32 Release"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue