[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Zero-padded [map-raw] from CoMET



It would be perhaps nice to have the [map-raw] section in files 
exported by CoMET zero-padded (like 030,030,177,177,077...). It would 
be easier to edit the map by hand in .src files (though nobody does 
this :-) ) and I missed it when creating the second tutorial map 
(where I wanted to leave part of the map intact) though several 
commands in vi did the job.

I could be done by this: 

--- old/map.cpp 2005-01-03 18:52:23.000000000 +0100
+++ map.cpp     2005-01-25 22:35:23.000000000 +0100
@@ -126,9 +126,12 @@
   file << "[map-raw]\n";
 
   Point p;
+  char tempstr[4];
+  
   for ( p.y = 0; p.y < m_h; ++p.y ) {
     for ( p.x = 0; p.x < m_w; ++p.x ) {
-      file << HexTypeID( p );
+      sprintf(tempstr, "%03d", HexTypeID(p));
+      file << tempstr;
       if ( p.x != m_w - 1 ) file << ',';
     }
     file << '\n';

(this is my very first code patch I ever submitted :-) )

or by creating a function like itoa is. Hm?

Andrej



____________________________________
RAMMSTEIN, 22.02.2005 o 20,00, Bratislava Incheba, 
Info: 0904 666 363, http://www.xl.sk