~ubuntu-branches/ubuntu/maverick/asc/maverick

« back to all changes in this revision

Viewing changes to source/edgen.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Eddy Petrișor, Gonéri Le Bouder, Cyril Brulebois, Barry deFreese
  • Date: 2008-01-08 19:54:18 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080108195418-n19fc4eobhhqxcy5
Tags: 2.0.1.0-1
[ Eddy Petrișor ]
* fixed Homepage semifield

[ Gonéri Le Bouder ]
* add a watchfile
* move homepage from the description to the new Homepage field

[ Cyril Brulebois ]
* Added Vcs-Svn and Vcs-Browser fields in the control file.

[ Barry deFreese ]
* Fix make-clean lintian warning
* New upstream release
* Bump debhelper build-dep to match compat
* Add desktop file
* Update watch file for new upstream naming
* Remove nostrip check from rules
* Bump Standards Version to 3.7.3
* Add myself to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
    \brief The random map generator
3
3
*/
4
4
 
5
 
//     $Id: edgen.cpp,v 1.20 2004/07/12 18:15:05 mbickel Exp $
6
 
//
7
 
//     $Log: edgen.cpp,v $
8
 
//     Revision 1.20  2004/07/12 18:15:05  mbickel
9
 
//      Lots of tweaks and fixed for more portability and compilation with mingw
10
 
//
11
 
//     Revision 1.19  2004/05/12 20:05:52  mbickel
12
 
//      Restructured file loading routines for upcoming data cache
13
 
//
14
 
//     Revision 1.18  2002/04/21 21:27:00  mbickel
15
 
//      Mapeditor: Fixed crash in "Put Resources"
16
 
//      Updating the small map after AI
17
 
//      Fixed infinite loop "quit game" after sending signal
18
 
//
19
 
//     Revision 1.17  2002/04/17 22:41:34  mbickel
20
 
//      Updated build system to warn about missing music
21
 
//      Updated build system to insert version information automatically
22
 
//      edgen.cpp compiles with gcc 3.0.4 again
23
 
//
24
 
//     Revision 1.16  2002/04/05 09:25:09  mbickel
25
 
//      Project files now for Borland C++ Builder 6
26
 
//      Fixed: netcontrol not working
27
 
//      Fixed: replay errors when constructing turrets
28
 
//      Submarine require no fuel for sufacing
29
 
//      Field info dialog extended
30
 
//      Fixed several buffer overruns
31
 
//
32
 
//     Revision 1.15  2001/12/14 10:20:05  mbickel
33
 
//      Cleanup and enhancements to configure.in
34
 
//      Removed last remains of octagonal version from source files
35
 
//
36
 
//     Revision 1.14  2001/10/31 18:34:31  mbickel
37
 
//      Some adjustments and fixes for gcc 3.0.2
38
 
//
39
 
//     Revision 1.13  2001/10/11 10:22:49  mbickel
40
 
//      Some cleanup and fixes for Visual C++
41
 
//
42
 
//     Revision 1.12  2001/08/09 10:28:22  mbickel
43
 
//      Fixed AI problems
44
 
//      Mapeditor can edit a units AI parameter
45
 
//
46
 
//     Revision 1.11  2001/07/28 11:19:10  mbickel
47
 
//      Updated weaponguide
48
 
//      moved item repository from spfst to itemrepository
49
 
//
50
 
//     Revision 1.10  2001/07/27 21:13:34  mbickel
51
 
//      Added text based file formats
52
 
//      Terraintype and Objecttype restructured
53
 
//
54
 
//     Revision 1.9  2001/02/01 22:48:37  mbickel
55
 
//      rewrote the storing of units and buildings
56
 
//      Fixed bugs in bi3 map importing routines
57
 
//      Fixed bugs in AI
58
 
//      Fixed bugs in mapeditor
59
 
//
60
 
//     Revision 1.8  2001/01/28 14:04:13  mbickel
61
 
//      Some restructuring, documentation and cleanup
62
 
//      The resource network functions are now it their own files, the dashboard
63
 
//       as well
64
 
//      Updated the TODO list
65
 
//
66
 
//     Revision 1.7  2000/12/23 13:19:45  mbickel
67
 
