mirror of
https://github.com/glest/glest-source.git
synced 2025-10-04 11:21:36 +02:00
- attempt to improve harvesting a bit
This commit is contained in:
@@ -832,15 +832,21 @@ void UnitUpdater::updateHarvest(Unit *unit, int frameIndex) {
|
||||
switch(this->game->getGameSettings()->getPathFinderType()) {
|
||||
case pfBasic:
|
||||
{
|
||||
const bool newHarvestPath = true;
|
||||
bool isNearResource = false;
|
||||
Vec2i clickPos = command->getOriginalPos();
|
||||
bool isNearResource = map->isResourceNear(unit->getPos(), r->getType(), targetPos,unit->getType()->getSize(),unit, false,&clickPos);
|
||||
//bool isNearResource = map->isResourceNear(unit->getPos(), r->getType(), targetPos,unit->getType()->getSize(),unit);
|
||||
if(newHarvestPath == true) {
|
||||
isNearResource = map->isResourceNear(unit->getPos(), r->getType(), targetPos,unit->getType()->getSize(),unit, false,&clickPos);
|
||||
}
|
||||
else {
|
||||
isNearResource = map->isResourceNear(unit->getPos(), r->getType(), targetPos,unit->getType()->getSize(),unit);
|
||||
}
|
||||
if(isNearResource == true) {
|
||||
if((unit->getPos().dist(command->getPos()) < harvestDistance || unit->getPos().dist(targetPos) < harvestDistance) && isNearResource == true) {
|
||||
canHarvestDestPos = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if(newHarvestPath == true) {
|
||||
if(clickPos != command->getOriginalPos()) {
|
||||
//printf("%%----------- unit [%s - %d] CHANGING RESOURCE POS from [%s] to [%s]\n",unit->getFullName().c_str(),unit->getId(),command->getOriginalPos().getString().c_str(),clickPos.getString().c_str());
|
||||
|
||||
|
Reference in New Issue
Block a user