removed some unnecessary diagnostics (CVS internal)
This commit is contained in:
parent
61a2cd8334
commit
0172e51f45
29 changed files with 56 additions and 108 deletions
|
@ -163,9 +163,9 @@ int combat_modifier(const gamestatus& status,
|
|||
//structure which records information to be able to undo a movement
|
||||
struct undo_action {
|
||||
undo_action(unit u,const std::vector<gamemap::location>& rt,int sm,int orig=-1)
|
||||
: affected_unit(u), route(rt), starting_moves(sm), original_village_owner(orig), recall_pos(-1) {}
|
||||
: route(rt), starting_moves(sm), original_village_owner(orig), recall_pos(-1), affected_unit(u) {}
|
||||
undo_action(unit u,const gamemap::location& loc, int pos)
|
||||
: affected_unit(u), recall_loc(loc), recall_pos(pos) {}
|
||||
: recall_loc(loc), recall_pos(pos), affected_unit(u) {}
|
||||
std::vector<gamemap::location> route;
|
||||
int starting_moves;
|
||||
int original_village_owner;
|
||||
|
|
|
@ -49,9 +49,10 @@ ai_interface* create_ai(const std::string& name, ai_interface::info& info)
|
|||
}
|
||||
|
||||
ai::ai(ai_interface::info& info)
|
||||
: ai_interface(info), disp_(info.disp), map_(info.map), gameinfo_(info.gameinfo), units_(info.units),
|
||||
teams_(info.teams), team_num_(info.team_num), state_(info.state),
|
||||
consider_combat_(true), threats_found_(false)
|
||||
: ai_interface(info), threats_found_(false), disp_(info.disp),
|
||||
map_(info.map), gameinfo_(info.gameinfo), units_(info.units),
|
||||
teams_(info.teams), team_num_(info.team_num),
|
||||
state_(info.state), consider_combat_(true)
|
||||
{}
|
||||
|
||||
bool ai::recruit_usage(const std::string& usage)
|
||||
|
|
|
@ -222,7 +222,7 @@ private:
|
|||
|
||||
int best_attack_rating = -1;
|
||||
int best_attack = -1;
|
||||
for(int n = 0; n != attacks.size(); ++n) {
|
||||
for(size_t n = 0; n != attacks.size(); ++n) {
|
||||
const battle_stats stats = evaluate_battle_stats(get_info().map,attacker,defender,n,get_info().units,get_info().state,get_info().gameinfo,0,false);
|
||||
const int attack_rating = stats.damage_defender_takes*stats.nattacks*stats.chance_to_hit_defender;
|
||||
if(best_attack == -1 || attack_rating > best_attack_rating) {
|
||||
|
|
|
@ -83,7 +83,7 @@ private:
|
|||
{};
|
||||
|
||||
frame(int milliseconds, const T& value) :
|
||||
milliseconds(milliseconds), value(value), has_value(true)
|
||||
milliseconds(milliseconds), has_value(true), value(value)
|
||||
{};
|
||||
|
||||
// Represents the timestamp of the frame start
|
||||
|
@ -122,22 +122,24 @@ const T animated<T,T_void_value>::void_value_ = T_void_value()();
|
|||
|
||||
template<typename T, typename T_void_value>
|
||||
animated<T,T_void_value>::animated() :
|
||||
no_current_frame_(true), started_(false),
|
||||
starting_frame_time_(INT_MAX),
|
||||
ending_frame_time_(INT_MIN),
|
||||
start_ticks_(0),
|
||||
real_start_ticks_(0),
|
||||
started_(false),
|
||||
no_current_frame_(true),
|
||||
does_not_change_(false),
|
||||
real_start_ticks_(0),
|
||||
start_ticks_(0),
|
||||
acceleration_(1)
|
||||
{}
|
||||
|
||||
template<typename T, typename T_void_value>
|
||||
animated<T,T_void_value>::animated(const std::string &cfg, const string_initializer& init):
|
||||
no_current_frame_(true), started_(false),
|
||||
starting_frame_time_(INT_MAX),
|
||||
start_ticks_(0),
|
||||
real_start_ticks_(0),
|
||||
started_(false),
|
||||
no_current_frame_(true),
|
||||
does_not_change_(false),
|
||||
real_start_ticks_(0),
|
||||
start_ticks_(0),
|
||||
acceleration_(1)
|
||||
{
|
||||
std::vector<std::string> items = config::split(cfg);
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace {
|
|||
class locator_string_initializer : public animated<image::locator>::string_initializer
|
||||
{
|
||||
public:
|
||||
locator_string_initializer() : loc_(), no_loc_(true) {}
|
||||
locator_string_initializer(const gamemap::location& loc): loc_(loc), no_loc_(false) {}
|
||||
locator_string_initializer() : no_loc_(true) {}
|
||||
locator_string_initializer(const gamemap::location& loc): no_loc_(false), loc_(loc) {}
|
||||
image::locator operator()(const std::string &s) const;
|
||||
|
||||
private:
|
||||
|
@ -299,7 +299,7 @@ terrain_builder::terrain_constraint terrain_builder::rotate(const terrain_builde
|
|||
|
||||
void terrain_builder::replace_token(std::string &s, const std::string &token, const std::string &replacement)
|
||||
{
|
||||
int pos;
|
||||
size_t pos;
|
||||
|
||||
if(token.empty()) {
|
||||
std::cerr << "Error: empty token in replace_token\n";
|
||||
|
@ -548,7 +548,7 @@ void terrain_builder::add_rotated_rules(building_ruleset& rules, building_rule&
|
|||
} else {
|
||||
const std::vector<std::string>& rot = config::split(rotations, ',');
|
||||
|
||||
for(int angle = 0; angle < rot.size(); angle++) {
|
||||
for(size_t angle = 0; angle < rot.size(); angle++) {
|
||||
building_rule rule = rotate_rule(tpl, angle, rot);
|
||||
add_rule(rules, rule);
|
||||
}
|
||||
|
@ -673,8 +673,6 @@ void terrain_builder::parse_config(const config &cfg)
|
|||
|
||||
bool terrain_builder::terrain_matches(gamemap::TERRAIN letter, const std::string &terrains)
|
||||
{
|
||||
|
||||
bool res = false;
|
||||
bool negative = false;
|
||||
std::string::const_iterator itor;
|
||||
|
||||
|
@ -712,8 +710,6 @@ bool terrain_builder::rule_matches(const terrain_builder::building_rule &rule, c
|
|||
if(!tile_map_.on_map(tloc))
|
||||
return false;
|
||||
|
||||
const tile& btile = tile_map_[tloc];
|
||||
|
||||
if(!terrain_matches(map_.get_terrain(tloc), cons->second.terrain_types))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ private:
|
|||
class tilemap
|
||||
{
|
||||
public:
|
||||
tilemap(int x, int y) : x_(x), y_(y), map_((x+2)*(y+2)) {}
|
||||
tilemap(int x, int y) : map_((x+2)*(y+2)), x_(x), y_(y) {}
|
||||
|
||||
tile &operator[](const gamemap::location &loc);
|
||||
const tile &operator[] (const gamemap::location &loc) const;
|
||||
|
|
|
@ -155,7 +155,6 @@ bool animate_unit_advancement(const game_data& info,unit_map& units, gamemap::lo
|
|||
void show_objectives(display& disp, config& level_info)
|
||||
{
|
||||
static const std::string no_objectives(_("No objectives available"));
|
||||
const std::string& id = level_info["id"];
|
||||
const std::string& name = level_info["name"];
|
||||
const std::string& lang_objectives = level_info["objectives"];
|
||||
|
||||
|
@ -281,8 +280,6 @@ void save_preview_pane::draw()
|
|||
|
||||
set_dirty(false);
|
||||
|
||||
static int n = 0;
|
||||
|
||||
const config& summary = *(*summaries_)[index_];
|
||||
|
||||
surface const screen = disp().video().getSurface();
|
||||
|
@ -358,12 +355,12 @@ void save_preview_pane::draw()
|
|||
std::string name = (*info_)[index_].name;
|
||||
str << font::BOLD_TEXT << config::escape(name) << "\n" << time_buf;
|
||||
|
||||
const std::string& campaign_type = summary["campaign_type"];
|
||||
if(summary["corrupt"] == "yes") {
|
||||
str << "\n" << _("#(Invalid)");
|
||||
} else if(summary["campaign_type"] != "") {
|
||||
} else if (!campaign_type.empty()) {
|
||||
str << "\n";
|
||||
|
||||
const std::string& campaign_type = summary["campaign_type"];
|
||||
if(campaign_type == "scenario") {
|
||||
str << _("Campaign");
|
||||
} else if(campaign_type == "multiplayer") {
|
||||
|
@ -378,7 +375,7 @@ void save_preview_pane::draw()
|
|||
|
||||
if(summary["snapshot"] == "no" && summary["replay"] == "yes") {
|
||||
str << _("replay");
|
||||
} else if(summary["turn"] != "") {
|
||||
} else if (!summary["turn"].empty()) {
|
||||
str << _("Turn") << " " << summary["turn"];
|
||||
} else {
|
||||
str << _("Scenario Start");
|
||||
|
@ -759,14 +756,10 @@ void unit_preview_pane::draw()
|
|||
for(std::vector<attack_type>::const_iterator at_it = attacks.begin();
|
||||
at_it != attacks.end(); ++at_it) {
|
||||
|
||||
const std::string& lang_weapon = at_it->name();
|
||||
const std::string& lang_type = at_it->type();
|
||||
const std::string& lang_special = at_it->special();
|
||||
details << "\n"
|
||||
<< (lang_weapon.empty() ? at_it->name():lang_weapon) << " ("
|
||||
<< (lang_type.empty() ? at_it->type():lang_type) << ")\n"
|
||||
<< (lang_special.empty() ? at_it->special():lang_special)<<"\n"
|
||||
<< at_it->damage() << "-" << at_it->num_attacks() << " -- "
|
||||
<< at_it->name() << " (" << at_it->type() << ")\n"
|
||||
<< at_it->special() << "\n"
|
||||
<< at_it->damage() << "-" << at_it->num_attacks() << " -- "
|
||||
<< (at_it->range() == attack_type::SHORT_RANGE ?
|
||||
_("melee") :
|
||||
_("ranged"));
|
||||
|
@ -778,7 +771,6 @@ void unit_preview_pane::draw()
|
|||
}
|
||||
|
||||
const std::string text = details.str();
|
||||
const SDL_Rect& text_area = font::text_area(text,12);
|
||||
|
||||
const std::vector<std::string> lines = config::split(text,'\n');
|
||||
|
||||
|
|
|
@ -1533,9 +1533,6 @@ void display::draw_footstep(const gamemap::location& loc, int xloc, int yloc)
|
|||
draw_unit(xloc,yloc,image,vflip,0.5);
|
||||
|
||||
if(show_time && route_.move_left > 0 && route_.move_left < 10) {
|
||||
//draw number in yellow if terrain is light, else draw in black
|
||||
gamemap::TERRAIN terrain = map_.get_terrain(loc);
|
||||
|
||||
const SDL_Rect& rect = map_area();
|
||||
std::string str(1,'x');
|
||||
str[0] = '1' + route_.move_left;
|
||||
|
@ -1582,7 +1579,6 @@ std::vector<std::string> display::get_fog_shroud_graphics(const gamemap::locatio
|
|||
std::vector<std::string> res;
|
||||
|
||||
gamemap::location adjacent[6];
|
||||
bool transition_done[6];
|
||||
get_adjacent_tiles(loc,adjacent);
|
||||
int tiles[6];
|
||||
static const int terrain_types[] = { gamemap::FOGGED, gamemap::VOID_TERRAIN, 0 };
|
||||
|
@ -1951,7 +1947,7 @@ void display::invalidate_animations()
|
|||
gamemap::location bottomright;
|
||||
get_visible_hex_bounds(topleft, bottomright);
|
||||
|
||||
for(int i = 0; i < flags_.size(); ++i) {
|
||||
for(size_t i = 0; i < flags_.size(); ++i) {
|
||||
flags_[i].update_current_frame();
|
||||
if(flags_[i].frame_changed())
|
||||
animate_flags = true;
|
||||
|
|
|
@ -519,7 +519,7 @@ namespace font {
|
|||
std::string cur_word; // including start-whitespace
|
||||
std::string cur_line; // the whole line so far
|
||||
|
||||
for(int c = 0; c < unwrapped_text.length(); c++) {
|
||||
for(size_t c = 0; c < unwrapped_text.length(); c++) {
|
||||
|
||||
// Find the next word
|
||||
bool forced_line_break = false;
|
||||
|
@ -715,7 +715,6 @@ surface floating_label::create_surface()
|
|||
height += (*i)->h;
|
||||
}
|
||||
|
||||
const SDL_PixelFormat* const format = surfaces.front()->format;
|
||||
surf_.assign(create_compatible_surface(surfaces.front(),width,height));
|
||||
|
||||
size_t ypos = 0;
|
||||
|
|
|
@ -542,7 +542,7 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
|
|||
|
||||
int choice = get_random() % num_choices;
|
||||
tmp = 0;
|
||||
for (int i = 0; i < ranges.size(); i++) {
|
||||
for(size_t i = 0; i < ranges.size(); i++) {
|
||||
tmp += (ranges[i].second - ranges[i].first) + 1;
|
||||
if (tmp > choice) {
|
||||
if (ranges[i].first == 0 && ranges[i].second == 0) {
|
||||
|
@ -806,7 +806,6 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
|
|||
//displaying a message on-screen
|
||||
else if(cmd == "print") {
|
||||
const std::string& text = cfg["text"];
|
||||
const std::string& id = cfg["id"];
|
||||
const int size = lexical_cast_default<int>(cfg["size"],12);
|
||||
const int lifetime = lexical_cast_default<int>(cfg["duration"],20);
|
||||
const int red = lexical_cast_default<int>(cfg["red"],0);
|
||||
|
|
|
@ -194,8 +194,6 @@ bool gamestatus::next_turn()
|
|||
|
||||
game_state read_game(const game_data& data, const config* cfg)
|
||||
{
|
||||
std::cerr << "reading scenario: '" << cfg->write() << "'\n";
|
||||
|
||||
log_scope("read_game");
|
||||
game_state res;
|
||||
res.label = (*cfg)["label"];
|
||||
|
|
|
@ -50,7 +50,8 @@ bool hide_halo = false;
|
|||
static const SDL_Rect empty_rect = {0,0,0,0};
|
||||
|
||||
effect::effect(int xpos, int ypos, const std::string& img, ORIENTATION orientation, int lifetime)
|
||||
: reverse_(orientation == REVERSE), origx_(xpos), origy_(ypos), x_(xpos), y_(ypos), origzoom_(disp->zoom()), zoom_(disp->zoom()), surf_(NULL), buffer_(NULL), rect_(empty_rect), images_(img)
|
||||
: images_(img), reverse_(orientation == REVERSE), origx_(xpos), origy_(ypos), x_(xpos), y_(ypos),
|
||||
origzoom_(disp->zoom()), zoom_(disp->zoom()), surf_(NULL), buffer_(NULL), rect_(empty_rect)
|
||||
{
|
||||
assert(disp != NULL);
|
||||
// std::cerr << "Constructing halo sequence from image " << img << "\n";
|
||||
|
|
|
@ -846,9 +846,9 @@ std::vector<topic> generate_terrains_topics() {
|
|||
}
|
||||
}
|
||||
show_info_about.erase(std::remove(show_info_about.begin(), show_info_about.end(),
|
||||
gamemap::VOID_TERRAIN), show_info_about.end());
|
||||
(char)gamemap::VOID_TERRAIN), show_info_about.end());
|
||||
show_info_about.erase(std::remove(show_info_about.begin(), show_info_about.end(),
|
||||
gamemap::FOGGED), show_info_about.end());
|
||||
(char)gamemap::FOGGED), show_info_about.end());
|
||||
for (std::vector<gamemap::TERRAIN>::const_iterator terrain_it = show_info_about.begin();
|
||||
terrain_it != show_info_about.end(); terrain_it++) {
|
||||
const std::string& name = string_table[map->terrain_name(*terrain_it)];
|
||||
|
|
|
@ -100,12 +100,12 @@ void locator::init_index()
|
|||
}
|
||||
|
||||
locator::locator() :
|
||||
val_(), index_(-1)
|
||||
index_(-1)
|
||||
{
|
||||
}
|
||||
|
||||
locator::locator(const locator &a):
|
||||
val_(a.val_), index_(a.index_)
|
||||
index_(a.index_), val_(a.val_)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -828,10 +828,6 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
|
|||
//based on our [convert] tags.
|
||||
for(x = 0; x != width; ++x) {
|
||||
for(y = 0; y != height; ++y) {
|
||||
|
||||
const int temperature = temperature_map[x][y];
|
||||
const int height = heights[x][y];
|
||||
|
||||
for(std::vector<terrain_converter>::const_iterator i = converters.begin(); i != converters.end(); ++i) {
|
||||
if(i->convert_terrain(terrain[x][y],heights[x][y],temperature_map[x][y])) {
|
||||
terrain[x][y] = i->convert_to();
|
||||
|
|
|
@ -12,6 +12,7 @@ config random_generate_scenario(const std::string& parms, const config* cfg);
|
|||
class map_generator
|
||||
{
|
||||
public:
|
||||
virtual ~map_generator() {}
|
||||
|
||||
//returns true iff the map generator has an interactive screen
|
||||
//which allows the user to modify how the generator behaves
|
||||
|
|
|
@ -126,7 +126,6 @@ void default_map_generator::user_config(display& disp)
|
|||
|
||||
const int min_width = 20;
|
||||
const int max_width = 200;
|
||||
const int min_height = 20;
|
||||
const int max_height = 200;
|
||||
const int extra_size_per_player = 2;
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ multiplayer_game_setup_dialog::multiplayer_game_setup_dialog(
|
|||
const config& cfg, game_state& state, bool server)
|
||||
: disp_(disp), units_data_(units_data), cfg_(cfg), state_(state), server_(server), level_(NULL), map_selection_(-1),
|
||||
maps_menu_(NULL), turns_slider_(NULL), village_gold_slider_(NULL), xp_modifier_slider_(NULL),
|
||||
fog_game_(NULL), shroud_game_(NULL), observers_game_(NULL), vision_combo_(NULL),
|
||||
fog_game_(NULL), shroud_game_(NULL), observers_game_(NULL),
|
||||
cancel_game_(NULL), launch_game_(NULL), regenerate_map_(NULL), generator_settings_(NULL),
|
||||
era_combo_(NULL), name_entry_(NULL), generator_(NULL)
|
||||
era_combo_(NULL), vision_combo_(NULL), name_entry_(NULL), generator_(NULL)
|
||||
{
|
||||
std::cerr << "setup dialog ctor\n";
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void receive_gamelist(display& disp, config& data)
|
|||
class wait_for_start : public lobby::dialog
|
||||
{
|
||||
public:
|
||||
wait_for_start(display& disp, config& cfg, int team_num, const std::string& team_name) : got_side(false), team(team_num), name(team_name), status(START_GAME), disp_(disp), cancel_button_(NULL), menu_(NULL), sides_(cfg)
|
||||
wait_for_start(display& disp, config& cfg, int team_num, const std::string& team_name) : got_side(false), team(team_num), name(team_name), status(START_GAME), disp_(disp), cancel_button_(NULL), sides_(cfg), menu_(NULL)
|
||||
{
|
||||
SDL_Rect empty_rect = {0,0,0,0};
|
||||
area_ = empty_rect;
|
||||
|
|
|
@ -45,9 +45,9 @@ mp_connect::mp_connect(display& disp, std::string game_name,
|
|||
player_types_(), player_races_(), player_teams_(),
|
||||
player_colors_(), combos_type_(), combos_race_(),
|
||||
combos_team_(), combos_color_(), sliders_gold_(),
|
||||
ai_(gui::button(disp, _(" Computer vs Computer "))),
|
||||
launch_(gui::button(disp, _("I'm Ready"))),
|
||||
cancel_(gui::button(disp, _("Cancel"))),
|
||||
ai_(gui::button(disp, _(" Computer vs Computer "))),
|
||||
message_full_(true)
|
||||
{
|
||||
// Send Initial information
|
||||
|
@ -333,13 +333,8 @@ void mp_connect::set_area(const SDL_Rect& rect)
|
|||
|
||||
const int left = rect.x;
|
||||
const int right = rect.x + rect.w;
|
||||
const int center_x = rect.x + rect.w/2;
|
||||
const int top = rect.y;
|
||||
const int bottom = rect.y + rect.h;
|
||||
const int center_y = rect.y + rect.h/2;
|
||||
|
||||
const int width = rect.w;
|
||||
const int height = rect.h;
|
||||
|
||||
// Wait to players, Configure players
|
||||
//gui::draw_dialog_background(left, right, width, height, *disp_, "menu");
|
||||
|
@ -391,8 +386,6 @@ void mp_connect::set_area(const SDL_Rect& rect)
|
|||
return;
|
||||
}
|
||||
|
||||
const config::child_list& possible_sides = era_cfg->get_children("multiplayer_side");
|
||||
|
||||
combos_type_.clear();
|
||||
combos_race_.clear();
|
||||
combos_team_.clear();
|
||||
|
@ -460,8 +453,6 @@ void mp_connect::gui_update()
|
|||
return;
|
||||
}
|
||||
|
||||
const config::child_list& possible_sides = era_cfg->get_children("multiplayer_side");
|
||||
|
||||
const config::child_itors sides = level_->child_range("side");
|
||||
SDL_Rect rect;
|
||||
|
||||
|
@ -915,10 +906,6 @@ void mp_connect::update_network()
|
|||
|
||||
std::cerr << "client has taken a valid position\n";
|
||||
|
||||
//does the client already own the side, and is just updating
|
||||
//it, or is it taking a vacant slot?
|
||||
const bool update_only = pos->second == sock;
|
||||
|
||||
//broadcast to everyone the new game status
|
||||
pos->first->values["controller"] = "network";
|
||||
pos->first->values["taken"] = "yes";
|
||||
|
|
|
@ -318,7 +318,7 @@ shortest_path_calculator::shortest_path_calculator(const unit& u, const team& t,
|
|||
const gamemap& map,
|
||||
const gamestatus& status)
|
||||
: unit_(u), team_(t), units_(units), teams_(teams),
|
||||
status_(status), map_(map)
|
||||
map_(map), status_(status)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,6 @@ void play_turn(game_data& gameinfo, game_state& state_of_game,
|
|||
gui.draw();
|
||||
gui.update_display();
|
||||
|
||||
team& current_team = teams[team_num-1];
|
||||
|
||||
const paths_wiper wiper(gui);
|
||||
|
||||
if(preferences::turn_bell()) {
|
||||
|
@ -139,8 +137,8 @@ turn_info::turn_info(game_data& gameinfo, game_state& state_of_game,
|
|||
key_(key), gui_(gui), map_(map), teams_(teams), team_num_(team_num),
|
||||
units_(units), browse_(mode != PLAY_TURN), allow_network_commands_(mode == BROWSE_NETWORKED),
|
||||
left_button_(false), right_button_(false), middle_button_(false),
|
||||
minimap_scrolling_(false), start_ncmd_(-1),
|
||||
enemy_paths_(false), path_turns_(0), end_turn_(false), textbox_(textbox), replay_sender_(replay_sender)
|
||||
minimap_scrolling_(false), enemy_paths_(false),
|
||||
path_turns_(0), end_turn_(false), start_ncmd_(-1), textbox_(textbox), replay_sender_(replay_sender)
|
||||
{
|
||||
enemies_visible_ = enemies_visible();
|
||||
}
|
||||
|
@ -607,10 +605,8 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
|
|||
const battle_stats& st = stats.back();
|
||||
|
||||
const std::string& attack_name = st.attack_name;
|
||||
const std::string& attack_type = st.attack_type;
|
||||
const std::string& attack_special = st.attack_special;
|
||||
const std::string& defend_name = st.defend_name;
|
||||
const std::string& defend_type = st.defend_type;
|
||||
const std::string& defend_special = st.defend_special;
|
||||
|
||||
const std::string& range = gettext(st.range == "Melee" ? N_("melee") : N_("ranged"));
|
||||
|
@ -759,7 +755,6 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
|
|||
gui_.select_hex(dst);
|
||||
}
|
||||
|
||||
const int range = u->second.longest_range();
|
||||
current_route_.steps.clear();
|
||||
show_attack_options(u);
|
||||
|
||||
|
@ -2147,18 +2142,19 @@ void turn_info::do_command(const std::string& str)
|
|||
} else if(cmd == "n" && game_config::debug) {
|
||||
throw end_level_exception(VICTORY);
|
||||
} else if(game_config::debug && cmd == "unit") {
|
||||
std::cerr << "processing unit: '" << data << "'\n";
|
||||
const unit_map::iterator i = current_unit();
|
||||
if(i != units_.end()) {
|
||||
const std::string::const_iterator j = std::find(data.begin(),data.end(),'=');
|
||||
if(j != data.end()) {
|
||||
const std::string name(data.begin(),j);
|
||||
const std::string value(j+1,data.end());
|
||||
std::cerr << "setting '" << name << "' = '" << value << "\n";
|
||||
config cfg;
|
||||
i->second.write(cfg);
|
||||
cfg[name] = value;
|
||||
i->second = unit(gameinfo_,cfg);
|
||||
|
||||
gui_.invalidate(i->first);
|
||||
gui_.invalidate_unit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -959,7 +959,6 @@ bool show_video_mode_dialog(display& disp)
|
|||
|
||||
std::vector<std::pair<int,int> > resolutions;
|
||||
|
||||
bool added_current = false;
|
||||
for(int i = 0; modes[i] != NULL; ++i) {
|
||||
if(modes[i]->w >= 800 && modes[i]->h >= 600) {
|
||||
resolutions.push_back(std::pair<int,int>(modes[i]->w,modes[i]->h));
|
||||
|
|
|
@ -189,7 +189,7 @@ void draw_dialog(int x, int y, int w, int h, display& disp, const std::string& t
|
|||
{
|
||||
int border_size = 10;
|
||||
SDL_Rect title_area = {0,0,0,0};
|
||||
if(title != "") {
|
||||
if (!title.empty()) {
|
||||
title_area = draw_dialog_title(0,0,NULL,title);
|
||||
title_area.w += border_size;
|
||||
title_area.h += border_size;
|
||||
|
@ -225,7 +225,7 @@ void draw_dialog(int x, int y, int w, int h, display& disp, const std::string& t
|
|||
|
||||
draw_dialog_frame(xpos,ypos,width,height,disp,style,restorer);
|
||||
|
||||
if(title != "") {
|
||||
if (!title.empty()) {
|
||||
draw_dialog_title(x + border_size, y - title_area.h, &disp, title);
|
||||
}
|
||||
|
||||
|
@ -416,12 +416,10 @@ int show_dialog(display& disp, surface image,
|
|||
|
||||
menu menu_(disp,menu_items,type == MESSAGE);
|
||||
|
||||
const int border_size = 6;
|
||||
|
||||
const int max_line_length = 54;
|
||||
|
||||
std::string message = msg;
|
||||
const size_t longest_line = text_to_lines(message,max_line_length);
|
||||
text_to_lines(message,max_line_length);
|
||||
|
||||
SDL_Rect text_size = { 0, 0, 0, 0 };
|
||||
if(!message.empty()) {
|
||||
|
@ -430,7 +428,7 @@ int show_dialog(display& disp, surface image,
|
|||
}
|
||||
|
||||
SDL_Rect caption_size = { 0, 0, 0, 0 };
|
||||
if(caption != "" && image != NULL) {
|
||||
if (!caption.empty() && image != NULL) {
|
||||
caption_size = font::draw_text(NULL, clipRect, caption_font_size,
|
||||
font::NORMAL_COLOUR,caption,0,0,NULL);
|
||||
}
|
||||
|
@ -566,7 +564,6 @@ int show_dialog(display& disp, surface image,
|
|||
text_widget_height + check_button_height;
|
||||
|
||||
|
||||
const int border_padding = 10;
|
||||
int frame_width = maximum<int>(total_width,above_left_preview_pane_width + above_right_preview_pane_width);
|
||||
int frame_height = maximum<int>(total_height,int(preview_pane_height));
|
||||
int xframe = maximum<int>(0,xloc >= 0 ? xloc : scr->w/2 - (frame_width + left_preview_pane_width + right_preview_pane_width)/2);
|
||||
|
@ -681,9 +678,6 @@ int show_dialog(display& disp, surface image,
|
|||
yloc+top_padding+image->h, NULL);
|
||||
}
|
||||
|
||||
const int unitw = 200;
|
||||
const int unith = disp.y()/2;
|
||||
|
||||
font::draw_text(&disp, clipRect, message_font_size,
|
||||
font::NORMAL_COLOUR, message,
|
||||
xloc+total_image_width+left_padding+image_h_padding,
|
||||
|
|
|
@ -229,7 +229,6 @@ TITLE_RESULT show_title(display& screen, int* ntip)
|
|||
for(;;) {
|
||||
int mousex, mousey;
|
||||
const int mouse_flags = SDL_GetMouseState(&mousex,&mousey);
|
||||
const bool left_button = mouse_flags&SDL_BUTTON_LMASK;
|
||||
|
||||
for(size_t b = 0; b != buttons.size(); ++b) {
|
||||
if(buttons[b].pressed()) {
|
||||
|
|
|
@ -112,11 +112,11 @@ unit::unit(const unit_type* t, const unit& u) :
|
|||
underlying_description_(u.underlying_description_),
|
||||
description_(u.description_), recruit_(u.recruit_),
|
||||
role_(u.role_), statusFlags_(u.statusFlags_),
|
||||
overlays_(u.overlays_), variables_(u.variables_),
|
||||
attacks_(type_->attacks()), backupAttacks_(type_->attacks()),
|
||||
modifications_(u.modifications_),
|
||||
traitsDescription_(u.traitsDescription_),
|
||||
guardian_(false), upkeep_(u.upkeep_),
|
||||
overlays_(u.overlays_), variables_(u.variables_)
|
||||
guardian_(false), upkeep_(u.upkeep_)
|
||||
{
|
||||
validate_side(side_);
|
||||
|
||||
|
@ -1143,7 +1143,7 @@ void unit::apply_modifications()
|
|||
log_scope("apply mods");
|
||||
modificationDescriptions_.clear();
|
||||
|
||||
for(int i = 0; i != NumModificationTypes; ++i) {
|
||||
for(size_t i = 0; i != NumModificationTypes; ++i) {
|
||||
const std::string& mod = ModificationTypes[i];
|
||||
const config::child_list& mods = modifications_.get_children(mod);
|
||||
for(config::child_list::const_iterator j = mods.begin(); j != mods.end(); ++j) {
|
||||
|
@ -1158,7 +1158,7 @@ void unit::remove_temporary_modifications()
|
|||
for(int i = 0; i != NumModificationTypes; ++i) {
|
||||
const std::string& mod = ModificationTypes[i];
|
||||
const config::child_list& mods = modifications_.get_children(mod);
|
||||
for(int j = 0; j != mods.size(); ++j) {
|
||||
for(size_t j = 0; j != mods.size(); ++j) {
|
||||
if((*mods[j])["duration"] != "forever" && (*mods[j])["duration"] != "") {
|
||||
modifications_.remove_child(mod,j);
|
||||
--j;
|
||||
|
|
|
@ -289,8 +289,6 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
|
|||
|
||||
int flash_num = 0;
|
||||
|
||||
int ticks = SDL_GetTicks();
|
||||
|
||||
bool shown_label = false;
|
||||
|
||||
util::scoped_resource<int,halo::remover> missile_halo_effect(0), unit_halo_effect(0);
|
||||
|
@ -402,8 +400,6 @@ bool unit_attack_ranged(display& disp, unit_map& units, const gamemap& map,
|
|||
}
|
||||
|
||||
if(animation_time >= 0 && animation_time < real_last_missile && !hide) {
|
||||
const int missile_frame_time = animation_time + first_missile;
|
||||
|
||||
const unit_animation::frame& missile_frame = attack_anim.get_current_frame(unit_animation::MISSILE_FRAME);
|
||||
std::cerr << "Missile: animation time :" << animation_time << ", image " << missile_frame.image << ", halo: " << missile_frame.halo << "\n";
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ unit_type::unit_type(const unit_type& o)
|
|||
|
||||
unit_type::unit_type(const config& cfg, const movement_type_map& mv_types,
|
||||
const race_map& races, const std::vector<config*>& traits)
|
||||
: cfg_(cfg), alpha_(1.0), possibleTraits_(traits), movementType_(cfg)
|
||||
: cfg_(cfg), alpha_(1.0), movementType_(cfg), possibleTraits_(traits)
|
||||
{
|
||||
gender_types_[0] = NULL;
|
||||
gender_types_[1] = NULL;
|
||||
|
@ -1010,7 +1010,5 @@ game_data::game_data(const config& cfg)
|
|||
j.first != j.second; ++j.first) {
|
||||
const unit_type u_type(**j.first,movement_types,races,unit_traits);
|
||||
unit_types.insert(std::pair<std::string,unit_type>(u_type.name(),u_type));
|
||||
std::cerr << "Inserting unit " << u_type.id() << " (" << u_type.name() << ")"
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ class unit_animation
|
|||
public:
|
||||
struct frame {
|
||||
frame() {}
|
||||
explicit frame(const std::string& str) {}
|
||||
explicit frame(const config& cfg);
|
||||
|
||||
// int start, end;
|
||||
|
|
Loading…
Add table
Reference in a new issue