pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3635 - trunk/pingus/src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3635 - trunk/pingus/src
Date: Thu, 3 Jul 2008 01:37:43 +0200

Author: grumbel
Date: 2008-07-03 01:37:43 +0200 (Thu, 03 Jul 2008)
New Revision: 3635

Modified:
   trunk/pingus/src/server_event.cpp
Log:
Dump raw position data

Modified: trunk/pingus/src/server_event.cpp
===================================================================
--- trunk/pingus/src/server_event.cpp   2008-07-02 22:59:59 UTC (rev 3634)
+++ trunk/pingus/src/server_event.cpp   2008-07-02 23:37:43 UTC (rev 3635)
@@ -17,6 +17,8 @@
 
 #include <assert.h>
 #include <iostream>
+#include <boost/format.hpp>
+
 #include "pingus_error.hpp"
 #include "server.hpp"
 #include "world.hpp"
@@ -24,6 +26,16 @@
 #include "pingu.hpp"
 #include "string_util.hpp"
 
+std::string float2string(float value)
+{
+  std::string str = "0x";
+  for(size_t i = 0; i < sizeof(value); ++i)
+    {
+      str += (boost::format("%02x") % 
int(reinterpret_cast<uint8_t*>(&value)[i])).str();
+    }
+  return str;
+}
+
 ServerEvent::ServerEvent() :
        type(PINGU_ACTION_EVENT),
        time_stamp(0),
@@ -152,7 +164,12 @@
        Pingu* pingu = server->get_world()->get_pingus()->get_pingu(pingu_id);
        if (pingu)
          {
-            std::cout << "Apply: " << pos << " == " << pingu->get_pos() << 
std::endl;
+            std::cout << "Apply: "
+              //<< float2string(pos.x) << "," << float2string(pos.y) << " == "
+                      << float2string(pingu->get_pos().x) << "," << 
float2string(pingu->get_pos().y) << " "
+              //<< "(" << pos.x << ", " << pos.y << ") == "
+              //        << "(" << pingu->get_pos().x << ", " << 
pingu->get_pos().y << ")"
+                      << std::endl;
            server->send_pingu_action_event(pingu,
                                            pingu_action);
          }





reply via email to

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