00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef GAME_EVENTS_H_INCLUDED
00015 #define GAME_EVENTS_H_INCLUDED
00016
00017 #include "config.hpp"
00018 #include "map.hpp"
00019 #include "soundsource.hpp"
00020 #include "variable.hpp"
00021 #include "unit_map.hpp"
00022
00023 #include <vector>
00024 #include <map>
00025
00026 class game_display;
00027 class game_state;
00028 class gamestatus;
00029 class team;
00030 class t_string;
00031 class unit;
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 namespace game_events
00046 {
00047
00048
00049
00050
00051
00052
00053 struct manager {
00054
00055
00056 manager(const config& scenario_cfg, game_display& disp, gamemap& map,
00057 soundsource::manager& sndsources, unit_map& units, std::vector<team>& teams,
00058 game_state& state_of_game, gamestatus& status);
00059 ~manager();
00060
00061 variable::manager variable_manager;
00062 };
00063
00064 struct entity_location : public gamemap::location {
00065 entity_location(gamemap::location loc, const std::string& id="");
00066 explicit entity_location(unit_map::iterator itor);
00067 bool requires_unit() const;
00068 bool matches_unit(const unit& u) const;
00069 private:
00070 std::string id_;
00071 };
00072
00073 game_state* get_state_of_game();
00074 void write_events(config& cfg);
00075 void add_events(const config::child_list& cfgs,const std::string& id);
00076
00077 bool unit_matches_filter(unit_map::const_iterator itor, const vconfig filter);
00078
00079
00080
00081 bool fire(const std::string& event,
00082 const entity_location& loc1=gamemap::location::null_location,
00083 const entity_location& loc2=gamemap::location::null_location,
00084 const config& data=config());
00085
00086 void raise(const std::string& event,
00087 const entity_location& loc1=gamemap::location::null_location,
00088 const entity_location& loc2=gamemap::location::null_location,
00089 const config& data=config());
00090
00091 bool conditional_passed(const unit_map* units,
00092 const vconfig cond, bool backwards_compat=true);
00093 bool pump();
00094
00095
00096 Uint32 mutations();
00097
00098 }
00099
00100 #endif