Index: /branches/network/src/lib/network/converter.cc
===================================================================
--- /branches/network/src/lib/network/converter.cc	(revision 6196)
+++ /branches/network/src/lib/network/converter.cc	(revision 6197)
@@ -94,7 +94,5 @@
     mult *= step;
   }
-  
-  printf("tara: %i", result);
-  
+
   if (a[INTSIZE - 1] >= sgnadd)
   {
@@ -108,75 +106,22 @@
 }
 
-/*char* Converter::floatToBinString(float x)
+/*!
+ * Converts a float into a string containing its binary representation
+ */
+char* Converter::floatToBinString(float x)
 {
   char* result = new char[200];
   int pos = 0;
   
-  int h = (int)x;
-  if (h > x)
-    h--;
-  x -= h;
-  
-  
-  while (h > 0 && pos < 200)
-  {
-    //printf("%i ", pos);
-    
-    if (h % 2 == 1)
-    {
-      result[pos] = '1';
-      h -= 1;
-    }
-    else
-      result[pos] = '0';
-    pos++;
-    h /= 2;
-  }
-  
-  //printf("x = %f\n", x);
-  
-  
-  //invert
-  for (int i = 0; i < pos / 2; i++)
-  {
-    char temp = result[i];
-    result[i] = result[pos - 1 - i];
-    result[pos - 1 - i] = temp;
-  }
-  
-  
-  result[pos++] = '.';
-  float sub = 0.5;
-  while (x > 0 && pos < 200)
-  {
-    //printf("%i ", pos);
-    
-    if (x >= sub)
-    {
-      result[pos] = '1';
-      x -= sub;
-    }
-    else
-      result[pos] = '0';
-    pos++;
-    sub /= 2;
-  }
-  
-  
-  return result;
-}*/
-
-char* Converter::floatToBinString(float x)
-{
-  char* result = new char[200];
-  int pos = 0;
+  if (x < 0)
+  {
+    result[pos++] = '-';
+    x = -x;
+  }
   
   float sub = 1;
   while (sub < x)
     sub *= 2;
-  
-  //printf("sub = %f\n", sub);
-  
-  //while (sub >= 1 && pos < 200)
+
   while ((x > 0 || sub >= 1) && pos < 200)
   {
@@ -195,20 +140,129 @@
   }
   
-  /*result[pos++] = '.';
-  sub = 0.5;
-  while (x > 0 && pos < 200)
+  return result;
+}
+
+const int expmult = 8388608; //2^23
+
+/*!
+ * Converts a float value into a byte-array
+ * @param x: The float which is to convert
+ * @return: A byte-array which accords the given float
+ */
+byte* Converter::floatToByteArray(float x)
+{
+  int mantisse = 0;
+  int exponent = 128;
+  
+  int sgn;
+  if (x < 0)
+  {
+    x = -x;
+    sgn = -1;
+  }
+  else
+    sgn = 1;
+  
+  float sub = 1;
+  while (sub < x)
+  {
+    sub *= 2;
+    exponent++;
+  }
+
+  while (x > 0)
   {
     if (x >= sub)
     {
-      result[pos] = '1';
+      mantisse += 1;
       x -= sub;
     }
-    else
-      result[pos] = '0';
-    pos++;
+    
+    mantisse *= 2;
+    exponent--;
     sub /= 2;
   }
-  */
-  
-  return result;
-}
+  exponent++;
+  mantisse /= 2;
+  while (mantisse < expmult)
+  {
+    mantisse *= 2;
+    exponent--;
+  }
+  
+  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);  
+  
+  mantisse -= expmult;
+  
+  int hx = mantisse + expmult * exponent;
+  byte* result = intToByteArray(hx);
+  if (sgn == -1)
+    result[3] += sgnadd;
+  
+  return result;
+}
+
+
+/*!
+ * Converts a byte-array into a float value
+ * @param a: The byte-array which is to convert
+ * @return: A float value which accords the given byte-array
+ */
+float Converter::byteArrayToFloat(byte* a)
+{
+  int hmant = a[0] + a[1] * 256 + a[2] * 65536;
+  int mantisse = hmant % expmult;
+  mantisse += expmult;
+  
+  int hexp = a[2] + a[3] * 256;
+  int exponent = (hexp / 128) % 256 - 128;
+  
+  int sgn;
+  if (a[3] >= sgnadd)
+    sgn = -1;
+  else
+    sgn = 1;
+  
+  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
+  
+  float emult = 1;
+  if (exponent > 0)
+    for (int i = 0; i < exponent; i++)
+      emult *= 2;
+  else if (exponent < 0)
+    for (int i = 0; i > exponent; i--)
+      emult /= 2;
+  
+  float result = mantisse * emult;
+  if (sgn == -1)
+    result = -result;
+  
+  return result;
+}
+
+/*!
+ * Converts a float value into a byte-array
+ * @param x: The float which is to convert
+ * @return: A byte-array which accords the given float
+ */
+byte* Converter::_floatToByteArray(float x)
+{
+  byte* p = (byte*)&x;
+  byte* result = new byte[4];
+  for (int i = 0; i < 4; i++)
+    result[i] = p[i];
+  return result;
+}
+
+
+/*!
+ * Converts a byte-array into a float value
+ * @param a: The byte-array which is to convert
+ * @return: A float value which accords the given byte-array
+ */
+float Converter::_byteArrayToFloat(byte* a)
+{
+  float* p = (float*)a;
+  float result = *p;
+  return result;
+}
Index: /branches/network/src/lib/network/converter.h
===================================================================
--- /branches/network/src/lib/network/converter.h	(revision 6196)
+++ /branches/network/src/lib/network/converter.h	(revision 6197)
@@ -31,4 +31,9 @@
     static char* floatToBinString(float x);
     
