pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3916 - in trunk/pingus/src: editor worldmap


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3916 - in trunk/pingus/src: editor worldmap
Date: Sun, 27 Jul 2008 16:34:35 +0200

Author: grumbel
Date: 2008-07-27 16:34:33 +0200 (Sun, 27 Jul 2008)
New Revision: 3916

Modified:
   trunk/pingus/src/editor/viewport.cpp
   trunk/pingus/src/worldmap/level_dot.cpp
   trunk/pingus/src/worldmap/worldmap.cpp
Log:
Some more float/int cleanup

Modified: trunk/pingus/src/editor/viewport.cpp
===================================================================
--- trunk/pingus/src/editor/viewport.cpp        2008-07-27 14:22:32 UTC (rev 
3915)
+++ trunk/pingus/src/editor/viewport.cpp        2008-07-27 14:34:33 UTC (rev 
3916)
@@ -345,7 +345,7 @@
   UNUSED_ARG(delta);
 
   if (current_action == SCROLLING)
-    state.set_pos(Vector2i(state.get_pos() + Vector2i(mouse_screen_pos - 
drag_screen_pos) * delta * 5));
+    state.set_pos(state.get_pos() + (mouse_screen_pos - drag_screen_pos) * 5 * 
delta);
 
   // Autoscroll if necessary
   if (autoscroll)

Modified: trunk/pingus/src/worldmap/level_dot.cpp
===================================================================
--- trunk/pingus/src/worldmap/level_dot.cpp     2008-07-27 14:22:32 UTC (rev 
3915)
+++ trunk/pingus/src/worldmap/level_dot.cpp     2008-07-27 14:34:33 UTC (rev 
3916)
@@ -130,7 +130,7 @@
   if (accessible())
     {
       int length = Fonts::pingus_small.bounding_rect(0, 0, 
_(get_plf().get_levelname())).get_width() / 2;
-      int realpos = static_cast<int>(gc.world_to_screen(Vector2i(pos.x, 
pos.y)).x);
+      int realpos = gc.world_to_screen(Vector2i(static_cast<int>(pos.x), 
static_cast<int>(pos.y))).x;
       if (realpos - length < 0)
         pos_correction = realpos - length;
       else if (realpos + length > gc.get_width())
@@ -145,7 +145,7 @@
   else
     {
       int length  = Fonts::pingus_small.bounding_rect(0, 0, 
_("locked")).get_width() / 2;
-      int realpos = static_cast<int>(gc.world_to_screen(Vector2i(pos.x, 
pos.y)).x);
+      int realpos = gc.world_to_screen(Vector2i(static_cast<int>(pos.x), 
static_cast<int>(pos.y))).x;
       if (realpos - length < 0)
         pos_correction = realpos - length;
       else if (realpos + length > gc.get_width())

Modified: trunk/pingus/src/worldmap/worldmap.cpp
===================================================================
--- trunk/pingus/src/worldmap/worldmap.cpp      2008-07-27 14:22:32 UTC (rev 
3915)
+++ trunk/pingus/src/worldmap/worldmap.cpp      2008-07-27 14:34:33 UTC (rev 
3916)
@@ -108,25 +108,25 @@
 
   if (width >= gc.get_width())
     {
-      min = float(gc.get_width()/2);
-      max = float(width - gc.get_width()/2);
+      min = gc.get_width()/2;
+      max = width - gc.get_width()/2;
     }
   else
     {
-      min = float(width - gc.get_width()/2);
-      max = float(gc.get_width()/2);
+      min = width - gc.get_width()/2;
+      max = gc.get_width()/2;
     }
   pingu_pos.x = Math::clamp(min, pingu_pos.x, max);
 
   if (height >= gc.get_height())
     {
-      min = float(gc.get_height()/2);
-      max = float(height - gc.get_height()/2);
+      min = gc.get_height()/2;
+      max = height - gc.get_height()/2;
     }
   else
     {
-      min = float(height - gc.get_height()/2);
-      max = float(gc.get_height()/2);
+      min = height - gc.get_height()/2;
+      max = gc.get_height()/2;
     }
   pingu_pos.y = Math::clamp(min, pingu_pos.y, max);
 
@@ -147,7 +147,7 @@
 }
 
 void
-Worldmap::update (float delta)
+Worldmap::update(float delta)
 {
   for (DrawableLst::iterator i = drawables.begin (); i != drawables.end (); 
++i)
     {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]