@@ -10180,6 +10180,18 @@ if (g_UT_startTiming) return false;
1018010180 continue ;
1018110181 }
1018210182
10183+ #if !(RTS_GENERALS && RETAIL_COMPATIBLE_PATHFINDING)
10184+ if (otherObj->getAI ()->isAttacking ()) {
10185+ continue ; // Don't move units that are attacking. [8/14/2003]
10186+ }
10187+
10188+ // Kris: Patch 1.01 November 3, 2003
10189+ // Black Lotus exploit fix -- moving while hacking.
10190+ if ( otherObj->testStatus ( OBJECT_STATUS_IS_USING_ABILITY ) || otherObj->getAI ()->isBusy () ) {
10191+ continue ; // Packing or unpacking objects for example
10192+ }
10193+ #endif
10194+
1018310195 // DEBUG_LOG(("Moving ally"));
1018410196 otherObj->getAI ()->aiMoveAwayFromUnit (obj, CMD_FROM_AI );
1018510197 }
@@ -10820,6 +10832,68 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
1082010832 if (show)
1082110833 debugShowSearch (true );
1082210834
10835+ #if !(RTS_GENERALS && RETAIL_COMPATIBLE_PATHFINDING)
10836+ // put parent cell onto closed list - its evaluation is finished
10837+ parentCell->putOnClosedList ( m_closedList );
10838+
10839+ if (obj->isKindOf (KINDOF_VEHICLE )) {
10840+ // Strip backwards.
10841+ PathfindCell *lastBlocked = nullptr ;
10842+ PathfindCell *cur = parentCell;
10843+ Bool useLargeRadius = false ;
10844+ Int cellLimit = 12 ; // Magic number, yes I know - jba. It is about 4 * size of an average vehicle width (3 cells) [8/15/2003]
10845+ while (cur) {
10846+ cellLimit--;
10847+ if (cellLimit<0 ) {
10848+ break ;
10849+ }
10850+ TCheckMovementInfo info;
10851+ info.cell .x = cur->getXIndex ();
10852+ info.cell .y = cur->getYIndex ();
10853+ info.layer = cur->getLayer ();
10854+ if (useLargeRadius) {
10855+ info.centerInCell = centerInCell;
10856+ info.radius = radius;
10857+ } else {
10858+ info.centerInCell = true ;
10859+ info.radius = 0 ;
10860+ }
10861+ info.considerTransient = false ;
10862+ info.acceptableSurfaces = locomotorSet.getValidSurfaces ();
10863+ PathfindCell *cell = getCell (info.layer ,info.cell .x ,info.cell .y );
10864+ Bool unitIdle = false ;
10865+ if (cell) {
10866+ ObjectID posUnit = cell->getPosUnit ();
10867+ Object *unit = TheGameLogic->findObjectByID (posUnit);
10868+ if (unit && unit->getAI () && unit->getAI ()->isIdle ()) {
10869+ unitIdle = true ;
10870+ }
10871+ }
10872+ Bool checkMovement = checkForMovement (obj, info);
10873+ Bool blockedByEnemy = info.enemyFixed ;
10874+ Bool blockedByAllies = info.allyFixedCount || info.allyGoal ;
10875+ if (unitIdle) {
10876+ // If the unit present is idle, it doesn't block allies. [8/18/2003]
10877+ blockedByAllies = false ;
10878+ }
10879+
10880+
10881+ if (!checkMovement || blockedByEnemy || blockedByAllies) {
10882+ lastBlocked = cur;
10883+ useLargeRadius = true ;
10884+ } else {
10885+ useLargeRadius = false ;
10886+ }
10887+ cur = cur->getParentCell ();
10888+ }
10889+ if (lastBlocked) {
10890+ parentCell = lastBlocked;
10891+ if (lastBlocked->getParentCell ()) {
10892+ parentCell = lastBlocked->getParentCell ();
10893+ }
10894+ }
10895+ }
10896+ #endif
1082310897 // construct and return path
1082410898 Path *path = buildActualPath ( obj, locomotorSet.getValidSurfaces (), obj->getPosition (), parentCell, centerInCell, false );
1082510899#if RETAIL_COMPATIBLE_PATHFINDING
0 commit comments