naval transports disembark troops on the other side of the sea

bugfix for selecting garrisoned units
bugfix for selecting cell id with depth check
This commit is contained in:
devZoGok
2026-03-15 15:21:11 +02:00
parent 63ad44b3b8
commit 27d1cdbe0c
9 changed files with 103 additions and 24 deletions
+12 -2
View File
@@ -4,6 +4,7 @@
#include "player.h"
#include "game.h"
#include "structure.h"
#include "vehicle.h"
#include "projectile.h"
#include "tradeOffer.h"
#include "destructable.h"
@@ -71,6 +72,11 @@ namespace battleship{
}
}
void Player::haltUnits(){
for (Unit *u : selectedUnits)
u->halt();
}
int Player::getOrderLineId(Order::TYPE type, Vector3 startPos, Vector3 endPos){
Vector3 color;
@@ -169,11 +175,15 @@ namespace battleship{
}
void Player::selectUnits(vector<Unit*> selUnits){
for(Unit *u : selUnits)
if(find(selectedUnits.begin(), selectedUnits.end(), u) == selectedUnits.end()){
for(Unit *u : selUnits){
bool garrisonable = (!u->isVehicle() || (u->isVehicle() && !((Vehicle*)u)->getGarrisonable()));
bool selected = (find(selectedUnits.begin(), selectedUnits.end(), u) != selectedUnits.end());
if(garrisonable && !selected){
selectedUnits.push_back(u);
u->select();
}
}
}
vector<Unit*> Player::getUnitsById(int id, int numUnits){