Advanced Strategic Command
dialog.cpp
Go to the documentation of this file.
1 
5 /*
6  This file is part of Advanced Strategic Command; http://www.asc-hq.de
7  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING. If not, write to the
21  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22  Boston, MA 02111-1307 USA
23 */
24 
25 
26 #include <stdio.h>
27 #include <cstring>
28 #include <ctype.h>
29 #include <stdlib.h>
30 #include <stdarg.h>
31 
32 #include "typen.h"
33 #include "buildingtype.h"
34 #include "vehicletype.h"
35 #include "basegfx.h"
36 #include "newfont.h"
37 #include "spfst.h"
38 #include "loaders.h"
39 #include "misc.h"
40 #include "events.h"
41 #include "stack.h"
42 #include "dlg_box.h"
43 #include "dialog.h"
44 #include "sgstream.h"
45 #include "attack.h"
46 #include "gameoptions.h"
47 #include "errors.h"
48 // #include "password_dialog.h"
49 #include "itemrepository.h"
50 #include "mapdisplay.h"
51 #include "graphicset.h"
52 #include "viewcalculation.h"
53 #include "paradialog.h"
54 #include "cannedmessages.h"
55 
56 #include "dialogs/messagedialog.h"
57 #include "dialogs/fileselector.h"
58 #include "widgets/textrenderer.h"
59 #include "unitset.h"
60 
61 #include "spfst-legacy.h"
62 
63 
64 #define markedlettercolor red
65 
66 
67 #if 0
68 
69 
70 void doubleline(int x1, int y1, int x2, int y2)
71 {
72  line(x1,y1,x2,y2,white);
73  line(x1 + 1,y1 + 1,x2 + 1,y2 + 1,dbluedark);
74 }
75 
76 
77 class tstatistics : public tdialogbox {
78  public:
79  int linelength;
80  Uint8 categories;
81  int l[3][4];
82  int m[3][9];
83  Uint8 paintmode;
84  Uint8 color1,color2,color3,color4;
85  Uint8 action;
86 
87  void init ( void );
88  void paintgraph ( void );
89  virtual void buttonpressed( int id );
90  };
91 
92 class tstatisticbuildings : public tstatistics {
93  public:
94  void init ( void );
95  virtual void run ( void );
96  void count ( void );
97  };
98 
99 class tstatisticarmies : public tstatistics {
100  Uint8 jk;
101  public:
102  void init ( void );
103  virtual void run ( void );
104  void count ( void );
105  void newknopfdruck ( integer xx1,
106  integer yy1,
107  integer xx2,
108  integer yy2 );
109  };
110 
111 
112 
113 
114 void tstatisticarmies ::newknopfdruck(integer xx1,
115  integer yy1,
116  integer xx2,
117  integer yy2)
118 {
119  char* p;
120  bool kn;
121  integer mt;
122  {
123  collategraphicoperations cgo ( xx1, yy1, xx2, yy2 );
124  mt = mouseparams.taste;
125  mousevisible(false);
126  p = new Uint8 [ imagesize ( xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2 )];
127  getimage(xx1 + 1,yy1 + 1,xx2 - 2,yy2 - 2, p);
128  putimage(xx1 + 3,yy1 + 3, p);
129 
130  line(xx1 - 1,yy1 - 1,xx2 + 1,yy1 - 1, 8);
131  line(xx1 - 1,yy1 - 1,xx1 - 1,yy2 + 1, 8);
132 
133  line(xx2 + 1,yy1 - 1,xx2 + 1,yy2 + 1, 15);
134  line(xx1 - 1,yy2 + 1,xx2 + 1,yy2 + 1, 15);
135 
136  line(xx1,yy1,xx2,yy1, 8);
137  line(xx1,yy1,xx1,yy2, 8);
138 
139  line(xx2,yy1,xx2,yy2, 15);
140  line(xx1,yy2,xx2,yy2, 15);
141  mousevisible(true);
142 
143  knopfsuccessful = true;
144  kn = true;
145  }
146  do {
147  if ((mouseparams.x > xx2) || (mouseparams.x < xx1) || (mouseparams.y > yy2) || (mouseparams.y < yy1)) {
148  knopfsuccessful = false;
149  kn = false;
150  }
151  if (mouseparams.taste != mt)
152  kn = false;
153 
155  } while (kn == true);
156 
157  {
158  collategraphicoperations cgo ( xx1, yy1, xx2, yy2 );
159 
160  mousevisible(false);
161  putimage(xx1 + 1,yy1 + 1,p);
162  delete[] p ;
163 
164  line(xx1 - 1,yy1 - 1,xx2 + 1,yy1 - 1, 8);
165  line(xx1 - 1,yy1 - 1,xx1 - 1,yy2 + 1, 8);
166 
167  line(xx2 + 1,yy1 - 1,xx2 + 1,yy2 + 1, 15);
168  line(xx1 - 1,yy2 + 1,xx2 + 1,yy2 + 1, 15);
169 
170  line(xx1,yy1,xx2,yy1, 15);
171  line(xx1,yy1,xx1,yy2, 15);
172 
173  line(xx2,yy1,xx2,yy2, 8);
174  line(xx1,yy2,xx2,yy2, 8);
175 
176  mousevisible(true);
177  }
178 }
179 
180 
181 
182 void tstatistics::init(void)
183 {
185  paintmode = 1;
186  color1 = 23 + actmap->actplayer * 8;
187  color2 = 19 + actmap->actplayer * 8;
188  color3 = 14;
189  color4 = darkgray;
190  x1 = 70;
191  xsize = 640 - 2 * x1;
192  linelength = (xsize - 95 - 20 - 10);
193 
194  memset( l, 0, sizeof(l) );
195  memset( m, 0, sizeof(m) );
196 
197  windowstyle = windowstyle ^ dlg_in3d;
198 }
199 
200 
201 void tstatisticarmies::init(void)
202 {
203  int i;
204 
205  tstatistics::init();
206  categories = 3;
207  y1 = 25;
208  ysize = 490 - 2 * y1;
209  title = "army statistics";
210  action = 0;
211  jk = 0;
212 
213  addbutton("e~x~it",10,ysize - 35,xsize - 10,ysize - 10,0,1,2,true);
214  addbutton("~c~hange display mode",10,ysize - 65,xsize - 10,ysize - 40,0,1,1,true);
215 
216  buildgraphics();
217  rahmen(true,x1 + 10,y1 + 50,x1 + xsize - 10,y1 + ysize - 70);
218  for (i = 0; i <= 2; i++)
219  putimage(x1 + 20,y1 + 75 + i * 90,icons.statarmy[i]);
220 
221 }
222 
223 
224 void tstatisticbuildings::init(void)
225 {
226 
227  tstatistics::init();
228  categories = 1;
229  y1 = 115;
230  ysize = 490 - 2 * y1;
231  title = "building statistics";
232 
233  action = 0;
234 
235  addbutton("e~x~it",10,ysize - 35,xsize - 10,ysize - 10,0,1,2,true);
236  addbutton("~c~hange display mode",10,ysize - 65,xsize - 10,ysize - 40,0,1,1,true);
237 
238  buildgraphics();
239  rahmen(true,x1 + 10,y1 + 50,x1 + xsize - 10,y1 + ysize - 70);
240 }
241 
242 
243 
244 void tstatisticarmies::count(void)
245 {
246  integer j, b;
247 
248  for (j = 0; j <= 8; j++) {
249  if (j == 8)
250  b = 3;
251  else
252  if (j == actmap->actplayer)
253  b = 0;
254  else
256  b = 1;
257  else
258  b = 2;
259 
260  for ( Player::VehicleList::iterator i = actmap->player[j].vehicleList.begin(); i != actmap->player[j].vehicleList.end(); i++ ) {
261  Vehicle* actvehicle = *i;
262  if (fieldvisiblenow(getfield(actvehicle->xpos,actvehicle->ypos))) {
263  if (actvehicle->typ->height & (chtieffliegend | chfliegend | chhochfliegend | chsatellit)) {
264  l[0][b]++;
265  m[0][j]++;
266  }
267  else
268  if (actvehicle->typ->height & (chschwimmend | chgetaucht | chtiefgetaucht) ) {
269  l[2][b]++;
270  m[2][j]++;
271  }
272  else {
273  l[1][b]++;
274  m[1][j]++;
275  }
276  }
277  }
278  }
279 }
280 
281 
282 void tstatisticbuildings::count(void)
283 {
284  integer j, b;
285  for (j = 0; j <= 8; j++) {
286  if (j == 8)
287  b = 3;
288  else
289  if (j == actmap->actplayer)
290  b = 0;
291  else
293  b = 1;
294  else
295  b = 2;
296  for ( Player::BuildingList::iterator i = actmap->player[j].buildingList.begin(); i != actmap->player[j].buildingList.end(); i++ ) {
297  Building* actbuilding = *i;
298  if (fieldvisiblenow( actbuilding->getEntryField() )) {
299  l[0][b]++;
300  m[0][j]++;
301  }
302  }
303  }
304 }
305 
306 
307 void tstatistics::paintgraph(void)
308 {
309  collategraphicoperations cgo ( x1, y1, x1 + xsize, y1 + ysize );
310  int linestart = x1 + 95;
311 
312  int max;
313  integer b, i, j, y;
314 
315  max = 0;
316  if (paintmode == 0) {
317  for (i = 0; i <= categories - 1; i++)
318  for (j = 0; j <= 3; j++)
319  if (l[i][j] > max) max = l[i][j];
320  }
321  else
322  for (i = 0; i <= categories - 1; i++)
323  for (j = 0; j <= 8; j++)
324  if (m[i][j] > max) max = m[i][j];
325 
326  if (max > 0)
327  for (i = 0; i <= categories - 1; i++) {
328  y = y1 + 60 + i * 90;
329 
330  rahmen(true,x1 + 90,y,x1 + xsize - 20,y + 60);
331  if (paintmode == 0) {
332  bar(linestart,y + 5,linestart + linelength * l[i][0] / max,y + 15,color1);
333  bar(linestart,y + 17,linestart + linelength * l[i][1] / max,y + 27,color2);
334  bar(linestart,y + 29,linestart + linelength * l[i][2] / max,y + 39,color3);
335  bar(linestart,y + 41,linestart + linelength * l[i][3] / max,y + 51,color4);
336  }
337  else
338  for (j = 0; j <= 8; j++)
339  bar(linestart,y + 3 + j * 6,linestart + linelength * m[i][j] / max,y + 8 + j * 6,21 + j * 8);
340 
341  }
342  else
343  y = y1 + 60 + (categories - 1) * 90;
344 
345  doubleline(linestart,y + 80,linestart + linelength,y + 80);
348 
349  if ((max & 3) == 0)
350  b = 4;
351  else
352  if ((max % 3) == 0)
353  b = 3;
354  else
355  b = 2;
356 
358  activefontsettings.color = color1;
359  for (i = 0; i <= b; i++) {
360  doubleline(linestart + linelength * i / b,y + 75,linestart + linelength * i / b,y + 85);
361  showtext2(strr(max * i / b),linestart + linelength * i / b - 5,y + 87);
362  }
366  activefontsettings.background = color1;
367 
368  if (paintmode == 0) {
369  showtext2("own units",linestart,y + 110);
370 
371  activefontsettings.background = color2;
372  showtext2("allies", linestart + linelength / 4,y + 110);
373 
374  activefontsettings.background = color3;
376  showtext2("enemys", linestart + linelength * 2 / 4,y + 110);
377 
378  activefontsettings.background = color4;
380  showtext2("neutral", linestart + linelength * 3 / 4,y + 110);
381  }
382  else
383  paintsurface2(linestart,y + 110,linestart + linelength,y + 110 + schriften.smallarial->height);
384 }
385 
386 
387 void tstatisticarmies::run(void)
388 {
389  count();
390  paintgraph();
391  mousevisible(true);
392  do {
393  tstatistics::run();
394  if (taste == ct_esc)
395  action = 2;
396  if (taste == ct_f1)
397  help(11);
398  if ((mouseparams.taste == 1) && (mouseparams.x > x1 + 10) && (mouseparams.y > y1 + 50) && (mouseparams.x < x1 + xsize - 10) && (mouseparams.y < y1 + ysize - 70)) {
399  jk++;
400  newknopfdruck( (int) (x1 + 10) , (int) (y1 + 50) , (int) (x1 + xsize - 10) , (int) (y1 + ysize - 70));
401  if (jk > 3) {
402  displaymessage("that makes fun, doesn't it ? \n this will be released as a seperate game soon ! ",1);
403  }
404  }
405  } while (action < 2);
406 }
407 
408 
409 void tstatisticbuildings::run(void)
410 {
411  count();
412  paintgraph();
413  mousevisible(true);
414  do {
415  tstatistics::run();
416  if (taste == ct_esc)
417  action = 2;
418  if (taste == ct_f1)
419  help(10);
420  } while (action < 2);
421 }
422 
423 
424 void tstatistics::buttonpressed( int id )
425 {
426  if (id == 1) {
427  paintmode = 1 - paintmode;
428  mousevisible(false);
429  paintsurface ( 81, 51, xsize - 11, ysize - 72 );
430  paintgraph();
431  mousevisible(true);
432  }
433  if (id == 2)
434  action = 2;
435 }
436 
437 
438 void statisticarmies(void)
439 {
440  tstatisticarmies sta;
441 
442  sta.init();
443  sta.run();
444  sta.done();
445 }
446 
447 
448 void statisticbuildings(void)
449 {
450  tstatisticbuildings stb;
451 
452  stb.init();
453  stb.run();
454  stb.done();
455 }
456 
457 
458 #endif
459 
460 
461 
462 #define klickconst 100
463 #define delayconst 10
464 
465 
466 void dispmessage2( const ActionResult& result )
467 {
468  dispmessage2( result.getCode(), result.getMessage().c_str() );
469 }
470 
471 
472 void dispmessage2(int id,
473  const char * st)
474 {
475  char *s2;
476 
477  const char* sp = getmessage(id);
478  const char* s1 = sp;
479  if (sp != NULL) {
480  char s[200];
481  s2 = s;
482  while (*s1 !=0) {
483  if ( *s1 != 35 /* # */ ) {
484  *s2 = *s1;
485  s2++;
486  s1++;
487  } else {
488  if (st != NULL) {
489  while (*st != 0) {
490  *s2 = *st;
491  s2++;
492  st++;
493  } /* endwhile */
494  } /* endif */
495  } /* endif */
496  } /* endwhile */
497  *s2 = 0;
498 
499  displaymessage2(s);
500  }
501 }
502 
503 
504  /* type
505  tmemoryinfo = object(tdialogbox)
506  procedure init;
507  procedure run;
508  end;
509 
510 procedure tmemoryinfoinit;
511 var
512  l:int;
513 begin
514  x1:=80;
515  y1:=50;
516  xsize:=640-2*x1;
517  ysize:=480-2*y1;
518  buildgraphics;
519  activefontsettings.font:=schriften.smallarial;
520  activefontsettings.color:=lightblue;
521  activefontsettings.background:=255;
522  activefontsettings.justify:=lefttext;
523  showtext2('vehicletypeen : '+strr(sizeof(tvehicletype)*vehicletypeenanz+
524 end; */
525 
526 
527 
528 
529 class tchoice_dlg : public tdialogbox {
530  public:
531  int result;
532  void init( const char* a, const char* b, const char* c );
533  virtual void buttonpressed( int id );
534  virtual void run( void );
535  };
536 
537 
538 void tchoice_dlg::init( const char* a, const char* b, const char* c )
539 {
542  int wdth = gettextwdth ( a, schriften.arial8 ) ;
543  if ( wdth > 280 )
544  xsize = wdth + 20;
545  else
546  xsize = 300;
547 
548  ysize = 100;
549  addbutton(b,10,60,xsize/2-5,90,0,1,1,true);
550  addbutton(c,xsize/2+5,60,xsize-10,90,0,1,2,true);
551 
552  x1 = (640 - xsize) / 2;
553  y1 = (480 - ysize) / 2;
554 
555  buildgraphics();
560  if ( actmap && actmap->actplayer >= 0 )
562  else
564  mousevisible ( false );
565  showtext2(a,x1 + 10,y1 + 15);
566  mousevisible ( true );
567  result = 0;
568 }
569 
570 
572 {
573  if (id == 1) result = 1;
574  if (id == 2) result = 2;
575 }
576 
577 
579 {
580  while ( mouseparams.taste )
582  mousevisible(true);
583  do {
584  tdialogbox::run();
585  } while (result == 0);
586 }
587 
588 
589 int legacy_choice_dlg( const char * title,
590  const char * s1,
591  const char * s2,
592  ... )
593 {
594 
595  va_list paramlist;
596  va_start ( paramlist, s2 );
597 
598  char tempbuf[1000];
599 
600  int lng = vsprintf( tempbuf, title, paramlist );
601  va_end ( paramlist );
602  if ( lng >= 1000 )
603  displaymessage ( "dialog.cpp / choice_dlg: string to long !\nPlease report this error",1 );
604 
605  tchoice_dlg c;
606  int a;
607 
608  c.init(tempbuf,s1,s2);
609  c.run();
610  a = c.result;
611  c.done();
612  return a;
613 }
614 
615 
616 int choice_dlg(const ASCString& title, const ASCString& leftButton, const ASCString& rightButton )
617 {
618  if ( legacyEventSystemActive() ) {
619  return legacy_choice_dlg( title.c_str(), leftButton.c_str(), rightButton.c_str() );
620  } else {
621  return new_choice_dlg( title, leftButton, rightButton );
622  }
623  return 0;
624 }
625 
626 
627 
628 /*********************************************************************************************/
629 /* unpack_date : entpackt das datum (von zb dateien) */
630 /*********************************************************************************************/
631 void unpack_date (unsigned short packed, int &day, int &month, int &year)
632 {
633  year = packed >> 9;
634  month = (packed - year*512) >> 5;
635  day = packed - year*512 - month*32;
636  year +=1980;
637 }
638 
639 
640 
641 
642 /*********************************************************************************************/
643 /* unpack_time : entpackt die zeit (von zb dateien) */
644 /*********************************************************************************************/
645 void unpack_time (unsigned short packed, int &sec, int &min, int &hour)
646 {
647  hour = packed >> 11;
648  min = (packed - hour*2048) >> 5;
649  sec = packed - hour*2048 - min*32; // sekunden sind noch nicht getestet !!!
650 }
651 
652 
653 
654 
655 
656 
657 /*
658 void testdisptext ( void )
659 {
660  tnfilestream stream ("tst.txt",1 );
661  char *cct;
662  stream.readpnchar ( &cct );
663 
664  if ( cct ) {
665  tviewtext vt;
666  vt.setparams ( 10, 10, 630, 470, cct, white, black );
667  vt.tvt_dispactive = 1;
668  vt.displaytext ();
669 
670 
671  delete[] cct;
672  }
673 }
674 
675 
676 void tenterfiledescription::init ( char* descrip )
677 {
678 
679  tdialogbox::init();
680  xsize = 350;
681  ysize = 145;
682  x1 = 170;
683  y1 = 100;
684  title = "enter description";
685  description = new char [ 100 ];
686 
687  if ( descrip )
688  strcpy ( description, descrip );
689  else
690  description[0] = 0;
691 
692  addbutton( NULL, 15, starty + 10, xsize - 15, starty + 35 , 1, 0, 1, true );
693  addeingabe ( 1, (void*) description, 0, 100 );
694  addbutton( "~O~K", 15, ysize - 35, xsize - 15, ysize - 10, 0,1,2,true);
695  addkey( 2, ct_enter);
696 
697  buildgraphics();
698  status = 0;
699 }
700 
701 void tenterfiledescription::buttonpressed ( int id )
702 {
703  tdialogbox::buttonpressed ( id );
704  if (id == 2)
705  status = 1;
706 };
707 
708 
709 void tenterfiledescription::run ( void )
710 {
711  tdialogbox::run();
712  pbutton pb = firstbutton;
713  while (pb->id != 1)
714  pb = pb->next;
715  execbutton( pb , false );
716 
717 
718  mousevisible(true);
719  do {
720  tdialogbox::run();
721  } while ( status == 0 );
722 
723 }
724 
725 */
726 
727 
728 
729 #if 0
730 
731 
732 
733 typedef string* tnamestrings[9];
734 
735 class tenternamestrings : public tdialogbox {
736  typedef tdialogbox inherited;
737  ASCString dlgtitle;
738  public:
739  Uint8 status;
740  Uint8 playerexist;
741  tnamestrings& orgnames;
742  Uint8 names[9][100];
743  Uint8 buttonnames[9][100];
744 
745  void init( Uint8 plyexistyte, int md);
746  virtual void run ( void );
747  virtual void buttonpressed( int id );
748  void done ( void );
749  virtual int getcapabilities ( void );
750 
751  tenternamestrings ( tnamestrings& n ) : orgnames ( n ) {};
752  };
753 
754 
755 class tsetalliances : public tdialogbox {
756  typedef tdialogbox inherited;
757  protected:
758  virtual void redraw ( void );
759  tmap::Shareview sv;
760  public:
761  Uint8 status;
762  Uint8 alliancedata[8][8];
763  Uint8 location[8];
764  int playerpos[8]; // Beispiel: Es existieren Spieler 0 und Spieler 6; dann ist playerpos[0] = 0 und playerpos[1] = 6
765  // int playermode[8]; /* 0: player
766  // 1: ai
767  // 2: off */
768 
769  Uint8 playernum;
770  Uint8 playerexist;
771  Uint8 lastplayer;
772  int oninit;
773  int supervisor;
774  bool mapeditor;
775  bool shareview_changeable;
776  int xp,yp,xa,ya,bx; /* position der tastatur-markierungsrechtecke */
777 
778  void init ( int supervis );
779  virtual void buttonpressed( int id);
780  virtual void run ( void );
781  virtual int getcapabilities ( void );
782  void click( Uint8 bxx, Uint8 x, Uint8 y);
783  void paintkeybar ( void );
784  void buildhlgraphics ( void );
785  void displayplayernamesintable( void );
786  #ifndef karteneditor
787  void checkfornetwork ( void );
788  #endif
789  void setparams ( void );
790  };
791 
792 static const char* cens[] = { "player", "alliance", "computer" };
793 
794 
795 void tenternamestrings::init( Uint8 plyexist, int md )
796 {
797 
798  Uint8 i, j;
799 
801  playerexist = plyexist;
802  j = 0;
803  for (i = 0; i <= 7; i++)
804  if (playerexist & (1 << i))
805  j++;
806 
807  dlgtitle = "enter ";
808  dlgtitle += cens[md];
809  dlgtitle += " names" ;
810  title = dlgtitle.c_str();
811 
812  xsize = 350;
813  x1 = (640 - xsize) / 2;
814  ysize = 140 + j * 45;
815  y1 = (480 - ysize) / 2;
816 
817 
818  for (i=0;i<8 ;i++ ) {
819  strcpy ( names[i], orgnames[i]->c_str() );
820  strcpy( buttonnames [i], cens[md] );
821  strcat( buttonnames [i], digit[i] );
822  } /* endfor */
823 
824  j = 0;
825  for (i = 0; i <= 7; i++)
826  if ( (playerexist & (1 << i)) && names[i] ) {
827  j++;
828  addbutton(buttonnames[i],20,30 + j * 45,xsize - 20,52 + j * 45,1,0,i + 1,true);
829  addeingabe(i + 1, names[i], 1, 99);
830  }
831  addbutton("~o~k",20,ysize - 40,xsize / 2 - 5,ysize - 10,0,1,30,true);
832  addbutton("~c~ancel",xsize / 2 + 5,ysize - 40,xsize - 20,ysize - 10,0,1,31,true);
833  buildgraphics();
834  status = 0;
835 }
836 
837 void tenternamestrings::done ( void )
838 {
840 }
841 
842 
843 void tenternamestrings::buttonpressed( int id )
844 {
845  inherited::buttonpressed(id);
846  if (id == 30) status = 2;
847  if (id == 31) status = 1;
848 }
849 
850 
851 void tenternamestrings::run(void)
852 {
853  mousevisible(true);
854  do {
855  tdialogbox::run();
856  } while (status == 0);
857 
858  if (status == 2)
859  for (int i=0;i<8 ;i++ )
860  *orgnames[i] = names[i];
861 
862 }
863 
864 
865 
866 int tenternamestrings::getcapabilities ( void )
867 {
868  return 1;
869 }
870 
871 #endif
872 
873 
875 {
876 /*
877  ASCString msg;
878 
879  tmap::Shareview* sv = actmap->shareview;
880  actmap->shareview = NULL;
881  computeview ( actmap );
882 
883  for ( int i = 0; i < 8; i++ )
884  if ( actmap->player[i].exist() ) {
885  msg += ASCString("#font02#Player ") + strrr ( i ) + "#font01#\n" ;
886  int notVisible = 0;
887  int fogOfWar = 0;
888  int visible = 0;
889  for ( int x = 0; x < actmap->xsize; x++ )
890  for ( int y = 0; y < actmap->ysize; y++ ) {
891  VisibilityStates vs = fieldVisibility ( actmap->getField ( x, y ), i );
892  switch ( vs ) {
893  case visible_not: ++notVisible;
894  break;
895  case visible_ago: ++fogOfWar;
896  break;
897  default: ++visible;
898  }
899  }
900  msg += ASCString(" not visible: ") + strrr(notVisible ) + " fields\n";
901  msg += ASCString(" fog of war: ") + strrr(fogOfWar ) + " fields\n";
902  msg += ASCString(" visible: ") + strrr(visible ) + " fields\n\n";
903  }
904 
905 
906  actmap->shareview = sv;
907  computeview ( actmap );
908 
909 */
910  tviewanytext vat;
911  vat.init ( "Visibility Statistics", "Sorry, not available in ASC2 " );
912  vat.run();
913  vat.done();
914 }
915 
916 
917 
918 
919 
920 void tviewanytext:: init( const char* _title, const char* text , int xx1 , int yy1 , int xxsize , int yysize )
921 {
922 
923  // dialogbox initialisieren
924 
926  x1 = xx1;
927  y1 = yy1;
928  xsize = xxsize;
929  ysize = yysize;
930  textstart = 42 ;
931  textsizey = (ysize - textstart - 40);
932  starty = starty + 10;
933  title = _title;
935  action=0;
936 
937 
938  txt = text;
939 
940  setparams ( x1 + 13, y1 + textstart, x1 + xsize - 41, y1 + ysize - 40, txt, black, dblue);
941  addbutton ( "~O~K", 10, ysize - 30, xsize - 10, ysize - 10, 0, 1, 10, true );
942  addkey ( 10, ct_space );
943  addkey ( 10, ct_enter );
944  addkey ( 10, ct_esc );
945  tvt_dispactive = 0;
946  displaytext( );
948  tvt_dispactive = 1;
949 
950 
951  if (textsizeycomplete >= textsizey) {
952  scrollbarvisible = true;
953 
955  setscrollspeed ( 1 , 1 );
956 
957  rightspace = 40;
958  }
959  else {
960  rightspace = 10;
961  scrollbarvisible = false;
962  }
963 
964  tvt_starty = 0;
965  buildgraphics();
966 }
967 
968 
970 {
971  enablebutton( 1 );
972 }
973 
974 
976 {
977  collategraphicoperations cgo ( x1, y1, x1 + xsize, y1 + ysize);
978 
980  rahmen(true,x1 + 10,y1 + textstart - 2,x1 + xsize - rightspace,y1 + textstart + textsizey + 2);
981 
982 
987 
990 
991  int xd = 15 - (rightspace - 10) / 2;
992 
993  setpos ( x1 + 13 + xd, y1 + textstart, x1 + xsize - 41 + xd, y1 + ysize - 40 );
994  displaytext();
995 
996 }
997 
998 
1000 {
1002  if (id == 1)
1003  displaytext();
1004  if ( id== 10 )
1005  action = 11;
1006 }
1007 
1008 
1010 {
1011  mousevisible(true);
1012  do {
1013  tdialogbox::run();
1014  checkscrolling ( );
1015  if ( prntkey == 's' )
1016  printf("%s", txt);
1017  } while (action < 10);
1018 }
1019 
1020 
1021 
1022 
1023 
1024 class tbi3preferences : public tdialogbox {
1025  CGameOptions actoptions;
1026  int status;
1027  tmouserect delta, r1, r2, r3, r4, r5, r6, r7, r8;
1028  tmouserect dlgoffset;
1029 
1030  public:
1031  void init ( void );
1032  void buttonpressed ( int id );
1033  void run ( void );
1034  tbi3preferences ( ) : actoptions ( *CGameOptions::Instance() ) {};
1035  };
1036 
1037 
1039 {
1040  tdialogbox::init();
1041  title = "BattleIsle options";
1042 
1043  xsize = 600;
1044  ysize = 460;
1045 
1046  x1 = -1;
1047  y1 = -1;
1048 
1049  addbutton ( "~O~K", 10, ysize - 35, xsize / 2 - 5, ysize - 10, 0, 1, 1, true );
1050  addbutton ( "~C~ancel", xsize / 2 + 5, ysize - 35, xsize - 10, ysize - 10, 0, 1, 2, true );
1051 
1052  r1.x1 = xsize - 150;
1053  r1.y1 = starty + 20;
1054  r1.x2 = xsize - 20;
1055  r1.y2 = starty + 35;
1056 
1057  delta.x1 = 0;
1058  delta.x2 = 0;
1059  delta.y1 = 30;
1060  delta.y2 = 30;
1061 
1062  addbutton ( "", r1, 3, 0, 3, true );
1063 // addeingabe ( 3, &actoptions.bi3.interpolate.terrain, 0, dblue );
1064 
1065  r2 = r1 + delta;
1066 
1067  addbutton ( "", r2, 3, 0, 4, true );
1068  // addeingabe ( 4, &actoptions.bi3.interpolate.units, 0, dblue );
1069 
1070  r3 = r2 + delta;
1071 
1072  addbutton ( "", r3, 3, 0, 5, true );
1073  // addeingabe ( 5, &actoptions.bi3.interpolate.buildings, 0, dblue );
1074 
1075  r4 = r3 + delta;
1076 
1077  addbutton ( "", r4, 3, 0, 6, true );
1078 // addeingabe ( 6, &actoptions.bi3.interpolate.objects, 0, dblue );
1079 
1080  buildgraphics();
1081 
1086 
1087  dlgoffset.x1 = x1;
1088  dlgoffset.y1 = y1;
1089  dlgoffset.x2 = x1;
1090  dlgoffset.y2 = y1;
1091 
1092  showtext2 ( "interpolate terrain", x1 + 25, y1 + r1.y1 );
1093  showtext2 ( "interpolate units", x1 + 25, y1 + r2.y1 );
1094  showtext2 ( "interpolate buildings", x1 + 25, y1 + r3.y1 );
1095  showtext2 ( "interpolate objects", x1 + 25, y1 + r4.y1 );
1096 
1097  status = 0;
1098 
1099 
1100 }
1101 
1103 {
1105 
1106  if ( id == 1 ) {
1107  *CGameOptions::Instance() = actoptions;
1108  status = 10;
1109  }
1110 
1111  if ( id == 2 )
1112  status = 10;
1113 }
1114 
1115 
1117 {
1118  mousevisible ( true );
1119  do {
1120  tdialogbox::run();
1121  } while ( status < 10 ); /* enddo */
1122 }
1123 
1124 void bi3preferences ( void )
1125 {
1126  tbi3preferences prefs;
1127  prefs.init();
1128  prefs.run();
1129  prefs.done();
1130 }
1131 
1132 
1133 
1134 
1135 class ResizeMap : public tdialogbox {
1136  int status;
1137  int top, bottom, left, right;
1138 
1139  public:
1140  void init ( void );
1141  void buttonpressed ( int id );
1142  void run ( void );
1143  Uint8 checkvalue( int id, void* p);
1144  };
1145 
1146 
1147 Uint8 ResizeMap :: checkvalue(int id, void* p)
1148 {
1149  if ( id >= 3 && id <= 6 ) {
1150  int* wp = (int*) p;
1151 
1152  if ( id == 3 && id == 6 )
1153  if ( *wp & 1 ) {
1154  displaymessage ( "values must be even !", 1 );
1155  return 0;
1156  }
1157  /*
1158  if ( (id == 3 && - ( *wp + bottom ) > actmap->ysize - idisplaymap.getscreenysize(1) ) ||
1159  (id == 6 && - ( top + *wp ) > actmap->ysize - idisplaymap.getscreenysize(1) ) ||
1160  (id == 4 && - ( *wp + right ) > actmap->xsize - idisplaymap.getscreenxsize(1) ) ||
1161  (id == 5 && - ( left + *wp ) > actmap->xsize - idisplaymap.getscreenxsize(1) ) ) {
1162  displaymessage ( "remaining size too small !", 1 );
1163  return 0;
1164  } */
1165 
1166  if ( (id == 3 && ( *wp + bottom ) + actmap->ysize > 32000 ) ||
1167  (id == 6 && ( top + *wp ) + actmap->ysize > 32000 ) ||
1168  (id == 4 && ( *wp + right ) + actmap->xsize > 32000 ) ||
1169  (id == 5 && ( left + *wp ) + actmap->xsize > 32000 ) ) {
1170  displaymessage ( "new map too large !", 1 );
1171  return 0;
1172  }
1173 
1174  }
1175  return 1;
1176 }
1177 
1178 void ResizeMap :: init ( void )
1179 {
1180 
1181  top = 0;
1182  bottom = 0;
1183  left = 0;
1184  right = 0;
1185 
1186  tdialogbox::init();
1187  title = "Resize Map";
1188 
1189  xsize = 400;
1190  ysize = 300;
1191 
1192  x1 = -1;
1193  y1 = -1;
1194 
1195  addbutton ( "~O~K", 10, ysize - 35, xsize / 2 - 5, ysize - 10, 0, 1, 1, true );
1196  addkey ( 1, ct_enter );
1197 
1198  addbutton ( "~C~ancel", xsize / 2 + 5, ysize - 35, xsize - 10, ysize - 10, 0, 1, 2, true );
1199  addkey ( 2, ct_esc );
1200 
1201  addbutton ( "~T~op", xsize/2 - 30, 70, xsize/2 + 30, 90, 2, 0, 3, true );
1202  addeingabe ( 3, &top, -actmap->ysize, 70000 );
1203  addkey ( 3, ct_t );
1204 
1205  addbutton ( "~L~eft", 20, 120, 80, 140, 2, 0, 4, true );
1206  addeingabe ( 4, &left, -actmap->xsize, 70000 );
1207  addkey ( 4, ct_l );
1208 
1209  addbutton ( "~R~ight", xsize - 80, 120, xsize - 20, 140, 2, 0, 5, true );
1210  addeingabe ( 5, &right, -actmap->xsize, 70000 );
1211  addkey ( 5, ct_r );
1212 
1213  addbutton ( "~B~ottom", xsize/2 - 30, 150, xsize/2 + 30, 170, 2, 0, 6, true );
1214  addeingabe ( 6, &bottom, -actmap->ysize, 70000 );
1215  addkey ( 6, ct_b );
1216 
1217  buildgraphics();
1218 
1223 
1224  showtext2 ( "positive values: enlarge map", x1 + 25, y1 + 220 );
1225  showtext2 ( "negative values: shrink map", x1 + 25, y1 + 240 );
1226 
1227  status = 0;
1228 }
1229 
1231 {
1233 
1234  if ( id == 1 )
1235  status = 12;
1236 
1237  if ( id == 2 )
1238  status = 10;
1239 
1240 }
1241 
1242 
1243 void ResizeMap :: run ( void )
1244 {
1245  mousevisible ( true );
1246  do {
1247  tdialogbox::run();
1248  } while ( status < 10 ); /* enddo */
1249  if ( status >= 12 ) {
1250  int result = actmap->resize ( top, bottom, left, right );
1251  if ( result )
1252  displaymessage ( "resizing failed" , 1 );
1253  }
1254 }
1255 
1256 void resizemap ( void )
1257 {
1258  ResizeMap rm;
1259  rm.init();
1260  rm.run();
1261  rm.done();
1262  displaymap();
1263 }
1264 
1265 
1266 
1267 
1268 
1269 
1270 
1271 
1273  protected:
1274  int zoom;
1275  int ok;
1276  public:
1277  void init ( void );
1278  void buttonpressed ( int id );
1279  void run ( void );
1280  };
1281 
1283 {
1284  tdialogbox :: init ( );
1285  title = "choose zoomlevel";
1286  xsize = 200;
1287  ysize = 150;
1288 // zoom = zoomlevel.getzoomlevel();
1289  ok = 0;
1290 
1291  addbutton ( "~O~k", 10, ysize - 30, xsize - 10, ysize - 10 , 0, 1, 1, true );
1292  addkey ( 1, ct_enter );
1293 
1294  addbutton ( "", 10, 60, xsize - 10, 85 , 2, 1, 2, true );
1295  // addeingabe ( 2, &zoom, zoomlevel.getminzoom(), zoomlevel.getmaxzoom() );
1296  addkey ( 1, ct_space );
1297 
1298  buildgraphics();
1299 }
1300 
1302 {
1304  if ( id == 1 )
1305  ok = 1;
1306 }
1307 
1309 {
1310  if ( pcgo ) {
1311  delete pcgo;
1312  pcgo = NULL;
1313  }
1314  editfield ( 2 );
1315  ok = 1;
1316  mousevisible ( true );
1317  do {
1318  tdialogbox::run();
1319  } while ( !ok );
1320 // zoomlevel.setzoomlevel ( zoom );
1321 
1322 };
1323 
1324 void choosezoomlevel ( void )
1325 {
1326  tchoosezoomlevel ctl;
1327  ctl.init();
1328  ctl.run();
1329  ctl.done();
1330  displaymap();
1331 }
1332 
1333 
1334 
1335 
1336 
1337 void showbdtbits( void )
1338 {
1339  MapField* fld = actmap->getField(actmap->getCursor());
1340  ASCString m;
1341  for (int i = 0; i < terrainPropertyNum ; i++) {
1342  TerrainBits bts;
1343  bts.set ( i );
1344 
1345  if ( (fld->bdt & bts).any() ) {
1346  m = m + terrainProperty[i] + "\n";
1347  }
1348  } /* endfor */
1349  displaymessage( m, 3 );
1350 }
1351 
1352 void appendTerrainBits ( char* text, const TerrainBits* bdt )
1353 {
1354  for (int i = 0; i < terrainPropertyNum ; i++) {
1355  TerrainBits bts;
1356  bts.set ( i );
1357 
1358  if ( (*bdt & bts).any() ) {
1359  strcat ( text, " " );
1360  strcat ( text, terrainProperty[i] );
1361  strcat ( text, "\n" );
1362  }
1363  } /* endfor */
1364 }
1365 
1366 
1367 void viewUnitSetinfo ( void )
1368 {
1369  ASCString s;
1370  MapField* fld = actmap->getField( actmap->getCursor() );
1371  if ( fld && fieldvisiblenow ( fld ) && fld->vehicle ) {
1372 
1373  s += "#fontsize=18#Unit Information:#fontsize=14##aeinzug20##eeinzug20##crtp20#" ;
1374 
1375  const VehicleType* typ = fld->vehicle->typ;
1376 /*
1377  s += "\nreactionfire.Status: ";
1378  s += strrr( getactfield()->vehicle->reactionfire.status );
1379  s += "\nreactionfire.enemiesattackable: ";
1380  s += strrr ( getactfield()->vehicle->reactionfire.enemiesAttackable );
1381 */
1382  s += "Unit name: " ;
1383  if ( !typ->name.empty() )
1384  s += typ->name ;
1385  else
1386  s += typ->description;
1387 
1388  s += "\nUnit owner: " + ASCString::toString( fld->vehicle->getOwner() ) + " - " + actmap->getPlayer(fld->vehicle).getName();
1389 
1390  s += "\nUnit ID: " + ASCString::toString( typ->id );
1391 
1392  if ( !typ->location.empty() )
1393  s += typ->location;
1394 
1395  if ( unitSets.size() > 0 )
1396  for ( unsigned int i = 0; i < unitSets.size(); i++ )
1397  if ( unitSets[i]->isMember ( typ->id,SingleUnitSet::unit )) {
1398  s += "Unit is part of this unit set:";
1399  if ( unitSets[i]->name.length()) {
1400  s += "#aeinzug20##eeinzug20#\nName: #aeinzug60##eeinzug60#\n";
1401  s += unitSets[i]->name;
1402  }
1403  if ( unitSets[i]->maintainer.length()) {
1404  s += "#aeinzug20##eeinzug20#\nMaintainer: #aeinzug60##eeinzug60#\n";
1405  s += unitSets[i]->maintainer;
1406  }
1407  if ( unitSets[i]->information.length()) {
1408  s += "#aeinzug20##eeinzug20#\nInformation: #aeinzug60##eeinzug60#\n";
1409  s += unitSets[i]->information;
1410  }
1411  s += "#aeinzug0##eeinzug0#\n";
1412  }
1413 
1414 
1415  } else
1416  s += "\nNo unit selected";
1417 
1418  ViewFormattedText vft( "Unit information", s, PG_Rect( -1, -1, 400, 350) );
1419  vft.Show();
1420  vft.RunModal();
1421 }
1422 
1423 
1424 
1425 
1426 
1427 
1428 #define blocksize 256
1429 
1430 
1435 
1437 {
1438  text = new char [ blocksize ];
1439  text[0] = 0;
1440  size = 1;
1441  allocated = blocksize;
1442 
1443  next = NULL;
1444  prev = NULL;
1445  cursor = -1;
1446  cursorstat = 0;
1447  ps.line1num = 0;
1448  linenum = -1;
1449  searchcursorpos = 0;
1450 }
1451 
1453 {
1454  searchcursorpos = 0;
1455  linenum = -1;
1456  text = new char [ blocksize ];
1457  text[0] = 0;
1458  size = 1;
1459  allocated = blocksize;
1460  cursorstat = 0;
1461  cursor = -1;
1462 
1463  prev = prv;
1464 
1465  if ( prv ) {
1466  next = prv->next;
1467  if ( next )
1468  next->prev = this;
1469  prv->next = this;
1470 
1471  ps.line1num = prv->ps.line1num + 1 + prv->linenum;
1472  } else {
1473  next = NULL;
1474  ps.line1num = 0;
1475  }
1476 }
1477 
1478 
1479 
1481 {
1482  if ( text ) {
1483  delete[] text;
1484  text = NULL;
1485  }
1486 
1487  if ( prev )
1488  prev->next = next;
1489 
1490  if ( next )
1491  next->prev = prev;
1492 
1493 }
1494 
1495 
1496 void tparagraph :: changesize ( int newsize )
1497 {
1498  newsize = (newsize / blocksize + 1) * blocksize;
1499  char* temp = new char[newsize];
1500  if ( text ) {
1501  strcpy ( temp, text );
1502  delete[] text;
1503  } else
1504  temp[0] = 0;
1505 
1506  allocated = newsize;
1507  size = strlen ( temp )+1;
1508  text = temp;
1509 }
1510 
1511 
1512 void tparagraph :: join ( void )
1513 {
1514  cursor = size-1;
1515  addtext ( next->text );
1516  delete next;
1517  if ( reflow() ) {
1518  display();
1519  if ( checkcursorpos() ) {
1520  checkscrollup();
1521  checkscrolldown();
1522  }
1523  }
1524 
1525 
1526 }
1527 
1528 
1529 
1531 {
1532  int nsize = txt.length();
1533  if ( allocated < nsize + size )
1534  changesize ( nsize + size );
1535 
1536  strcat ( text, txt.c_str() );
1537  size = strlen ( text ) + 1;
1538 }
1539 
1541 {
1542  if ( cursor != -1 ) {
1543  if ( cursor >= size )
1544  cursor = size-1;
1545  if ( cursor < 0 )
1546  cursor = 0;
1547  } else
1548  displaymessage ( " void tparagraph :: checkcursor ( void ) \ncursor not in paragraph !\n text is : %s", 2, text );
1549 }
1550 
1551 
1552 
1553 void tparagraph :: addchar ( char c )
1554 {
1555  checkcursor();
1556  if ( size + 1 > allocated )
1557  changesize ( size + 1 );
1558 
1559  for ( int i = size; i > cursor; i--)
1560  text[i] = text[i-1];
1561 
1562  text[cursor] = c;
1563  cursor++;
1564  size++;
1565 
1566  if ( reflow() ) {
1567  display();
1568  checkcursorpos();
1569  }
1570 }
1571 
1572 
1574 {
1575  checkcursor();
1576  if ( c == 1 ) { // backspace
1577  if ( cursor ) {
1578  for ( int i = cursor-1; i < size; i++)
1579  text[i] = text[i+1];
1580  cursor--;
1581  size--;
1582  if ( reflow() )
1583  display();
1584  } else
1585  if ( prev ) {
1586  pparagraph temp = prev;
1587  prev->join();
1588  return temp; // !!!###!!! gef�llt mir eigentlich ?berhauptnicht, wird aber wohl laufen. Sonst m?�te ich halt erasechar von au�en managen
1589  }
1590 
1591  }
1592  if ( c == 2 ) { // del
1593  if ( cursor < size-1 ) {
1594  for ( int i = cursor; i < size; i++)
1595  text[i] = text[i+1];
1596  size--;
1597  if ( reflow() )
1598  display();
1599  } else
1600  if ( next )
1601  join ( );
1602  }
1603  return this;
1604 }
1605 
1607 {
1608  if ( cursor >= 0 ) {
1609  checkcursor();
1610  if ( ps.line1num + cursory >= maxlinenum ) {
1611  ps.line1num = maxlinenum - cursory - 1;
1612  display();
1613  checkscrollup();
1614  checkscrolldown();
1615  return 0;
1616  }
1617 
1618  if( ps.line1num + cursory < 0 ) {
1619  ps.line1num = -cursory;
1620  display();
1621  checkscrollup();
1622  checkscrolldown();
1623  return 0;
1624  }
1625  }
1626  return 1;
1627 }
1628 
1630 {
1631  checkcursor();
1632  displaycursor();
1633  char* tempbuf = strdup ( &text[cursor] );
1634  text[cursor] = 0;
1635  size = strlen ( text ) + 1;
1636  reflow ( 0 );
1637  new tparagraph ( this );
1638  if ( tempbuf[0] )
1639  next->addtext ( tempbuf );
1640 
1641  free ( tempbuf );
1642  cursor = -1;
1643  next->cursor = 0;
1644  reflow( 0 );
1645  display();
1646  if ( next->reflow() )
1647  next->display();
1648 
1649  return next;
1650 }
1651 
1653 {
1654  if ( prev ) {
1655  if ( prev->ps.line1num + prev->linenum + 1 != ps.line1num ) {
1656  prev->ps.line1num = ps.line1num - 1 - prev->linenum ;
1657  prev->display();
1658  prev->checkscrollup();
1659  }
1660  }
1661 }
1662 
1664 {
1665  if ( next ) {
1666  if ( ps.line1num + linenum + 1 != next->ps.line1num ) {
1667  next->ps.line1num = ps.line1num + linenum + 1;
1668  next->display();
1669  next->checkscrolldown ();
1670  }
1671  } else {
1672  if ( ps.line1num + linenum < maxlinenum )
1674 
1675  }
1676 }
1677 
1678 
1679 int tparagraph :: reflow( int all )
1680 {
1681  int oldlinenum = linenum;
1682 
1683  pfont font = activefontsettings.font;
1684  linenum = 0;
1685  int pos = 0;
1686  linestart [ linenum ] = text;
1687  int length = 0;
1688 
1689  do {
1690 
1691  if ( font->character[int(text[pos])].size ) {
1692  length += font->character[int(text[pos])].width + 2 ;
1693  if ( pos )
1694  length += font->kerning[int(text[pos])][int(text[pos-1])];
1695  }
1696 
1697  if ( length > activefontsettings.length ) {
1698  int pos2 = pos;
1699  while ( ( text[pos2] != ' ' ) && ( &text[pos2] - linestart[linenum] ) )
1700  pos2--;
1701 
1702  if ( &text[pos2] == linestart[linenum] )
1703  pos2 = pos;
1704  else
1705  pos2++;
1706 
1707  linelength[linenum] = &text[pos2] - linestart[linenum];
1708  if ( linelength[linenum] > 200 ) {
1709  printf("\a");
1710  }
1711  linenum++;
1712  linestart[linenum] = &text[pos2];
1713  length = 0;
1714  pos = pos2;
1715  } else
1716  pos++;
1717  } while ( pos <= size ); /* enddo */
1718 
1719  linelength[linenum] = &text[pos] - linestart[linenum];
1720  if ( linelength[linenum] > 200 ) {
1721  printf("\a");
1722  }
1723 
1724 
1725  int oldlength = 0;
1726  for (int i = 0; i <= linenum; i++) {
1727  length = 0;
1728  for ( int j = 0; j < linelength[i]; j++ ) {
1729  pos = linestart[i] - text + j;
1730 
1731  if ( pos == cursor && !searchcursorpos ) {
1732  cursorx = length;
1733  normcursorx = cursorx;
1734  cursory = i;
1735  }
1736 
1737  if ( searchcursorpos ) {
1738  if ( i == cursory )
1739  if ( length >= normcursorx ) {
1740  cursorx = length;
1741  cursor = pos;
1742  searchcursorpos = 0;
1743  }
1744  if ( i > cursory ) {
1745  cursorx = oldlength;
1746  cursor = pos-1;
1747  searchcursorpos = 0;
1748  }
1749  }
1750 
1751  if ( font->character[int(text[pos])].size ) {
1752  length += font->character[int(text[pos])].width + 2 ;
1753  if ( pos )
1754  length += font->kerning[int(text[pos])][int(text[pos-1])];
1755  }
1756 
1757  }
1758  oldlength = length;
1759  } /* endfor */
1760 
1761 
1762  if ( searchcursorpos ) {
1763  cursorx = length;
1764  cursor = size-1;
1765  searchcursorpos = 0;
1766  }
1767 
1768 
1769  if ( all ) {
1770  if ( linenum != oldlinenum ) {
1771  display ( );
1772  if ( checkcursorpos() ) {
1773  checkscrollup();
1774  checkscrolldown();
1775  }
1776  return 0;
1777  }
1778  }
1779  return 1;
1780 
1781 }
1782 
1783 
1785 {
1786  pparagraph newcursorpos = this;
1787 
1788  if ( cursorstat )
1789  displaycursor();
1790 
1791  if ( dx == -1 ) {
1792  if ( cursor > 0 )
1793  cursor--;
1794  else
1795  if ( prev ) {
1796  cursor = -1;
1797  newcursorpos = prev;
1798  prev->cursor = prev->size - 1;
1799  }
1800  }
1801 
1802  if ( dx == 1 ) {
1803  if ( cursor < size-1 )
1804  cursor++;
1805  else
1806  if ( next ) {
1807  cursor = -1;
1808  next->cursor = 0;
1809  newcursorpos = next;
1810  }
1811  }
1812 
1813  if ( dy == 1 ) {
1814  if ( cursory < linenum ) {
1815  cursory++;
1816  searchcursorpos++;
1817  } else
1818  if ( next ) {
1819  cursor = -1;
1820  next->cursor = 0;
1821  next->normcursorx = normcursorx;
1822  next->cursorx = normcursorx;
1823  next->cursory = 0;
1824  next->searchcursorpos = 1;
1825  newcursorpos = next;
1826  }
1827  }
1828 
1829  if ( dy == -1 ) {
1830  if ( cursory > 0 ) {
1831  cursory--;
1832  searchcursorpos++;
1833  } else
1834  if ( prev ) {
1835  cursor = -1;
1836  prev->cursor = 0;
1837  prev->normcursorx = normcursorx;
1838  prev->cursorx = normcursorx;
1839  prev->cursory = prev->linenum;
1840  prev->searchcursorpos = 1;
1841  newcursorpos = prev;
1842  }
1843  }
1844 
1845  newcursorpos->reflow( 0 );
1846  newcursorpos->checkcursorpos();
1847  newcursorpos->displaycursor();
1848  return newcursorpos;
1849 }
1850 
1851 
1853 {
1854  if ( cursor >= 0 ) {
1855  int starty;
1856  if ( ps.line1num < 0 ) {
1857  starty = winy1 + (ps.line1num + cursory) * activefontsettings.height;
1858  // startline = -ps.line1num;
1859  } else {
1860  starty = winy1 + (ps.line1num + cursory) * activefontsettings.height;
1861  // startline = 0;
1862  }
1863 
1864  if ( starty < winy2 ) {
1865  collategraphicoperations cgo ( winx1 + cursorx-2, starty, winx1 + cursorx+2, starty + activefontsettings.height );
1866  xorline ( winx1 + cursorx, starty+1, winx1 + cursorx, starty + activefontsettings.height - 1, blue );
1867  if ( cursorx )
1868  xorline ( winx1 + cursorx-1, starty+1, winx1 + cursorx-1, starty + activefontsettings.height - 1, blue );
1870  }
1871  }
1872 }
1873 
1874 void tparagraph :: setpos ( int x1, int y1, int y2, int linepos, int linenum )
1875 {
1876  winx1 = x1;
1877  winy1 = y1;
1878  winy2 = y2;
1879  ps.line1num = linepos;
1880  maxlinenum = linenum;
1881 }
1882 
1884 {
1885  if ( cursorstat )
1886  displaycursor();
1887  cursorstat = 0;
1888 
1889  int startline;
1890  int starty;
1891  if ( ps.line1num < 0 ) {
1892  starty = winy1;
1893  startline = -ps.line1num;
1894  } else {
1895  starty = winy1 + ps.line1num * activefontsettings.height;
1896  startline = 0;
1897  }
1898 
1899  while ( startline <= linenum && starty < winy2 ) {
1900  char *c = &linestart[ startline ] [ linelength [ startline ]] ;
1901  char d = *c;
1902  *c = 0;
1903 
1904  showtext2 ( linestart[ startline ], winx1, starty );
1905 
1906  *c = d;
1907  starty += activefontsettings.height;
1908  startline++;
1909  } ; /* enddo */
1910 
1911  if ( cursor >= 0 )
1912  displaycursor();
1913 }
1914 
1915 
1916 
1917 
1919 {
1920  firstparagraph = NULL;
1921  lastcursortick = 0;
1922  blinkspeed = 80;
1923 }
1924 
1926 {
1927  if ( txt.empty() )
1928  firstparagraph = new tparagraph;
1929  else {
1930  firstparagraph = NULL;
1931  actparagraph = NULL;
1932  int pos = 0;
1933  int start = 0;
1934  const char* c = txt.c_str();
1935  while ( c[pos] ) {
1936  int sz = 0;
1937  if ( strnicmp(&c[pos], "#CRT#" , 5 ) == 0 )
1938  sz = 5;
1939  if ( strnicmp(&c[pos], "\r\n" , 2 ) == 0 )
1940  sz = 2;
1941  if ( strnicmp(&c[pos], "\n" , 2 ) == 0 )
1942  sz = 1;
1943  if ( sz ) {
1944  ASCString s = txt;
1945  if ( start ) {
1946  s.erase ( 0, start );
1947  s.erase ( pos-start );
1948  } else
1949  s.erase ( pos );
1951  if ( !firstparagraph )
1953 
1954  actparagraph->addtext ( s );
1955  pos+=sz;
1956  start = pos;
1957  } else
1958  pos++;
1959  } /* endwhile */
1960 
1961  if ( start < txt.length() ) {
1963  if ( !firstparagraph )
1965  actparagraph->addtext ( &(txt.c_str()[start]) );
1966  }
1967 
1968  }
1969 }
1970 
1971 void tmessagedlg :: run ( void )
1972 {
1973  tdialogbox::run ( );
1974  if ( prntkey != cto_invvalue ) {
1975  if ( prntkey == cto_bspace )
1976  actparagraph = actparagraph->erasechar ( 1 );
1977  else
1978  if ( taste == cto_entf )
1979  actparagraph->erasechar ( 2 );
1980  else
1981  if ( taste == cto_left )
1982  actparagraph = actparagraph->movecursor ( -1, 0 );
1983  else
1984  if ( taste == cto_right )
1985  actparagraph = actparagraph->movecursor ( 1, 0 );
1986  else
1987  if ( taste == cto_up )
1988  actparagraph = actparagraph->movecursor ( 0, -1 );
1989  else
1990  if ( taste == cto_down )
1991  actparagraph = actparagraph->movecursor ( 0, 1 );
1992  else
1993  if ( taste == cto_enter )
1994  actparagraph = actparagraph->cut ( );
1995  else
1996  if ( taste == cto_esc )
1997  printf("\a");
1998  else
1999  if ( prntkey > 31 && prntkey < 256 )
2000  actparagraph->addchar ( prntkey );
2001  }
2002  if ( lastcursortick + blinkspeed < ticker ) {
2003  actparagraph->displaycursor();
2005  }
2006 }
2007 
2009 {
2010  tparagraph text;
2011 
2013  while ( actparagraph ) {
2014  text.addtext ( actparagraph->text );
2015  text.addtext ( "#crt#" );
2016  actparagraph = actparagraph->next;
2017  }
2018  return text.text;
2019 
2020 }
2021 
2023 {
2025  while ( actparagraph ) {
2026  pparagraph temp = actparagraph->next;
2027  delete actparagraph;
2028  actparagraph = temp;
2029  }
2030 }
2031 
2033 {
2034  xsize = 500;
2035  ysize = 450;
2036  ok = 0;
2037  tx1 = 20;
2038  ty1 = starty + 10;
2039  tx2 = xsize - 40;
2040  ty2 = ysize - ty1 - 80;
2041 
2042  addbutton ( "~S~end", 10, ysize - 30, xsize / 2 - 5, ysize - 10 , 0, 1, 1, true );
2043  clearkey ( 1 );
2044  addkey ( 1, cto_stp + cto_s );
2045 
2046  addbutton ( "~C~ancel", xsize / 2 + 5, ysize - 30, xsize - 10, ysize - 10 , 0, 1, 2, true );
2047  clearkey ( 2 );
2048  addkey ( 2, cto_stp + cto_c );
2049 
2050  int num = 0;
2051  for ( int i = 0; i < 8; i++ ) {
2052  if ( actmap->player[i].exist() )
2053  if ( actmap->actplayer != i ) {
2054  int x = 20 + ( num % 2 ) * 200;
2055  int y = ty2 + 10 + ( num / 2 ) * 20;
2056  // this is a leak! As this dialog will be scrapped before the ASC2 release, I don't care :->
2057  addbutton ( strdup( actmap->player[i].getName().c_str()), x, y, x+ 180, y+15, 3, 0, num+3, true );
2058  addeingabe ( num+3, &to[i], 0, dblue );
2059  num++;
2060  }
2061  }
2062 
2063 
2064 }
2065 
2066 
2067 
2068 
2070 {
2071  tdialogbox :: init ( );
2072  title = dlg_title.c_str();
2073 
2074  setup();
2075  buildgraphics();
2076 
2077 
2078  rectangle ( x1 + tx1 - 2, y1 + ty1 - 2, x1 + tx2 + 2, y1 + ty2 + 2 ,black );
2079 
2080 
2082  activefontsettings.length = tx2 - tx1 -1 ;
2087 
2088  inserttext ( text.c_str() );
2090  actparagraph->cursor = 0;
2091  actparagraph->setpos( x1 + tx1, y1 + ty1, y1 + ty2, 0, 13 );
2092 
2093  while ( actparagraph ) {
2094  actparagraph->reflow( 0 );
2095  actparagraph = actparagraph->next;
2096  }
2097  actparagraph = firstparagraph;
2098  actparagraph->checkscrolldown();
2099  actparagraph->display();
2100 
2101 
2102 }
2103 
2104 
2106 {
2107  xsize = 500;
2108  ysize = 400;
2109  ok = 0;
2110  tx1 = 20;
2111  ty1 = starty + 10;
2112  tx2 = xsize - 40;
2113  ty2 = ysize - ty1 - 40;
2114 
2115  addbutton ( "~O~k", 10, ysize - 30, xsize / 2 - 5, ysize - 10 , 0, 1, 1, true );
2116  clearkey ( 1 );
2117  addkey ( 1, cto_stp + cto_o );
2118 
2119  addbutton ( "~C~ancel", xsize / 2 + 5, ysize - 30, xsize - 10, ysize - 10 , 0, 1, 2, true );
2120  clearkey ( 2 );
2121  addkey ( 2, cto_stp + cto_c );
2122 
2123 }
2124 
2125 
2127 {
2129  if ( id == 1 )
2130  ok = 1;
2131  if ( id == 2 )
2132  ok = 2;
2133 }
2134 
2135 
2137 {
2138  mousevisible ( true );
2139  do {
2140  tmessagedlg::run ( );
2141  } while ( !ok );
2142 
2143  if ( ok == 1 ) {
2144  text = extracttext();
2145  textchanged = true;
2146  }
2147 }
2148 
2149 
2150 
2151 void selectgraphicset ( void )
2152 {
2153  ASCString filename = selectFile( "*.gfx", true );
2154  if ( !filename.empty() ) {
2155  int id = getGraphicSetIdFromFilename ( filename.c_str() );
2156  if ( id != actmap->graphicset ) {
2157  actmap->graphicset = id;
2158  displaymap();
2159  }
2160  }
2161 }
2162 
2163 int editInt( const ASCString& title, int defaultValue, int minValue, int maxValue )
2164 {
2165  return getid( title.c_str(), defaultValue, minValue, maxValue );
2166 }
2167 
2168 void displayActionError( const ActionResult& result, const ASCString& additionalInfo )
2169 {
2170  ASCString s = getmessage(result.getCode());
2171  s += "\n" + result.getMessage();
2172  if ( !additionalInfo.empty() )
2173  s += "\n" + additionalInfo;
2174 
2175  errorMessage( s );
2176 }
2177 
2178 
2179 
2180 
2181 
DiplomaticStates getState(PlayerID towardsPlayer) const
Definition: player.cpp:92
void init(const char *title, const char *text, int xx1=50, int yy1=50, int xxsize=360, int yysize=360)
Definition: dialog.cpp:920
int rightspace
Definition: dialog.h:70
const int blue
Definition: basegfx.h:88
void xorline(int x1, int y1, int x2, int y2, Uint8 actcol)
draws a simple line on the screen, but performs a XOR operation between the pixel already on screen a...
Definition: basegfx.cpp:241
void displaymap()
Definition: spfst.cpp:58
tfontsettings activefontsettings
Definition: newfont.cpp:51
#define dblue
Definition: misc.h:33
Uint8 background
Definition: newfont.h:171
The (base-) classes which are thrown as exceptions.
int x1
Definition: dlg_box.h:40
tmessagedlg(void)
Definition: dialog.cpp:1918
#define centertext
Definition: newfont.h:185
Player & getPlayer(PlayerID p)
Definition: gamemap.h:257
pparagraph cut(void)
Definition: dialog.cpp:1629
MapCoordinate & getCursor()
Definition: gamemap.cpp:933
void init(void)
Definition: dialog.cpp:1038
int xsize
the size of the map
Definition: gamemap.h:201
int size
Definition: dialog.h:140
int action
Definition: dialog.h:66
map accessing and usage routines used by ASC and the mapeditor
void buttonpressed(int id)
Definition: dialog.cpp:2126
miscellaneous functions which are used by ASC and all its tools
#define chschwimmend
Definition: typen.h:412
void run(void)
Definition: dialog.cpp:2136
int checkcursorpos(void)
Definition: dialog.cpp:1606
Vehicle * vehicle
Definition: mapfield.h:89
void setpos(int x1, int y1, int y2, int linepos, int linenum)
Definition: dialog.cpp:1874
#define cto_right
Definition: keysymbols.h:241
#define cto_o
Definition: keysymbols.h:210
void setup(void)
Definition: dialog.cpp:2105
void putimage(int x1, int y1, void *img)
puts the image pointed to by buffer to the screen
Definition: basegfx.cpp:1280
int lastcursortick
Definition: dialog.h:169
virtual int getcapabilities(void)
Definition: dlg_box.cpp:180
#define dlg_notitle
Definition: dlg_box.h:34
void viewVisibilityStatistics()
Definition: dialog.cpp:874
#define cto_left
Definition: keysymbols.h:240
int ok
Definition: dialog.h:168
void bi3preferences(void)
the dialog box for setting up how to load bi3 graphics and maps. Since ASC now uses its own graphics...
Definition: dialog.cpp:1124
int y1
Definition: dlg_box.h:40
virtual void run(void)
Definition: dlg_box.cpp:1477
ASCString getName() const
returns the name of the player
Definition: player.cpp:274
void clearkey(char id)
Definition: dlg_box.cpp:762
int result
Definition: dialog.cpp:531
DiplomaticStateVector diplomacy
Definition: player.h:209
#define cto_stp
Definition: keysymbols.h:147
virtual void buttonpressed(int id)
Definition: dlg_box.cpp:369
int getOwner() const
returns the number of the player this vehicle/building belongs to
int starty
Definition: dlg_box.h:158
void unpack_date(unsigned short packed, int &day, int &month, int &year)
Definition: dialog.cpp:631
int xsize
Definition: dlg_box.h:40
void rahmen(bool invers, int x1, int y1, int x2, int y2)
Definition: dlgraph.cpp:97
void changesize(int newsize)
Definition: dialog.cpp:1496
void choosezoomlevel(void)
Definition: dialog.cpp:1324
int scrollbarvisible
Definition: dialog.h:65
tparagraph(void)
Definition: dialog.cpp:1436
void bar(int x1, int y1, int x2, int y2, Uint8 color)
paints a colored bar
Definition: basegfx.cpp:1239
#define cto_esc
Definition: keysymbols.h:163
int tvt_starty
Definition: dlg_box.h:357
class tparagraph * pparagraph
Definition: dialog.h:104
int x1
Definition: events.h:64
pfont arial8
Definition: spfst-legacy.h:31
void buildgraphics(void)
Definition: dlg_box.cpp:1180
pfont smallarial
Definition: spfst-legacy.h:28
#define ct_enter
Definition: keysymbols.h:51
int cursor
Definition: dialog.h:132
const int dbluedark
Definition: dialog.h:37
A system that provides a set of images for vehicles, buildings, etc.
int allocated
Definition: dialog.h:141
Uint8 justify
Definition: newfont.h:176
#define chhochfliegend
Definition: typen.h:416
int ty2
Definition: dialog.h:168
Sint16 height
Definition: newfont.h:154
#define lefttext
Definition: newfont.h:184
Interface for some basic classes from which all of ASC's dialogs are derived.
pparagraph firstparagraph
Definition: dialog.h:165
int normcursorx
Definition: dialog.h:135
a single field of the map
Definition: mapfield.h:26
int blinkspeed
Definition: dialog.h:170
if(!yyg->yy_init)
Definition: scanner.cpp:695
#define ct_space
Definition: keysymbols.h:30
#define blocksize
Definition: dialog.cpp:1428
int tx2
Definition: dialog.h:168
void init(void)
Definition: dialog.cpp:1282
MapField * getEntryField() const
returns the field the buildings entry is standing on
Definition: buildings.cpp:405
void addchar(char c)
Definition: dialog.cpp:1553
#define cto_s
Definition: keysymbols.h:214
Uint8 color
Definition: newfont.h:170
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
ASCString getMessage() const
ASCString description
short description of the units role, for example "strategic bomber"
void dispmessage2(const ActionResult &result)
Definition: dialog.cpp:466
const int terrainPropertyNum
the number of bits that specify the terrain of a field
Definition: terraintype.h:28
const char * getmessage(int id)
returns a pointer to the message id. The messages must have been loaded with loadmessages ...
void addscrollbar(int lx1, int ly1, int lx2, int ly2, int *numberofitems, int itemsvisible, int *actitem, int lid, int keys)
Definition: dlg_box.cpp:582
int ty1
Definition: dialog.h:168
Uint8 taste
Definition: events.h:95
tkey taste
Definition: dlg_box.h:88
const int black
Definition: basegfx.h:87
int ysize
Definition: dlg_box.h:40
int legacy_choice_dlg(const char *title, const char *s1, const char *s2,...)
Definition: dialog.cpp:589
MapField * getfield(int x, int y)
returns the field at the given coordinates
Definition: spfst.cpp:199
virtual void run(void)
Definition: dialog.cpp:1009
void buttonpressed(int id)
Definition: dialog.cpp:1102
const int white
Definition: basegfx.h:102
void rahmen(bool invers, int x1, int y1, int x2, int y2)
paints a pseudo-3D rectangle on the screen.
Definition: basegfx.cpp:82
virtual void buttonpressed(int id)
Definition: dialog.cpp:999
struct tparagraph::@7 ps
int resize(int top, int bottom, int left, int right)
resizes the map. Positive numbers enlarge the map in that direction
Definition: gamemap.cpp:1636
int cursorstat
Definition: dialog.h:133
bool fieldvisiblenow(const MapField *pe, Vehicle *veh, int player)
{@
Definition: spfst.cpp:399
#define cto_entf
Definition: keysymbols.h:245
The class describing properties that are common to all vehicles of a certain kind.
Definition: vehicletype.h:177
pparagraph actparagraph
Definition: dialog.h:166
pfont font
Definition: newfont.h:169
static ASCString toString(int i)
converts the parameter to a String
Definition: ascstring.cpp:193
void appendTerrainBits(char *text, const TerrainBits *bdt)
Definition: dialog.cpp:1352
Schriften schriften
Definition: spfst.cpp:66
#define chtiefgetaucht
Definition: typen.h:410
VehicleList vehicleList
a list of all units
Definition: player.h:135
int tvt_yp
Definition: dlg_box.h:357
void done(void)
Definition: dlg_box.cpp:1235
const char * digit[]
Definition: misc.cpp:37
int graphicset
the ID of the graphic set
Definition: gamemap.h:424
int tx1
Definition: dialog.h:168
int windowstyle
Definition: dlg_box.h:163
the properties of a terrain describing which units can move onto this field and which can't ...
Definition: terraintype.h:32
void inserttext(const ASCString &txt)
Definition: dialog.cpp:1925
int linenum
Definition: dialog.h:154
#define ct_t
Definition: keysymbols.h:95
void run(void)
Definition: dialog.cpp:1971
static collategraphicoperations * pcgo
Definition: dlg_box.h:169
signed char kerning[256][256]
Definition: newfont.h:156
#define cto_up
Definition: keysymbols.h:242
#define chtieffliegend
Definition: typen.h:414
#define cto_c
Definition: keysymbols.h:198
pfont smallsystem
Definition: spfst-legacy.h:29
Uint8 checkvalue(int id, void *p)
Definition: dialog.cpp:1147
void displaymessage(const char *formatstring, int num,...)
displays a dialog box with a message
Definition: dlg_box.cpp:1849
#define ct_l
Definition: keysymbols.h:87
dynamic_array< int > linelength
Definition: dialog.h:152
Interface for all the fighting routines of ASC.
void addbutton(const char *ltxt, int lx1, int ly1, int lx2, int ly2, int lart, int lstyle, int lid, bool enabled)
Definition: dlg_box.cpp:471
#define ct_esc
Definition: keysymbols.h:43
Dialog classes based on the Paragui library.
void viewUnitSetinfo(void)
Definition: dialog.cpp:1367
The interface for the buildingtype class.
static int maxlinenum
Definition: dialog.h:138
static int winx1
Definition: dialog.h:146
Uint16 length
Definition: newfont.h:174
virtual void run(void)
Definition: dialog.cpp:578
int reflow(int all=1)
Definition: dialog.cpp:1679
void init(void)
Definition: dialog.cpp:1178
void setpos(int xx1, int yy1, int xx2, int yy2)
Definition: dlg_box.cpp:2657
#define cto_invvalue
Definition: keysymbols.h:145
int textstart
Definition: dialog.h:69
signed char actplayer
the player who is currently making his moves (may be human or AI)
Definition: gamemap.h:232
The IO for many basic classes and structurs of ACS.
int releasetimeslice(void)
Definition: events.cpp:209
void init(const char *a, const char *b, const char *c)
Definition: dialog.cpp:538
virtual void buttonpressed(int id)
Definition: dialog.cpp:571
void resizemap(void)
a dialog box that lets a user resize the active map. Should only be used in the mapeditor ...
Definition: dialog.cpp:1256
int cursorx
Definition: dialog.h:134
void editfield(pbutton pb)
Definition: dlg_box.cpp:1662
int gettextwdth(const char *txt, pfont font)
Definition: newfont.cpp:217
void addkey(int id, tkey key)
Definition: dlg_box.cpp:774
Player player[9]
Definition: gamemap.h:253
void errorMessage(const ASCString &string)
void showbdtbits(void)
Definition: dialog.cpp:1337
static CGameOptions * Instance()
returns the only Instance
Definition: gameoptions.cpp:38
#define chsatellit
Definition: typen.h:417
void display(void)
Definition: dialog.cpp:1883
Uint16 width
Definition: newfont.h:145
Uint16 size
Definition: newfont.h:146
#define ct_b
Definition: keysymbols.h:77
int ysize
Definition: gamemap.h:201
int prntkey
Definition: dlg_box.h:89
TerrainBits bdt
the terraintype properties. They determine which units can move over the field. This variable is reca...
Definition: mapfield.h:161
void checkscrolling(void)
Definition: dlg_box.cpp:2982
void setscrollspeed(char id, int speed)
Definition: dlg_box.cpp:814
#define cto_enter
Definition: keysymbols.h:171
int new_choice_dlg(const ASCString &title, const ASCString &leftButton, const ASCString &rightButton)
void displaytext(void)
Definition: dlg_box.cpp:2693
ASCString selectFile(const ASCString &ext, bool load, bool overwriteMessage)
void showtext2(const ASCString &text, int x, int y)
Definition: basegfx.cpp:1953
void help(int id)
displays a dialogbog with the given help topic
Definition: dlg_box.cpp:3286
#define cto_bspace
Definition: keysymbols.h:151
int height
the levels of height which this unit can enter
BuildingList buildingList
a list of all units
Definition: player.h:139
void run(void)
Definition: dialog.cpp:1243
void displaycursor(void)
Definition: dialog.cpp:1852
basegfx.h is the interface for the legacy graphic routines (of which some are platform dependent)...
int imagesize(int x1, int y1, int x2, int y2)
returns the size for a buffer that can contain an image of the given size.
Definition: basegfx.cpp:896
void checkscrolldown(void)
Definition: dialog.cpp:1663
void displaymessage2(const char *formatstring,...)
displays a message in the status line of ASC
Interface for all the dialog boxes used by the game and the mapeditor.
int y2
Definition: events.h:65
int xpos
the position on the map
Definition: vehicle.h:124
Definition: player.h:53
virtual void redraw(void)
Definition: dlg_box.cpp:1113
void setparams(int xx1, int yy1, int xx2, int yy2, const char *ttxt, char clr, char bkgr)
Definition: dlg_box.cpp:2665
procedure for loading and writing savegames, maps etc.
const VehicleType * typ
Definition: vehicle.h:83
static int winy2
Definition: dialog.h:145
int editInt(const ASCString &title, int defaultValue, int minValue, int maxValue)
Definition: dialog.cpp:2163
bool legacyEventSystemActive()
Definition: events.cpp:651
int to[8]
Definition: dialog.h:163
int tvt_dispactive
Definition: dlg_box.h:359
const char * terrainProperty[terrainPropertyNum+1]
Definition: terraintype.cpp:30
int searchcursorpos
Definition: dialog.h:137
virtual void enablebutton(int id)
Definition: dlg_box.cpp:860
void selectgraphicset(void)
Definition: dialog.cpp:2151
#define dlg_in3d
Definition: dlg_box.h:33
GameMap * actmap
Definition: spfst.cpp:64
void init(void)
Definition: dlg_box.cpp:314
void checkscrollup(void)
Definition: dialog.cpp:1652
void unpack_time(unsigned short packed, int &sec, int &min, int &hour)
Definition: dialog.cpp:645
void init(void)
Definition: dialog.cpp:2069
void redraw(void)
Definition: dialog.cpp:975
tcharacter character[256]
Definition: newfont.h:155
UnitSets unitSets
Definition: unitset.cpp:211
ASCString location
The filename and location on disk (including containerfiles) of the object.
Definition: typen.h:296
An actual building on the map, which references a BuildingType Buildings have an owner,.
Definition: buildings.h:38
const T & max(const T &a, const T &b, const T &c)
Definition: misc.h:97
const T & min(const T &a, const T &b, const T &c)
Definition: misc.h:80
void addtext(const ASCString &txt)
Definition: dialog.cpp:1530
pparagraph movecursor(int dx, int dy)
Definition: dialog.cpp:1784
pparagraph prev
Definition: dialog.h:157
static int winy1
Definition: dialog.h:144
const char * txt
Definition: dialog.h:62
void displayActionError(const ActionResult &result, const ASCString &additionalInfo)
Definition: dialog.cpp:2168
const int darkgray
Definition: basegfx.h:95
#define ct_f1
Definition: keysymbols.h:132
#define strnicmp
#define chgetaucht
Definition: typen.h:411
#define ct_r
Definition: keysymbols.h:93
void getimage(int x1, int y1, int x2, int y2, void *buffer)
copy an image to a buffer. buffer must have been alloced before with malloc ( imagesize ( x1...
Definition: basegfx.cpp:1256
void buttonpressed(int id)
Definition: dialog.cpp:1230
int choice_dlg(const ASCString &title, const ASCString &leftButton, const ASCString &rightButton)
Definition: dialog.cpp:616
int y1
Definition: events.h:64
void buttonpressed(int id)
Definition: dialog.cpp:1301
void join(void)
Definition: dialog.cpp:1512
char * text
Definition: dialog.h:142
int getCode() const
Definition: actionresult.h:43
virtual void setup(void)
Definition: dialog.cpp:2032
void run(void)
Definition: dialog.cpp:1308
#define cto_down
Definition: keysymbols.h:243
int ypos
Definition: vehicle.h:124
Uint8 height
Definition: newfont.h:178
void mousevisible(int an)
Definition: events.cpp:75
void addeingabe(int lid, void *data, int min, int max)
Definition: dlg_box.cpp:833
volatile tmousesettings mouseparams
Definition: events.cpp:35
Collects all graphic operations and updates the screen on destruction When porting ASC from DOS to SD...
Definition: basegfx.h:406
int x2
Definition: events.h:65
#define linesshown
Definition: dlg_box.h:386
pparagraph next
Definition: dialog.h:156
Interface for a small general-purpose stack (not type safe)
int cursory
Definition: dialog.h:136
#define chfliegend
Definition: typen.h:415
pparagraph erasechar(int c)
Definition: dialog.cpp:1573
bool exist() const
does the player exist at all
Definition: player.cpp:313
void rectangle(int x1, int y1, int x2, int y2, Uint8 color)
draws a simple rectangl
Definition: basegfx.cpp:297
ASCString name
a short name, for example B-52
const char * title
Definition: dlg_box.h:162
void run(void)
Definition: dialog.cpp:1116
void line(int x1, int y1, int x2, int y2, Uint8 actcol)
draws a simple line on the screen. Not very fast...
Definition: basegfx.cpp:181
int getid(const char *title, int lval, int min, int max)
Definition: dlg_box.cpp:3701
void checkcursor(void)
Definition: dialog.cpp:1540
volatile int ticker
Definition: events.cpp:234
void repaintscrollbar(void)
Definition: dialog.cpp:969
Definition: newfont.h:150
MapField * getField(int x, int y)
Definition: gamemap.h:465
ASCString extracttext()
Definition: dialog.cpp:2008
int getGraphicSetIdFromFilename(const ASCString &filename)
Definition: graphicset.cpp:117