mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-03 23:26:40 +00:00 
			
		
		
		
	AiEscortCell complains if no cell was given or cell does not exist
This commit is contained in:
		
							parent
							
								
									965bea45c0
								
							
						
					
					
						commit
						65b5cbe3f7
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -1,5 +1,8 @@
 | 
				
			||||||
#include "aiextensions.hpp"
 | 
					#include "aiextensions.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdexcept>
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <components/compiler/extensions.hpp>
 | 
					#include <components/compiler/extensions.hpp>
 | 
				
			||||||
#include <components/compiler/opcodes.hpp>
 | 
					#include <components/compiler/opcodes.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +11,7 @@
 | 
				
			||||||
#include <components/interpreter/opcodes.hpp>
 | 
					#include <components/interpreter/opcodes.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../mwworld/class.hpp"
 | 
					#include "../mwworld/class.hpp"
 | 
				
			||||||
 | 
					#include "../mwworld/esmstore.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../mwmechanics/creaturestats.hpp"
 | 
					#include "../mwmechanics/creaturestats.hpp"
 | 
				
			||||||
#include "../mwmechanics/aiactivate.hpp"
 | 
					#include "../mwmechanics/aiactivate.hpp"
 | 
				
			||||||
| 
						 | 
					@ -18,13 +22,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../mwbase/environment.hpp"
 | 
					#include "../mwbase/environment.hpp"
 | 
				
			||||||
#include "../mwbase/world.hpp"
 | 
					#include "../mwbase/world.hpp"
 | 
				
			||||||
 | 
					#include "../mwbase/mechanicsmanager.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "interpretercontext.hpp"
 | 
					#include "interpretercontext.hpp"
 | 
				
			||||||
#include "ref.hpp"
 | 
					#include "ref.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <iostream>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "../mwbase/mechanicsmanager.hpp"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MWScript
 | 
					namespace MWScript
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -144,6 +146,11 @@ namespace MWScript
 | 
				
			||||||
                    // discard additional arguments (reset), because we have no idea what they mean.
 | 
					                    // discard additional arguments (reset), because we have no idea what they mean.
 | 
				
			||||||
                    for (unsigned int i=0; i<arg0; ++i) runtime.pop();
 | 
					                    for (unsigned int i=0; i<arg0; ++i) runtime.pop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (cellID.empty())
 | 
				
			||||||
 | 
					                        throw std::runtime_error("AiEscortCell: no cell ID given");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    MWBase::Environment::get().getWorld()->getStore().get<ESM::Cell>().find(cellID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    MWMechanics::AiEscort escortPackage(actorID, cellID, static_cast<int>(duration), x, y, z);
 | 
					                    MWMechanics::AiEscort escortPackage(actorID, cellID, static_cast<int>(duration), x, y, z);
 | 
				
			||||||
                    ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(escortPackage, ptr);
 | 
					                    ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(escortPackage, ptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue