Advanced Strategic Command
messagedlg.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  messagedlg.cpp - description
3  -------------------
4  begin : Mon M� 24 2003
5  copyright : (C) 2003 by Martin Bickel
6  email : bickel@asc-hq.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "messagedlg.h"
19 #include "gamemap.h"
20 
21 
22 
23 #include "paradialog.h"
24 #include "gameeventsystem.h"
25 
26 
27 #include "dialog.h"
28 #include "dlg_box.h"
29 #include "spfst.h"
30 
31 #include "widgets/textrenderer.h"
32 
33 #include "messages.h"
34 #include "pgwidget.h"
35 #include "widgets/playerselector.h"
36 #include "pgrichedit.h"
37 #include "pgmultilineedit.h"
38 #include "pgtooltiphelp.h"
39 
40 #include "dialogs/fieldmarker.h"
42 
43 #include "spfst-legacy.h"
44 
45 class NewMessage : public ASC_PG_Dialog {
46  GameMap* gamemap;
47  Message* message;
48  PG_MultiLineEdit* editor;
49  PlayerSelector* to;
50  PlayerSelector* cc;
51  bool reminder;
52 
53  bool ok()
54  {
55  if ( !message ) {
56  message = new Message ( editor->GetText(), gamemap, 0, 1 << actmap->actplayer );
57  gamemap->unsentmessage.push_back ( message );
58  } else {
59  message->text = editor->GetText();
60  }
61 
62  if ( reminder ) {
63  message->cc = 0;
64  message->to = 1 << actmap->actplayer;
65  } else {
66  message->cc = cc->getSelectedPlayers();
67  message->to = to->getSelectedPlayers();
68  }
69  message->reminder = reminder;
70 
71  QuitModal();
72  return true;
73  }
74 
75  bool cancel()
76  {
77  QuitModal();
78  return true;
79  }
80 
81  bool insertCursorCoordinates()
82  {
83  MapCoordinate pos = gamemap->getCursor();
84  if ( pos.valid() ) {
85  editor->InsertText( pos.toString() );
86  return true;
87  } else
88  return false;
89  }
90 
91  bool insertCoordinates()
92  {
94 
95  SelectFromMap sfm( coordinates, gamemap );
96  sfm.Show();
97  sfm.RunModal();
98 
99  ASCString text = "#coord(";
100  for ( SelectFromMap::CoordinateList::iterator i = coordinates.begin(); i != coordinates.end(); ++i ) {
101  if ( i != coordinates.begin() )
102  text += ";";
103  text += ASCString::toString( i->x ) + "/" + ASCString::toString( i->y );
104  }
105  text += ")#";
106  editor->InsertText( text );
107  return true;
108  }
109 
110  bool eventKeyDown(const SDL_KeyboardEvent* key)
111  {
112  int mod = SDL_GetModState() & ~(KMOD_NUM | KMOD_CAPS | KMOD_MODE);
113  if ( (mod & KMOD_CTRL) &&( key->keysym.sym == SDLK_r ))
114  return insertCursorCoordinates();
115 
116  return ASC_PG_Dialog::eventKeyDown(key);
117  }
118 
119  public:
120  NewMessage ( GameMap* gamemap, Message* msg = NULL, bool reminder = false );
121 
122  void Show(bool fade = false ) {
123  editor->EditBegin();
124  ASC_PG_Dialog::Show(fade);
125  }
126 
127 };
128 
129 
130 NewMessage :: NewMessage ( GameMap* gamemap, Message* msg, bool reminder ) : ASC_PG_Dialog( NULL, PG_Rect( -1, -1, 600, 500 ), "new message" )
131 {
132  this->gamemap = gamemap;
133  message = msg;
134  if ( message )
135  reminder = message->reminder;
136  this->reminder = reminder;
137 
138  int startY = 30;
139 
140  if ( !reminder ) {
141  new PG_Label ( this, PG_Rect( 20, 30, 30, 20 ), "TO:");
142  to = new PlayerSelector ( this, PG_Rect( 50, 30, 150, 150 ), gamemap, true, 1 << gamemap->actplayer );
143  if ( msg )
144  to->setSelection( msg->to );
145 
146  new PG_Label ( this, PG_Rect( 210, 30, 30, 20 ), "CC:" );
147  cc = new PlayerSelector ( this, PG_Rect( 240, 30, 150, 150 ), gamemap, true, 1 << gamemap->actplayer );
148  if ( msg )
149  cc->setSelection( msg->cc );
150 
151  startY += 170;
152  }
153 
154  editor = new PG_MultiLineEdit( this, PG_Rect(20, startY, Width() - 140, Height() - startY - 10 ));
155  if ( message )
156  editor->SetText( message->text );
157  editor->SetInputFocus();
158 
159  AddStandardButton("OK")->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &NewMessage::ok )));
160  AddStandardButton("Cancel")->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &NewMessage::cancel )));
161  AddStandardButton("");
162  AddStandardButton("Coordinates")->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &NewMessage::insertCoordinates )));
163  PG_Button* coord = AddStandardButton("Cursor Coord");
164  coord->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &NewMessage::insertCursorCoordinates )));
165  new PG_ToolTipHelp ( coord, "ctrl-r");
166 
167 }
168 
169 
171  TextRenderer* textViewer;
172  const Message* message;
173  PG_Label* from;
174  PG_Label* to;
175  PG_Label* cc;
176  bool keepMessage;
177 
178  bool ok()
179  {
180  keepMessage = false;
181  Hide();
182  QuitModal();
183  return true;
184  };
185 
186  bool keep()
187  {
188  keepMessage = true;
189  Hide();
190  QuitModal();
191  return true;
192  };
193 
194 
195  PG_Label* addHeaderLine( int y, const ASCString& name )
196  {
197  PG_Rect f( 10, y, Width() - 20, 25 );
198 
199  new PG_Label( this, PG_Rect( f.x, f.y, 50, f.h ), name );
200  Emboss* emb = new Emboss( this, PG_Rect( f.x + 50, f.y, f.w - 50, f.h ), true );
201  return new PG_Label( emb, PG_Rect( 2, 2, emb->w - 4, emb->h - 4) );
202  }
203 
204  public:
205  IngameMessageViewer ( const ASCString& title, const Message& msg, PG_Rect rect = PG_Rect( 50, 50, 500, 400 ), bool autoHeader = true ) : ASC_PG_Dialog ( NULL, rect, title ), message(NULL), from(NULL), to(NULL), cc(NULL)
206  {
207 
208  keepMessage = false;
209  int footerHeight;
210  /* if ( !buttonText.empty() ) { */
211  if ( msg.reminder ) {
212  PG_Button* b = new PG_Button( this, PG_Rect( Width() - 70, Height() - 40, 60, 30), "Done" );
213  b->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &IngameMessageViewer::ok)) );
214 
215  PG_Button* b2 = new PG_Button( this, PG_Rect( Width() - 140, Height() - 40, 60, 30), "Keep" );
216  b2->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &IngameMessageViewer::keep)) );
217  } else {
218  PG_Button* b = new PG_Button( this, PG_Rect( Width() - 110, Height() - 40, 100, 30), "OK" );
219  b->sigClick.connect( sigc::hide( sigc::mem_fun( *this, &IngameMessageViewer::ok)) );
220  }
221  footerHeight = 50;
222  /* } else
223  footerHeight = 10; */
224 
225  int y = 40;
226  if ( !msg.getFromText( actmap ).empty() ) {
227 
228 
229  from = addHeaderLine( y, "From:");
230  y += 30;
231 
232  if ( !autoHeader || (msg.to && !(msg.from & 512)) ) {
233  to = addHeaderLine( y, "To:");
234  y += 30;
235  }
236 
237  if ( !autoHeader || msg.cc ) {
238  cc = addHeaderLine( y, "CC:");
239  y += 30;
240  }
241 
242 
243  }
244 
245  PG_Rect r ( 10, y, Width() - 20, Height() - (y + footerHeight ));
246  new Emboss( this, r, true );
247 
248 #ifdef RICHEDIT
249  PG_RichEdit* re = new PG_RichEdit( this, PG_Rect(r.x + 2, r.y+2, r.w-4, r.h-4));
250 
251  ASCString text = msg.text;
252  while ( text.find ( "#crt#" ) != ASCString::npos )
253  text.replace ( text.find ("#crt#"), 5, " \n");
254 
255  re->SetText( text );
256  re->SetTransparency(255);
257  textViewer = re;
258 #else
259  TextRenderer* tr = new TextRenderer( this, PG_Rect(r.x + 2, r.y+2, r.w-4, r.h-4));
260  tr->SetText( msg.text );
261  textViewer = tr;
262 #endif
263  SetMessage( msg );
264  };
265 
266  void SetMessage( const Message& msg )
267  {
268  if ( &msg != message) {
269  PG_Application::BulkModeActivator bulk;
270  textViewer->SetText( msg.text );
271 
272  if ( from )
273  from->SetText( msg.getFromText( actmap ));
274 
275  if ( cc )
276  cc->SetText( msg.getCcText( actmap ));
277 
278  if ( to )
279  to->SetText( msg.getToText( actmap ));
280 
281 
282  bulk.disable();
283  Show();
284  message = &msg;
285  } else
286  Show();
287  };
288 
289 
290  void Hide (bool fade=false)
291  {
292  ASC_PG_Dialog::Hide(fade);
294  }
295 
296  bool eventKeyDown (const SDL_KeyboardEvent *key)
297  {
298  if ( key->keysym.sym == SDLK_ESCAPE ) {
299  quitModalLoop(10);
300  return true;
301  }
302  if ( key->keysym.sym == SDLK_RETURN || key->keysym.sym == SDLK_KP_ENTER ) {
303  quitModalLoop(11);
304  return true;
305  }
306  if ( key->keysym.sym == SDLK_SPACE ) {
307  quitModalLoop(12);
308  return true;
309  }
310 
311  int mod = SDL_GetModState() & ~(KMOD_NUM | KMOD_CAPS | KMOD_MODE);
312  if ( mod & KMOD_CTRL )
313  if ( key->keysym.sym == 's' )
314  textViewer->saveText( mod & KMOD_SHIFT );
315 
316 
317  return ASC_PG_Dialog::eventKeyDown( key );
318  };
319 
321  {
322  return keepMessage;
323  }
324 
326  {
327  displayLogMessage ( 9, "~IngameMessageViewer\n" );
328  }
329 
330 };
331 
332 
333 
334 
336 {
337  if ( Player::getHumanPlayerNum( actmap ) < 2 ) {
338  infoMessage( "nobody is listening to our transmissions");
339  return;
340  }
341 
342  // PG_LineEdit::SetBlinkingTime(-1);
343 
344  NewMessage nm ( actmap );
345  nm.Show();
346  nm.RunModal();
347 }
348 
350 {
351  NewMessage nm ( actmap, NULL, true );
352  nm.Show();
353  nm.RunModal();
354 }
355 
356 
357 
358 
360 {
361  Message* message;
362  ASCString msgtime;
363  GameMap* map;
364  public:
365  MessageLineWidget( PG_Widget* parent, const PG_Point& pos, int width, Message* msg, GameMap* gamemap );
366 
368  {
369  if ( message->from > 0 && message->from <= 255 )
370  return map->getPlayer(getFirstBit(message->from)).getName();
371  else
372  if ( message->from & ( 1 << 9 ))
373  return "system";
374  return "";
375  };
376 
377  Message* getMessage() const { return message; };
378 
379  protected:
380 
381  void display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst )
382  {
383  }
384  ;
385 };
386 
387 
388 
389 MessageLineWidget::MessageLineWidget( PG_Widget* parent, const PG_Point& pos, int width, Message* msg, GameMap* gamemap ) : SelectionWidget( parent, PG_Rect( pos.x, pos.y, width, 20 )), message( msg ), map(gamemap)
390 {
391 #ifndef ctime_r
392  msgtime = ctime( &msg->time);
393 #else
394 
395  char c[100];
396  ctime_r( &msg->time, c );
397  msgtime = c;
398 #endif
399 
400  int col1 = width * 3 / 10;
401  int col2 = col1 + width * 4 / 10;
402 
403 
404  PG_Label* lbl1 = new PG_Label( this, PG_Rect( 0, 0, col1 - 10, Height() ), getName() );
405  lbl1->SetFontSize( lbl1->GetFontSize() -2 );
406 
407  PG_Label* lbl2 = new PG_Label( this, PG_Rect( col1, 0, col2-col1-10, Height() ), msgtime );
408  lbl2->SetFontSize( lbl2->GetFontSize() -2 );
409 
410  int x = 0;
411  for ( int i = 0; i< gamemap->getPlayerCount(); ++i )
412  if ( msg->to & (1 << i)) {
413  new ColoredBar( gamemap->getPlayer(i).getColor(), this, PG_Rect( col2 + x, 0, 15 , 15 ));
414  x += 18;
415  }
416 
417  SetTransparency( 255 );
418 };
419 
420 
422  protected:
424  MessagePntrContainer::const_iterator it;
426 
427  public:
428  MessageListItemFactory( const MessagePntrContainer& messages, GameMap* g );
429 
430  void restart();
431 
432  SelectionWidget* spawnNextItem( PG_Widget* parent, const PG_Point& pos );
433 
434  void itemMarked( const SelectionWidget* widget );
435  void itemSelected( const SelectionWidget* widget, bool mouse );
436 
437  sigc::signal<void, Message* > messageSelected;
438 };
439 
440 
441 MessageListItemFactory::MessageListItemFactory( const MessagePntrContainer& messages, GameMap* map ) : messageContainer ( messages ), gamemap(map)
442 {
443  restart();
444 };
445 
446 
448 {
449  it = messageContainer.begin();
450 };
451 
452 SelectionWidget* MessageListItemFactory::spawnNextItem( PG_Widget* parent, const PG_Point& pos )
453 {
454  if ( it != messageContainer.end() )
455  return new MessageLineWidget( parent, pos, parent->Width() - 15, *(it++), gamemap );
456  else
457  return NULL;
458 };
459 
460 
462 {
463  if ( !widget )
464  return;
465 
466  const MessageLineWidget* mlw = dynamic_cast< const MessageLineWidget*>(widget);
467  assert( mlw );
468  messageSelected( mlw->getMessage() );
469 }
470 
471 void MessageListItemFactory::itemSelected( const SelectionWidget* widget, bool mouse )
472 {
473  if ( !widget )
474  return;
475 
476  const MessageLineWidget* fw = dynamic_cast<const MessageLineWidget*>(widget);
477  assert( fw );
478  messageSelected( fw->getMessage() );
479 }
480 
481 
482 
483 
485  private:
486  bool edit;
487 
488  bool viewerDeleted( const PG_MessageObject* obj )
489  {
490  if ( viewer == obj )
491  viewer = NULL;
492  return true;
493  };
494 
495  bool ProcessEvent ( const SDL_Event * event, bool bModal = false )
496  {
497  if ( ASC_PG_Dialog::ProcessEvent( event, bModal ) )
498  return true;
499 
500  if ( viewer )
501  if ( viewer->ProcessEvent( event, bModal ))
502  return true;
503 
504  return false;
505  };
506 
507  bool eventKeyDown(const SDL_KeyboardEvent* key)
508  {
509 
510  int mod = SDL_GetModState() & ~(KMOD_NUM | KMOD_CAPS | KMOD_MODE);
511  if ( mod & KMOD_CTRL )
512  if ( key->keysym.sym == 's' )
513  if ( viewer )
514  return viewer->eventKeyDown( key );
515 
516  return ASC_PG_Dialog::eventKeyDown(key);
517  }
518 
519 
520 
521  protected:
522  void messageSelected( Message* msg );
524 
525  public:
526  MessageSelectionWindow( PG_Widget *parent, const PG_Rect &r, const MessagePntrContainer& messages, GameMap* g, bool editable );
527 };
528 
530 {
531  if ( edit ) {
532  NewMessage nm ( actmap, msg );
533  nm.Show();
534  nm.RunModal();
535  } else {
536  if ( !viewer ) {
537  PG_Rect r ( my_xpos + Width(), my_ypos, min( PG_Application::GetScreenWidth()/2, 500), Height() );
538  viewer = new IngameMessageViewer( "Message", *msg, r );
539  viewer->Show();
540  viewer->sigDelete.connect( sigc::mem_fun( *this, &MessageSelectionWindow::viewerDeleted ));
541  } else
542  viewer->SetMessage( *msg );
543  }
544 };
545 
546 
547 MessageSelectionWindow::MessageSelectionWindow( PG_Widget *parent, const PG_Rect &r, const MessagePntrContainer& messages, GameMap* gamemap, bool editable )
548  : ASC_PG_Dialog( parent, r, "Messages" ), edit( editable), viewer(NULL)
549 {
550 
551  MessageListItemFactory* factory = new MessageListItemFactory( messages, gamemap );
552  factory->messageSelected.connect ( sigc::mem_fun( *this, &MessageSelectionWindow::messageSelected ));
553 
554  ItemSelectorWidget* isw = new ItemSelectorWidget( this, PG_Rect(10, GetTitlebarHeight(), r.Width() - 10, r.Height() - GetTitlebarHeight()), factory );
555  isw->sigQuitModal.connect( sigc::mem_fun( *this, &ItemSelectorWindow::QuitModal));
556 };
557 
558 
559 
560 
561 void viewmessages ( const char* title, const MessagePntrContainer& msg, bool editable ) // mode : 0 verschickte ; 1 empfangene
562 {
563  int ww = min( PG_Application::GetScreenWidth()/2, 500 );
564  PG_Rect r ( max(PG_Application::GetScreenWidth()/2,0) - ww, -1, ww, 500 );
565  MessageSelectionWindow msw ( NULL, r, msg, actmap, editable );
566  msw.Show();
567  msw.RunModal();
568 }
569 
570 
571 
572 bool viewmessage ( const Message& message )
573 {
575  if ( PG_Application::GetScreen()==NULL )
576  return false;
577 
578  assert( !legacyEventSystemActive() );
579  IngameMessageViewer igm( "incoming message...", message );
580  igm.Show();
581  igm.RunModal();
582  return igm.getKeepMessage();
583 }
584 
585 
586 
587 void checkJournal( Player& player )
588 {
589  GameMap* actmap = player.getParentMap();
590 
591  if ( actmap->lastjournalchange.abstime )
592  if ( (actmap->lastjournalchange.turn() == actmap->time.turn() ) ||
593  (actmap->lastjournalchange.turn() == actmap->time.turn()-1 && actmap->lastjournalchange.move() > actmap->actplayer ) )
594  viewjournal( false );
595 }
596 
597 void viewjournal ( bool showEmptyDlg )
598 {
599  if ( !actmap->gameJournal.empty() ) {
600  tviewanytext vat;
601  vat.init ( "journal", actmap->gameJournal.c_str() );
602  vat.run();
603  vat.done();
604  } else
605  if ( showEmptyDlg )
606  infoMessage("no entries to journal yet");
607 
608 }
609 
610 void editjournal ( void )
611 {
612  MultilineEdit ej ( actmap->newJournal, "Journal" );
613  ej.init ();
614  ej.run ();
615  if ( ej.changed() )
617  ej.done ();
618 }
619 
620 
621 void viewunreadmessages ( Player& player )
622 {
623 
629  static bool isRunning = false;
630  if ( isRunning )
631  return;
632 
633  VariableLocker l( isRunning );
634 
635  if( (player.stat == Player::human || player.stat == Player::supervisor) && player.getParentMap()->getPlayerView() == player.getPosition() ) {
636  MessagePntrContainer::iterator mi = player.unreadmessage.begin();
637  while ( mi != player.unreadmessage.end() ) {
638  Message* msg = *mi;
639  bool keep = viewmessage ( *msg );
640 
641  if ( keep )
642  ++mi;
643  else {
644  player.oldmessage.push_back ( *mi );
645  mi = player.unreadmessage.erase ( mi );
646  }
647  }
648  }
649 }
void init(const char *title, const char *text, int xx1=50, int yy1=50, int xxsize=360, int yysize=360)
Definition: dialog.cpp:920
MessageListItemFactory(const MessagePntrContainer &messages, GameMap *g)
Definition: messagedlg.cpp:441
void viewmessages(const char *title, const MessagePntrContainer &msg, bool editable)
Definition: messagedlg.cpp:561
ASCString getName() const
Definition: messagedlg.cpp:367
Player & getPlayer(PlayerID p)
Definition: gamemap.h:257
MapCoordinate & getCursor()
Definition: gamemap.cpp:933
map accessing and usage routines used by ASC and the mapeditor
void run(void)
Definition: dialog.cpp:2136
const MessagePntrContainer & messageContainer
Definition: messagedlg.cpp:423
void itemSelected(const SelectionWidget *widget, bool mouse)
Definition: messagedlg.cpp:471
bool valid() const
Definition: typen.h:221
IngameMessageViewer * viewer
Definition: messagedlg.cpp:523
Classes and Functions managing the in-game mails and the journal.
ASCString text
the body of the message
Definition: messages.h:51
int abstime
Definition: typen.h:183
int getPosition() const
Definition: player.h:112
NewMessage(GameMap *gamemap, Message *msg=NULL, bool reminder=false)
Definition: messagedlg.cpp:130
time_t time
the real world time the message was written
Definition: messages.h:48
const GameMap * getParentMap() const
Definition: player.h:114
ASCString getName() const
returns the name of the player
Definition: player.cpp:274
int getFirstBit(int zahl)
Count the number of zero bits on the LSB side of "zahl".
Definition: misc.cpp:45
MessageSelectionWindow(PG_Widget *parent, const PG_Rect &r, const MessagePntrContainer &messages, GameMap *g, bool editable)
Definition: messagedlg.cpp:547
MessagePntrContainer::const_iterator it
Definition: messagedlg.cpp:424
int turn() const
Definition: typen.h:181
int from
bitmapped variable showing the sender of the message. Bit 0 - 7 are the players, Bit 9 is the system...
Definition: messages.h:34
void Hide(bool fade=false)
Definition: messagedlg.cpp:290
sigc::signal< bool > sigQuitModal
virtual bool eventKeyDown(const SDL_KeyboardEvent *key)
Definition: paradialog.cpp:531
SelectionWidget * spawnNextItem(PG_Widget *parent, const PG_Point &pos)
Definition: messagedlg.cpp:452
MessagePntrContainer oldmessage
the list of messages that already have been read by the player yet
Definition: player.h:185
void itemMarked(const SelectionWidget *widget)
Definition: messagedlg.cpp:461
ASCString toString(bool coordinates=false) const
Definition: typen.cpp:304
Interface for some basic classes from which all of ASC's dialogs are derived.
GameTime lastjournalchange
Definition: gamemap.h:413
void display(SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst)
Definition: messagedlg.cpp:381
void viewunreadmessages(Player &player)
Definition: messagedlg.cpp:621
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
void Show(bool fade=false)
Definition: messagedlg.cpp:122
int to
bitmapped variable showing the recipients of the message.
Definition: messages.h:38
ASCString gameJournal
Definition: gamemap.h:365
ASCString getToText(const GameMap *gamemap) const
Definition: messages.h:38
int getPlayerView() const
the player which is currently viewing the map.
Definition: gamemap.cpp:1007
virtual void run(void)
Definition: dialog.cpp:1009
int move() const
Definition: typen.h:180
static ASCString toString(int i)
converts the parameter to a String
Definition: ascstring.cpp:193
void SetText(const std::string &text)
ASC_PG_App & getPGApplication()
Definition: paradialog.cpp:294
void done(void)
Definition: dlg_box.cpp:1235
void Show(bool fade=false)
int cc
bitmapped variable showing the recipients of the message.
Definition: messages.h:44
void setSelection(int s)
bool quitModalLoop(int value)
Definition: paradialog.cpp:545
enum Player::PlayerStatus stat
MessageLineWidget(PG_Widget *parent, const PG_Point &pos, int width, Message *msg, GameMap *gamemap)
Definition: messagedlg.cpp:389
void displayLogMessage(int msgVerbosity, const char *message,...)
Coordinate on the twodimensional map.
Definition: typen.h:202
Adapter class for using Paragui Dialogs in ASC. This class transfers the event control from ASC to Pa...
Definition: paradialog.h:127
Definition of THE central asc class: GameMap.
Dialog classes based on the Paragui library.
DI_Color getColor() const
Definition: player.cpp:249
signed char actplayer
the player who is currently making his moves (may be human or AI)
Definition: gamemap.h:232
IngameMessageViewer(const ASCString &title, const Message &msg, PG_Rect rect=PG_Rect(50, 50, 500, 400), bool autoHeader=true)
Definition: messagedlg.cpp:205
void newreminder()
Definition: messagedlg.cpp:349
bool changed()
Definition: dialog.h:191
list< Message * > MessagePntrContainer
Definition: messages.h:74
static int getHumanPlayerNum(const GameMap *gamemap)
Definition: player.cpp:285
void viewjournal(bool showEmptyDlg)
Definition: messagedlg.cpp:597
ASCString getCcText(const GameMap *gamemap) const
Definition: messages.h:37
sigc::signal< void, Message * > messageSelected
Definition: messagedlg.cpp:437
A Message to a player. It may either be send by another player or by the system.
Definition: messages.h:30
Interface for all the dialog boxes used by the game and the mapeditor.
vector< MapCoordinate > CoordinateList
Definition: fieldmarker.h:45
bool legacyEventSystemActive()
Definition: events.cpp:651
void editjournal(void)
Definition: messagedlg.cpp:610
void newmessage()
Definition: messagedlg.cpp:335
GameMap * actmap
Definition: spfst.cpp:64
Interface to the event handling of ASC.
void init(void)
Definition: dialog.cpp:2069
Message * getMessage() const
Definition: messagedlg.cpp:377
void saveText(bool stripFormatting)
MessagePntrContainer unsentmessage
the list of messages that were written this turn and are waiting to be processed at the end of the tu...
Definition: gamemap.h:350
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
bool reminder
reminders are special messages that the players sends to himself, to be read the next turn ...
Definition: messages.h:60
the different players in ASC. There may be 8 players (0..7) and neutral units (8) ...
Definition: player.h:99
void SetMessage(const Message &msg)
Definition: messagedlg.cpp:266
bool queueWidgetForDeletion(PG_Widget *widget)
Definition: paradialog.cpp:194
PG_Button * AddStandardButton(const ASCString &name)
Definition: paradialog.cpp:516
void checkJournal(Player &player)
Definition: messagedlg.cpp:587
int getPlayerCount() const
Definition: gamemap.h:255
void messageSelected(Message *msg)
Definition: messagedlg.cpp:529
ASCString getFromText(const GameMap *gamemap) const
Definition: messages.cpp:72
bool viewmessage(const Message &message)
Views the message.
Definition: messagedlg.cpp:572
GameTime time
the time in the game, mesured in a turns and moves
Definition: gamemap.h:235
void infoMessage(const ASCString &string)
bool eventKeyDown(const SDL_KeyboardEvent *key)
Definition: messagedlg.cpp:296
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
MessagePntrContainer unreadmessage
the list of messages that haven't been read by the player yet
Definition: player.h:181
ASCString newJournal
Definition: gamemap.h:366
void set(int turn, int move)
Definition: typen.h:183