pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3911 - in trunk/pingus/src: . actions input math


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3911 - in trunk/pingus/src: . actions input math
Date: Sun, 27 Jul 2008 06:00:31 +0200

Author: grumbel
Date: 2008-07-27 06:00:29 +0200 (Sun, 27 Jul 2008)
New Revision: 3911

Modified:
   trunk/pingus/src/actions/angel.cpp
   trunk/pingus/src/actions/boarder.cpp
   trunk/pingus/src/blitter.cpp
   trunk/pingus/src/input/evdev_device.cpp
   trunk/pingus/src/math/rect.hpp
   trunk/pingus/src/math/size.hpp
   trunk/pingus/src/math/vector2f.hpp
Log:
Removed unneded casts or converted to C++ style

Modified: trunk/pingus/src/actions/angel.cpp
===================================================================
--- trunk/pingus/src/actions/angel.cpp  2008-07-27 04:00:11 UTC (rev 3910)
+++ trunk/pingus/src/actions/angel.cpp  2008-07-27 04:00:29 UTC (rev 3911)
@@ -36,7 +36,7 @@
   sprite.update ();
 
   counter += game_speed;
-  pingu->set_pos((float)x_pos + 20 * (float)Math::sin(counter * 3.0f), 
pingu->get_y() - 50.0f * 0.025f);
+  pingu->set_pos(x_pos + 20 * Math::sin(counter * 3.0f), pingu->get_y() - 
50.0f * 0.025f);
 
   // Out of screen, let the pingu die
   if (pingu->get_y() < -32)

Modified: trunk/pingus/src/actions/boarder.cpp
===================================================================
--- trunk/pingus/src/actions/boarder.cpp        2008-07-27 04:00:11 UTC (rev 
3910)
+++ trunk/pingus/src/actions/boarder.cpp        2008-07-27 04:00:29 UTC (rev 
3911)
@@ -69,7 +69,7 @@
   }
   else
   {
-    pingu->apply_force (Vector3f((float)speed * pingu->direction, 0));
+    pingu->apply_force (Vector3f(speed * pingu->direction, 0));
     pingu->set_action(Actions::WALKER);
   }
 }

Modified: trunk/pingus/src/blitter.cpp
===================================================================
--- trunk/pingus/src/blitter.cpp        2008-07-27 04:00:11 UTC (rev 3910)
+++ trunk/pingus/src/blitter.cpp        2008-07-27 04:00:29 UTC (rev 3911)
@@ -54,9 +54,9 @@
     SDL_LockSurface(surface);
     SDL_LockSurface(new_surface);
 
-    pixels = (unsigned char *)surface->pixels;
-    new_pixels = (unsigned char *)new_surface->pixels;
-    new_pitch = new_surface->pitch;
+    pixels     = static_cast<unsigned char*>(surface->pixels);
+    new_pixels = static_cast<unsigned char*>(new_surface->pixels);
+    new_pitch  = new_surface->pitch;
 
     memcpy(pal, surface->format->palette->colors, sizeof(SDL_Color) * 256);
     ckey = surface->format->colorkey;
@@ -87,8 +87,8 @@
     SDL_LockSurface(surface);
     SDL_LockSurface(new_surface);
 
-    pixels = (unsigned char *)surface->pixels;
-    new_pixels = (unsigned char *)new_surface->pixels;
+    pixels     = static_cast<unsigned char*>(surface->pixels);
+    new_pixels = static_cast<unsigned char*>(new_surface->pixels);
     new_pitch = new_surface->pitch;
 
     for (i = 0; i < height; ++i) {

Modified: trunk/pingus/src/input/evdev_device.cpp
===================================================================
--- trunk/pingus/src/input/evdev_device.cpp     2008-07-27 04:00:11 UTC (rev 
3910)
+++ trunk/pingus/src/input/evdev_device.cpp     2008-07-27 04:00:29 UTC (rev 
3911)
@@ -216,9 +216,9 @@
 {
   struct input_event ev[128];
   // FIXME: turn this into a while loop so all events get processed
-  int rd = read(fd, ev, sizeof(struct input_event) * 128);
+  ssize_t rd = read(fd, ev, sizeof(struct input_event) * 128);
   //std::cout << rd / sizeof(struct input_event) << std::endl;
-  if (rd >= (int) sizeof(struct input_event))
+  if (rd >= static_cast<ssize_t>(sizeof(struct input_event)))
     {
       for (int i = 0; i < rd / (int)sizeof(struct input_event); ++i)
         {

Modified: trunk/pingus/src/math/rect.hpp
===================================================================
--- trunk/pingus/src/math/rect.hpp      2008-07-27 04:00:11 UTC (rev 3910)
+++ trunk/pingus/src/math/rect.hpp      2008-07-27 04:00:29 UTC (rev 3911)
@@ -220,10 +220,10 @@
   Rectf() { left = right = top = bottom = 0.0f; }
 
   Rectf(const Rect& rect)
-    : left((float)rect.left), 
-      top((float)rect.top), 
-      right((float)rect.right), 
-      bottom((float)rect.bottom)
+    : left(static_cast<float>(rect.left)), 
+      top(static_cast<float>(rect.top)), 
+      right(static_cast<float>(rect.right)), 
+      bottom(static_cast<float>(rect.bottom))
   {}
 
   Rectf(float new_left, float new_top, float new_right, float new_bottom)

Modified: trunk/pingus/src/math/size.hpp
===================================================================
--- trunk/pingus/src/math/size.hpp      2008-07-27 04:00:11 UTC (rev 3910)
+++ trunk/pingus/src/math/size.hpp      2008-07-27 04:00:29 UTC (rev 3911)
@@ -111,8 +111,8 @@
        Sizef() : width(0.f), height(0.f) { return; }
 
        Sizef(const Size& s) 
-               : width((float)s.width),
-                 height((float)s.height)
+          : width(static_cast<float>(s.width)),
+            height(static_cast<float>(s.height))
        {}
 
        Sizef(float width, float height)

Modified: trunk/pingus/src/math/vector2f.hpp
===================================================================
--- trunk/pingus/src/math/vector2f.hpp  2008-07-27 04:00:11 UTC (rev 3910)
+++ trunk/pingus/src/math/vector2f.hpp  2008-07-27 04:00:29 UTC (rev 3911)
@@ -32,7 +32,8 @@
     : x(other.x), y(other.y)
   { }
   Vector2f(const Vector2i& other)
-    : x((float)other.x), y((float)other.y)
+    : x(static_cast<float>(other.x)), 
+      y(static_cast<float>(other.y))
   {}
   Vector2f()
     : x(0), y(0)





reply via email to

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