//      Made ASC compileable with Borland C++ Builder
68
 
//
69
 
//     Revision 1.6  2000/08/12 12:52:45  mbickel
70
 
//      Made DOS-Version compile and run again.
71
 
//
72
 
//     Revision 1.5  2000/05/23 20:40:44  mbickel
73
 
//      Removed boolean type
74
 
//
75
 
//     Revision 1.4  2000/05/10 19:55:48  mbickel
76
 
//      Fixed empty loops when waiting for mouse events
77
 
//
78
 
//     Revision 1.3  2000/05/05 21:15:02  mbickel
79
 
//      Added Makefiles for mount/demount and mapeditor
80
 
//      mapeditor can now be compiled for linux, but is not running yet
81
 
//
82
 
//     Revision 1.2  1999/11/16 03:41:31  tmwilson
83
 
//      Added CVS keywords to most of the files.
84
 
//      Started porting the code to Linux (ifdef'ing the DOS specific stuff)
85
 
//      Wrote replacement routines for kbhit/getch for Linux
86
 
//      Cleaned up parts of the code that gcc barfed on (char vs unsigned char)
87
 
//      Added autoconf/automake capabilities
88
 
//      Added files used by 'automake --gnu'
89
 
//
90
 
//
91
5
/*
92
6
    This file is part of Advanced Strategic Command; http://www.asc-hq.de
93
7
    Copyright (C) 1994-1999  Martin Bickel  and  Marc Schellenberger
113
27
#include "edgen.h"
114
28
#include "vehicletype.h"
115
29
#include "itemrepository.h"
 
30
#include "paradialog.h"
116
31
 
117
32
#define layercount 5
118
33
#define centerlayer 65000
138
53
       protected :
139
54
               char flip,showland,showdesert,showforest,showmaterial,showfuel,correctvalues,calculatevalues;
140
55
               char initialized[ layercount ];
141
 
               pascal_byte *constructionlayer;
 
56
               char *constructionlayer;
142
57
               int layer,actlayer;
143
58
               int barsize,maxbarsize;
144
59
               int whereland;
147
62
               pmemoryblock mblocks[ layercount ];
148
63
               pterraintype btyp[numofbdts];
149
64
               int overwritecolor[maxoverwrite];
150
 
               pfield pf;
 
65
               tfield* pf;
151
66
               };
152
67
 
153
68
const char* clayer[layercount]  = {"Land", "Forest", "Desert","Material","Fuel"};
189
104
 
190
105
   barsize = maxbarsize;
191
106
 
192
 
   constructionlayer = new ( pascal_byte[plasma.maxx * plasma.maxy ]); // =blockcount
 
107
   constructionlayer = new ( char[plasma.maxx * plasma.maxy ]); // =blockcount
193
108
 
194
109
   addbutton("",480,80,510,100,0,1,7,true);
195
110
   addkey(7,ct_down);
268
183
   showtext2(strcat(s1,strrr(plasma.maxx)),x1+10,y1+10);
269
184
   showtext2(strcat(s2,strrr(plasma.maxy)),x1+120,y1+10);
270
185
 
 
186
   /*
271
187
   putspriteimage(x1 + 487,y1 + 83,icons.pfeil2[6]);
272
188
   putspriteimage(x1 + 537,y1 + 83,icons.pfeil2[2]);
273
189
 
274
190
   putspriteimage(x1 + 487,y1 + 373,icons.pfeil2[6]);
275
191
   putspriteimage(x1 + 537,y1 + 373,icons.pfeil2[2]);
 
192
   */
276
193
 
277
194
   rahmen(true,x1 + 450,y1 + 40,x1 + 590,y1 + 400);
278
195
   rahmen(true,x1 + 10,y1 + 40,x1 + 440,y1 + 390);
302
219
            }
303
220
            else j++;
304
221
         } while ( ( found == false ) && (j < mblocks[layer]->tilevalcount ) ); /* enddo */
305
 
         if ( (j == mblocks[layer]->tilevalcount ) && ( mblocks[layer]->color[mblocks[layer]->tilevalcount] != ctransparent ) )
306
 
               constructionlayer[i] =  mblocks[layer]->color[mblocks[layer]->tilevalcount];
 
