mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
fixed destroyed unit deselection
rovers have greater distance allowance to load resources from structures temporarily removed patroling
This commit is contained in:
@@ -825,10 +825,12 @@ namespace battleship{
|
||||
}
|
||||
break;
|
||||
case Bind::SELECT_PATROL_POINTS:
|
||||
/*
|
||||
if(isPressed && mainPlayer->getNumSelectedUnits() > 0){
|
||||
targets.push_back(Order::Target(nullptr, mainPlayer->getSelectedUnit(0)->getPos()));
|
||||
selectingPatrolPoints = isPressed;
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
case Bind::GROUP_0:
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace battleship{
|
||||
void GameObject::destroyHitbox(){
|
||||
model->dettachChild(hitbox);
|
||||
delete hitbox;
|
||||
hitbox = nullptr;
|
||||
}
|
||||
|
||||
//TODO use a vector for the color nodes
|
||||
|
||||
+11
@@ -142,6 +142,9 @@ namespace battleship{
|
||||
}
|
||||
|
||||
void Player::removeUnit(int id){
|
||||
if(find(selectedUnits.begin(), selectedUnits.end(), units[id]) != selectedUnits.end())
|
||||
deselectUnit(units[id]);
|
||||
|
||||
delete units[id];
|
||||
units.erase(units.begin() + id);
|
||||
}
|
||||
@@ -244,4 +247,12 @@ namespace battleship{
|
||||
|
||||
return vector<TradeOffer*>{};
|
||||
}
|
||||
|
||||
void Player::deselectUnit(Unit *unit){
|
||||
for(int i = 0; i < selectedUnits.size(); i++)
|
||||
if(selectedUnits[i] == unit){
|
||||
selectedUnits.erase(selectedUnits.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace battleship{
|
||||
void updateTradedResource(Player*, ResourceType, int, bool, bool);
|
||||
void addTradeOffer(Player*, TradeOffer*);
|
||||
std::vector<TradeOffer*> getTradeOffers(Player*);
|
||||
void deselectUnit(Unit*);
|
||||
inline int getResource(ResourceType rt){return resources[(int)rt];}
|
||||
inline void updateResource(ResourceType rt, int amount, bool add){resources[(int)rt] = (add ? resources[(int)rt] + amount : amount);}
|
||||
inline Trader* getTrader(){return trader;}
|
||||
|
||||
+3
-1
@@ -37,8 +37,10 @@ namespace battleship{
|
||||
loadRate = unitTable["loadRate"]; loadRate += game->calcAbilFromTech(Ability::Type::LOAD_RATE, currTechs, (int)GameObject::type, id);
|
||||
}
|
||||
|
||||
//TODO implement a check of whether a vehicle is next to a building's outline
|
||||
void ResourceRover::loadResources(Structure *targStruct, float minDist, bool loadResource){
|
||||
bool closeEnough = (pos.getDistanceFrom(targStruct->getPos()) <= minDist);
|
||||
float w = targStruct->getWidth(), l = targStruct->getLength();
|
||||
bool closeEnough = (pos.getDistanceFrom(targStruct->getPos()) <= sqrt(l * l + w * w));
|
||||
if(!closeEnough) return;
|
||||
|
||||
ResourceType resType;
|
||||
|
||||
Reference in New Issue
Block a user