netAspect.h

Go to the documentation of this file.
00001 /*
00002  * netAspect.h
00003  *
00004  */
00005 
00006 #ifndef NETASPECT_H_
00007 #define NETASPECT_H_
00008 
00009 #include <messages.h>
00010 #include <aspect.h>
00011 #include <OgreVector3.h>
00012 #include <OgreQuaternion.h>
00013 #include <utils.h>
00014 
00015 namespace FastEcslent {
00016         class Entity;
00017 
00018         class NetAspect : public UnitAspect {
00019                 private:
00020                         int id;
00021 
00022                         Ogre::Vector3 remoteVel;
00023                         Ogre::Vector3 remotePos;
00024                         Ogre::Vector3 nextRemotePos;
00025                         Ogre::Vector3 nextPos;
00026                         Ogre::Vector3 diffPos;
00027                         Ogre::Vector3 diffPosFrac;
00028 
00029                         Ogre::Quaternion remoteQuat;
00030                         Ogre::Quaternion destOrie;
00031                         Ogre::Quaternion srcOrie;
00032                         Ogre::Quaternion finalDestOrie;
00033                         float rotFactor;
00034                         float rotProgress;
00035 
00036                         int oldTime;
00037                         float latency;
00038                         float nSteps;
00039 
00040                         Ogre::Quaternion qDelta;
00041                         float deltaYaw;
00042 
00043                         bool firstTick;
00044 
00045                         State statusData;
00046 
00047                         int pendingEntityId;
00048 
00049                         void initNetworking();
00050                         void updateServer(float newDS, float newDH);
00051                     bool withinSpeedTolerance(float a, float b);
00052                     bool withinHeadingTolerance(float a, float b);
00053                     void squalchOtherClients();
00054                     bool isValid(State *state);
00055                     void clearQueue(std::deque<State*> * queue, int size);
00056                     void setEntityBeingBuilt(Entity * ent);
00057                     bool checkPendingEntityId();
00058                     void requestMineralPatchID();
00059                 protected:
00060 
00061                 public:
00062                     NetAspect (Entity* ent, UnitAspectType at): UnitAspect(ent, at) {};
00063 
00064                         void init();
00065                         void tick(double dt);
00066                         void lerpPos();
00067                         void lerpRot();
00068                         void updateEcslent(double dt);
00069                         void createEntity(EntityType entType, Ogre::Vector3 pos);
00070                         void squalch();
00071 
00072                         void setEntityBeingBuilt(int entID);
00073 
00074                         float ds;
00075                         float dh;
00076 
00077                         float SPEED_TOLERANCE;
00078                         float HEADING_TOLERANCE;
00079 
00080                         std::deque<State *> updateQueue;
00081         };
00082 
00083 }
00084 
00085 #endif /* NETASPECT_H_ */

Generated on Fri Dec 13 14:54:16 2013 for FastECSLent by  doxygen 1.5.4