diff --git a/data/translations/english.cfg b/data/translations/english.cfg index fa09bc79344..5317e0a9a5c 100644 --- a/data/translations/english.cfg +++ b/data/translations/english.cfg @@ -213,7 +213,7 @@ This unit illuminates the surrounding area, making lawful units fight better, an Any units adjacent to this unit will fight as if it were dusk when it is night, and as if it were day when it is dusk." -skirmisher_description="Skirmishes: +skirmisher_description="Skirmisher: This unit is skilled in moving past enemies quickly, and ignores all Enemy Zones of Control." no_leader_to_recruit="You don't have a leader to recruit with." diff --git a/images/wesnoth-icon.png b/images/wesnoth-icon.png index eb6090a61ab..9bd6cbc8062 100644 Binary files a/images/wesnoth-icon.png and b/images/wesnoth-icon.png differ diff --git a/src/display.cpp b/src/display.cpp index 824e98ffbe6..bf75478da2c 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -278,7 +278,7 @@ int display::hex_width() const double display::zoom(int amount) { - if(amount == 0) { + if(amount == 0 || !team_valid()) { return double(zoom_)/double(DefaultZoom); } @@ -2079,7 +2079,7 @@ void display::add_chat_message(const std::string& speaker, int side, const std:: if(type == MESSAGE_PUBLIC) { str << "<" << speaker << ">"; } else { - str << "*" << speaker << "*"; + str << font::NULL_MARKUP << "*" << speaker << "*"; } SDL_Color speaker_colour = {255,255,255,255}; diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp index ea6acba0be5..4deb9c3995e 100644 --- a/src/editor/editor.cpp +++ b/src/editor/editor.cpp @@ -66,7 +66,7 @@ namespace { double location_distance(const gamemap::location loc1, const gamemap::location loc2) { const double xdiff = loc1.x - loc2.x; const double ydiff = loc1.y - loc2.y; - const double dist = std::sqrt(xdiff * xdiff + ydiff * ydiff); + const double dist = sqrt(xdiff * xdiff + ydiff * ydiff); return dist; } @@ -631,8 +631,8 @@ void map_editor::perform_selection_move() { gui_.clear_highlighted_locs(); std::set new_selection; // Transfer the terrain to the new position. - for (std::set::const_iterator it = selected_hexes_.begin(); - it != selected_hexes_.end(); it++) { + std::set::const_iterator it; + for(it = selected_hexes_.begin(); it != selected_hexes_.end(); it++) { const gamemap::location hl_loc = get_hex_with_offset(*it, x_diff, y_diff); if (map_.on_board(hl_loc)) { @@ -644,8 +644,7 @@ void map_editor::perform_selection_move() { } // Fill the selection with the selected terrain. - for (std::set::const_iterator it = selected_hexes_.begin(); - it != selected_hexes_.end(); it++) { + for (it = selected_hexes_.begin(); it != selected_hexes_.end(); it++) { if (map_.on_board(*it) && new_selection.find(*it) == new_selection.end()) { undo_action.add(map_.get_terrain(*it), palette_.selected_terrain(), *it); map_.set_terrain(*it, palette_.selected_terrain()); diff --git a/src/game.cpp b/src/game.cpp index ae613a93461..427174c0ff6 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -41,6 +41,7 @@ #include "sound.hpp" #include "statistics.hpp" #include "team.hpp" +#include "titlescreen.hpp" #include "util.hpp" #include "unit_types.hpp" #include "unit.hpp" @@ -598,7 +599,11 @@ int play_game(int argc, char** argv) recorder.clear(); std::cerr << "showing title screen...\n"; - gui::TITLE_RESULT res = gui::show_title(disp); + gui::TITLE_RESULT res = gui::CONTINUE; + + while(res == gui::CONTINUE) { + res = gui::show_title(disp); + } std::cerr << "title screen returned result\n"; diff --git a/src/multiplayer_connect.cpp b/src/multiplayer_connect.cpp index 7a13fa2ead2..6b2155b4f36 100644 --- a/src/multiplayer_connect.cpp +++ b/src/multiplayer_connect.cpp @@ -282,15 +282,12 @@ void mp_connect::lists_init() config::child_iterator sd; for(sd = sides.first; sd != sides.second; ++sd) { const int team_num = sd - sides.first; - const std::string& team_name = (**sd)["team_name"]; - std::stringstream str; - str << string_table["team"] << " "; + std::string& team_name = (**sd)["team_name"]; + if(team_name.empty()) { + team_name = lexical_cast(team_num+1); + } - if(team_name.empty() == false) - str << team_name; - else - str << (team_num+1); - player_teams_.push_back(str.str()); + player_teams_.push_back(string_table["team"] + " " + team_name); } //Colors diff --git a/src/server/game.cpp b/src/server/game.cpp index 1711fc9218f..7938c0781df 100644 --- a/src/server/game.cpp +++ b/src/server/game.cpp @@ -284,15 +284,37 @@ void game::send_data(const config& data, network::connection exclude) } } +bool game::player_on_team(const std::string& team, network::connection player) const +{ + //if the player is the game host, then iterate over all the sides and if any of + //the sides controlled by the game host are on this team, then the game host + //is on this team + if(players_.empty() == false && player == players_.front()) { + const config::child_list& sides = level_.get_children("side"); + for(config::child_list::const_iterator i = sides.begin(); i != sides.end(); ++i) { + if((**i)["controller"] == "human" && (**i)["team_name"] == team) { + return true; + } + } + } + + //other hosts than the game host + const std::map::const_iterator side = sides_.find(player); + if(side != sides_.end()) { + const config* const side_cfg = level_.find_child("side","side",side->second); + if(side_cfg != NULL && (*side_cfg)["team_name"] == team) { + return true; + } + } + + return false; +} + void game::send_data_team(const config& data, const std::string& team, network::connection exclude) { - for(std::vector::const_iterator - i = players_.begin(); i != players_.end(); ++i) { - if(*i != exclude && sides_.count(*i) == 1) { - const config* const side = level_.find_child("side","side",sides_[*i]); - if(side != NULL && (*side)["team_name"] == team) { - network::send_data(data,*i); - } + for(std::vector::const_iterator i = players_.begin(); i != players_.end(); ++i) { + if(*i != exclude && player_on_team(team,*i)) { + network::send_data(data,*i); } } } diff --git a/src/server/game.hpp b/src/server/game.hpp index 853be5cff5e..43e7d24415f 100644 --- a/src/server/game.hpp +++ b/src/server/game.hpp @@ -70,6 +70,9 @@ public: private: + //function which returns true iff 'player' is on 'team'. + bool player_on_team(const std::string& team, network::connection player) const; + //function which should be called every time a player ends their turn //(i.e. [end_turn] received). This will update the 'turn' attribute for //the game's description when appropriate. Will return true if there has diff --git a/src/show_dialog.cpp b/src/show_dialog.cpp index 26ba21fa023..d06b0bc9d2f 100644 --- a/src/show_dialog.cpp +++ b/src/show_dialog.cpp @@ -800,157 +800,4 @@ network::connection network_data_dialog(display& disp, const std::string& msg, c } } -void fade_logo(display& screen, int xpos, int ypos) -{ - const scoped_sdl_surface logo(image::get_image(game_config::game_logo,image::UNSCALED)); - if(logo == NULL) { - std::cerr << "Could not find game logo\n"; - return; - } - - SDL_Surface* const fb = screen.video().getSurface(); - - if(fb == NULL || xpos < 0 || ypos < 0 || xpos + logo->w > fb->w || ypos + logo->h > fb->h) { - return; - } - - //only once, when the game is first started, the logo fades in - static bool faded_in = false; - - CKey key; - bool last_button = key[SDLK_ESCAPE] || key[SDLK_SPACE]; - - std::cerr << "fading logo in....\n"; - - std::cerr << "logo size: " << logo->w << "," << logo->h << "\n"; - - for(int x = 0; x != logo->w; ++x) { - SDL_Rect srcrect = {x,0,1,logo->h}; - SDL_Rect dstrect = {xpos+x,ypos,1,logo->h}; - - SDL_BlitSurface(logo,&srcrect,fb,&dstrect); - - update_rect(dstrect); - - if(!faded_in && (x%5) == 0) { - - const bool new_button = key[SDLK_ESCAPE] || key[SDLK_SPACE] || key[SDLK_RETURN]; - if(new_button && !last_button) { - faded_in = true; - } - - last_button = new_button; - - screen.update_display(); - - SDL_Delay(10); - - events::pump(); - } - } - - std::cerr << "logo faded in\n"; - - faded_in = true; -} - -TITLE_RESULT show_title(display& screen) -{ - cursor::set(cursor::NORMAL); - - const events::resize_lock prevent_resizing; - - const scoped_sdl_surface title_surface_unscaled(image::get_image(game_config::game_title,image::UNSCALED)); - const scoped_sdl_surface title_surface(scale_surface(title_surface_unscaled,screen.x(),screen.y())); - - if(title_surface == NULL) { - std::cerr << "Could not find title image\n"; - } else { - screen.blit_surface(0,0,title_surface); - update_rect(screen.screen_area()); - - std::cerr << "displayed title image\n"; - } - - fade_logo(screen,(game_config::title_logo_x*screen.x())/1024,(game_config::title_logo_y*screen.y())/768); - - std::cerr << "faded logo\n"; - - const std::string& version_str = string_table["version"] + " " + - game_config::version; - - const SDL_Rect version_area = font::draw_text(NULL,screen.screen_area(),10, - font::NORMAL_COLOUR,version_str,0,0); - const size_t versiony = screen.y() - version_area.h; - - if(versiony < size_t(screen.y())) { - font::draw_text(&screen,screen.screen_area(), - 10,font::NORMAL_COLOUR,version_str,0,versiony); - } - - std::cerr << "drew version number\n"; - - //members of this array must correspond to the enumeration TITLE_RESULT - static const std::string button_labels[] = { "tutorial_button", "campaign_button", "multiplayer_button", - "load_button", "language_button", "preferences", "about_button", "quit_button" }; - - static const size_t nbuttons = sizeof(button_labels)/sizeof(*button_labels); - - const int menu_xbase = (game_config::title_buttons_x*screen.x())/1024; - const int menu_xincr = 0; - const int menu_ybase = (game_config::title_buttons_y*screen.y())/768; - const int menu_yincr = 40; - const int padding = game_config::title_buttons_padding; - - std::vector