Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
aginor committed Feb 29, 2016
2 parents 2a0631c + c17e144 commit dff0957
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/dialogs.cpp
Expand Up @@ -881,6 +881,7 @@ void unit_preview_pane::draw_contents()
, details_button_.location().w
, details_button_.location().h);
details_button_.set_location(button_loc);
details_button_.set_dirty(true);

SDL_Rect description_rect = sdl::create_rect(image_rect.x
, image_rect.y + image_rect.h + details_button_.location().h
Expand Down
1 change: 0 additions & 1 deletion src/game_launcher.cpp
Expand Up @@ -780,7 +780,6 @@ bool game_launcher::load_game()

if(state_.classification().campaign_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER) {
state_.unify_controllers();
gui2::show_message(video(), _("Warning") , _("This is a multiplayer scenario. Some parts of it may not work properly in single-player. It is recommended to load this scenario through the <b>Multiplayer</b> → <b>Load Game</b> dialog instead."), "", true, true);
}

if (load.cancel_orders()) {
Expand Down
12 changes: 10 additions & 2 deletions src/widgets/button.cpp
Expand Up @@ -577,17 +577,25 @@ bool button::hit(int x, int y) const
return sdl::point_in_rect(x,y,location());
}

static bool not_image(const std::string& str) { return !str.empty() && str[0] != IMAGE_PREFIX; }
static bool is_valid_image(const std::string& str) { return !str.empty() && str[0] != IMAGE_PREFIX; }

void button::set_image(const std::string& image_file)
{
if(!is_valid_image(image_file)) {
return;
}

button_image_name_ = "buttons/" + image_file;
load_images();
set_dirty();
}

void button::set_overlay(const std::string& image_file)
{
if(!is_valid_image(image_file)) {
return;
}

button_overlay_image_name_ = image_file;
load_images();
set_dirty();
Expand All @@ -600,7 +608,7 @@ void button::set_label(const std::string& val)
//if we have a list of items, use the first one that isn't an image
if (std::find(label_text_.begin(), label_text_.end(), COLUMN_SEPARATOR) != label_text_.end()) {
const std::vector<std::string>& items = utils::split(label_text_, COLUMN_SEPARATOR);
const std::vector<std::string>::const_iterator i = std::find_if(items.begin(),items.end(),not_image);
const std::vector<std::string>::const_iterator i = std::find_if(items.begin(),items.end(),is_valid_image);
if(i != items.end()) {
label_text_ = *i;
}
Expand Down

0 comments on commit dff0957

Please sign in to comment.