Index: code/trunk/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Gamestate.cc	(revision 8394)
+++ code/trunk/src/libraries/network/packet/Gamestate.cc	(revision 8858)
@@ -31,5 +31,5 @@
 #include <zlib.h>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/OrxAssert.h"
 #include "core/GameMode.h"
@@ -108,5 +108,5 @@
   uint32_t size = calcGamestateSize(id, mode);
 
-  COUT(5) << "G.ST.Man: producing gamestate with id: " << id << std::endl;
+  orxout(verbose_more, context::packets) << "G.ST.Man: producing gamestate with id: " << id << endl;
   if(size==0)
     return false;
@@ -114,5 +114,5 @@
   if(!data_)
   {
-    COUT(2) << "GameStateManager: could not allocate memory" << std::endl;
+    orxout(internal_warning, context::packets) << "GameStateManager: could not allocate memory" << endl;
     return false;
   }
@@ -139,5 +139,5 @@
       assert(0); // if we don't use multithreading this part shouldn't be neccessary
       // start allocate additional memory
-      COUT(3) << "Gamestate: need additional memory" << std::endl;
+      orxout(internal_info, context::packets) << "Gamestate: need additional memory" << endl;
       ObjectList<Synchronisable>::iterator temp = it;
       uint32_t addsize=tempsize;
@@ -167,6 +167,6 @@
   //stop write gamestate header
 
-  COUT(5) << "Gamestate: Gamestate size: " << currentsize << std::endl;
-  COUT(5) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << std::endl;
+  orxout(verbose_more, context::packets) << "Gamestate: Gamestate size: " << currentsize << endl;
+  orxout(verbose_more, context::packets) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << endl;
   return true;
 }
@@ -175,5 +175,5 @@
 bool Gamestate::spreadData(uint8_t mode)
 {
-  COUT(5) << "processing gamestate with id " << header_.getID() << endl;
+  orxout(verbose_more, context::packets) << "processing gamestate with id " << header_.getID() << endl;
   assert(data_);
   assert(!header_.isCompressed());
@@ -195,5 +195,5 @@
       else
       {
-//         COUT(4) << "not creating object of classid " << objectheader.getClassID() << endl;
+//         orxout(verbose, context::packets) << "not creating object of classid " << objectheader.getClassID() << endl;
         mem += objectheader.getDataSize() + ( objectheader.isDiffed() ? SynchronisableHeaderLight::getSize() : SynchronisableHeader::getSize() );
       }
@@ -201,5 +201,5 @@
     else
     {
-//       COUT(4) << "updating object of classid " << objectheader.getClassID() << endl;
+//       orxout(verbose, context::packets) << "updating object of classid " << objectheader.getClassID() << endl;
       OrxVerify(s->updateData(mem, mode), "ERROR: could not update Synchronisable with Gamestate data");
     }
@@ -219,7 +219,7 @@
         if (it->objectMode_ != 0x0)
         {
-          COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
-          COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
-          COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
+          orxout(user_error, context::packets) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << endl;
+          orxout(user_error, context::packets) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << endl;
+          orxout(user_error, context::packets) << "Objects class: " << it->getIdentifier()->getName() << endl;
           assert(false);
         }
@@ -232,7 +232,7 @@
           if (it->getObjectID() == *it2)
           {
-            COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
-                    << "Are you sure you don't create a Sychnronisable objcect with 'new' \
-                        that doesn't have objectMode = 0x0?" << std::endl;
+            orxout(user_error, context::packets) << "Found duplicate objectIDs on the client!" << endl
+                                                 << "Are you sure you don't create a Sychnronisable objcect with 'new' \
+                                                     that doesn't have objectMode = 0x0?" << endl;
             assert(false);
           }
@@ -293,8 +293,8 @@
   switch ( retval )
   {
-    case Z_OK: COUT(5) << "G.St.Man: compress: successfully compressed" << std::endl; break;
-    case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl; return false;
-    case Z_BUF_ERROR: COUT(2) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << std::endl; return false;
-    case Z_DATA_ERROR: COUT(2) << "G.St.Man: compress: data corrupted in gamestate.compress" << std::endl; return false;
+    case Z_OK: orxout(verbose_more, context::packets) << "G.St.Man: compress: successfully compressed" << endl; break;
+    case Z_MEM_ERROR: orxout(internal_error, context::packets) << "G.St.Man: compress: not enough memory available in gamestate.compress" << endl; return false;
+    case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << endl; return false;
+    case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: data corrupted in gamestate.compress" << endl; return false;
   }
 
@@ -310,5 +310,5 @@
   header_.setCompSize( buffer );
   header_.setCompressed( true );
-  COUT(4) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << std::endl;
+  orxout(verbose, context::packets) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << endl;
   return true;
 }