222
         if ( (j == mblocks[layer]->tilevalcount ) && ( mblocks[layer]->color[int(mblocks[layer]->tilevalcount)] != ctransparent ) )
 
223
            constructionlayer[i] =  mblocks[layer]->color[int(mblocks[layer]->tilevalcount)];
307
224
      } /* endfor */
308
225
   } else {
309
226
      for (i=0;i<plasma.blockcount;i++ ) {
318
235
                  }
319
236
                  else j++;
320
237
               } while ( ( found == false ) && (j < mblocks[layer]->tilevalcount ) ); /* enddo */
321
 
               if (j == mblocks[layer]->tilevalcount ) constructionlayer[i] =  mblocks[layer]->color[mblocks[layer]->tilevalcount];
 
238
               if (j == mblocks[layer]->tilevalcount )
 
239
                  constructionlayer[i] =  mblocks[layer]->color[int(mblocks[layer]->tilevalcount)];
322
240
            }
323
241
         } /* endfor */
324
242
      } /* endfor */
469
387
 
470
388
void tmapgenerator::addcoast(void)
471
389
{
472
 
   pfield pf;
 
390
   tfield* pf;
473
391
   const int id[2]={42,83};
474
392
 
475
393
   for (int i=0;i<2;i++ ) {
504
422
               } /* endif */
505
423
               if (whereland & 1) {
506
424
                  pf->typ = btyp[0]->weather[0];
507
 
                  pf->direction = 0;
 
425
                  // pf->direction = 0;
508
426
               } 
509
427
               if (whereland & 2) {
510
428
                  pf->typ = btyp[1]->weather[0];
511
 
                  pf->direction = 0;
 
429
                  // pf->direction = 0;
512
430
               } 
513
431
               if (whereland & 4) {
514
432
                  pf->typ = btyp[0]->weather[0];
515
 
                  pf->direction = 1;
 
433
                  // pf->direction = 1;
516
434
               } 
517
435
               if (whereland & 8) {
518
436
                  pf->typ = btyp[1]->weather[0];
519
 
                  pf->direction = 1;
 
437
                  // pf->direction = 1;
520
438
               } 
521
439
               if (whereland & 16) {
522
440
                  pf->typ = btyp[0]->weather[0];
523
 
                  pf->direction = 2;
 
441
                  // pf->direction = 2;
524
442
               } 
525
443
               if (whereland & 32) {
526
444
                  pf->typ = btyp[1]->weather[0];
527
 
                  pf->direction = 2;
 
445
                  // pf->direction = 2;
528
446
               } 
529
447
               if (whereland & 64) {
530
448
                  pf->typ = btyp[0]->weather[0];
531
 
                  pf->direction = 3;
 
449
                  // pf->direction = 3;
532
450
               } 
533
451
               if (whereland & 128) {
534
452
                  pf->typ = btyp[1]->weather[0];
535
 
                  pf->direction = 3;
 
453
                  // pf->direction = 3;
536
454
               } 
537
455
            } 
538
456
         } /* endfor */
639
557
         for (i=0;i< ( plasma.maxx / 2 ) ;i++ ) {
640
558
            for (j=0;j<plasma.maxy;j++ ) {
641
559
               pf = &actmap->field[ ( plasma.maxx / 2 - i - 1 ) + ( ( plasma.maxy - j -1) * plasma.maxx / 2 ) ];
642
 
               pf->direction = 0;
643
560
               int plasmalayernr = ( i * 2 + ( j & 1 ) ) + ( j * plasma.maxx );
644
561
               setpfield ( plasmalayernr ) ;
645
562
               pf->setparams();
656
573
         for (i=0;i< ( plasma.maxx / 2 ) ;i++ ) {
657
574
            for (j=0;j<plasma.maxy;j++ ) {
658
575
               pf = &actmap->field[i + ( j * plasma.maxx / 2 ) ];
659
 
               pf->direction = 0;
660
576
               int plasmalayernr = ( i * 2 + ( j & 1 ) ) + ( j * plasma.maxx );
661
577
               setpfield ( plasmalayernr ) ;
662
578
               pf->setparams();