[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src display.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src display.cpp |
Date: |
Sun, 06 Feb 2005 09:05:02 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/02/06 14:05:02
Modified files:
src : display.cpp
Log message:
Fix units being not correctly diplayed on the minimap for odd
x-locations.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.287&tr2=1.288&r1=text&r2=text
Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.287 wesnoth/src/display.cpp:1.288
--- wesnoth/src/display.cpp:1.287 Sun Feb 6 10:40:12 2005
+++ wesnoth/src/display.cpp Sun Feb 6 14:05:02 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.287 2005/02/06 10:40:12 isaaccp Exp $ */
+/* $Id: display.cpp,v 1.288 2005/02/06 14:05:02 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1052,6 +1052,8 @@
SDL_Rect loc = minimap_location;
SDL_BlitSurface(surf,NULL,video().getSurface(),&loc);
+ int map_w = map_.x(), map_h = map_.y();
+
for(unit_map::const_iterator u = units_.begin(); u != units_.end();
++u) {
if(fogged(u->first.x,u->first.y) ||
(teams_[currentTeam_].is_enemy(u->second.side()) &&
@@ -1063,14 +1065,14 @@
const int side = u->second.side();
const SDL_Color& col = team::get_side_colour(side);
const Uint32 mapped_col =
SDL_MapRGB(video().getSurface()->format,col.r,col.g,col.b);
- SDL_Rect rect = {x + (u->first.x*w)/map_.x(),
- y + (u->first.y*h)/map_.y(),
- w/map_.x(), h/map_.y() };
+ SDL_Rect rect = { x + (u->first.x * w) / map_w,
+ y + (u->first.y * h + (is_odd(u->first.x) ? h
/ 2 : 0)) / map_h,
+ w / map_w, h / map_h };
SDL_FillRect(video().getSurface(),&rect,mapped_col);
}
- const double xscaling = double(surf->w)/double(map_.x());
- const double yscaling = double(surf->h)/double(map_.y());
+ const double xscaling = double(surf->w) / map_w;
+ const double yscaling = double(surf->h) / map_h;
const int xbox = static_cast<int>(xscaling*xpos_/(zoom_*0.75));
const int ybox = static_cast<int>(yscaling*ypos_/zoom_);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src display.cpp,
Guillaume Melquiond <=