Developer-only change: fixed remaining g++ compiler warnings:

double->int casts, and no newlines at the end of files.
This commit is contained in:
John B. Messerly 2004-05-23 18:19:30 +00:00
parent 747286baed
commit 0bdf49c8df
8 changed files with 23 additions and 23 deletions

View file

@ -1616,4 +1616,4 @@ const gamemap::location& ai::nearest_keep(const gamemap::location& loc) const
}
return *res;
}
}

View file

@ -1255,7 +1255,7 @@ void display::draw_bar(const std::string& image, int xpos, int ypos, size_t heig
blit_surface(xpos,ypos,surf,&top);
blit_surface(xpos,ypos+top.h,surf,&bot);
const size_t unfilled = height*(1.0 - filled);
const size_t unfilled = size_t(height*(1.0 - filled));
if(unfilled < height) {
SDL_Rect filled_area = {xpos+bar_loc.x,ypos+bar_loc.y+unfilled,bar_loc.w,height-unfilled};

View file

@ -462,7 +462,7 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
const std::string& add = cfg["add"];
if(add.empty() == false) {
int value = atof(var.c_str());
int value = int(atof(var.c_str()));
value += atoi(add.c_str());
char buf[50];
sprintf(buf,"%d",value);
@ -471,7 +471,7 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
const std::string& multiply = cfg["multiply"];
if(multiply.empty() == false) {
int value = atof(var.c_str());
int value = int(atof(var.c_str()));
value = int(double(value) * atof(multiply.c_str()));
char buf[50];
sprintf(buf,"%d",value);

View file

@ -416,7 +416,7 @@ SDL_Surface* getMinimap(int w, int h, const gamemap& map,
std::cerr << "creating minimap " << int(map.x()*scale*0.75) << "," << int(map.y()*scale) << "\n";
const size_t map_width = map.x()*scale*0.75;
const size_t map_width = map.x()*scale*3/4;
const size_t map_height = map.y()*scale;
if(map_width == 0 || map_height == 0) {
return NULL;
@ -477,7 +477,7 @@ SDL_Surface* getMinimap(int w, int h, const gamemap& map,
assert(surf != NULL);
SDL_Rect maprect = {x*scale*0.75,y*scale + (is_odd(x) ? scale/2 : 0),0,0};
SDL_Rect maprect = {x*scale*3/4,y*scale + (is_odd(x) ? scale/2 : 0),0,0};
sdl_safe_blit(surf, NULL, minimap, &maprect);
}
}

View file

@ -445,9 +445,9 @@ SDL_Surface* blend_surface(SDL_Surface* surface, double amount, Uint32 colour)
Uint8 red2, green2, blue2, alpha2;
SDL_GetRGBA(colour,surf->format,&red2,&green2,&blue2,&alpha2);
red2 *= amount;
green2 *= amount;
blue2 *= amount;
red2 = Uint8(red2*amount);
green2 = Uint8(green2*amount);
blue2 = Uint8(blue2*amount);
amount = 1.0 - amount;
@ -455,9 +455,9 @@ SDL_Surface* blend_surface(SDL_Surface* surface, double amount, Uint32 colour)
Uint8 red, green, blue, alpha;
SDL_GetRGBA(*beg,surf->format,&red,&green,&blue,&alpha);
red = red*amount + red2;
green = green*amount + green2;
blue = blue*amount + blue2;
red = Uint8(red*amount) + red2;
green = Uint8(green*amount) + green2;
blue = Uint8(blue*amount) + blue2;
*beg = SDL_MapRGBA(surf->format,red,green,blue,alpha);

View file

@ -182,4 +182,4 @@ TITLE_RESULT show_title(display& screen)
return QUIT_GAME;
}
}
}

View file

@ -12,4 +12,4 @@ TITLE_RESULT show_title(display& screen);
}
#endif
#endif

View file

@ -90,8 +90,8 @@ void move_unit_between(display& disp, const gamemap& map, const gamemap::locatio
ysrc = disp.get_location_y(a);
xdst = disp.get_location_x(b);
ydst = disp.get_location_y(b);
xloc = xsrc + xstep*i;
yloc = ysrc + ystep*i;
xloc = xsrc + int(xstep*i);
yloc = ysrc + int(ystep*i);
}
//invalidate the source tile and all adjacent tiles,
@ -391,10 +391,10 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
|| preferences::show_combat() == false;
if(!hide) {
const double side_threshhold = 80.0;
const int side_threshhold = 80;
double xloc = disp.get_location_x(a);
double yloc = disp.get_location_y(a);
int xloc = disp.get_location_x(a);
int yloc = disp.get_location_y(a);
SDL_Rect area = disp.map_area();
@ -402,19 +402,19 @@ bool unit_attack(display& disp, unit_map& units, const gamemap& map,
//keep track of the old position, and if the map moves at all,
//then recenter it on the unit
if(xloc < area.x + side_threshhold) {
disp.scroll(xloc - side_threshhold - disp.map_area().x,0.0);
disp.scroll(xloc - side_threshhold - disp.map_area().x,0);
}
if(yloc < area.y + side_threshhold) {
disp.scroll(0.0,yloc - side_threshhold - area.y);
disp.scroll(0,yloc - side_threshhold - area.y);
}
if(xloc + disp.hex_size() > area.x + area.w - side_threshhold) {
disp.scroll(((xloc + disp.hex_size()) - (area.x + area.w - side_threshhold)),0.0);
disp.scroll(((xloc + disp.hex_size()) - (area.x + area.w - side_threshhold)),0);
}
if(yloc + disp.hex_size() > area.y + area.h - side_threshhold) {
disp.scroll(0.0,((yloc + disp.hex_size()) - (area.y + area.h - side_threshhold)));
disp.scroll(0,((yloc + disp.hex_size()) - (area.y + area.h - side_threshhold)));
}
if(xloc != disp.get_location_x(a) || yloc != disp.get_location_y(a)) {