/
playsingle_controller.cpp
704 lines (618 loc) · 21.1 KB
/
playsingle_controller.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
/*
Copyright (C) 2006 - 2015 by Joerg Hinrichs <joerg.hinrichs@alice-dsl.de>
wesnoth playlevel Copyright (C) 2003 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
/**
* @file
* Logic for single-player game.
*/
#include "playsingle_controller.hpp"
#include "actions/undo.hpp"
#include "ai/manager.hpp"
#include "ai/game_info.hpp"
#include "ai/testing.hpp"
#include "config_assign.hpp"
#include "dialogs.hpp"
#include "display_chat_manager.hpp"
#include "game_end_exceptions.hpp"
#include "game_events/manager.hpp"
#include "game_events/pump.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "hotkey_handler_sp.hpp"
#include "log.hpp"
#include "map_label.hpp"
#include "marked-up_text.hpp"
#include "playturn.hpp"
#include "random_new_deterministic.hpp"
#include "replay_helper.hpp"
#include "resources.hpp"
#include "savegame.hpp"
#include "sound.hpp"
#include "synced_context.hpp"
#include "formula_string_utils.hpp"
#include "events.hpp"
#include "save_blocker.hpp"
#include "scripting/plugins/context.hpp"
#include "soundsource.hpp"
#include "statistics.hpp"
#include "storyscreen/interface.hpp"
#include "unit.hpp"
#include "unit_animation.hpp"
#include "util.hpp"
#include "whiteboard/manager.hpp"
#include "hotkey/hotkey_item.hpp"
#include <boost/foreach.hpp>
static lg::log_domain log_aitesting("aitesting");
#define LOG_AIT LOG_STREAM(info, log_aitesting)
//If necessary, this define can be replaced with `#define LOG_AIT std::cout` to restore previous behavior
static lg::log_domain log_engine("engine");
#define ERR_NG LOG_STREAM(err, log_engine)
#define LOG_NG LOG_STREAM(info, log_engine)
static lg::log_domain log_enginerefac("enginerefac");
#define LOG_RG LOG_STREAM(info, log_enginerefac)
playsingle_controller::playsingle_controller(const config& level,
saved_game& state_of_game, const int ticks,
const config& game_config, const tdata_cache & tdata,
CVideo& video, bool skip_replay)
: play_controller(level, state_of_game, ticks, game_config, tdata, video, skip_replay)
, cursor_setter(cursor::NORMAL)
, textbox_info_()
, replay_sender_(*resources::recorder)
, network_reader_()
, turn_data_(replay_sender_, network_reader_)
, end_turn_(END_TURN_NONE)
, skip_next_turn_(false)
, mp_replay_()
{
hotkey_handler_.reset(new hotkey_handler(*this, saved_game_)); //upgrade hotkey handler to the sp (whiteboard enabled) version
// game may need to start in linger mode
linger_ = this->is_regular_game_end();
ai::game_info ai_info;
ai::manager::set_ai_info(ai_info);
ai::manager::add_observer(this) ;
plugins_context_->set_accessor_string("level_result", boost::bind(&playsingle_controller::describe_result, this));
plugins_context_->set_accessor_int("turn", boost::bind(&play_controller::turn, this));
}
std::string playsingle_controller::describe_result() const
{
if(!is_regular_game_end()) {
return "NONE";
}
else if(get_end_level_data_const().is_victory){
return "VICTORY";
}
else {
return "DEFEAT";
}
}
playsingle_controller::~playsingle_controller()
{
ai::manager::remove_observer(this) ;
ai::manager::clear_ais() ;
}
void playsingle_controller::init_gui(){
LOG_NG << "Initializing GUI... " << (SDL_GetTicks() - ticks()) << "\n";
play_controller::init_gui();
if(gamestate().first_human_team_ != -1) {
gui_->scroll_to_tile(gamestate().board_.map().starting_position(gamestate().first_human_team_ + 1), game_display::WARP);
}
gui_->scroll_to_tile(gamestate().board_.map().starting_position(1), game_display::WARP);
update_locker lock_display(gui_->video(), is_skipping_replay());
gui_->draw();
get_hotkey_command_executor()->set_button_state(*gui_);
events::raise_draw_event();
}
void playsingle_controller::report_victory(
std::ostringstream &report, team& t,
int finishing_bonus_per_turn, int turns_left, int finishing_bonus)
{
report << "<small>" << _("Remaining gold: ") << utils::half_signed_value(t.gold()) << "</small>";
if(t.carryover_bonus()) {
if (turns_left > -1) {
report << "\n\n<b>" << _("Turns finished early: ") << turns_left << "</b>\n"
<< "<small>" << _("Early finish bonus: ") << finishing_bonus_per_turn << _(" per turn") << "</small>\n"
<< "<small>" << _("Total bonus: ") << finishing_bonus << "</small>\n";
}
report << "<small>" << _("Total gold: ") << utils::half_signed_value(t.gold() + finishing_bonus) << "</small>";
}
if (t.gold() > 0) {
report << "\n<small>" << _("Carryover percentage: ") << t.carryover_percentage() << "</small>";
}
if(t.carryover_add()) {
report << "\n\n<big><b>" << _("Bonus gold: ") << utils::half_signed_value(t.carryover_gold()) << "</b></big>";
} else {
report << "\n\n<big><b>" << _("Retained gold: ") << utils::half_signed_value(t.carryover_gold()) << "</b></big>";
}
std::string goldmsg;
utils::string_map symbols;
symbols["gold"] = lexical_cast_default<std::string>(t.carryover_gold());
// Note that both strings are the same in English, but some languages will
// want to translate them differently.
if(t.carryover_add()) {
if(t.carryover_gold() > 0) {
goldmsg = vngettext(
"You will start the next scenario with $gold "
"on top of the defined minimum starting gold.",
"You will start the next scenario with $gold "
"on top of the defined minimum starting gold.",
t.carryover_gold(), symbols);
} else {
goldmsg = vngettext(
"You will start the next scenario with "
"the defined minimum starting gold.",
"You will start the next scenario with "
"the defined minimum starting gold.",
t.carryover_gold(), symbols);
}
} else {
goldmsg = vngettext(
"You will start the next scenario with $gold "
"or its defined minimum starting gold, "
"whichever is higher.",
"You will start the next scenario with $gold "
"or its defined minimum starting gold, "
"whichever is higher.",
t.carryover_gold(), symbols);
}
// xgettext:no-c-format
report << "\n" << goldmsg;
}
void playsingle_controller::play_scenario_init(const config& level) {
// At the beginning of the scenario, save a snapshot as replay_start
if(saved_game_.replay_start().empty()){
saved_game_.replay_start() = to_config();
}
start_game(level);
if( saved_game_.classification().random_mode != "" && (network::nconnections() != 0)) {
// This won't cause errors later but we should notify the user about it in case he didn't knew it.
gui2::show_transient_message(
gui_->video(),
// TODO: find a better title
_("Game Error"),
_("This multiplayer game uses an alternative random mode, if you don't know what this message means, then most likely someone is cheating or someone reloaded a corrupt game.")
);
}
return;
}
void playsingle_controller::play_scenario_main_loop()
{
LOG_NG << "starting main loop\n" << (SDL_GetTicks() - ticks()) << "\n";
// Avoid autosaving after loading, but still
// allow the first turn to have an autosave.
ai_testing::log_game_start();
if(gamestate().board_.teams().empty())
{
ERR_NG << "Playing game with 0 teams." << std::endl;
}
while(true) {
try {
play_turn();
if (is_regular_game_end()) {
return;
}
gamestate_->player_number_ = 1;
}
catch(const reset_gamestate_exception& ex) {
/**
@TODO: The mp replay feature still doesnt work properly (casues OOS) becasue:
1) The undo stack is not reset along with the gamestate (fixed).
2) The server_request_number_ is not reset along with the gamestate (fixed).
3) chat and other unsynced actions are inserted in the middle of the replay bringing the replay_pos in unorder (fixed).
4) untracked changes in side controllers are lost when resetting gamestate.
5) The game should have a stricter check for whether the loaded game is actually a parent of this game.
6) If an action was undone after a game was saved it can casue if teh undone action is in the snapshot of the saved game. (luckyli this is never the case for autosaves)
*/
reset_gamestate(*ex.level, (*ex.level)["replay_pos"]);
play_scenario_init(*ex.level);
mp_replay_.reset(new mp_replay_controller(*this));
mp_replay_->play_replay();
}
} //end for loop
}
LEVEL_RESULT playsingle_controller::play_scenario(
const config::const_child_itors &story, const config& level)
{
LOG_NG << "in playsingle_controller::play_scenario()...\n";
// Start music.
BOOST_FOREACH(const config &m, level.child_range("music")) {
sound::play_music_config(m);
}
sound::commit_music_changes();
if(!this->is_skipping_replay()) {
show_story(*gui_, get_scenario_name(), story);
}
gui_->labels().read(level);
// Read sound sources
assert(soundsources_manager_ != NULL);
BOOST_FOREACH(const config &s, level.child_range("sound_source")) {
try {
soundsource::sourcespec spec(s);
soundsources_manager_->add(spec);
} catch (bad_lexical_cast &) {
ERR_NG << "Error when parsing sound_source config: bad lexical cast." << std::endl;
ERR_NG << "sound_source config was: " << s.debug() << std::endl;
ERR_NG << "Skipping this sound source..." << std::endl;
}
}
LOG_NG << "entering try... " << (SDL_GetTicks() - ticks()) << "\n";
try {
play_scenario_init(level);
// clears level config;
this->saved_game_.remove_snapshot();
if (!is_regular_game_end() && !linger_) {
play_scenario_main_loop();
}
if (game_config::exit_at_end) {
exit(0);
}
const bool is_victory = get_end_level_data_const().is_victory;
if(gamestate().gamedata_.phase() <= game_data::PRESTART) {
sdl::draw_solid_tinted_rectangle(
0, 0, gui_->video().getx(), gui_->video().gety(), 0, 0, 0, 1.0,
gui_->video().getSurface()
);
update_rect(0, 0, gui_->video().getx(), gui_->video().gety());
}
ai_testing::log_game_end();
const end_level_data& end_level = get_end_level_data_const();
if (!end_level.transient.custom_endlevel_music.empty()) {
if (!is_victory) {
set_defeat_music_list(end_level.transient.custom_endlevel_music);
} else {
set_victory_music_list(end_level.transient.custom_endlevel_music);
}
}
if (gamestate().board_.teams().empty())
{
//store persistent teams
saved_game_.set_snapshot(config());
return LEVEL_RESULT::VICTORY; // this is probably only a story scenario, i.e. has its endlevel in the prestart event
}
if(linger_) {
LOG_NG << "resuming from loaded linger state...\n";
//as carryover information is stored in the snapshot, we have to re-store it after loading a linger state
saved_game_.set_snapshot(config());
if(!is_observer()) {
persist_.end_transaction();
}
return LEVEL_RESULT::VICTORY;
}
pump().fire(is_victory ? "victory" : "defeat");
{ // Block for set_scontext_synced_base
set_scontext_synced_base sync;
pump().fire("scenario_end");
}
if(end_level.proceed_to_next_level) {
gamestate().board_.heal_all_survivors();
}
if(is_observer()) {
gui2::show_transient_message(gui_->video(), _("Game Over"), _("The game is over."));
return LEVEL_RESULT::OBSERVER_END;
}
// If we're a player, and the result is victory/defeat, then send
// a message to notify the server of the reason for the game ending.
network::send_data(config_of
("info", config_of
("type", "termination")
("condition", "game over")
("result", is_victory ? "victory" : "defeat")
));
// Play victory music once all victory events
// are finished, if we aren't observers.
//
// Some scenario authors may use 'continue'
// result for something that is not story-wise
// a victory, so let them use [music] tags
// instead should they want special music.
const std::string& end_music = is_victory ? select_victory_music() : select_defeat_music();
if(end_music.empty() != true) {
sound::play_music_once(end_music);
}
persist_.end_transaction();
return is_victory ? LEVEL_RESULT::VICTORY : LEVEL_RESULT::DEFEAT;
} catch(const game::load_game_exception &) {
// Loading a new game is effectively a quit.
//
if ( game::load_game_exception::game != "" ) {
saved_game_ = saved_game();
}
throw;
} catch(network::error& e) {
bool disconnect = false;
if(e.socket) {
e.disconnect();
disconnect = true;
}
scoped_savegame_snapshot snapshot(*this);
savegame::ingame_savegame save(saved_game_, *gui_, preferences::save_compression_format());
save.save_game_interactive(gui_->video(), _("A network disconnection has occurred, and the game cannot continue. Do you want to save the game?"), gui::YES_NO);
if(disconnect) {
throw network::error();
} else {
return LEVEL_RESULT::QUIT;
}
}
return LEVEL_RESULT::QUIT;
}
void playsingle_controller::play_idle_loop()
{
while(!should_return_to_play_side()) {
play_slice_catch();
gui_->draw();
SDL_Delay(10);
}
}
void playsingle_controller::play_side_impl()
{
if (!skip_next_turn_) {
end_turn_ = END_TURN_NONE;
}
if(mp_replay_.get() != NULL) {
REPLAY_RETURN res = mp_replay_->play_side_impl();
if(res == REPLAY_FOUND_END_TURN) {
end_turn_ = END_TURN_SYNCED;
}
if (replay_->at_end()) {
mp_replay_.reset();
player_type_changed_ = true;
}
} else if((current_team().is_local_human() && current_team().is_proxy_human())) {
LOG_NG << "is human...\n";
// If a side is dead end the turn, but play at least side=1's
// turn in case all sides are dead
if (gamestate().board_.side_units(current_side()) == 0 && !(gamestate().board_.units().size() == 0 && current_side() == 1)) {
end_turn_ = END_TURN_REQUIRED;
}
before_human_turn();
if (end_turn_ == END_TURN_NONE) {
play_human_turn();
}
if ( !player_type_changed_ && !is_regular_game_end()) {
after_human_turn();
}
LOG_NG << "human finished turn...\n";
} else if(current_team().is_local_ai() || (current_team().is_local_human() && current_team().is_droid())) {
play_ai_turn();
} else if(current_team().is_network()) {
play_network_turn();
} else if(current_team().is_local_human() && current_team().is_idle()) {
end_turn_enable(false);
do_idle_notification();
before_human_turn();
if (end_turn_ == END_TURN_NONE) {
play_idle_loop();
}
}
else {
// we should have skipped over empty controllers before so this shouldn't be possible
ERR_NG << "Found invalid side controller " << current_team().controller().to_string() << " (" << current_team().proxy_controller().to_string() << ") for side " << current_team().side() << "\n";
}
}
void playsingle_controller::before_human_turn()
{
log_scope("player turn");
assert(!linger_);
if(end_turn_ != END_TURN_NONE || is_regular_game_end()) {
return;
}
if(init_side_done_now_) {
scoped_savegame_snapshot snapshot(*this);
savegame::autosave_savegame save(saved_game_, *gui_, preferences::save_compression_format());
save.autosave(game_config::disable_autosave, preferences::autosavemax(), preferences::INFINITE_AUTO_SAVES);
}
if(preferences::turn_bell()) {
sound::play_bell(game_config::sounds::turn_bell);
}
}
void playsingle_controller::show_turn_dialog(){
if(preferences::turn_dialog() && !is_regular_game_end() ) {
blindfold b(*gui_, true); //apply a blindfold for the duration of this dialog
gui_->redraw_everything();
gui_->recalculate_minimap();
std::string message = _("It is now $name|’s turn");
utils::string_map symbols;
symbols["name"] = gamestate().board_.teams()[current_side() - 1].current_player();
message = utils::interpolate_variables_into_string(message, &symbols);
gui2::show_transient_message(gui_->video(), "", message);
}
}
void playsingle_controller::execute_gotos()
{
if(should_return_to_play_side())
{
return;
}
try
{
menu_handler_.execute_gotos(mouse_handler_, current_side());
}
catch (const return_to_play_side_exception&)
{
}
}
void playsingle_controller::play_human_turn() {
show_turn_dialog();
if (!preferences::disable_auto_moves()) {
execute_gotos();
}
end_turn_enable(true);
while(!should_return_to_play_side()) {
check_objectives();
play_slice_catch();
gui_->draw();
}
}
void playsingle_controller::linger()
{
LOG_NG << "beginning end-of-scenario linger\n";
linger_ = true;
// If we need to set the status depending on the completion state
// the key to it is here.
gui_->set_game_mode(game_display::LINGER_SP);
// change the end-turn button text to its alternate label
gui_->get_theme().refresh_title2("button-endturn", "title2");
gui_->invalidate_theme();
gui_->redraw_everything();
// End all unit moves
gamestate().board_.set_all_units_user_end_turn();
try {
// Same logic as single-player human turn, but
// *not* the same as multiplayer human turn.
end_turn_enable(true);
end_turn_ = END_TURN_NONE;
while(end_turn_ == END_TURN_NONE) {
play_slice();
gui_->draw();
}
} catch(const game::load_game_exception &) {
// Loading a new game is effectively a quit.
if ( game::load_game_exception::game != "" ) {
saved_game_ = saved_game();
}
throw;
}
// revert the end-turn button text to its normal label
gui_->get_theme().refresh_title2("button-endturn", "title");
gui_->invalidate_theme();
gui_->redraw_everything();
gui_->set_game_mode(game_display::RUNNING);
LOG_NG << "ending end-of-scenario linger\n";
}
void playsingle_controller::end_turn_enable(bool enable)
{
gui_->enable_menu("endturn", enable);
get_hotkey_command_executor()->set_button_state(*gui_);
}
void playsingle_controller::after_human_turn()
{
// Clear moves from the GUI.
gui_->set_route(NULL);
gui_->unhighlight_reach();
}
void playsingle_controller::play_ai_turn()
{
LOG_NG << "is ai...\n";
end_turn_enable(false);
gui_->recalculate_minimap();
const cursor::setter cursor_setter(cursor::WAIT);
// Correct an oddball case where a human could have left delayed shroud
// updates on before giving control to the AI. (The AI does not bother
// with the undo stack, so it cannot delay shroud updates.)
team & cur_team = current_team();
if ( !cur_team.auto_shroud_updates() ) {
// We just took control, so the undo stack is empty. We still need
// to record this change for the replay though.
synced_context::run_and_store("auto_shroud", replay_helper::get_auto_shroud(true));
}
undo_stack().clear();
turn_data_.send_data();
try {
try {
ai::manager::play_turn(current_side());
}
catch (return_to_play_side_exception&) {
}
catch (fallback_ai_to_human_exception&) {
current_team().make_human();
player_type_changed_ = true;
}
}
catch(...) {
turn_data_.sync_network();
throw;
}
if(!should_return_to_play_side()) {
end_turn_ = END_TURN_REQUIRED;
}
turn_data_.sync_network();
gui_->recalculate_minimap();
gui_->invalidate_unit();
gui_->invalidate_game_status();
gui_->invalidate_all();
gui_->draw();
}
/**
* Will handle sending a networked notification in descendent classes.
*/
void playsingle_controller::do_idle_notification()
{
gui_->get_chat_manager().add_chat_message(time(NULL), "Wesnoth", 0,
"This side is in an idle state. To proceed with the game, the host must assign it to another controller.",
events::chat_handler::MESSAGE_PUBLIC, false);
}
/**
* Will handle networked turns in descendent classes.
*/
void playsingle_controller::play_network_turn()
{
// There should be no networked sides in single-player.
ERR_NG << "Networked team encountered by playsingle_controller." << std::endl;
}
void playsingle_controller::handle_generic_event(const std::string& name){
if (name == "ai_user_interact"){
play_slice(false);
}
}
void playsingle_controller::end_turn(){
if (linger_)
end_turn_ = END_TURN_REQUIRED;
else if (!is_browsing() && menu_handler_.end_turn(current_side())){
end_turn_ = END_TURN_REQUIRED;
}
}
void playsingle_controller::force_end_turn(){
skip_next_turn_ = true;
end_turn_ = END_TURN_REQUIRED;
}
void playsingle_controller::check_objectives()
{
const team &t = gamestate().board_.teams()[gui_->viewing_team()];
if (!is_regular_game_end() && !is_browsing() && t.objectives_changed()) {
dialogs::show_objectives(get_scenario_name().str(), t.objectives());
t.reset_objectives_changed();
}
}
bool playsingle_controller::is_host() const
{
return turn_data_.is_host();
}
void playsingle_controller::maybe_linger()
{
// mouse_handler expects at least one team for linger mode to work.
assert(is_regular_game_end());
if (get_end_level_data_const().transient.linger_mode && !gamestate().board_.teams().empty()) {
linger();
}
}
void playsingle_controller::sync_end_turn()
{
//We cannot add [end_turn] to the recorder while executing another action.
assert(synced_context::synced_state() == synced_context::UNSYNCED);
if(end_turn_ == END_TURN_REQUIRED && current_team().is_local())
{
//TODO: we shodul also send this immideateley.
resources::recorder->end_turn();
end_turn_ = END_TURN_SYNCED;
}
assert(end_turn_ == END_TURN_SYNCED);
skip_next_turn_ = false;
}
void playsingle_controller::update_viewing_player()
{
//Update viewing team in case it has changed during the loop.
if(int side_num = play_controller::find_last_visible_team()) {
if(side_num != this->gui_->viewing_side()) {
update_gui_to_player(side_num - 1);
}
}
}