made 'browse mode' much more functional
browse mode is viewing the game when it's not your turn
This commit is contained in:
parent
ee5cd2890e
commit
8cacbf0e9f
4 changed files with 827 additions and 784 deletions
|
@ -122,6 +122,8 @@ void show_intro(display& screen, config& data)
|
|||
} else {
|
||||
last = false;
|
||||
}
|
||||
|
||||
screen.draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -209,31 +209,27 @@ LEVEL_RESULT play_level(game_data& gameinfo, config& terrain_config,
|
|||
SDL_Delay(500);
|
||||
} else if(!replaying && team_it->is_network()) {
|
||||
config cfg;
|
||||
|
||||
bool left_button = false, right_button = false;
|
||||
gamemap::location next_unit;
|
||||
paths current_paths;
|
||||
paths::route current_route;
|
||||
bool enemy_paths = false;
|
||||
gamemap::location last_hex, selected_hex;
|
||||
undo_list undo_stack, redo_stack;
|
||||
|
||||
for(;;) {
|
||||
network::connection res=network::receive_data(cfg,0,20);
|
||||
network::connection res = network::receive_data(cfg);
|
||||
if(res && cfg.children["turn"].empty() == false) {
|
||||
break;
|
||||
}
|
||||
|
||||
//FIXME: call a proper event handling function here
|
||||
int mousex, mousey;
|
||||
SDL_GetMouseState(&mousex,&mousey);
|
||||
|
||||
if(key[KEY_UP] || mousey == 0)
|
||||
gui.scroll(0.0,-preferences::scroll_speed());
|
||||
|
||||
if(key[KEY_DOWN] || mousey == gui.y()-1)
|
||||
gui.scroll(0.0,preferences::scroll_speed());
|
||||
|
||||
if(key[KEY_LEFT] || mousex == 0)
|
||||
gui.scroll(-preferences::scroll_speed(),0.0);
|
||||
|
||||
if(key[KEY_RIGHT] || mousex == gui.x()-1)
|
||||
gui.scroll(preferences::scroll_speed(),0.0);
|
||||
|
||||
gui.draw();
|
||||
game_events::pump();
|
||||
events::pump();
|
||||
turn_slice(gameinfo,state_of_game,status,terrain_config,
|
||||
level,video,key,gui,map,teams,player_number,
|
||||
units,left_button,right_button,next_unit,
|
||||
current_paths,current_route,enemy_paths,
|
||||
last_hex,selected_hex,undo_stack,redo_stack,
|
||||
true);
|
||||
}
|
||||
|
||||
std::cerr << "replay: '" << cfg.children["turn"].front()->write() << "'\n";
|
||||
|
|
1560
src/playturn.cpp
1560
src/playturn.cpp
File diff suppressed because it is too large
Load diff
|
@ -50,4 +50,17 @@ void play_turn(game_data& gameinfo, game_state& state_of_game,
|
|||
std::vector<team>& teams, int team_num,
|
||||
std::map<gamemap::location,unit>& units);
|
||||
|
||||
bool turn_slice(game_data& gameinfo, game_state& state_of_game,
|
||||
gamestatus& status, config& terrain_config, config* level,
|
||||
CVideo& video, CKey& key, display& gui, gamemap& map,
|
||||
std::vector<team>& teams, int team_num,
|
||||
std::map<gamemap::location,unit>& units,
|
||||
bool& left_button, bool& right_button,
|
||||
gamemap::location& next_unit, paths& current_paths,
|
||||
paths::route& current_route, bool& enemy_paths,
|
||||
gamemap::location& last_hex, gamemap::location& selected_hex,
|
||||
undo_list& undo_stack, undo_list& redo_stack,
|
||||
bool browse_only);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue