File: messages.h

package info (click to toggle)
asc 2.4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 75,080 kB
  • ctags: 24,943
  • sloc: cpp: 155,023; sh: 8,829; ansic: 6,890; makefile: 650; perl: 138
file content (78 lines) | stat: -rw-r--r-- 2,883 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/***************************************************************************
                          messages.h  -  description
                             -------------------
    begin                : Thu Feb 21 2002
    copyright            : (C) 2002 by Martin Bickel
    email                : bickel@asc-hq.org
 ***************************************************************************/
/*! \file messages.h
    \brief Classes and Functions managing the in-game mails and the journal
*/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef messages_h_included
 #define messages_h_included

 #include "typen.h"

class GameMap;

//! A Message to a player. It may either be send by another player or by the system.
class  Message {
     ASCString bitMap2PlayerName( int p, const GameMap* gamemap  ) const;
   public:
     //! bitmapped variable showing the sender of the message. Bit 0 - 7 are the players, Bit 9 is the system.
     int from;

     ASCString getFromText( const GameMap* gamemap ) const;
     ASCString getCcText( const GameMap* gamemap ) const { return bitMap2PlayerName( cc, gamemap ); };
     ASCString getToText( const GameMap* gamemap ) const { return bitMap2PlayerName( to, gamemap ); };
     
     //! bitmapped variable showing the recipients of the message.
     int to;

     //! bitmapped variable showing the recipients of the message.
     int cc;


     //! the real world time the message was written
     time_t time;

     //! the body of the message
     ASCString text;

     //! an id that identifies the message. It is assigned automatically
     int id;

     //! the game time the messages was written
     GameTime gametime;
     
     //! reminders are special messages that the players sends to himself, to be read the next turn
     bool reminder;

     Message ( GameMap* spfld );

     /** Constructor.
         \param msg      The message text
         \param gamemap  The map that this message is currently being played
         \param rec      The receipient. Bitmapped: each bit one player
         \param from     The sender. Bitmapped too! 512 = system
     */
     Message ( const ASCString& msg, GameMap* gamemap,int rec, int from = 512 );
};

typedef PointerList<Message*> MessageContainer;
typedef list<Message*> MessagePntrContainer;



#endif