mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
Merge pull request #175 from devZoGok/bf-172-wrong-orders
garrison order validation
This commit is contained in:
@@ -690,7 +690,7 @@ namespace battleship{
|
||||
case Order::TYPE::MOVE:
|
||||
return vehicle;
|
||||
case Order::TYPE::GARRISON:
|
||||
return true;
|
||||
return validateGarrisonOrder(order);
|
||||
case Order::TYPE::EJECT:
|
||||
return !garrisonSlots.empty();
|
||||
case Order::TYPE::LAUNCH:
|
||||
|
||||
@@ -164,6 +164,7 @@ namespace battleship{
|
||||
void updateScreenCoordinates();
|
||||
void initWeapons();
|
||||
void destroyWeapons();
|
||||
bool validateOrder(Order);
|
||||
inline bool canDisplayOrderLine(){return vb01::getTime() - orderLineDispTime < orderVecDispLength;}
|
||||
|
||||
const int orderVecDispLength = 2000, DEATH_HP = 0;
|
||||
@@ -187,7 +188,7 @@ namespace battleship{
|
||||
|
||||
std::vector<Player*> getSelectingPlayers();
|
||||
void removeOrder(int);
|
||||
bool validateOrder(Order);
|
||||
virtual bool validateGarrisonOrder(Order){return false;}
|
||||
virtual void targetUnitsAutomatically();
|
||||
virtual void reinit();
|
||||
virtual void initProperties();
|
||||
|
||||
+10
@@ -46,6 +46,16 @@ namespace battleship{
|
||||
pursuingTarget = false;
|
||||
}
|
||||
|
||||
bool Vehicle::validateGarrisonOrder(Order order){
|
||||
Unit *targUnit = order.targets[0].unit;
|
||||
|
||||
for(GarrisonSlot slot : targUnit->getGarrisonSlots())
|
||||
if(!slot.vehicle && slot.category >= garrisonCategory)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Vehicle::receiveOrder(Order order, bool add){
|
||||
if(!(order.type == Order::TYPE::EJECT || order.type == Order::TYPE::LAUNCH)){
|
||||
Order::Target targ = order.targets[0];
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace battleship{
|
||||
std::vector<vb01::Node*> debugPathPoints;
|
||||
|
||||
inline int getNextPatrolPointId(int numPoints) {return patrolPointId == numPoints - 1 ? 0 : patrolPointId + 1;}
|
||||
bool validateGarrisonOrder(Order);
|
||||
void enterGarrisonable();
|
||||
void halt();
|
||||
void turn(float);
|
||||
|
||||
Reference in New Issue
Block a user