+    static byte* floatToByteArray(float x);
+    static float byteArrayToFloat(byte* a);
+    
+    static byte* _floatToByteArray(float x);
+    static float _byteArrayToFloat(byte* a);
   private:
     Converter();
Index: /branches/network/src/lib/network/network_game_manager.cc
===================================================================
--- /branches/network/src/lib/network/network_game_manager.cc	(revision 6196)
+++ /branches/network/src/lib/network/network_game_manager.cc	(revision 6197)
@@ -175,5 +175,6 @@
 void NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )
 {
-  BaseObject * b = Factory::fabricate( classID );
+  //BaseObject * b = Factory::fabricate( classID );
+  BaseObject * b = NULL;
 
   if ( b->isA(CL_SYNCHRONIZEABLE) )
Index: /branches/network/src/subprojects/network/network_unit_test.cc
===================================================================
--- /branches/network/src/subprojects/network/network_unit_test.cc	(revision 6196)
+++ /branches/network/src/subprojects/network/network_unit_test.cc	(revision 6197)
@@ -284,7 +284,38 @@
 }
 
-
+void testFloatConverter(float f)
+{
+  char* s = Converter::floatToBinString(f);
+  printf("%f = ", f);
+  printf(s); printf("\n");
+  
+  byte* res = Converter::floatToByteArray(f);
+  printf("Byte Array: ");
+  for (int i = 0; i < 4; i++)
+    printf("%i  ", res[i]);
+  printf("\n");
+  
+  float b = Converter::byteArrayToFloat(res);
+  printf("ReConvert: %f \n", b);
+}
+
+void testFloatConverter2(float f)
+{
+  char* s = Converter::floatToBinString(f);
+  printf("### %f = ", f);
+  printf(s); printf("\n");
+  
+  byte* res = Converter::_floatToByteArray(f);
+  printf("Byte Array: ");
+  for (int i = 0; i < 4; i++)
+    printf("%i  ", res[i]);
+  printf("\n");
+  
+  float b = Converter::_byteArrayToFloat(res);
+  printf("ReConvert: %f \n", b);
+}
 int converter(int argc, char** argv)
 {
+  /*
   int x = 200564786;
   printf("To convert: %i\n", x);
@@ -305,4 +336,6 @@
   printf("\n");
   
+  */
+  /*
   float y;
   char* s;
@@ -328,5 +361,35 @@
   printf(s); printf("\n");
   
-  
+  y = -4.7824f;
+  s = Converter::floatToBinString(y);
+  printf("%f = ", y);
+  printf(s); printf("\n");
+  
+  y = -14.35e14f;
+  s = Converter::floatToBinString(y);
+  printf("%f = ", y);
+  printf(s); printf("\n");
+                                                            */
+  
+  
+  /*
+  float a = 12.3f;
+  
+  char* s = Converter::floatToBinString(a);
+  printf("%f = ", a);
+  printf(s); printf("\n");
+  
+  byte* res = Converter::floatToByteArray(a);
+  printf("Byte Array: \n");
+  for (int i = 0; i < 4; i++)
+    printf("%i  ", res[i]);
+  printf("\n");
+  
+  float b = Converter::byteArrayToFloat(res);
+  printf("ReConvert: %f \n", b);
+  */
+  testFloatConverter2(12.3f); printf("\n");
+  testFloatConverter2(134.25f); printf("\n");
+  testFloatConverter2(35.67e14f); printf("\n");
   
   return 0;
