~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/ai/api/ai_event.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: ai_event.hpp 15684 2009-03-12 11:43:40Z yexo $ */
 
2
 
 
3
/** @file ai_event.hpp Everything to handle events from the game. */
 
4
 
 
5
#ifndef AI_EVENT_HPP
 
6
#define AI_EVENT_HPP
 
7
 
 
8
#include "ai_object.hpp"
 
9
 
 
10
/**
 
11
 * Class that handles all event related functions.
 
12
 * You can lookup the type, and than convert it to the real event-class.
 
13
 * That way you can request more detailed information about the event.
 
14
 */
 
15
class AIEvent : public AIObject {
 
16
public:
 
17
        static const char *GetClassName() { return "AIEvent"; }
 
18
 
 
19
        /**
 
20
         * The type of event. Needed to lookup the detailed class.
 
21
         */
 
22
        enum AIEventType {
 
23
                AI_ET_INVALID = 0,
 
24
                AI_ET_TEST,
 
25
                AI_ET_SUBSIDY_OFFER,
 
26
                AI_ET_SUBSIDY_OFFER_EXPIRED,
 
27
                AI_ET_SUBSIDY_AWARDED,
 
28
                AI_ET_SUBSIDY_EXPIRED,
 
29
                AI_ET_ENGINE_PREVIEW,
 
30
                AI_ET_COMPANY_NEW,
 
31
                AI_ET_COMPANY_IN_TROUBLE,
 
32
                AI_ET_COMPANY_MERGER,
 
33
                AI_ET_COMPANY_BANKRUPT,
 
34
                AI_ET_VEHICLE_CRASHED,
 
35
                AI_ET_VEHICLE_LOST,
 
36
                AI_ET_VEHICLE_WAITING_IN_DEPOT,
 
37
                AI_ET_VEHICLE_UNPROFITABLE,
 
38
                AI_ET_INDUSTRY_OPEN,
 
39
                AI_ET_INDUSTRY_CLOSE,
 
40
                AI_ET_ENGINE_AVAILABLE,
 
41
                AI_ET_STATION_FIRST_VEHICLE,
 
42
                AI_ET_DISASTER_ZEPPELINER_CRASHED,
 
43
                AI_ET_DISASTER_ZEPPELINER_CLEARED,
 
44
        };
 
45
 
 
46
        /**
 
47
         * Constructor of AIEvent, to get the type of event.
 
48
         */
 
49
        AIEvent(AIEvent::AIEventType type) :
 
50
                type(type)
 
51
        {}
 
52
 
 
53
        /**
 
54
         * Get the event-type.
 
55
         * @return The @c AIEventType.
 
56
         */
 
57
        AIEventType GetEventType() { return this->type; }
 
58
 
 
59
protected:
 
60
        /**
 
61
         * The type of this event.
 
62
         */
 
63
        AIEventType type;
 
64
};
 
65
 
 
66
/**
 
67
 * Class that handles all event related functions.
 
68
 * @note it is not needed to create an instance of AIEvent to access it, as
 
69
 *  all members are static, and all data is stored AI-wide.
 
70
 */
 
71
class AIEventController : public AIObject {
 
72
public:
 
73
        /**
 
74
         * The name of the class, needed by several sub-processes.
 
75
         */
 
76
        static const char *GetClassName() { return "AIEventController"; }
 
77
 
 
78
        /**
 
79
         * Check if there is an event waiting.
 
80
         * @return true if there is an event on the stack.
 
81
         */
 
82
        static bool IsEventWaiting();
 
83
 
 
84
        /**
 
85
         * Get the next event.
 
86
         * @return a class of the event-child issues.
 
87
         */
 
88
        static AIEvent *GetNextEvent();
 
89
 
 
90
#ifndef EXPORT_SKIP
 
91
        /**
 
92
         * Insert an event to the queue for the company.
 
93
         * @param event The event to insert.
 
94
         * @note DO NOT CALL YOURSELF; leave it to the internal AI programming.
 
95
         */
 
96
        static void InsertEvent(AIEvent *event);
 
97
 
 
98
        /**
 
99
         * Free the event pointer.
 
100
         * @note DO NOT CALL YOURSELF; leave it to the internal AI programming.
 
101
         */
 
102
        static void FreeEventPointer();
 
103
#endif /* EXPORT_SKIP */
 
104
 
 
105
private:
 
106
        /**
 
107
         * Create the event pointer.
 
108
         */
 
109
        static void CreateEventPointer();
 
110
};
 
111
 
 
112
#endif /* AI_EVENT_HPP */