mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 14:56:44 +00:00 
			
		
		
		
	Use if-continue to skip build path
This commit is contained in:
		
							parent
							
								
									5e12073b47
								
							
						
					
					
						commit
						e82d65a2c7
					
				
					 1 changed files with 17 additions and 14 deletions
				
			
		|  | @ -309,22 +309,25 @@ namespace MWMechanics | |||
|             mDestination = osg::Vec3f(destinationX, destinationY, destinationZ); | ||||
| 
 | ||||
|             // Check if land creature will walk onto water or if water creature will swim onto land
 | ||||
|             if ((!isWaterCreature && !destinationIsAtWater(actor, mDestination)) || | ||||
|                 (isWaterCreature && !destinationThroughGround(currentPosition, mDestination))) | ||||
|             { | ||||
|                 const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor); | ||||
|                 mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(), | ||||
|                     getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor)); | ||||
|                 mPathFinder.addPointToPath(mDestination); | ||||
|             if (!isWaterCreature && destinationIsAtWater(actor, mDestination)) | ||||
|                 continue; | ||||
| 
 | ||||
|                 if (mPathFinder.isPathConstructed()) | ||||
|                 { | ||||
|                     storage.setState(AiWanderStorage::Wander_Walking, true); | ||||
|                     mHasDestination = true; | ||||
|                     mUsePathgrid = false; | ||||
|                 } | ||||
|                 return; | ||||
|             if (isWaterCreature && destinationThroughGround(currentPosition, mDestination)) | ||||
|                 continue; | ||||
| 
 | ||||
|             const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor); | ||||
|             mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(), | ||||
|                 getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor)); | ||||
|             mPathFinder.addPointToPath(mDestination); | ||||
| 
 | ||||
|             if (mPathFinder.isPathConstructed()) | ||||
|             { | ||||
|                 storage.setState(AiWanderStorage::Wander_Walking, true); | ||||
|                 mHasDestination = true; | ||||
|                 mUsePathgrid = false; | ||||
|             } | ||||
| 
 | ||||
|             break; | ||||
|         } while (--attempts); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue