Partly fixed compilation issues with ICC,

...including some real bugs in the code.
This commit is contained in:
Guillaume Melquiond 2009-12-18 08:08:48 +00:00
parent 64db3b1ff4
commit 61f5727523
15 changed files with 24 additions and 27 deletions

View file

@ -33,7 +33,8 @@ static lg::log_domain log_ai_composite("ai/composite");
// =======================================================================
// COMPOSITE AI
// =======================================================================
std::string ai_composite::describe_self(){
std::string ai_composite::describe_self() const
{
return "[composite_ai]";
}

View file

@ -76,7 +76,7 @@ public:
virtual void new_turn();
std::string describe_self();
std::string describe_self() const;
/**
* serialize

View file

@ -437,7 +437,7 @@ public:
return target_->get_side_context();
}
virtual int get_recursion_count()
virtual int get_recursion_count() const
{
return target_->get_recursion_count();
}
@ -937,7 +937,7 @@ public:
}
virtual int get_recursion_count()
virtual int get_recursion_count() const
{
return target_->get_recursion_count();
}

View file

@ -63,7 +63,7 @@ idle_ai::idle_ai(readwrite_context &context, const config &cfg)
init_readwrite_context_proxy(context);
}
std::string idle_ai::describe_self()
std::string idle_ai::describe_self() const
{
return "[idle_ai]";
}
@ -117,7 +117,8 @@ public:
do_recruitment();
}
virtual std::string describe_self(){
virtual std::string describe_self() const
{
return "[sample_ai]";
}
@ -322,7 +323,8 @@ void ai_default::new_turn()
consider_combat_ = true;
}
std::string ai_default::describe_self(){
std::string ai_default::describe_self() const
{
return "[default_ai]";
}

View file

@ -42,7 +42,7 @@ public:
idle_ai(readwrite_context &context, const config &cfg);
void play_turn();
void new_turn();
virtual std::string describe_self();
std::string describe_self() const;
void switch_side(side_number side);
int get_recursion_count() const;
virtual config to_config() const;
@ -152,7 +152,7 @@ public:
virtual void play_turn();
virtual void new_turn();
virtual std::string describe_self();
std::string describe_self() const;
virtual config to_config() const;
void switch_side(side_number side);

View file

@ -22,21 +22,21 @@
#ifdef _MSC_VER
#define BREAKPOINT() __debugbreak()
#define WES_HALT() if (true) { BREAKPOINT(); exit(1); } else (void)0
#define WES_HALT() do { BREAKPOINT(); exit(1); } while (false)
#elif defined(__GNUG__) && (defined(__i386__) || defined(__x86_64__))
#define BREAKPOINT() asm("int3")
#define WES_HALT() if (true) { BREAKPOINT(); abort(); } else (void)0
#define WES_HALT() do { BREAKPOINT(); abort(); } while (false)
#else
#define BREAKPOINT()
#define WES_HALT() abort()
#endif
#define ERROR_LOG(a) if (true) { \
#define ERROR_LOG(a) do { \
std::cerr << __FILE__ << ":" << __LINE__ << " ASSSERTION FAILED: " << a << std::endl; \
WES_HALT(); \
} else (void)0
} while (false)
//for custom logging. Example usage:
//ASSERT_LOG(x != y, "x not equal to y. Value of x: " << x << ", y: " << y);

View file

@ -103,9 +103,6 @@ struct node {
bool operator<(const node& o) const {
return t < o.t;
}
bool operator>(const node& o) const {
return o < *this;
}
};
class comp {

View file

@ -159,7 +159,6 @@ public:
bool play_multiplayer();
bool change_language();
void show_help();
void show_preferences();
void show_upload_begging();

View file

@ -576,7 +576,7 @@ void game_display::draw_bar(const std::string& image, int xpos, int ypos,
drawing_buffer_add(LAYER_UNIT_BAR, loc, tblit(xpos, ypos, surf, top));
drawing_buffer_add(LAYER_UNIT_BAR, loc, tblit(xpos, ypos + top.h, surf, bot));
const size_t unfilled = static_cast<const size_t>(height*(1.0 - filled));
size_t unfilled = static_cast<size_t>(height * (1.0 - filled));
if(unfilled < height && alpha >= ftofxp(0.3)) {
const Uint8 r_alpha = std::min<unsigned>(unsigned(fxpmult(alpha,255)),255);

View file

@ -60,7 +60,6 @@ public:
private:
void parse_element();
void parse_variable();
void parse_directive();
std::string lineno_string(utils::string_map &map, std::string const &lineno,
const char *error_string);
void error(const std::string& message);

View file

@ -115,7 +115,7 @@ part::BLOCK_LOCATION part::string_tblock_loc(const std::string& s)
if(s == "top") {
return part::BLOCK_TOP;
}
else if("middle") {
else if (s == "middle") {
return part::BLOCK_MIDDLE;
}
}

View file

@ -379,7 +379,6 @@ public:
}
bool get_esc_ignore() { return ignore_esc_; }
void set_esc_ignore(bool ignore) { ignore_esc_ = ignore; }
virtual void handle_event(const SDL_Event& event)
{

View file

@ -23,7 +23,7 @@ static lg::log_domain log_unit("unit");
namespace n_unit {
id_manager id_manager::manager_;
id_manager::id_manager() : next_id_(0), fake_id_(-1)
id_manager::id_manager() : next_id_(0), fake_id_(size_t(-1))
{}
id_manager& id_manager::instance()
@ -59,7 +59,7 @@ namespace n_unit {
void id_manager::reset_fake()
{
fake_id_ = -1;
fake_id_ = size_t(-1);
}
void id_manager::clear()

View file

@ -51,7 +51,7 @@ unit_map &unit_map::operator=(const unit_map &that)
unit_map::~unit_map()
{
assert(num_iters_ == 0 && "dangling iterators will attempt to dereference an invalid pointer in their destructor");
assert(num_iters_ == 0);
delete_all();
}
@ -103,7 +103,7 @@ void unit_map::add(const map_location &l, const unit &u) {
void unit_map::move(const map_location &src, const map_location &dst) {
std::pair<map_location,unit> *p = extract(src);
assert(p && "attempt to move unit at location with no unit");
assert(p);
p->first = dst;
insert(p);
}

View file

@ -112,8 +112,8 @@ public:
iterator_base() : policy_(), counter_(), map_(NULL), i_() { }
iterator_base(iterator_type i, map_type* m) : policy_(i, m), counter_(m), map_(m), i_(i) { }
pointer_type operator->() const { assert(policy_.valid(i_, map_) && "Attempt to dereference invalid iterator"); return i_->second.ptr_; }
reference_type operator*() const { assert(policy_.valid(i_, map_) && "Attempt to dereference invalid iterator"); return *i_->second.ptr_; }
pointer_type operator->() const { assert(policy_.valid(i_, map_)); return i_->second.ptr_; }
reference_type operator*() const { assert(policy_.valid(i_, map_)); return *i_->second.ptr_; }
iterator_base& operator++();
iterator_base operator++(int);