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

Re: Zero-padded [map-raw] from CoMET



On Tue, Jan 25, 2005 at 11:51:14PM +0100, The Fox wrote:
> 
> 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: 
[cut]

IMHO this:

diff -u -r1.5 map.cpp
--- map.cpp     3 Jan 2005 17:52:23 -0000       1.5
+++ map.cpp     26 Jan 2005 08:41:41 -0000
@@ -128,6 +128,8 @@
   Point p;
   for ( p.y = 0; p.y < m_h; ++p.y ) {
     for ( p.x = 0; p.x < m_w; ++p.x ) {
+      file.width(3);
+      file.fill('0');
       file << HexTypeID( p );
       if ( p.x != m_w - 1 ) file << ',';
     }

does the trick even nicer. But I still think *printf functions are a lot
better than C++ streams.
Torinthiel

-- 
 Waclaw "Torinthiel" Schiller       GG#: 542916, 3073512
   torinthiel(at)megapolis(dot)pl
   gpg: B06901F1 fpr: FAA3 559F CAE9 34DE CDC8  7346 2B6E 39F2 B069 01F1
 "No classmates may be used during this examination"

Attachment: pgp6JURaO1Qsl.pgp
Description: PGP signature