(svn r7166) -Fix: [FS#402] MiniMap was misplacing vehicles sometimes (HMage)
authorKUDr
Thu, 16 Nov 2006 12:31:38 +0000
changeset 5096 144cdbb32045
parent 5095 fd35de11728c
child 5097 402cbcb525b2
(svn r7166) -Fix: [FS#402] MiniMap was misplacing vehicles sometimes (HMage)
smallmap_gui.c
--- a/smallmap_gui.c	Thu Nov 16 10:51:42 2006 +0000
+++ b/smallmap_gui.c	Thu Nov 16 12:31:38 2006 +0000
@@ -695,8 +695,8 @@
 					(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) {
 				// Remap into flat coordinates.
 				Point pt = RemapCoords(
-					(v->x_pos - WP(w,smallmap_d).scroll_x) / TILE_SIZE,
-					(v->y_pos - WP(w,smallmap_d).scroll_y) / TILE_SIZE,
+					v->x_pos / TILE_SIZE - WP(w,smallmap_d).scroll_x / TILE_SIZE, // divide each one separately because (a-b)/c != a/c-b/c in integer world
+					v->y_pos / TILE_SIZE - WP(w,smallmap_d).scroll_y / TILE_SIZE, //    dtto
 					0);
 				x = pt.x;
 				y = pt.y;