@@ -319,5 +319,5 @@
   assert(data_);
   assert(header_.isCompressed());
-  COUT(4) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << std::endl;
+  orxout(verbose, context::packets) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << endl;
   uint32_t datasize = header_.getDataSize();
   uint32_t compsize = header_.getCompSize();
@@ -333,8 +333,8 @@
   switch ( retval )
   {
-    case Z_OK: COUT(5) << "successfully decompressed" << std::endl; break;
-    case Z_MEM_ERROR: COUT(1) << "not enough memory available" << std::endl; return false;
-    case Z_BUF_ERROR: COUT(2) << "not enough memory available in the buffer" << std::endl; return false;
-    case Z_DATA_ERROR: COUT(2) << "data corrupted (zlib)" << std::endl; return false;
+    case Z_OK: orxout(verbose_more, context::packets) << "successfully decompressed" << endl; break;
+    case Z_MEM_ERROR: orxout(internal_error, context::packets) << "not enough memory available" << endl; return false;
+    case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "not enough memory available in the buffer" << endl; return false;
+    case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "data corrupted (zlib)" << endl; return false;
   }
 
@@ -375,5 +375,5 @@
   if( memcmp( origDataPtr+objectOffset, baseDataPtr+objectOffset, objectHeader.getDataSize()) == 0 )
   {
-//     COUT(4) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl;
+//     orxout(verbose, context::packets) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl;
     origDataPtr += objectOffset + objectHeader.getDataSize(); // skip the whole object
     baseDataPtr += objectOffset + objectHeader.getDataSize();
@@ -431,5 +431,5 @@
 inline void /*Gamestate::*/copyObject( uint8_t*& newData, uint8_t*& origData, uint8_t*& baseData, SynchronisableHeader& objectHeader, std::vector<uint32_t>::iterator& sizes )
 {
-  //       COUT(4) << "docopy" << endl;
+  //       orxout(verbose, context::packets) << "docopy" << endl;
   // Just copy over the whole Object
   memcpy( newData, origData, objectHeader.getDataSize()+SynchronisableHeader::getSize() );
@@ -440,13 +440,13 @@
 //   SynchronisableHeader baseHeader( baseData );
 //   baseData += baseHeader.getDataSize()+SynchronisableHeader::getSize();
-  //       COUT(4) << "copy " << h.getObjectID() << endl;
-  //       COUT(4) << "copy " << h.getObjectID() << ":";
+  //       orxout(verbose, context::packets) << "copy " << h.getObjectID() << endl;
+  //       orxout(verbose, context::packets) << "copy " << h.getObjectID() << ":";
   sizes += Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables();
 //   for( unsigned int i = 0; i < Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables(); ++i )
 //   {
-//     //         COUT(4) << " " << *sizes;
+//     //         orxout(verbose, context::packets) << " " << *sizes;
 //     ++sizes;
 //   }
-    //       COUT(4) << endl;
+    //       orxout(verbose, context::packets) << endl;
 }
 
@@ -541,5 +541,5 @@
       if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() )
       {
-//         COUT(4) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
         diffedObject = true;
@@ -547,5 +547,5 @@
       else
       {
-//         COUT(4) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
         assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd);
@@ -565,5 +565,5 @@
         if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() )
         {
-//           COUT(4) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//           orxout(verbose, context::packets) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
           diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
           diffedObject = true;
@@ -571,5 +571,5 @@
         else
         {
-//           COUT(4) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//           orxout(verbose, context::packets) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
           copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
           assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd);
@@ -578,5 +578,5 @@
       else
       {
-//         COUT(4) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         assert(baseDataPtr == oldBaseDataPtr);
         copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
@@ -718,8 +718,8 @@
   //copy in the zeros
 //   std::list<obj>::iterator itt;
-//   COUT(0) << "myvector contains:";
+//   orxout() << "myvector contains:";
 //   for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
-//     COUT(0) << " " << (*itt).objID;
-//   COUT(0) << endl;
+//     orxout() << " " << (*itt).objID;
+//   orxout() << endl;
   for(it=dataVector_.begin(); it!=dataVector_.end();){
     SynchronisableHeader oldobjectheader(origdata);
@@ -771,5 +771,5 @@
     nrOfVariables += it->getNrOfVariables();
   }
-//   COUT(0) << "allocating " << nrOfVariables << " ints" << endl;
+//   orxout() << "allocating " << nrOfVariables << " ints" << endl;
   this->sizes_.reserve(nrOfVariables);
   return size;
