first round of warning fixes

This commit is contained in:
Jérémy Rosen 2006-01-08 11:14:47 +00:00
parent 5ae425d814
commit 8e43e4f4b8
11 changed files with 26 additions and 31 deletions

View file

@ -96,7 +96,6 @@ namespace dfool {
const config::child_list& clear_assign = (**o).get_children("clear_assignment");
unit_map matching_units;
unit_map assigned_units;
int count=num;
assigned_units.clear();
//find units assigned to this order;

View file

@ -32,9 +32,11 @@ public:
{
public:
virtual T operator()(const std::string& s) const { return T(s); }
virtual ~string_initializer(){};
};
animated();
virtual ~animated(){};
//if T can be constructed from a string, you may use this constructor
// animated(const std::string& cfg);

View file

@ -80,7 +80,7 @@ display::display(unit_map& units, CVideo& video, const gamemap& map,
screen_(video), xpos_(0), ypos_(0),
zoom_(DefaultZoom), map_(map), units_(units),
minimap_(NULL), redrawMinimap_(false),
pathsList_(NULL), enemy_reach_(NULL), status_(status),
pathsList_(NULL), status_(status),
teams_(t), lastDraw_(0), drawSkips_(0),
invalidateAll_(true), invalidateUnit_(true),
invalidateGameStatus_(true), panelsDrawn_(false),
@ -89,8 +89,8 @@ display::display(unit_map& units, CVideo& video, const gamemap& map,
turbo_(false), grid_(false), sidebarScaling_(1.0),
theme_(theme_cfg,screen_area()), builder_(cfg, level, map),
first_turn_(true), in_game_(false), map_labels_(*this,map),
tod_hex_mask1(NULL), tod_hex_mask2(NULL), diagnostic_label_(0),
fps_handle_(0)
tod_hex_mask1(NULL), tod_hex_mask2(NULL), enemy_reach_(NULL),
diagnostic_label_(0), fps_handle_(0)
{
if(non_interactive()) {
screen_.lock_updates(true);
@ -2320,7 +2320,7 @@ char *timestring ( void )
char *tstring;
tstring = new char[TIME_SIZE];
size_t s = strftime(tstring,TIME_SIZE,preferences::clock_format().c_str(),lt);
strftime(tstring,TIME_SIZE,preferences::clock_format().c_str(),lt);
return tstring;
#undef TIME_SIZE
}
@ -2531,7 +2531,6 @@ void display::prune_chat_messages(bool remove_all)
{
const unsigned int message_ttl = remove_all ? 0 : 1200000;
const unsigned int max_chat_messages = preferences::chat_lines();
int ticks = SDL_GetTicks();
if(chat_messages_.empty() == false && (chat_messages_.front().created_at+message_ttl < SDL_GetTicks() || chat_messages_.size() > max_chat_messages)) {
const int movement = font::get_floating_label_rect(chat_messages_.front().handle).h;

View file

@ -48,7 +48,7 @@ public:
virtual bool requires_event_focus() const { return false; }
virtual void process_help_string(int mousex, int mousey) {}
virtual void process_help_string(int /*mousex*/, int /*mousey*/) {}
protected:
handler();

View file

@ -195,9 +195,9 @@ public:
virtual void edit_refresh() {}
//Gets the action's image (if any). Displayed left of the action text in menus.
virtual std::string get_action_image(hotkey::HOTKEY_COMMAND command) const { return ""; }
virtual std::string get_action_image(hotkey::HOTKEY_COMMAND /*command*/) const { return ""; }
//Does the action control a toggle switch? If so, return the state of the action (on or off)
virtual ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command) const { return ACTION_STATELESS; }
virtual ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND /*command*/) const { return ACTION_STATELESS; }
//Returns the appropriate menu image. Checkable items will get a checked/unchecked image.
std::string get_menu_image(hotkey::HOTKEY_COMMAND command) const;
//Returns a vector of images for a given menu

View file

@ -1031,11 +1031,11 @@ gamemap::location turn_info::current_unit_attacks_from(const gamemap::location&
if(current_paths_.routes.count(adj[n])) {
static const size_t NDIRECTIONS = gamemap::location::NDIRECTIONS;
int difference = abs(int(preferred - n));
unsigned int difference = abs(int(preferred - n));
if(difference > NDIRECTIONS/2) {
difference = NDIRECTIONS - difference;
}
int second_difference = abs(int(second_preferred - n));
unsigned int second_difference = abs(int(second_preferred - n));
if(second_difference > NDIRECTIONS/2) {
second_difference = NDIRECTIONS - second_difference;
}

View file

@ -90,7 +90,7 @@ preprocessor_streambuf::preprocessor_streambuf(preproc_map *def)
}
preprocessor_streambuf::preprocessor_streambuf(preprocessor_streambuf const &t)
: current_(NULL), defines_(t.defines_),
: std::streambuf(),current_(NULL), defines_(t.defines_),
textdomain_(PACKAGE), depth_(t.depth_), quoted_(t.quoted_)
{
}

View file

@ -148,7 +148,7 @@ public:
}
}
bool has_seen(int index) const {
bool has_seen(unsigned int index) const {
if(!uses_shroud() && !uses_fog()) return true;
if(index < seen_.size()) {
return seen_[index];
@ -156,7 +156,7 @@ public:
return false;
}
}
void see(int index) {
void see(unsigned int index) {
if(index >= seen_.size()) {
seen_.resize(index+1);
}

View file

@ -832,23 +832,18 @@ const std::string& unit_type::image_fighting(attack_type::RANGE range) const
const std::string& unit_type::image_defensive(attack_type::RANGE range) const
{
{
static const std::string short_range("image_defensive_short");
static const std::string long_range("image_defensive_long");
static const std::string short_range("image_defensive_short");
static const std::string long_range("image_defensive_long");
const std::string& str = range == attack_type::LONG_RANGE ?
long_range : short_range;
const std::string& str = range == attack_type::LONG_RANGE ?
long_range : short_range;
const std::string& val = cfg_[str];
}
const std::string& val = cfg_["image_defensive"];
if(val.empty())
if(!cfg_[str].empty())
return cfg_[str];
else if(!cfg_["image_defensive"].empty())
return cfg_["image_defensive"];
else
return cfg_["image"];
else {
return val;
}
}
const std::string& unit_type::image_leading() const
@ -1092,7 +1087,7 @@ const std::string& unit_type::race() const
return race_->name();
}
unit_type::defensive_animation::defensive_animation(const config& cfg) : hits(HIT_OR_MISS), animation(cfg), range(utils::split(cfg["range"]))
unit_type::defensive_animation::defensive_animation(const config& cfg) : hits(HIT_OR_MISS), range(utils::split(cfg["range"])),animation(cfg)
{
const std::string& hits_str = cfg["hits"];
if(hits_str.empty() == false) {

View file

@ -47,7 +47,7 @@ inline int div100rounded(int num) {
// round (base_damage * bonus / divisor) to the closest integer
// but up or down towards base_damage
static int round_damage(int base_damage, int bonus, int divisor) {
inline int round_damage(int base_damage, int bonus, int divisor) {
const int rounding = divisor / 2 - (bonus < divisor ? 0 : 1);
return maximum<int>(1, (base_damage * bonus + rounding) / divisor);
}

View file

@ -79,7 +79,7 @@ protected:
CVideo& video() const { return *video_; };
virtual void handle_event(SDL_Event const &event) {}
virtual void handle_event(SDL_Event const &/*event*/) {}
virtual void draw();
virtual void draw_contents() {};