This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
rc2007-soccer/source/Concept/Framework/modules/logic/logic.h

92 lines
1.5 KiB
C
Raw Normal View History

2007-02-22 21:22:02 +00:00
#ifndef _LOGIC_H
#define _LOGIC_H
#include "../../stdafx.h"
class Logic : public IO_Module
{
public:
Logic()
{
this->parent = NULL;
this->moduleId = 0;
this->isKeeper = false;
this->status = 0;
2007-02-26 21:25:01 +00:00
this->hasBall = false;
this->avoidsObstacle = false;
2007-02-22 21:22:02 +00:00
}
Logic(uint32 logicId)
{
this->parent = NULL;
this->moduleId = logicId;
this->isKeeper = false;
this->status = 0;
2007-02-26 21:25:01 +00:00
this->hasBall = false;
this->avoidsObstacle = false;
2007-02-22 21:22:02 +00:00
}
protected:
bool isKeeper;
uint8 status;
2007-02-26 21:25:01 +00:00
bool hasBall;
bool avoidsObstacle;
2007-02-22 21:22:02 +00:00
2007-02-22 23:04:02 +00:00
enum LogicalStatus
{
STATUS_KEEPER_TURN_RIGHT,
STATUS_KEEPER_TURN_LEFT,
2007-02-26 21:25:01 +00:00
STATUS_KEEPER_RETURN_HOME,
STATUS_KEEPER_HUNT_BALL,
STATUS_KEEPER_TURN_TO_BALL,
STATUS_KEEPER_DRIVE_TO_DEFEND,
STATUS_ATTACKER_TURN_TO_BALL,
STATUS_ATTACKER_DRIVE_TO_BALL,
STATUS_ATTACKER_SEARCHING_AT_HOME,
STATUS_ATTACKER_SEARCHING_AT_ENEMY,
2007-02-22 23:04:02 +00:00
};
2007-02-22 21:22:02 +00:00
void OnBallOwned();
void OnBallLost();
2007-02-22 23:04:02 +00:00
void OnBecomeKeeper();
void OnBecomeAttacker();
2007-02-22 21:22:02 +00:00
public:
void Update();
bool IsKeeper()
{
return isKeeper;
}
bool IsAttacker()
{
return !isKeeper;
}
2007-02-26 21:25:01 +00:00
void SetKeeper(bool newStatus)
{
2007-02-22 23:04:02 +00:00
if(!this->isKeeper && newStatus)
{
this->OnBecomeKeeper();
}
else if(this->isKeeper && !newStatus)
{
this->OnBecomeAttacker();
}
2007-02-22 21:22:02 +00:00
this->isKeeper = newStatus;
}
bool HasBall()
{
2007-02-26 21:25:01 +00:00
return this->hasBall;
2007-02-22 21:22:02 +00:00
}
2007-02-26 21:25:01 +00:00
void UpdateKeeperMovement();
void UpdateAttackerMovement();
2007-02-22 21:22:02 +00:00
};
#endif