mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 11:56:39 +00:00 
			
		
		
		
	uninit bool and invalid iterator bugs fixes
This commit is contained in:
		
							parent
							
								
									2906ade531
								
							
						
					
					
						commit
						e8f7d12c01
					
				
					 4 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
					@ -392,7 +392,7 @@ namespace MWMechanics
 | 
				
			||||||
        else // remote pathfinding
 | 
					        else // remote pathfinding
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool preferShortcut = false;
 | 
					            bool preferShortcut = false;
 | 
				
			||||||
            bool inLOS;
 | 
					            bool inLOS = MWBase::Environment::get().getWorld()->getLOS(actor, mTarget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(mReadyToAttack) isStuck = false;
 | 
					            if(mReadyToAttack) isStuck = false;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
| 
						 | 
					@ -400,7 +400,7 @@ namespace MWMechanics
 | 
				
			||||||
            if(!isStuck 
 | 
					            if(!isStuck 
 | 
				
			||||||
                && (!mForceNoShortcut
 | 
					                && (!mForceNoShortcut
 | 
				
			||||||
                || (Ogre::Vector3(mShortcutFailPos.pos) - vActorPos).length() >= PATHFIND_SHORTCUT_RETRY_DIST)
 | 
					                || (Ogre::Vector3(mShortcutFailPos.pos) - vActorPos).length() >= PATHFIND_SHORTCUT_RETRY_DIST)
 | 
				
			||||||
                && (inLOS = MWBase::Environment::get().getWorld()->getLOS(actor, mTarget)))
 | 
					                && inLOS)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if(speed == 0.0f) speed = actorCls.getSpeed(actor);
 | 
					                if(speed == 0.0f) speed = actorCls.getSpeed(actor);
 | 
				
			||||||
                // maximum dist before pit/obstacle for actor to avoid them depending on his speed
 | 
					                // maximum dist before pit/obstacle for actor to avoid them depending on his speed
 | 
				
			||||||
| 
						 | 
					@ -437,7 +437,7 @@ namespace MWMechanics
 | 
				
			||||||
                if(inLOS && mPathFinder.getPath().size() > 1)
 | 
					                if(inLOS && mPathFinder.getPath().size() > 1)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    // get point just before target
 | 
					                    // get point just before target
 | 
				
			||||||
                    std::list<ESM::Pathgrid::Point>::iterator pntIter = --mPathFinder.getPath().end();
 | 
					                    std::list<ESM::Pathgrid::Point>::const_iterator pntIter = --mPathFinder.getPath().end();
 | 
				
			||||||
                    --pntIter;
 | 
					                    --pntIter;
 | 
				
			||||||
                    Ogre::Vector3 vBeforeTarget = Ogre::Vector3(pntIter->mX, pntIter->mY, pntIter->mZ);
 | 
					                    Ogre::Vector3 vBeforeTarget = Ogre::Vector3(pntIter->mX, pntIter->mY, pntIter->mZ);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -539,14 +539,14 @@ namespace MWMechanics
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void AiWander::trimAllowedNodes(std::vector<ESM::Pathgrid::Point>& nodes,
 | 
					    void AiWander::trimAllowedNodes(std::vector<ESM::Pathgrid::Point>& nodes,
 | 
				
			||||||
                                    const PathFinder& pathfinder)
 | 
					                                    PathFinder& pathfinder)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // TODO: how to add these back in once the door opens?
 | 
					        // TODO: how to add these back in once the door opens?
 | 
				
			||||||
        // Idea: keep a list of detected closed doors (see aicombat.cpp)
 | 
					        // Idea: keep a list of detected closed doors (see aicombat.cpp)
 | 
				
			||||||
        // Every now and then check whether one of the doors is opened. (maybe
 | 
					        // Every now and then check whether one of the doors is opened. (maybe
 | 
				
			||||||
        // at the end of playing idle?) If the door is opened then re-calculate
 | 
					        // at the end of playing idle?) If the door is opened then re-calculate
 | 
				
			||||||
        // allowed nodes starting from the spawn point.
 | 
					        // allowed nodes starting from the spawn point.
 | 
				
			||||||
        std::list<ESM::Pathgrid::Point> paths = pathfinder.getPath();
 | 
					        std::list<ESM::Pathgrid::Point>& paths = pathfinder.getPath();
 | 
				
			||||||
        while(paths.size() >= 2)
 | 
					        while(paths.size() >= 2)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ESM::Pathgrid::Point pt = paths.back();
 | 
					            ESM::Pathgrid::Point pt = paths.back();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,7 +77,7 @@ namespace MWMechanics
 | 
				
			||||||
            ESM::Pathgrid::Point mCurrentNode;
 | 
					            ESM::Pathgrid::Point mCurrentNode;
 | 
				
			||||||
            bool mTrimCurrentNode;
 | 
					            bool mTrimCurrentNode;
 | 
				
			||||||
            void trimAllowedNodes(std::vector<ESM::Pathgrid::Point>& nodes,
 | 
					            void trimAllowedNodes(std::vector<ESM::Pathgrid::Point>& nodes,
 | 
				
			||||||
                                  const PathFinder& pathfinder);
 | 
					                                  PathFinder& pathfinder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            PathFinder mPathFinder;
 | 
					            PathFinder mPathFinder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,7 @@ namespace MWMechanics
 | 
				
			||||||
                return mPath.size();
 | 
					                return mPath.size();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            std::list<ESM::Pathgrid::Point> getPath() const
 | 
					            std::list<ESM::Pathgrid::Point>& getPath()
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                return mPath;
 | 
					                return mPath;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue