BWAPI
SPAR/AIModule/SparAIModule/DecisionMaking/Layer2Actions/Layer2Actions.h
Go to the documentation of this file.
00001 #pragma once
00002 #include "../../../Utils/Utils.h"
00003 #include "../../PerceptualState/Common.h"
00004 #include "Interface/Common.h"
00005 #include <BWAPI.h>
00006 
00007 class Layer2ActionsBase
00008 {
00009 public:
00010   Layer2ActionsBase()
00011   {
00012     s_instance = this;
00013   }
00014 
00015   DECLARE_EVENT2(OnUnitIdle, BWAPI::Unit*, const layer2::GroupTacticalAction*); // The unit released and the previous action
00016   OnUnitIdle& getUnitIdleEvent() const { return m_unitIdleEvent; }
00017 
00018   static Layer2ActionsBase& getInstance()
00019   {
00020     return *s_instance;
00021   }
00022 
00023 private:
00024   static Layer2ActionsBase* s_instance;
00025 
00026   EVENT(OnUnitIdle) m_unitIdleEvent;
00027 };
00028 
00029 template <class Layer2Cueing, class Layer1Reactive>
00030 class Layer2Actions : public Layer2ActionsBase, public Component
00031 {
00032 public:
00033   //
00034   // Default location types matching
00035   //
00036   template <class LocationType>
00037   struct LocationTypes {};
00038   template <>
00039   struct LocationTypes<AirLocation> {
00040     typedef empty<Layer2Actions> Type;
00041   };
00042   template <>
00043   struct LocationTypes<BaseLocation> {
00044     typedef empty<Layer2Actions> Type;
00045   };
00046   template <>
00047   struct LocationTypes<Chokepoint> {
00048     typedef empty<Layer2Actions> Type;
00049   };
00050   template <>
00051   struct LocationTypes<Region> {
00052     typedef empty<Layer2Actions> Type;
00053   };
00054   template <>
00055   struct LocationTypes<RegionLocation> {
00056     typedef empty<Layer2Actions> Type;
00057   };
00058   template <>
00059   struct LocationTypes<Map> {
00060     typedef empty<Layer2Actions> Type;
00061   };
00062 
00063   typedef Layer2UnitData L2UnitData;
00064 
00065   Layer2Actions(Layer2Cueing& layer2Cueing, Layer1Reactive& layer1Reactive)
00066     : m_layer2Cueing(layer2Cueing)
00067     , m_layer1Reactive(layer1Reactive)
00068   {
00069   }
00070 
00071   void onStart() {}
00072   void onFrame() {}
00073   void onEnd() {}
00074   void onSendText(std::string text) {}
00075 
00076 protected:
00077   Layer2Cueing& m_layer2Cueing;
00078   Layer1Reactive& m_layer1Reactive;
00079 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines