00001 // 00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH) 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 // 00018 00024 #ifndef __SIMPLEGAMECLIENT_H_ 00025 #define __SIMPLEGAMECLIENT_H_ 00026 00027 #include <map> 00028 #include <Vector2D.h> 00029 #include <BaseApp.h> 00030 #include <string> 00031 00032 #include <GlobalCoordinator.h> 00033 #include <MovementGenerator.h> 00034 #include <randomRoaming.h> 00035 #include <groupRoaming.h> 00036 #include <greatGathering.h> 00037 #include <realWorldRoaming.h> 00038 #include "SCPacket.h" 00039 #include "SimpleGameClient_m.h" 00040 00041 #include <tunoutscheduler.h> 00042 #include <realtimescheduler.h> 00043 00045 00049 class SimpleGameClient : public BaseApp 00050 { 00051 public: 00052 // OMNeT++ 00053 virtual ~SimpleGameClient(); 00054 virtual void initializeApp(int stage); 00055 virtual void handleTimerEvent(cMessage* msg); 00056 virtual void handleLowerMessage(cMessage* msg); 00057 virtual void handleReadyMessage(CompReadyMessage* msg); 00058 00059 protected: 00060 GlobalCoordinator* coordinator; 00061 CollisionList CollisionRect; 00062 00063 void updateNeighbors(GameAPIListMessage* sgcMsg); 00064 void updatePosition(); 00065 00066 // parameters 00067 simtime_t movementDelay; 00068 double areaDimension, movementSpeed, movementRate, AOIWidth; 00069 bool useScenery; 00070 bool overlayReady; 00071 Vector2D position; 00072 MovementGenerator *Generator; 00073 00074 NeighborMap Neighbors; 00075 NeighborMap::iterator itNeighbors; 00076 std::string GeneratorType; 00077 00078 timeval startTime; 00079 00080 // timers 00081 cMessage* move_timer; 00082 00083 // realworld 00084 void handleRealworldPacket(char *buf, uint32_t len); 00085 cMessage* packetNotification; // used by TunOutScheduler to notify about new packets 00086 RealtimeScheduler::PacketBuffer packetBuffer; // received packets are stored here 00087 RealtimeScheduler* scheduler; 00088 unsigned int mtu; 00089 SOCKET appFd; 00090 bool doRealworld; 00091 bool frozen; 00092 }; 00093 00094 #endif
1.5.5