rebalanced 'Valley of Death' and 'Ford of Abez'. Made 'Skip AI Moves' option
This commit is contained in:
parent
0f9214b565
commit
c34a31cfa4
17 changed files with 149 additions and 107 deletions
|
@ -48,6 +48,10 @@ Defeat:
|
|||
recruit=Cavalry,Swordsman,Spearman,Red Mage,Ogre,Duelist
|
||||
[ai]
|
||||
recruitment_pattern=scout,fighter,fighter,fighter,mixed fighter
|
||||
aggression=1.0
|
||||
caution=-5.0
|
||||
grouping=no
|
||||
leader_value=100
|
||||
[/ai]
|
||||
gold=200
|
||||
income=50
|
||||
|
@ -77,7 +81,7 @@ Defeat:
|
|||
description=Gaga-Breuk
|
||||
side=3
|
||||
canrecruit=1
|
||||
team_name=bad
|
||||
team_name=orcs
|
||||
#ifdef EASY
|
||||
recruit=Orcish Warrior,Orcish Crossbow,Wolf Rider
|
||||
#endif
|
||||
|
@ -92,6 +96,9 @@ Defeat:
|
|||
|
||||
gold=200
|
||||
[ai]
|
||||
aggression=1.0
|
||||
caution=-4.0
|
||||
grouping=no
|
||||
recruitment_pattern=scout,fighter,fighter
|
||||
|
||||
leader_value=100
|
||||
|
@ -104,6 +111,31 @@ Defeat:
|
|||
[/ai]
|
||||
[/side]
|
||||
|
||||
[side]
|
||||
side=4
|
||||
team_name=creature
|
||||
type=Sea Serpent
|
||||
[ai]
|
||||
aggression=1.0
|
||||
caution=-4.0
|
||||
grouping=no
|
||||
[avoid]
|
||||
x=1-100
|
||||
y=21-100
|
||||
[/avoid]
|
||||
[avoid]
|
||||
x=1-100
|
||||
y=1-12
|
||||
[/avoid]
|
||||
#target Konrad especially heavily
|
||||
[target]
|
||||
description=Konrad
|
||||
value=100
|
||||
[/target]
|
||||
village_value=0
|
||||
[/ai]
|
||||
[/side]
|
||||
|
||||
{OBJ_TRIDENT_STORM 16 17 ford_trident}
|
||||
|
||||
#if the player dares attack Li'sar's escort, they are pounced on by
|
||||
|
@ -130,7 +162,7 @@ Defeat:
|
|||
name=turn 5
|
||||
[command]
|
||||
[unit]
|
||||
side=3
|
||||
side=4
|
||||
type=Sea Serpent
|
||||
x=1
|
||||
y=15
|
||||
|
@ -138,7 +170,7 @@ Defeat:
|
|||
|
||||
#define SEA_CREATURE
|
||||
[unit]
|
||||
side=3
|
||||
side=4
|
||||
type=Cuttle Fish
|
||||
x=1
|
||||
y=15
|
||||
|
|
|
@ -58,7 +58,7 @@ Defeat:
|
|||
team_name=undead
|
||||
|
||||
{VOD_AI_PARMS}
|
||||
{GOLD 250 500 500}
|
||||
{GOLD 200 300 500}
|
||||
|
||||
#ifdef EASY
|
||||
recruit=Skeleton,Revenant,Blood Bat,Ghost,Bone Shooter
|
||||
|
@ -124,7 +124,7 @@ Defeat:
|
|||
side=4
|
||||
canrecruit=1
|
||||
{VOD_AI_PARMS}
|
||||
{GOLD 200 500 500}
|
||||
{GOLD 150 300 500}
|
||||
|
||||
#ifdef EASY
|
||||
recruit=Walking Corpse,Wraith,Bone Shooter,Revenant,Skeleton
|
||||
|
|
|
@ -534,6 +534,7 @@ speak_allies_only="Send to allies only"
|
|||
speed="Speed:"
|
||||
speed_normal="Normal"
|
||||
speed_turbo="Accelerated Speed"
|
||||
skip_ai_moves="Skip AI Moves"
|
||||
|
||||
grid_button="Show Grid"
|
||||
floating_labels_button="Show floating labels"
|
||||
|
@ -780,5 +781,11 @@ tip_of_day31="Units are healed when they advance a level. Used wisely, this can
|
|||
tip_of_day32="Charging units are best used against enemies they can kill with a single blow."
|
||||
|
||||
tome="-- The Tome of Wesnoth"
|
||||
next_tip="More"
|
||||
|
||||
enemy="Enemy"
|
||||
ally="Allied"
|
||||
owned="Owned"
|
||||
neutral="Neutral"
|
||||
|
||||
[/language]
|
||||
|
|
|
@ -863,7 +863,7 @@ void attack(display& gui, const gamemap& map,
|
|||
gui.invalidate_unit();
|
||||
}
|
||||
|
||||
int village_owner(const gamemap::location& loc, std::vector<team>& teams)
|
||||
int village_owner(const gamemap::location& loc, const std::vector<team>& teams)
|
||||
{
|
||||
for(size_t i = 0; i != teams.size(); ++i) {
|
||||
if(teams[i].owns_village(loc))
|
||||
|
@ -1648,8 +1648,8 @@ size_t move_unit(display* disp, const game_data& gamedata,
|
|||
orig_village_owner = village_owner(steps.back(),teams);
|
||||
|
||||
if(orig_village_owner != team_num) {
|
||||
get_village(steps.back(),teams,team_num,units);
|
||||
ui->second.set_movement(0);
|
||||
get_village(steps.back(),teams,team_num,units);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void attack(display& gui, const gamemap& map,
|
|||
|
||||
//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.
|
||||
int village_owner(const gamemap::location& loc, std::vector<team>& teams);
|
||||
int village_owner(const gamemap::location& loc, const std::vector<team>& teams);
|
||||
|
||||
//makes it so the village at the given location is owned by the given
|
||||
//0-based team number
|
||||
|
|
26
src/ai.cpp
26
src/ai.cpp
|
@ -22,6 +22,7 @@
|
|||
#include "pathfind.hpp"
|
||||
#include "playlevel.hpp"
|
||||
#include "playturn.hpp"
|
||||
#include "preferences.hpp"
|
||||
#include "replay.hpp"
|
||||
#include "show_dialog.hpp"
|
||||
#include "statistics.hpp"
|
||||
|
@ -117,7 +118,7 @@ bool ai_interface::recruit(const std::string& unit_name, location loc)
|
|||
unit new_unit(&u->second,info_.team_num,true);
|
||||
|
||||
//see if we can actually recruit (i.e. have enough room etc)
|
||||
if(recruit_unit(info_.map,info_.team_num,info_.units,new_unit,loc,&info_.disp).empty()) {
|
||||
if(recruit_unit(info_.map,info_.team_num,info_.units,new_unit,loc,preferences::show_ai_moves() ? &info_.disp : NULL).empty()) {
|
||||
statistics::recruit_unit(new_unit);
|
||||
current_team().spend_gold(u->second.cost());
|
||||
|
||||
|
@ -214,15 +215,19 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
|
|||
return to;
|
||||
}
|
||||
|
||||
const bool show_move = preferences::show_ai_moves();
|
||||
|
||||
const bool ignore_zocs = u_it->second.type().is_skirmisher();
|
||||
const bool teleport = u_it->second.type().teleports();
|
||||
paths current_paths = paths(info_.map,info_.state,info_.gameinfo,info_.units,from,info_.teams,ignore_zocs,teleport);
|
||||
paths current_paths(info_.map,info_.state,info_.gameinfo,info_.units,from,info_.teams,ignore_zocs,teleport);
|
||||
paths_wiper wiper(info_.disp);
|
||||
|
||||
if(!info_.disp.fogged(from.x,from.y))
|
||||
info_.disp.set_paths(¤t_paths);
|
||||
if(show_move) {
|
||||
if(!info_.disp.fogged(from.x,from.y))
|
||||
info_.disp.set_paths(¤t_paths);
|
||||
|
||||
info_.disp.scroll_to_tiles(from.x,from.y,to.x,to.y);
|
||||
info_.disp.scroll_to_tiles(from.x,from.y,to.x,to.y);
|
||||
}
|
||||
|
||||
unit current_unit = u_it->second;
|
||||
info_.units.erase(u_it);
|
||||
|
@ -268,7 +273,10 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
|
|||
}
|
||||
|
||||
steps.push_back(to); //add the destination to the steps
|
||||
unit_display::move_unit(info_.disp,info_.map,steps,current_unit);
|
||||
|
||||
if(show_move) {
|
||||
unit_display::move_unit(info_.disp,info_.map,steps,current_unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,8 +286,10 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
|
|||
get_village(to,info_.teams,info_.team_num-1,info_.units);
|
||||
}
|
||||
|
||||
info_.disp.draw_tile(to.x,to.y);
|
||||
info_.disp.draw();
|
||||
if(show_move) {
|
||||
info_.disp.draw_tile(to.x,to.y);
|
||||
info_.disp.draw();
|
||||
}
|
||||
|
||||
game_events::fire("moveto",to);
|
||||
|
||||
|
|
|
@ -520,7 +520,7 @@ double ai::attack_analysis::rating(double aggression, ai& ai_obj) const
|
|||
aggression = -4.0;
|
||||
}
|
||||
|
||||
double value = chance_to_kill*target_value - avg_losses;
|
||||
double value = chance_to_kill*target_value - avg_losses*(1.0-aggression);
|
||||
|
||||
if(terrain_quality > alternative_terrain_quality) {
|
||||
//this situation looks like it might be a bad move: we are moving our attackers out
|
||||
|
|
|
@ -331,57 +331,4 @@ int show_file_chooser_dialog(display &disp, std::string &filename,
|
|||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct next_tip_handler : public gui::dialog_button_action
|
||||
{
|
||||
next_tip_handler() : show_next_tip(false)
|
||||
{}
|
||||
|
||||
RESULT button_pressed(int menu_selection) { show_next_tip = true; return CLOSE_DIALOG; }
|
||||
|
||||
bool show_next_tip;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void tip_of_day(display& disp, int tip)
|
||||
{
|
||||
if(preferences::show_tip_of_day() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
int ntips = 0;
|
||||
while(ntips < 1000 && string_table["tip_of_day" + lexical_cast<std::string>(ntips+1)] != "") {
|
||||
++ntips;
|
||||
}
|
||||
|
||||
if(ntips == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const scoped_sdl_surface image(image::get_image("misc/item-sceptreoffire.png",image::UNSCALED));
|
||||
|
||||
std::vector<gui::check_item> checks;
|
||||
checks.push_back(gui::check_item(string_table["no_tip_of_day"],false));
|
||||
|
||||
next_tip_handler next_handler;
|
||||
|
||||
std::vector<gui::dialog_button> buttons;
|
||||
buttons.push_back(gui::dialog_button(&next_handler,string_table["show_next_tip"]));
|
||||
|
||||
if(tip <= 0 || tip > ntips) {
|
||||
tip = (rand()%ntips) + 1;
|
||||
}
|
||||
|
||||
gui::show_dialog(disp,image,string_table["tip_of_day"],string_table["tip_of_day" + lexical_cast<std::string>(tip)],gui::CLOSE_ONLY,
|
||||
NULL,NULL,string_table["show_next_tip"],NULL,NULL,&checks,-1,-1,NULL,&buttons);
|
||||
|
||||
preferences::set_show_tip_of_day(checks.front().checked == false);
|
||||
|
||||
if(next_handler.show_next_tip) {
|
||||
tip_of_day(disp,(tip%ntips) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
} //end namespace dialogs
|
||||
|
|
|
@ -57,10 +57,6 @@ void unit_speak(const config& message_info, display& disp, const unit_map& units
|
|||
int show_file_chooser_dialog(display &displ, std::string &filename,
|
||||
const std::string title="Choose a File",
|
||||
int xloc=-1, int yloc=-1);
|
||||
|
||||
/// Show a dialog showing a randomly selected 'tip of the day'
|
||||
void tip_of_day(display& disp, int tip=-1);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -695,8 +695,9 @@ int play_game(int argc, char** argv)
|
|||
std::cerr << (SDL_GetTicks() - start_ticks) << "\n";
|
||||
gui::TITLE_RESULT res = loaded_game.empty() ? gui::TITLE_CONTINUE : gui::LOAD_GAME;
|
||||
|
||||
int ntip = -1;
|
||||
while(res == gui::TITLE_CONTINUE) {
|
||||
res = gui::show_title(disp);
|
||||
res = gui::show_title(disp,&ntip);
|
||||
}
|
||||
|
||||
std::cerr << "title screen returned result\n";
|
||||
|
@ -712,6 +713,10 @@ int play_game(int argc, char** argv)
|
|||
|
||||
loaded_game = "";
|
||||
|
||||
if(game == "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
load_game(units_data,game,state);
|
||||
if(state.version != game_config::version) {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "sound.hpp"
|
||||
#include "statistics.hpp"
|
||||
#include "tooltips.hpp"
|
||||
#include "unit_display.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -503,8 +504,6 @@ redo_turn:
|
|||
if(level->values["objectives"].empty() == false) {
|
||||
dialogs::show_objectives(gui,*level);
|
||||
}
|
||||
|
||||
dialogs::tip_of_day(gui);
|
||||
}
|
||||
|
||||
play_turn(gameinfo,state_of_game,status,game_config,
|
||||
|
@ -522,8 +521,6 @@ redo_turn:
|
|||
|
||||
const cursor::setter cursor_setter(cursor::WAIT);
|
||||
|
||||
update_locker lock(gui,!preferences::show_ai_moves());
|
||||
|
||||
turn_info turn_data(gameinfo,state_of_game,status,
|
||||
game_config,level,key,gui,
|
||||
map,teams,player_number,units,
|
||||
|
|
|
@ -358,14 +358,13 @@ bool show_combat()
|
|||
}
|
||||
|
||||
bool show_ai_moves()
|
||||
{
|
||||
return prefs["show_ai_moves"] != "no";
|
||||
}
|
||||
|
||||
void set_show_ai_moves(bool value)
|
||||
{
|
||||
//there is currently a bug with not showing ai moves where
|
||||
//any dialogs that pop up during the ai's turn will not be shown,
|
||||
//due to the display being locked. Thus for the moment, we always
|
||||
//show ai moves.
|
||||
return true;
|
||||
|
||||
//return prefs["show_ai_moves"] != "no";
|
||||
prefs["show_ai_moves"] = value ? "yes" : "no";
|
||||
}
|
||||
|
||||
void set_show_side_colours(bool value)
|
||||
|
@ -550,28 +549,29 @@ void show_preferences_dialog(display& disp)
|
|||
scroll_slider.set_max(100);
|
||||
scroll_slider.set_value(scroll_speed());
|
||||
|
||||
gui::button fullscreen_button(disp,string_table["full_screen"],
|
||||
gui::button::TYPE_CHECK);
|
||||
gui::button fullscreen_button(disp,string_table["full_screen"],gui::button::TYPE_CHECK);
|
||||
|
||||
fullscreen_button.set_check(fullscreen());
|
||||
|
||||
fullscreen_button.set_location(slider_left,sound_pos + 80);
|
||||
|
||||
gui::button turbo_button(disp,string_table["speed_turbo"],
|
||||
gui::button::TYPE_CHECK);
|
||||
gui::button turbo_button(disp,string_table["speed_turbo"],gui::button::TYPE_CHECK);
|
||||
turbo_button.set_check(turbo());
|
||||
|
||||
turbo_button.set_location(slider_left,sound_pos + 80 + 50);
|
||||
|
||||
gui::button grid_button(disp,string_table["grid_button"],
|
||||
gui::button::TYPE_CHECK);
|
||||
gui::button show_ai_moves_button(disp,string_table["skip_ai_moves"],gui::button::TYPE_CHECK);
|
||||
show_ai_moves_button.set_check(!show_ai_moves());
|
||||
show_ai_moves_button.set_location(slider_left,sound_pos + 80 + 100);
|
||||
|
||||
gui::button grid_button(disp,string_table["grid_button"],gui::button::TYPE_CHECK);
|
||||
grid_button.set_check(grid());
|
||||
|
||||
grid_button.set_location(slider_left,sound_pos + 80 + 100);
|
||||
grid_button.set_location(slider_left,sound_pos + 80 + 150);
|
||||
|
||||
gui::button floating_labels_button(disp,string_table["floating_labels_button"],gui::button::TYPE_CHECK);
|
||||
floating_labels_button.set_check(show_floating_labels());
|
||||
floating_labels_button.set_location(slider_left,sound_pos + 80 + 150);
|
||||
floating_labels_button.set_location(slider_left,sound_pos + 80 + 200);
|
||||
|
||||
gui::button resolution_button(disp,string_table["video_mode"]);
|
||||
resolution_button.set_location(slider_left,sound_pos + 80 + 250);
|
||||
|
@ -624,6 +624,7 @@ void show_preferences_dialog(display& disp)
|
|||
gui::draw_dialog(xpos,ypos,width,height,disp,string_table["preferences"],NULL,&buttons,&restorer);
|
||||
fullscreen_button.set_dirty();
|
||||
turbo_button.set_dirty();
|
||||
show_ai_moves_button.set_dirty();
|
||||
grid_button.set_dirty();
|
||||
floating_labels_button.set_dirty();
|
||||
close_button.set_dirty();
|
||||
|
@ -656,6 +657,10 @@ void show_preferences_dialog(display& disp)
|
|||
set_turbo(turbo_button.checked());
|
||||
}
|
||||
|
||||
if(show_ai_moves_button.process(mousex,mousey,left_button)) {
|
||||
set_show_ai_moves(!show_ai_moves_button.checked());
|
||||
}
|
||||
|
||||
if(grid_button.process(mousex,mousey,left_button)) {
|
||||
set_grid(grid_button.checked());
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace preferences {
|
|||
bool show_combat();
|
||||
|
||||
bool show_ai_moves();
|
||||
void set_show_ai_moves(bool value);
|
||||
|
||||
void set_show_side_colours(bool value);
|
||||
bool show_side_colours();
|
||||
|
|
|
@ -301,6 +301,20 @@ report generate_report(TYPE type, const gamemap& map, const unit_map& units,
|
|||
const std::string& name = map.terrain_name(terrain);
|
||||
const std::vector<std::string>& underlying_names = map.underlying_terrain_name(terrain);
|
||||
|
||||
if(map.is_village(mouseover)) {
|
||||
const int owner = village_owner(mouseover,teams)+1;
|
||||
if(owner == 0) {
|
||||
} else if(owner == current_side) {
|
||||
str << translate_string("owned");
|
||||
} else if(current_team.is_enemy(owner)) {
|
||||
str << translate_string("enemy");
|
||||
} else {
|
||||
str << translate_string("ally");
|
||||
}
|
||||
|
||||
str << " ";
|
||||
}
|
||||
|
||||
const std::string& translated_name = translate_string(name);
|
||||
|
||||
str << translated_name;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
*/
|
||||
|
||||
#include "game_config.hpp"
|
||||
#include "game_events.hpp"
|
||||
#include "gamestatus.hpp"
|
||||
#include "network.hpp"
|
||||
#include "replay.hpp"
|
||||
|
@ -286,6 +287,7 @@ void team::write(config& cfg) const
|
|||
void team::get_village(const gamemap::location& loc)
|
||||
{
|
||||
villages_.insert(loc);
|
||||
game_events::fire("capture",loc);
|
||||
}
|
||||
|
||||
void team::lose_village(const gamemap::location& loc)
|
||||
|
|
|
@ -71,7 +71,7 @@ void fade_logo(display& screen, int xpos, int ypos)
|
|||
faded_in = true;
|
||||
}
|
||||
|
||||
const std::string& get_tip_of_day()
|
||||
const std::string& get_tip_of_day(int* ntip)
|
||||
{
|
||||
static const std::string empty_string;
|
||||
if(preferences::show_tip_of_day() == false) {
|
||||
|
@ -87,7 +87,19 @@ const std::string& get_tip_of_day()
|
|||
return empty_string;
|
||||
}
|
||||
|
||||
if(ntip != NULL && *ntip > 0) {
|
||||
if(*ntip > ntips) {
|
||||
*ntip -= ntips;
|
||||
}
|
||||
|
||||
return string_table["tip_of_day" + str_cast(*ntip)];
|
||||
}
|
||||
|
||||
const int tip = (rand()%ntips) + 1;
|
||||
if(ntip != NULL) {
|
||||
*ntip = tip;
|
||||
}
|
||||
|
||||
return string_table["tip_of_day" + str_cast(tip)];
|
||||
}
|
||||
|
||||
|
@ -95,7 +107,7 @@ const std::string& get_tip_of_day()
|
|||
|
||||
namespace gui {
|
||||
|
||||
TITLE_RESULT show_title(display& screen)
|
||||
TITLE_RESULT show_title(display& screen, int* ntip)
|
||||
{
|
||||
cursor::set(cursor::NORMAL);
|
||||
|
||||
|
@ -154,28 +166,34 @@ TITLE_RESULT show_title(display& screen)
|
|||
max_width = maximum<size_t>(max_width,buttons.back().width());
|
||||
}
|
||||
|
||||
SDL_Rect main_dialog_area = {menu_xbase-padding,menu_ybase-padding,max_width+padding*2,menu_yincr*(nbuttons-1)+buttons.back().height()+padding*2};
|
||||
std::string style = "mainmenu";
|
||||
draw_dialog_frame(menu_xbase-padding,menu_ybase-padding,max_width+padding*2,menu_yincr*(nbuttons-1)+buttons.back().height()+padding*2,screen,&style);
|
||||
draw_dialog_frame(main_dialog_area.x,main_dialog_area.y,main_dialog_area.w,main_dialog_area.h,screen,&style);
|
||||
|
||||
std::string tip_of_day = get_tip_of_day();
|
||||
gui::button next_tip_button(screen,string_table["next_tip"]);
|
||||
|
||||
std::string tip_of_day = get_tip_of_day(ntip);
|
||||
if(tip_of_day.empty() == false) {
|
||||
tip_of_day = font::word_wrap_text(tip_of_day,14,(game_config::title_tip_width*screen.x())/1024);
|
||||
|
||||
const std::string& tome = font::word_wrap_text(string_table["tome"],14,(game_config::title_tip_width*screen.x())/1024);
|
||||
|
||||
const int pad = game_config::title_tip_padding;
|
||||
|
||||
SDL_Rect area = font::text_area(tip_of_day,14);
|
||||
SDL_Rect tome_area = font::text_area(tome,14,TTF_STYLE_ITALIC);
|
||||
area.w = maximum<size_t>(area.w,tome_area.w);
|
||||
area.h += tome_area.h;
|
||||
area.w = maximum<size_t>(area.w,tome_area.w) + 2*pad;
|
||||
area.h += tome_area.h + next_tip_button.location().h + 3*pad;
|
||||
|
||||
area.x = game_config::title_tip_x;
|
||||
area.y = (game_config::title_tip_y*screen.y())/768;
|
||||
area.y = main_dialog_area.y + main_dialog_area.h - area.h;
|
||||
|
||||
const int pad = game_config::title_tip_padding;
|
||||
draw_dialog_frame(area.x-pad,area.y-pad,area.w+pad*2,area.h+pad*2,screen,&style);
|
||||
next_tip_button.set_location(area.x+area.w-next_tip_button.location().w - pad,area.y+area.h - pad - next_tip_button.location().h);
|
||||
|
||||
font::draw_text(&screen,area,14,font::NORMAL_COLOUR,tip_of_day,area.x,area.y);
|
||||
font::draw_text(&screen,area,14,font::NORMAL_COLOUR,tome,area.x+area.w-tome_area.w,area.y+area.h-tome_area.h,NULL,false,font::NO_MARKUP,TTF_STYLE_ITALIC);
|
||||
draw_dialog_frame(area.x,area.y,area.w,area.h,screen,&style);
|
||||
|
||||
font::draw_text(&screen,area,14,font::NORMAL_COLOUR,tip_of_day,area.x+pad,area.y+pad);
|
||||
font::draw_text(&screen,area,14,font::NORMAL_COLOUR,tome,area.x+area.w-tome_area.w-pad,next_tip_button.location().y-tome_area.h-pad,NULL,false,font::NO_MARKUP,TTF_STYLE_ITALIC);
|
||||
}
|
||||
|
||||
events::raise_draw_event();
|
||||
|
@ -196,11 +214,19 @@ TITLE_RESULT show_title(display& screen)
|
|||
const bool left_button = mouse_flags&SDL_BUTTON_LMASK;
|
||||
|
||||
for(size_t b = 0; b != buttons.size(); ++b) {
|
||||
if(buttons[b].process(mousex,mousey,left_button)) {
|
||||
if(buttons[b].pressed()) {
|
||||
return TITLE_RESULT(b);
|
||||
}
|
||||
}
|
||||
|
||||
if(next_tip_button.pressed()) {
|
||||
if(ntip != NULL) {
|
||||
*ntip = *ntip + 1;
|
||||
}
|
||||
|
||||
return TITLE_CONTINUE;
|
||||
}
|
||||
|
||||
events::raise_process_event();
|
||||
events::raise_draw_event();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace gui {
|
|||
enum TITLE_RESULT { TUTORIAL = 0, NEW_CAMPAIGN, MULTIPLAYER, LOAD_GAME,
|
||||
CHANGE_LANGUAGE, EDIT_PREFERENCES, SHOW_ABOUT, QUIT_GAME, TITLE_CONTINUE };
|
||||
|
||||
TITLE_RESULT show_title(display& screen);
|
||||
TITLE_RESULT show_title(display& screen, int* ntip);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue