📄 player.h
字号:
/* * Copyright 2002-2005, Mersad Team, Allameh Helli High School (NODET). * * This program is free software, you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * This file is created by: Ahmad Boorghany * * Released on Monday 1 August 2005, 10 Mordad 1384 by Mersad RoboCup Team. * For more information please read README file.*/#ifndef __PLAYER_H#define __PLAYER_H#include <Ball.h>#include <Types.h>#include <Object.h>#include <Types.h>#ifndef NULL# define NULL 0#endif // NULL#define APVR_RADIUS 7.5#define PLAYER_VALID_POS_DEV 8#define PLAYER_ALIVE_POS_DEV 15enum PlayerModel{ PLM_QUARTER = 0, PLM_HALF = 1, PLM_FULL = 2};class Body;class ConfigGroup;typedef ConfigGroup Param;class Player: public Object{protected: bool goalieFlag; bool tacklingFlag; float stamina; float bodyDir; float headDir; float pointingDir; float relativeBodyDir; float relativeHeadDir; float relativePointingDir; unsigned type; unsigned uniNum; unsigned postNum; TeamId teamId; PlayerModel model; unsigned lastAPVRTime; unsigned lastAPDRTime; Vector lastAPVRPosition; Vector lastAPDRVelocity; unsigned dashExpires; // Heterogeneous items float staminaIncMax; float inertiaMoment; float dashPowerRate; float kickableMargin; float kickRand; float extraStamina; float effortMax; float effortMin; // Local serverparams float staminaMax; float effortDecThr; float recoverDecThr; float maxNeckAng; float minNeckAng; float maxNeckMoment; float minNeckMoment; float catchableAreaL; float catchableAreaW; void executeAPVR(const Body &body); void executeAPDR(const Body &body);public: Player(PlayerModel model = PLM_FULL); virtual ~Player(); void virtualUpdate(const Body &body); void simulateByDynamics(const Body &body); void update(const Body &body, PlayMode playMode = PM_PLAY_ON); void parse(TeamId teamIdArg, unsigned uniNumArg, bool isGoalie, const SExpression &exp, unsigned curTime); void updateByHear(float x, float y, float velMag, float velDir, const Body &body); void updateByRadar(float magnitude, float direction, const Body &body, const Ball &ball); virtual void setServerParamVars(const Param &serverParam); bool isBody() const; bool canBodySee(const Vector &playerPos, float viewAngle, float visibleDist) const; void setByAnotherPlayer(const Player &player, const Body &body); bool isAlive() const; bool isValid() const; static unsigned uniNumToPostNum(unsigned uniNum); static unsigned postNumToUniNum(unsigned postNum); // Heterogeneous functions void setType(int typeArg, const Param &playerType); float getStaminaIncMax() const; float getInertiaMoment() const; float getDashPowerRate() const; float getKickableMargin() const; float getKickRand() const; float getExtraStamina() const; float getEffortMax() const; float getEffortMin() const; // Getting functions bool isGoalie() const; bool isTackling() const; float getStamina() const; float getBodyDir() const; float getHeadDir() const; float getPointingDir() const; float getRelativeBodyDir() const; float getRelativeHeadDir() const; float getRelativePointingDir() const; unsigned getType() const; unsigned getUniNum() const; unsigned getPostNum() const; unsigned getDashExpires() const; TeamId getTeamId() const; PlayerModel getModel() const; float getStaminaMax() const; float getEffortDecThr() const; float getRecoverDecThr() const; float getMaxNeckAng() const; float getMinNeckAng() const; float getMaxNeckMoment() const; float getMinNeckMoment() const; float getCatchableAreaL() const; float getCatchableAreaW() const; // Setting functions void setGoalie(bool goalieFlagArg); void setTackling(bool tacklingFlagArg); void setBodyDir(float bodyDirArg); void setHeadDir(float headDirArg); void setPointingDir(float pointingDirArg); void setRelativeBodyDir(float relativeBodyDirArg); void setRelativeHeadDir(float relativeHeadDirArg); void setRelativePointingDir(float relativePointingDirArg); void setType(unsigned typeArg); void setUniNum(unsigned uniNumArg); void setTeamId(TeamId teamIdArg); void setModel(PlayerModel modelArg); void parseFullState(TeamId teamIdArg, unsigned uniNumArg, bool isGoalieArg, const SExpression &exp, unsigned curTime);};#endif // __PLAYER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -