File: weaponguide_english.cpp

package info (click to toggle)
asc 2.4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 75,080 kB
  • ctags: 24,943
  • sloc: cpp: 155,023; sh: 8,829; ansic: 6,890; makefile: 650; perl: 138
file content (790 lines) | stat: -rw-r--r-- 41,482 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
/*
    This file is part of Advanced Strategic Command; http://www.asc-hq.de
    Copyright (C) 1994-2001  Martin Bickel, Marc Schellenberger and
    Steffen Froehlich
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; see the file COPYING. If not, write to the 
    Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
    Boston, MA  02111-1307  USA
*/
// Version v1.8 , change also GENERAL


#include <stdio.h>

#include "../tpascal.inc"
#include "../typen.h"
#include "../basestrm.h"
#include "../misc.h"
#include "../sgstream.h"
#include "../buildingtype.h"
#include "../vehicletype.h"
#include "../errors.h"
#include "../graphicset.h"
#include "../ascstring.h"
#include "../itemrepository.h"
#include "../strtmesg.h"


// including the command line parser, which is generated by genparse
#include "../clparser/weaponguide.cpp"

int main(int argc, char *argv[] )
{
   Cmdline cl ( argc, argv );

   if ( cl.v() ) {
      cout << argv[0] << " " << getVersionString() << endl;
      exit(0);
   }

   verbosity = cl.r();

   initFileIO( cl.c().c_str() );  // passing the filename from the command line options

   try {

      loadpalette();
      loadbi3graphics();

      loadalltextfiles();
      loadallobjecttypes();
      loadallbuildingtypes();
      loadallvehicletypes();
      freetextdata();


      char* wildcard;



      if ( cl.next_param() < argc ) {
         wildcard = argv[cl.next_param()];
         // if a command line parameter is specified, use it as wildcard
         // for example: weaponguide s*.veh
      }
      else {
         wildcard =  "*";
         // else use all verhicles
      }



      FILE* overview = fopen ( "overview.html", "w" );
      FILE* overview1 = fopen ( "overview1.html", "w" );
      // opens a file for writing and assigns the file pointer overview to it

      // Beginn des HTML Files HEAD und BODY
      //  \n is the sequence to start a new line

      fprintf ( overview , "<html>\n"
                "<HEAD>\n"
                "<TITLE>UNITGUIDE OVERVIEW LEFT</TITLE>\n"
                "<base target=\"base\">\n"
                "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../ug.css\">\n"
                "</HEAD>\n"
                "\n"
                "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\" leftmargin=\"5\" topmargin=\"2\">\n"                "<table width=\"100%\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">\n"
                "<tr><td><a href=\"overview1.html\">SEE PICTURES</a></td></tr><tr><td></td></tr>\n" );

      fprintf ( overview1 , "<html>\n"
                "<HEAD>\n"
                "<TITLE>WEAPONGUIDE OVERVIEW PICTURES</TITLE>\n"
                "<base target=\"base\">\n"
                "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../../asc/asc.css\">\n"
                "</HEAD>\n"
                "\n"
                "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\" leftmargin=\"5\" topmargin=\"0\">\n" );

      for ( int unit = 0; unit < vehicletypenum; unit++ ) {
         Vehicletype*  ft = getvehicletype_forpos ( unit );
         ASCString fn = extractFileName_withoutSuffix( ft->filename );
         if ( patimat ( wildcard, ft->filename.c_str() )) {
            ASCString cn = fn;
            cn.toLower();
            // now we are cycling through all files that match wildcard

            printf(" processing unit %s , ID %d ... ", ft->description.c_str(), ft->id );


            string s, s1, s2, s3, s4, s5, s6, b1, b2;
            s = s1 = s2 = s3 = s4 = s5 = s6 = b1 = b2 = cn;

            // this is a C++ string which is much more powerful than the standard C strings ( char* )

            s += ".html";    // frame
            s1 += "1.html";  // general
            s2 += "2.html";  // movement
            s3 += "3.html";  // weapon
            s4 += "4.html";  // functions
            s5 += "5.html";  // loading
            s6 += "6.html";  // description
            b1 += ".gif";    // little pic
            b2 += ".jpg";    // big pic

            FILE* detailed = fopen ( s.c_str(), "w" );
            FILE* detailed1 = fopen ( s1.c_str(), "w" );
            FILE* detailed2 = fopen ( s2.c_str(), "w" );
            FILE* detailed3 = fopen ( s3.c_str(), "w" );
            FILE* detailed4 = fopen ( s4.c_str(), "w" );
            FILE* detailed5 = fopen ( s5.c_str(), "w" );
            FILE* detailed6 = fopen ( s6.c_str(), "w" );
            // c_str() converts a c++ string back to a c string which fopen requires


            // Beginn Einzelfiles
            // UNIT FRAME
            fprintf ( detailed, "<html>\n"
                      "<HEAD>\n"
                      "<TITLE>UNITGUIDE FRAME</TITLE>\n"
                      "<frameset  rows=\"207,*\" border=0 >\n"
                      "<frame name=\"over\" src=\"%s\" marginheight=\"0\">\n"
                      "<frame name=\"under\" src=\"%s\" marginheight=\"2\">\n"
                      "<noframes><body><p>Diese Seite verwendet Frames. Frames werden von Ihrem Browser aber nicht unterst�tzt.</p></body></noframes>\n"
                      "</frameset>\n"
                      "</html>\n", s1.c_str() , s6.c_str() );

            // UNIT GENERAL
            fprintf ( detailed1, "<html>\n"
                      "<HEAD>\n"
                      "<TITLE>UNITGUIDE GENERAL</TITLE>\n"
                      "<base target=\"under\"> \n"
                      "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../ug.css\">\n"
                      "</HEAD>\n"
                      "\n"
                      "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\">\n" );

            // UNIT TERRAIN
            fprintf ( detailed2, "<html>\n"
                      "<HEAD>\n"
                      "<TITLE>UNITGUIDE MOVEMENT</TITLE>\n"
                      "<base target=\"under\"> \n"
                      "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../ug.css\">\n"
                      "</HEAD>\n"
                      "\n"
                      "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\">\n" );

            // UNIT WEAPONS
            fprintf ( detailed3, "<html>\n"
                      "<HEAD>\n"
                      "<TITLE>UNITGUIDE TERRAIN</TITLE>\n"
                      "<base target=\"under\"> \n"
                      "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../ug.css\">\n"
                      "</HEAD>\n"
                      "\n"
                      "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\">\n" );

            // UNIT FUNCTIONS
            fprintf ( detailed4, "<html>\n"
                      "<HEAD>\n"
                      "<TITLE>UNITGUIDE FUNCTIONS</TITLE>\n"
                      "<base target=\"under\"> \n"
                      "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../ug.css\">\n"
                      "</HEAD>\n"
                      "\n"
                      "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\">\n" );

            // UNIT LOADING
            fprintf ( detailed5, "<html>\n"
                      "<HEAD>\n"
                      "<TITLE>UNITGUIDE LOADING</TITLE>\n"
                      "<base target=\"under\"> \n"
                      "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../ug.css\">\n"
                      "</HEAD>\n"
                      "\n"
                      "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\">\n" );

            // UNIT DESCRIPTION
            fprintf ( detailed6, "<html>\n"
                      "<HEAD>\n"
                      "<TITLE>UNITGUIDE DESCRIPTION</TITLE>\n"
                      "<base target=\"under\"> \n"
                      "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../ug.css\">\n"
                      "</HEAD>\n"
                      "\n"
                      "<BODY bgcolor=\"#447744\" text=\"#eabc1a\" link=\"#EABC1A\" vlink=\"#EABC1A\" alink=\"#EABC1A\" background=\"../ug-hin.gif\">\n" );

            // OVERVIEW LEFT
            fprintf ( overview, " <tr><td><A HREF=\"%s\">", s.c_str() );
            fprintf ( overview, "%s", ft->getName().c_str() );
            fprintf ( overview, " </A></td></tr>\n" );

            // OVERVIEW RIGHT
            fprintf ( overview1, "<table align=\"center\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">\n"
                      " <tr><td rowspan=\"2\" width=\"50\">" );
            if ( exist ( b1.c_str() ))
               fprintf ( overview1, "<img src=\"%s\" border=\"0\">", b1.c_str() );
            fprintf ( overview1, "</td><td width=\"140\"><A HREF=\"%s\">%s</A></td></tr><tr><td><a href=\"%s\">%s</a></td></tr></table>\n", s.c_str(), ft->name.c_str(), s.c_str(), ft->description.c_str() );

            // END OVERVIEW RIGHT

            // we are adding a link to the overview file.
            // to put a singile " into a string we must use double quotes ( "" ), because a single quote is interpreted as the end of the string by C
            // %s tells C to insert a string there. The strings are appended at the end of the command
            // at the first %s the filename in s is inserted, at the second %s the unit variable 'description'

            // UNIT GENERAL
            fprintf ( detailed1, "<table width=\"100%\" id=\"H2\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"> \n"
                      "<tr><td colspan=\"2\"></td><td id=\"H9\" align=\"right\">UNIT GUIDE v1.8 </td></tr>"
                      "<tr><td width=\"50\">" );
            if ( exist ( b1.c_str() ))
               fprintf ( detailed1, "<img src=\"%s\">", b1.c_str() );
            fprintf ( detailed1, "</td>\n<td>" );

            fprintf ( detailed1, "<table id=\"H2\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"> \n" );
            fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\">Name</td>         <td align=\"center\" colspan=\"4\">%s</td> </tr>\n", ft->name.c_str() );
            if ( !ft->description.empty() )
               fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\">Description</td>  <td align=\"center\" colspan=\"4\">%s</td> </tr>\n", ft->description.c_str() );
            else
               fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\">Description</td>  <td align=\"center\" colspan=\"4\">--</td> </tr>\n" );
            fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\">ID</td>           <td align=\"center\">%i</td> <td></td><td bgcolor=\"#20483f\">Weight</td> <td align=\"center\">%d</td> <td bgcolor=\"#20483f\">Type</td><td>%s</td> </tr>\n", ft->id, ft->weight, cmovemalitypes[ft->movemalustyp]  );
            fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\">Armor</td>        <td align=\"center\">%i</td> <td></td><td bgcolor=\"#20483f\">View</td>   <td align=\"center\">%d</td> </tr>\n", ft->armor, (ft->view/10) );
            fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\">Cost energy</td>  <td align=\"center\">%i</td> <td></td><td bgcolor=\"#20483f\">Jamming</td><td align=\"center\">%d</td> </tr>\n", ft->productionCost.material, (ft->jamming/10) );
            fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\">Cost material</td><td align=\"center\">%i</td> </tr>\n", ft->productionCost.energy );

            if ( ft->wait )
               fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\" colspan=\"4\">Attack after move</td> <td>No</td> </tr>\n" );
            else
               fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\" colspan=\"4\">Attack after move</td> <td>Yes</td> </tr>\n" );

            if ( ft->functions & cf_moveafterattack )
               fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\" colspan=\"4\">Move after Attack</td> <td>Yes</td></tr>\n" );
            else
               fprintf ( detailed1, "<tr><td bgcolor=\"#20483f\" colspan=\"4\">Move after Attack</td> <td>No</td></tr>\n" );

            fprintf ( detailed1, "</table>\n" );
            fprintf ( detailed1, "</td>\n\n<td width=\"150\">" );
            if ( exist ( b2.c_str() ))
               fprintf ( detailed1, "<img src=\"%s\">", b2.c_str() );
            fprintf ( detailed1, "</td></tr></table>\n" );
            fprintf ( detailed1, "<table width=\"100%\" id=\"H2\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">\n<tr align=\"center\">" );
            fprintf ( detailed1, "<td><a href=\"%s\">Movement</a></td>", s2.c_str() );
            fprintf ( detailed1, "<td><a href=\"%s\">Weapons</a></td>" , s3.c_str() );
            fprintf ( detailed1, "<td><a href=\"%s\">Functions</a></td>" , s4.c_str() );
            fprintf ( detailed1, "<td><a href=\"%s\">Loading</a></td>" , s5.c_str() );
            fprintf ( detailed1, "<td><a href=\"%s\">Description</a></td>" , s6.c_str() );
            //         fprintf ( detailed1, "<td><a href=\"%s\">Research</a></td>" , s4.c_str() );
            fprintf ( detailed1, "</tr></table>\n" );
            // END UNIT GENERAL

            // some details about the unit; %d tells C to insert a decimal number there
            // take a look at the vehicletype class in vehicletype.h for the names of all variables that make a vehicletype
            // be carefuel not to make a , at the end of the first lines, since this would seperate the string in to several independant strings

            // choehenstufen is a global array that contains the names of the height levels


            // BEGIN MOVEMENT

            // Hoehenstufen
            int i,w;
            // Tabellenbeginn
            fprintf( detailed2, "<TABLE align=\"left\" rules=\"rows\" id=\"H9\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">"
                     "<TR><td colspan=\"9\" bgcolor=\"#20483f\" id=\"H2\">Reachable levels of height:</td></tr>\n<tr>");
            // Spaltentitel
            fprintf ( detailed2, "<td></td>" );
            for ( i = 0; i < 8; i++ )
               fprintf ( detailed2, " <TD><IMG src=\"../hoehe%d.gif\" ></TD>", i);
            fprintf( detailed2, "</TR>\n<TR>");
            // Spaltenwerte Hacken
            fprintf ( detailed2, "<td></td>" );
            for ( i = 0; i < 8; i++ )
               if ( ft->height & ( 1 << i ))
                  fprintf ( detailed2, " <TD><img src=\"../hacken.gif\"></TD>" );
               else
                  fprintf ( detailed2, " <TD></TD>"  );
            fprintf( detailed2, "</TR>\n<TR>");
            // Spaltenwerte pro Runde
            fprintf ( detailed2, "<td>Round</td>" );
            for ( i = 0; i < 8; i++ )
               if ( ft->height & ( 1 << i ))
                  fprintf ( detailed2, " <TD align=\"center\">%d</TD>", (ft->movement[i]/10) );
               else
                  fprintf ( detailed2, " <TD></TD>"  );
            fprintf( detailed2, "</TR>\n<TR>\n");

            /* ????
                     // Spaltenwerte Maximum
                     fprintf ( detailed2, "<td>Max.</td>" );
                     for ( i = 0; i < 8; i++ )
                        if ( (ft->height & ( 1 << i )) && ft->fuelConsumption )
                           fprintf ( detailed2, " <TD align=\"center\">%d</TD>", ft->tank.fuel/ft->fuelConsumption );
                        else
                           fprintf ( detailed2, " <TD></TD>"  );
            */
            fprintf( detailed2, "\n</TR>\n</TABLE>\n");

            // Einzelne Werte
            // Tabellenbeginn
            fprintf( detailed2, "<TABLE id=\"H2\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">\n" );
            fprintf( detailed2, "<TR><td bgcolor=\"#20483f\">Fuel tank</td>    <td align=\"center\">%d</td></tr>\n", ft->tank.fuel );
            fprintf( detailed2, "<TR><td bgcolor=\"#20483f\">Material tank</td><td align=\"center\">%d</td></tr>\n", ft->tank.material );
            fprintf( detailed2, "<TR><td bgcolor=\"#20483f\">Energy tank</td>  <td align=\"center\">%d</td></tr>\n", ft->tank.energy );
            fprintf( detailed2, "<TR><td bgcolor=\"#20483f\">Consumption</td>  <td align=\"center\">%d</td></tr>\n", ft->fuelConsumption );
            if ( ft->fuelConsumption > 0 )
               fprintf( detailed2, "<tr><td bgcolor=\"#20483f\">Max.Movem.</td>   <TD align=\"center\">%d</TD></tr>\n", (ft->tank.fuel/ft->fuelConsumption) );
            else
               fprintf( detailed2, "<tr><td bgcolor=\"#20483f\">Max.Movem.</td>   <TD align=\"center\">--</TD></tr>\n" );
            fprintf( detailed2, "<TR><td bgcolor=\"#20483f\">*Steigung*</td>   <td align=\"center\">%d</td></tr>\n", ft->steigung );
            fprintf( detailed2, "\n</TABLE>\n");


            // Bodentypen global
            fprintf( detailed2,"<br><br>\n<table rules=\"rows\" id=\"H2\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"><tr><td colspan=\"34\" bgcolor=\"#20483f\">" );
            fprintf( detailed2,"Terraintypes for not flying units:</td></tr>\n<tr>" );

            // Spalten gfx
            fprintf ( detailed2, "<td></td>" );
            for ( int i = 0; i < cbodenartennum ; i++ )
               fprintf ( detailed2, " <TD><IMG src=\"../gfx%d.gif\" alt=\"%s\"></TD>", i, cbodenarten[i]);
            fprintf( detailed2, "</TR>\n<TR>\n");

            // Spaltenwerte befahrbare Bodentypen
            fprintf ( detailed2, "<td>can&nbsp;drive&nbsp;on</td>" );
            for ( int i = 0; i < cbodenartennum ; i++) {
               if ( ft->terrainaccess.terrain.test(i) )
                  fprintf ( detailed2, "<td><img src=\"../hacken.gif\"></td>" );
               else
                  fprintf ( detailed2, "<td></td>" );
            } /* endfor */
            fprintf( detailed2, "</TR>\n<TR>\n");

            // Spaltenwerte stirbt auf
            fprintf ( detailed2, "<td>dies on</td>" );
            for ( i = 0; i < cbodenartennum ; i++) {
               if ( ft->terrainaccess.terrainkill.test(i))
                  fprintf ( detailed2, "<td><img src=\"../hacken.gif\"></td>" );
               else
                  fprintf ( detailed2, "<td></td>" );
            } /* endfor */
            fprintf( detailed2, "</TR>\n<TR>\n");

            // Spaltenwerte can not drive on
            fprintf ( detailed2, "<td>not drive on</td>" );
            for ( i = 0; i < cbodenartennum ; i++) {
               if ( ft->terrainaccess.terrainnot.test(i) )
                  fprintf ( detailed2, "<td><img src=\"../hacken.gif\"></td>" );
               else
                  fprintf ( detailed2, "<td></td>" );
            } /* endfor */

            fprintf ( detailed2, "</tr><tr>\n" );
            // Spaltenwerte can need terrain
            fprintf ( detailed2, "<td>required</td>" );
            for ( i = 0; i < cbodenartennum ; i++) {
               if ( ft->terrainaccess.terrainreq.test(i) )
                  fprintf ( detailed2, "<td><img src=\"../hacken.gif\"></td>" );
               else
                  fprintf ( detailed2, "<td></td>" );
            } /* endfor */
            fprintf ( detailed2, "</tr></table>\n" );
            // ENDE MOVEMENT

			
			
			
			
            // BEGIN WEAPONS
            // Waffen NR-AMMO-DISTANCE-STRENGS-SHOT FROM-ATTACK TO-TYP
            fprintf ( detailed3, "<table id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"> \n" );
            // �berschriften
            fprintf ( detailed3, "<tr><td colspan=\"2\"></td>"
                      "    <td bgcolor=\"#20483f\" colspan=\"4\" align=\"center\">Distance</td>"
                      "    <td bgcolor=\"#20483f\" colspan=\"8\" align=\"center\"> can shot from: </td>"
                      "    <td></td>"
                      "    <td bgcolor=\"#20483f\" colspan=\"8\" align=\"center\"> attack to: </td>"
                      "    <td bgcolor=\"#20483f\">Type</td>"
                      "</tr>\n" );
            // GFX
            fprintf ( detailed3, "<tr><td></td>"
                      "    <td><img src=\"../ammo.gif\"</td>"
                      "    <td><img src=\"../dis1.gif\"</td>"
                      "    <td><img src=\"../str1.gif\"</td>"
                      "    <td><img src=\"../dis2.gif\"</td>"
                      "    <td><img src=\"../str2.gif\"</td>" );
            // H�henstufenzeichen einf�gen f�r shoot from und target
            for ( i = 0; i < 8; i++ )
               fprintf ( detailed3, " <TD><IMG src=\"../hoehe%d.gif\" ></TD>", i);
            fprintf (detailed3, "<td></td> ");
            for ( i = 0; i < 8; i++ )
               fprintf ( detailed3, " <TD><IMG src=\"../hoehe%d.gif\" ></TD>", i);
            fprintf ( detailed3, "    <td></td>"
                      "</tr>\n" );

            // Werte der Waffen
            for ( w = 0; w < ft->weapons.count ; w++) {
               fprintf ( detailed3, "<tr><td>#%d</td>", w+1 );
               fprintf ( detailed3, "    <td align=\"center\">%d</td>", ft->weapons.weapon[w].count );
               fprintf ( detailed3, "    <td align=\"center\">%d</td>", (ft->weapons.weapon[w].mindistance+9)/10 );
               fprintf ( detailed3, "    <td align=\"center\">%d</td>", ft->weapons.weapon[w].maxstrength );
               fprintf ( detailed3, "    <td align=\"center\">%d</td>", (ft->weapons.weapon[w].maxdistance)/10 );
               fprintf ( detailed3, "    <td align=\"center\">%d</td>", ft->weapons.weapon[w].minstrength );
               // H�henstufenzeichen einf�gen f�r shoot from und target
               for ( i = 0; i < 8; i++ )
                  if ( ft->weapons.weapon[w].sourceheight & ( 1 << i ) )
                     fprintf ( detailed3, "<td><img src=\"../hacken.gif\"></td> " );
                  else
                     fprintf ( detailed3, "<td></td>" );
               fprintf ( detailed3, "    <td></td>");
               for ( i = 0; i < 8; i++ )
                  if ( ft->weapons.weapon[w].targ & ( 1 << i ) )
                     fprintf ( detailed3, "<td><img src=\"../hacken.gif\"></td>" );
                  else
                     fprintf ( detailed3, "<td></td>" );

               fprintf ( detailed3, "    <td nowrap>" );
               for ( int i = 0; i < weaponTypeNum; i++ )
                  if ( ft->weapons.weapon[w].typ & ( 1 << i ) )
                     fprintf ( detailed3, "%s.", cwaffentypen[i] );
               fprintf ( detailed3, "</td></tr>\n" );
            }
            fprintf ( detailed3, "</table>\n" );

            fprintf ( detailed3, "<br>\n\n" );
            // Die entfernung wird durch 10 dividiert, um die Anzahl der Felder zu erhalten
            // Die normale Division rundet IMMER ab, also 1,9 / 2 = 0
            // Aber die minimale Entfernung mu� aufgerundet werden, deshalb benutze ich einen kleinen Trick: Ich addiere vor der Division 9 (also Quotient-1) dazu

            //Weapon can hit:
            fprintf ( detailed3, "<table id=\"H9\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"> \n" );
            // Ueberschrift
            fprintf ( detailed3, "<tr><td></td><td align=\"center\" colspan=\"17\" bgcolor=\"#20483f\">The weapon can hit: </td></tr>" );
            // Spalten GFX
            fprintf ( detailed3, "<tr><td></td>" );
            for ( i = 0; i < cmovemalitypenum; i++ )
               fprintf ( detailed3, " <TD><IMG src=\"../typ%d.gif\"></TD>", i);
            fprintf ( detailed3, "</TR>\n");
            // Spaltenwerte
            for ( int w = 0; w < ft->weapons.count ; w++) {
               fprintf ( detailed3, "<TR><td>#%d</td>", w+1 );
               for ( i = 0; i < cmovemalitypenum; i++ )
                  if ( !(ft->weapons.weapon[w].targets_not_hittable & ( 1 << i )) )
                     fprintf ( detailed3, "<td><img src=\"../hacken.gif\"></td>" );
                  else
                     fprintf ( detailed3, "<td></td>" );
               fprintf ( detailed3, "</TR>\n");
            }
            //Ende tabelle
            fprintf ( detailed3, "</table><br> \n" );

            // Effizienz
            fprintf ( detailed3, "<table id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"> \n" );
            // Ueberschrift
            fprintf ( detailed3, "<tr><td></td><td align=\"center\" colspan=\"14\" bgcolor=\"#20483f\" >Efficiency over high difference: </td></tr>\n" );
            // Spalten Ueberschrift
            fprintf ( detailed3, "<tr><td></td>" );
            for ( i = 0; i < 13; i++ )
               fprintf(detailed3, "<td>%d</td>", i-6 );
            fprintf ( detailed3, "</TR>\n");
            // Spaltenwerte
            for ( int w = 0; w < ft->weapons.count ; w++) {
               fprintf ( detailed3, "<TR><td>#%d</td>", w+1 );
               for ( i = 0; i < 13; i++ )
                  fprintf ( detailed3, "<td>%d%%</td>", ft->weapons.weapon[w].efficiency[i] );
               fprintf ( detailed3, "</TR>\n");
            }
            //Ende tabelle
            fprintf ( detailed3, "</table> \n" );
            //ENDE WAFFEN

			
			
			
			
            //BEGINN FUNCTIONS
            fprintf ( detailed4, "<table align=\"left\" id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">" );
            // Ueberschrift
            fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\">Special Unit functions</td></tr>" );
            for ( int i = 0; i<cvehiclefunctionsnum; i++)
               if ( ft->functions & ( 1 << i ))
                  fprintf ( detailed4, "<tr><td>%s</td></tr>", cvehiclefunctions[i] );
            //Ende tabelle
            fprintf ( detailed4, "</table>\n" );
            
			//Einzelwerte
            fprintf ( detailed4, "<table id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">" );
            if ( ft->maxwindspeedonwater )
               fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\">Max. windspeed on water</td> <td>%d</td> </tr>", ft->maxwindspeedonwater );
            else
               fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\">Max. windspeed on water</td> <td>--</td> </tr>" );
            fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\">Ressource search range</td><td>%d</td> </tr>", ft->digrange );
            fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\">Auto repair rate</td> <td>%d</td> </tr>", ft->autorepairrate );
            //         fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\">Max. unit weight</td><td>%d</td> </tr>/n", ft->maxunitweight );
            fprintf ( detailed4, "</table>\n" );

            // Objekte
            fprintf ( detailed4, "<table align=\"left\" id=\"H9\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">\n" );
            // Ueberschrift baubare Objekte
            fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\" colspan=\"2\">baubare OBJEKTE</td></tr>\n" );
            for ( unsigned int i = 0; i < ft->objectsBuildable.size(); i++ ) {
//               fprintf( detailed4, "<tr><td>es k�nnen die Objekte mit ids von %d bis %d gebaut werden</td></tr>\n", ft->objectsBuildable[i].from, ft->objectsBuildable[i].to );
               for ( int b = 0; b < objecttypenum; b++ ) {
                  Object*type obj = getobjecttype_forpos ( b );
                  if (     obj->id >= ft->objectsBuildable[i].from
                        && obj->id <= ft->objectsBuildable[i].to ) {
                     fprintf ( detailed4, "<tr><td>ID %d </td><td align=\"center\"> %s </td></tr>\n", obj->id, obj->name.c_str() );
                  }
               }
            }
            fprintf ( detailed4, "</table>\n" );

			// UNITS
            fprintf ( detailed4, "<table align=\"left\" id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">\n" );
            // Ueberschrift baubare Einheiten
            fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\" colspan=\"2\">baubare UNITS</td></tr>\n" );
            for ( unsigned int i = 0; i < ft->vehiclesBuildable.size(); i++ ) {
//               fprintf( detailed4, "<tr><td colspan=\"2\">baubar ID %d bis %d </td></tr>\n", ft->vehiclesBuildable[i].from, ft->vehiclesBuildable[i].to );
               for ( int b = 0; b < vehicletypenum; b++ ) {
                  Vehicletype* veh = getvehicletype_forpos ( b );
                  if (     veh->id >= ft->vehiclesBuildable[i].from
                        && veh->id <= ft->vehiclesBuildable[i].to ) {
                     fprintf ( detailed4, "<tr><td>ID %d </td><td align=\"center\"> %s </td></tr>\n", veh->id, veh->getName().c_str() );
                  }
               }
            }
            fprintf ( detailed4, "</table>\n" );
            
			// Geb&auml;ude
            fprintf ( detailed4, "<table align=\"left\" id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">\n" );
            // Ueberschrift baubare Gebaeude
            fprintf ( detailed4, "<tr><td align=\"center\" bgcolor=\"#20483f\" colspan=\"2\">baubare GEB&Auml;UDE</td></tr>\n" );
            for ( unsigned int i = 0; i < ft->buildingsBuildable.size(); i++ ) {
//               fprintf( detailed4, "<tr><td>baubar ID %d bis %d </td></tr>\n", ft->buildingsBuildable[i].from, ft->vehiclesBuildable[i].to );
               for ( int b = 0; b < buildingtypenum; b++ ) {
                  BuildingType* bld = getbuildingtype_forpos ( b );
                  if (     bld->id >= ft->buildingsBuildable[i].from
                           && bld->id <= ft->buildingsBuildable[i].to ) {
                     fprintf ( detailed4, "<tr><td>ID %d </td><td align=\"center\"> %s </td></tr>\n", bld->id, bld->name.c_str() );
                  }
               }
            }
            fprintf ( detailed4, "</table>\n" );

            //ENDE FUNKTIONS

			
			
			
			
			
			
			
			
			
            //BEGINN LOADING
            if ( ft->loadcapacity ) {
               fprintf ( detailed5, "<table align=\"left\" id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"> " );
               fprintf ( detailed5, "<tr><td align=\"center\" bgcolor=\"#20483f\">Einladbare UNITS</td></tr>" );
			   
			   for ( int c = 0; c < cmovemalitypenum; c++ )
               if ( ft->vehicleCategoriesLoadable & (1 << c))
                  fprintf ( detailed5, "<tr><td align=\"center\" > %s </td></tr>", cmovemalitypes[c] );
			   
               fprintf ( detailed5, "</table>" );

               fprintf ( detailed5, "<table id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">" );
               fprintf ( detailed5, "<tr><td align=\"center\" bgcolor=\"#20483f\">max. Zuladung</td> <td>%d</td> </tr>", ft->loadcapacity );
               fprintf ( detailed5, "<tr><td align=\"center\" bgcolor=\"#20483f\">max. Gewicht einer Einheit</td><td>%d</td> </tr>", ft->maxunitweight );
               fprintf ( detailed5, "</table>" );
			   
			   // Ladbar von H&ouml;henstufen 
               fprintf ( detailed5, "<table id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\"> \n" );
               // �berschriften
               fprintf ( detailed5,
                      "    <td bgcolor=\"#20483f\" colspan=\"9\" align=\"center\"> Voraussetzungen f&uuml;r das Ein- und Ausladen </td>"
                      "</tr>\n" );
               // GFX
               fprintf ( detailed5, "<tr><td></td>\n");
               // H�henstufenzeichen einf�gen f�r shoot from und target
               for ( i = 0; i < 8; i++ )
                  fprintf ( detailed5, " <TD><IMG src=\"../hoehe%d.gif\" ></TD>", i);
               fprintf ( detailed5, "</tr>\n" );
               
			   // H�henstufenzeichen einf�gen f�r can load and unload from:
               fprintf ( detailed5, "<tr><td>UNIT muss auf dieser Stufe sein</td>" );
			   for ( int h = 0; h < 8; h++ ) {
                  if ( ft->loadcapability & (1 << h))
                     fprintf ( detailed5, "<td><img src=\"../hacken.gif\"></td> " );	
			      else
                     fprintf ( detailed5, "<td></td>" );
			   }
	           fprintf ( detailed5,	"</tr>\n" );	   
			   
			   // H�henstufenzeichen einf�gen f�r can load and unload from:
               fprintf ( detailed5, "<tr><td>UNIT muss diese Stufe selbst erreichen</td>" );
			   for ( int h = 0; h < 8; h++ ) {
                  if ( ft->loadcapabilityreq & (1 << h))
                     fprintf ( detailed5, "<td><img src=\"../hacken.gif\"></td> " );	
			      else
                     fprintf ( detailed5, "<td></td>" );
			   }
	           fprintf ( detailed5,	"</tr>\n" );
	
	           // H�henstufenzeichen einf�gen f�r can load and unload from:
               fprintf ( detailed5, "<tr><td>UNIT darf diese Stufe selbst nicht erreichen</td>" );
			   for ( int h = 0; h < 8; h++ ) {
                  if ( ft->loadcapabilitynot & (1 << h))
                     fprintf ( detailed5, "<td><img src=\"../hacken.gif\"></td> " );	
			      else
                     fprintf ( detailed5, "<td></td>" );
			   }
	           fprintf ( detailed5,	"</tr>\n" );
			   fprintf ( detailed5, "</table>\n" );            
			
			} else {
               fprintf ( detailed5, "<table align}\"left\" id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">" );
               fprintf ( detailed5, "<tr><td align=\"center\" bgcolor=\"#20483f\">Loadable units</td></tr>" );
               fprintf ( detailed5, "<tr><td align=\"center\" ><br>No transport unit!<br></td></tr>" );
               fprintf ( detailed5, "</table>" );
            }
            //ENDE LOADING

			
			
			
			
			
            //BEGINN DESCRIPTION
            fprintf ( detailed6, "<table align=\"left\" id=\"H10\" border=\"1\" bordercolordark=\"#333333\" bordercolorlight=\"#408050\" cellpadding=\"1\" cellspacing=\"1\">" );
            fprintf ( detailed6, "<tr><td align=\"center\" bgcolor=\"#20483f\">Unit description</td></tr>" );
            if ( !ft->infotext.empty() ) {
               string text = ft->infotext;
               if ( text.find ( "#color0#" ) != string::npos )
                  text.replace ( text.find  ("#color0#"), 8, " ");
               if ( text.find ( "#color1#" ) != string::npos )
                  text.replace ( text.find  ("#color1#"), 8, " ");
               if ( text.find ( "#color2#" ) != string::npos )
                  text.replace ( text.find  ("#color2#"), 8, " ");
               if ( text.find ( "#color3#" ) != string::npos )
                  text.replace ( text.find  ("#color3#"), 8, " ");
               if ( text.find ( "#color4#" ) != string::npos )
                  text.replace ( text.find  ("#color4#"), 8, " ");
               if ( text.find ( "#font0#" ) != string::npos )
                  text.replace ( text.find  ("#font0#"), 7, " ");
               if ( text.find ( "#font1#" ) != string::npos )
                  text.replace ( text.find  ("#font1#"), 7, " ");
               if ( text.find ( "#font2#" ) != string::npos )
                  text.replace ( text.find  ("#font2#"), 7, " ");
               if ( text.find ( "#crt#" ) != string::npos )
                  text.replace ( text.find  ("#crt#"), 5, " ");
               fprintf ( detailed6, "<tr><td><br>%s<br></td></tr>", text.c_str() );
            }
            //            fprintf ( detailed6, "<tr><td><br><br>%s</td></tr>", ft->infotext );
            else {
               fprintf ( detailed6, "<tr><td><br><br>No description available !<br><br></td></tr>" );
            }
            //Ende tabelle
            fprintf ( detailed6, "</table> \n" );
            //ENDE DESCRIPTION


/*           // NEU - noch anzupassen
            for ( int h = 0; h < 8; h++ ) {
               if ( ft->loadcapability & (1 << h))
                  printf("H�henstufe kann geladen werden" );

               if ( ft->loadcapabilityreq & (1 << h))
                  printf("H�henstufe mu� erreichbar sein, um geladen werden zu k�nnen" );

               if ( ft->loadcapability & (1 << h))
                  printf("H�henstufe darf nicht erreichbar sein" );
            }

            // ft->loadcapacity  ist maximale ladekapazit�t
            for ( int c = 0; c < cmovemalitypenum; c++ )
               if ( ft->vehicleCategoriesLoadable & (1 << c))
                  printf(" Kategorie %s kann geladen werden", cmovemalitypes[c] );

            for (  i = 0; i < ft->buildingsBuildable.size(); i++ ) {
               printf("es k�nnen die geb�ude mit ids von %d bis %d gebaut werden\n", ft->buildingsBuildable[i].from, ft->buildingsBuildable[i].to );
               for ( int b = 0; b < buildingtypenum; b++ ) {
                  BuildingType* bld = getbuildingtype_forpos ( b );
                  if (     bld->id >= ft->buildingsBuildable[i].from
                           && bld->id <= ft->buildingsBuildable[i].to ) {
                     printf( "das geb�ude mit id %d und dem Namen %s kann gebaut werden\n", bld->id, bld->name.c_str() );
                  }
               }
            }
*/
/*            for ( int i = 0; i  < ft->vehiclesBuildable.size(); i++ ) {
               printf("es k�nnen die einheiten mit ids von %d bis %d gebaut werden\n", ft->vehiclesBuildable[i].from, ft->vehiclesBuildable[i].to );
               for ( int b = 0; b < vehicletypenum; b++ ) {
                  Vehicletype* veh = getvehicletype_forpos ( b );
                  if (     veh->id >= ft->vehiclesBuildable[i].from
                        && veh->id <= ft->vehiclesBuildable[i].to ) {
                     printf( "die einheit mit id %d und dem Namen %s kann gebaut werden\n", veh->id, veh->getName().c_str() );
                  }
               }
            }
*/
/*            for ( int i = 0; i < ft->objectsBuildable.size(); i++ ) {
               printf("es k�nnen die Objekte mit ids von %d bis %d gebaut werden\n", ft->objectsBuildable[i].from, ft->objectsBuildable[i].to );
               for ( int b = 0; b < objecttypenum; b++ ) {
                  Object*type obj = getobjecttype_forpos ( b );
                  if (     obj->id >= ft->objectsBuildable[i].from
                        && obj->id <= ft->objectsBuildable[i].to ) {
                     printf( "die einheit mit id %d und dem Namen %s kann gebaut werden\n", obj->id, obj->name.c_str() );
                  }
               }
            }
*/
            // ABSCHLU� DER DOKUMENTE

            fprintf ( detailed1, "</body></html>\n");
            fprintf ( detailed2, "</body></html>\n");
            fprintf ( detailed3, "</body></html>\n");
            fprintf ( detailed4, "</body></html>\n");
            fprintf ( detailed5, "</body></html>\n");
            fprintf ( detailed6, "</body></html>\n");
            // Ende des Einheiten Dokuments

            fclose ( detailed );
            fclose ( detailed1 );
            fclose ( detailed2 );
            fclose ( detailed3 );
            fclose ( detailed4 );
            fclose ( detailed5 );
            fclose ( detailed6 );
            // closing the file

            printf(" done \n" );
            // we are writing this not to a file, but the screen

         }

      }

      // Dokument �bersicht Ende

      fprintf( overview , "</table></body></html>\n" );
      fprintf ( overview1, "</body></html>\n" );

      fclose ( overview );
      fclose ( overview1 );

   } /* endtry */
   catch ( tfileerror err ) {
      printf("\nfatal error accessing file %s \n", err.getFileName().c_str() );
      return 1;
   } /* endcatch */
   catch ( ASCexception ) {
      printf("\na fatal exception occured\n" );
      return 2;
   } /* endcatch */

   return 0;
};