fix alot of warnings
This commit is contained in:
parent
8352bf8c74
commit
e1096a0e0c
7 changed files with 27 additions and 28 deletions
|
@ -828,7 +828,7 @@ bool terrain_builder::rule_matches(const terrain_builder::building_rule &rule, c
|
|||
|
||||
random %= 100;
|
||||
|
||||
if(random > rule.probability)
|
||||
if(random > (unsigned int)rule.probability)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ void terrain_builder::build_terrains()
|
|||
continue;
|
||||
}
|
||||
|
||||
if(rule_matches(rule->second, *itor - loc, rule_index, (biggest_constraint_adjacent + 1) != rule->second.constraints.size())) {
|
||||
if(rule_matches(rule->second, *itor - loc, rule_index, (size_t)(biggest_constraint_adjacent + 1) != rule->second.constraints.size())) {
|
||||
apply_rule(rule->second, *itor - loc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ size_t cave_map_generator::translate_y(size_t y) const
|
|||
|
||||
bool cave_map_generator::allow_user_config() const { return true; }
|
||||
|
||||
void cave_map_generator::user_config(display& disp) { return; }
|
||||
void cave_map_generator::user_config(display& /*disp*/) { return; }
|
||||
|
||||
std::string cave_map_generator::name() const { return "cave"; }
|
||||
|
||||
|
@ -76,7 +76,7 @@ std::string cave_map_generator::create_map(const std::vector<std::string>& args)
|
|||
return res["map_data"];
|
||||
}
|
||||
|
||||
config cave_map_generator::create_scenario(const std::vector<std::string>& args)
|
||||
config cave_map_generator::create_scenario(const std::vector<std::string>& /*args*/)
|
||||
{
|
||||
map_ = std::vector<std::vector<gamemap::TERRAIN> >(width_,std::vector<gamemap::TERRAIN>(height_,wall_));
|
||||
chambers_.clear();
|
||||
|
@ -129,7 +129,7 @@ void cave_map_generator::build_chamber(gamemap::location loc, std::set<gamemap::
|
|||
gamemap::location adj[6];
|
||||
get_adjacent_tiles(loc,adj);
|
||||
for(size_t n = 0; n != 6; ++n) {
|
||||
if((rand()%100) < (100-jagged)) {
|
||||
if((rand()%100) < (100l-(long)jagged)) {
|
||||
build_chamber(adj[n],locs,size-1,jagged);
|
||||
}
|
||||
}
|
||||
|
@ -338,13 +338,13 @@ void cave_map_generator::place_passage(const passage& p)
|
|||
|
||||
bool cave_map_generator::on_board(const gamemap::location& loc) const
|
||||
{
|
||||
return loc.x >= 0 && loc.y >= 0 && loc.x < width_ && loc.y < height_;
|
||||
return loc.x >= 0 && loc.y >= 0 && loc.x < (long)width_ && loc.y < (long)height_;
|
||||
}
|
||||
|
||||
void cave_map_generator::set_terrain(gamemap::location loc, gamemap::TERRAIN t)
|
||||
{
|
||||
if(on_board(loc)) {
|
||||
if(t == clear_ && (rand()%1000) < village_density_) {
|
||||
if(t == clear_ && (rand()%1000) < (long)village_density_) {
|
||||
t = village_;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,15 +58,15 @@ SDL_Cursor* create_cursor(surface surf)
|
|||
//the format that data has to be in to pass to SDL_CreateCursor
|
||||
surface_lock lock(nsurf);
|
||||
const Uint32* const pixels = reinterpret_cast<Uint32*>(lock.pixels());
|
||||
for(size_t y = 0; y != nsurf->h; ++y) {
|
||||
for(size_t x = 0; x != nsurf->w; ++x) {
|
||||
for(int y = 0; y != nsurf->h; ++y) {
|
||||
for(int x = 0; x != nsurf->w; ++x) {
|
||||
Uint8 r,g,b,a;
|
||||
Uint8 trans = 0;
|
||||
Uint8 black = 0;
|
||||
|
||||
const size_t index = y*cursor_width + x;
|
||||
|
||||
if (x < cursor_width) {
|
||||
if ((size_t)x < cursor_width) {
|
||||
SDL_GetRGBA(pixels[y*nsurf->w + x],nsurf->format,&r,&g,&b,&a);
|
||||
|
||||
const size_t shift = 7 - (index%8);
|
||||
|
|
|
@ -207,7 +207,7 @@ manager::~manager()
|
|||
|
||||
void load_descriptions()
|
||||
{
|
||||
for (int i = 0; hotkey_list_[i].command; ++i) {
|
||||
for (size_t i = 0; hotkey_list_[i].command; ++i) {
|
||||
if (i >= hotkeys_.size()) {
|
||||
ERR_G << "Hotkey list too short: " << hotkeys_.size() << "\n";
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex
|
|||
}
|
||||
}
|
||||
|
||||
void command_executor::show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu, display& gui)
|
||||
void command_executor::show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool /*context_menu*/, display& gui)
|
||||
{
|
||||
std::vector<std::string> items = items_arg;
|
||||
if (can_execute_command(hotkey::get_hotkey(items.front()).get_id())){
|
||||
|
|
|
@ -124,9 +124,9 @@ height_map generate_height_map(size_t width, size_t height,
|
|||
const int radius = rand()%hill_size + 1;
|
||||
|
||||
const int min_x = x1 - radius > 0 ? x1 - radius : 0;
|
||||
const int max_x = x1 + radius < res.size() ? x1 + radius : res.size();
|
||||
const int max_x = x1 + radius < (long)res.size() ? x1 + radius : res.size();
|
||||
const int min_y = y1 - radius > 0 ? y1 - radius : 0;
|
||||
const int max_y = y1 + radius < res.front().size() ? y1 + radius : res.front().size();
|
||||
const int max_y = y1 + radius < (long)res.front().size() ? y1 + radius : res.front().size();
|
||||
|
||||
for(int x2 = min_x; x2 < max_x; ++x2) {
|
||||
for(int y2 = min_y; y2 < max_y; ++y2) {
|
||||
|
@ -222,7 +222,7 @@ typedef gamemap::location location;
|
|||
//false will be returned. true is returned if the river is generated successfully.
|
||||
bool generate_river_internal(const height_map& heights, terrain_map& terrain, int x, int y, std::vector<location>& river, std::set<location>& seen_locations, int river_uphill)
|
||||
{
|
||||
const bool on_map = x >= 0 && y >= 0 && x < heights.size() && y < heights.back().size();
|
||||
const bool on_map = x >= 0 && y >= 0 && x < (long)heights.size() && y < (long)heights.back().size();
|
||||
|
||||
if(on_map && !river.empty() && heights[x][y] > heights[river.back().x][river.back().y] + river_uphill) {
|
||||
return false;
|
||||
|
@ -341,10 +341,10 @@ private:
|
|||
mutable std::map<char,double> cache_;
|
||||
};
|
||||
|
||||
double road_path_calculator::cost(const location& loc, const double so_far, const bool isDst) const
|
||||
double road_path_calculator::cost(const location& loc, const double /*so_far*/, const bool /*isDst*/) const
|
||||
{
|
||||
++calls;
|
||||
if (loc.x < 0 || loc.y < 0 || loc.x >= map_.size() || loc.y >= map_.front().size())
|
||||
if (loc.x < 0 || loc.y < 0 || loc.x >= (long)map_.size() || loc.y >= (long)map_.front().size())
|
||||
return (getNoPathValue());
|
||||
|
||||
const std::map<location,double>::const_iterator val = loc_cache_.find(loc);
|
||||
|
@ -393,7 +393,7 @@ is_valid_terrain::is_valid_terrain(const std::vector<std::vector<gamemap::TERRAI
|
|||
|
||||
bool is_valid_terrain::operator()(int x, int y) const
|
||||
{
|
||||
if(x < 0 || x >= map_.size() || y < 0 || y >= map_[x].size()) {
|
||||
if(x < 0 || x >= (long)map_.size() || y < 0 || y >= (long)map_[x].size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ gamemap::location place_village(const std::vector<std::vector<gamemap::TERRAIN>
|
|||
gamemap::location best_loc;
|
||||
size_t best_rating = 0;
|
||||
for(std::set<gamemap::location>::const_iterator i = locs.begin(); i != locs.end(); ++i) {
|
||||
if(i->x < 0 || i->y < 0 || i->x >= map.size() || i->y >= map[i->x].size()) {
|
||||
if(i->x < 0 || i->y < 0 || i->x >= (long)map.size() || i->y >= (long)map[i->x].size()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ gamemap::location place_village(const std::vector<std::vector<gamemap::TERRAIN>
|
|||
gamemap::location adj[6];
|
||||
get_adjacent_tiles(gamemap::location(i->x,i->y),adj);
|
||||
for(size_t n = 0; n != 6; ++n) {
|
||||
if(adj[n].x < 0 || adj[n].y < 0 || adj[n].x >= map.size() || adj[n].y >= map[adj[n].x].size()) {
|
||||
if(adj[n].x < 0 || adj[n].y < 0 || adj[n].x >= (long)map.size() || adj[n].y >= (long)map[adj[n].x].size()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -693,7 +693,7 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
|
|||
|
||||
std::map<location,std::string> river_names, lake_names;
|
||||
|
||||
const int nlakes = max_lakes > 0 ? (rand()%max_lakes) : 0;
|
||||
const size_t nlakes = max_lakes > 0 ? (rand()%max_lakes) : 0;
|
||||
for(size_t lake = 0; lake != nlakes; ++lake) {
|
||||
for(int tries = 0; tries != 100; ++tries) {
|
||||
const int x = rand()%width;
|
||||
|
@ -929,7 +929,7 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
|
|||
const int x = step->x;
|
||||
const int y = step->y;
|
||||
|
||||
if(x < 0 || y < 0 || x >= width || y >= height)
|
||||
if(x < 0 || y < 0 || x >= (long)width || y >= (long)height)
|
||||
continue;
|
||||
|
||||
calc.terrain_changed(*step);
|
||||
|
@ -1086,7 +1086,7 @@ std::string default_generate_map(size_t width, size_t height, size_t island_size
|
|||
|
||||
const gamemap::location res = place_village(terrain,x,y,2,cfg);
|
||||
|
||||
if(res.x >= width/3 && res.x < (width*2)/3 && res.y >= height/3 && res.y < (height*2)/3) {
|
||||
if(res.x >= (long)width/3 && res.x < (long)(width*2)/3 && res.y >= (long)height/3 && res.y < (long)(height*2)/3) {
|
||||
const std::string str(1,terrain[res.x][res.y]);
|
||||
const config* const child = cfg.find_child("village","terrain",str);
|
||||
if(child != NULL) {
|
||||
|
|
|
@ -297,7 +297,7 @@ std::string default_map_generator::create_map(const std::vector<std::string>& ar
|
|||
return generate_map(args);
|
||||
}
|
||||
|
||||
std::string default_map_generator::generate_map(const std::vector<std::string>& args, std::map<gamemap::location,std::string>* labels)
|
||||
std::string default_map_generator::generate_map(const std::vector<std::string>& /*args*/, std::map<gamemap::location,std::string>* labels)
|
||||
{
|
||||
// the random generator thinks odd widths are nasty, so make them even
|
||||
if (is_odd(width_))
|
||||
|
@ -347,7 +347,7 @@ config default_map_generator::create_scenario(const std::vector<std::string>& ar
|
|||
std::cerr << "done generating map..\n";
|
||||
|
||||
for(std::map<gamemap::location,std::string>::const_iterator i = labels.begin(); i != labels.end(); ++i) {
|
||||
if(i->first.x >= 0 && i->first.y >= 0 && i->first.x < width_ && i->first.y < height_) {
|
||||
if(i->first.x >= 0 && i->first.y >= 0 && i->first.x < (long)width_ && i->first.y < (long)height_) {
|
||||
config& label = res.add_child("label");
|
||||
label["text"] = i->second;
|
||||
i->first.write(label);
|
||||
|
|
|
@ -89,7 +89,6 @@ std::string::const_iterator parse_markup(std::string::const_iterator i1, std::st
|
|||
//could be any non-# char
|
||||
++i1;
|
||||
Uint8 red=0, green=0, blue=0, temp=0;
|
||||
int count=0;
|
||||
while(i1 != i2 && *i1 >= '0' && *i1<='9'){
|
||||
temp*=10;
|
||||
temp += lexical_cast<int, char>(*i1);
|
||||
|
@ -364,8 +363,8 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size, int
|
|||
|
||||
line_width += word_width;
|
||||
|
||||
if(line_width > max_width) {
|
||||
if(word_width > max_width) {
|
||||
if((long)line_width > max_width) {
|
||||
if((long)word_width > max_width) {
|
||||
cut_word(current_line, current_word, font_size, max_width);
|
||||
}
|
||||
if(current_word == " ")
|
||||
|
|
Loading…
Add table
Reference in a new issue