mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-03 23:56:43 +00:00 
			
		
		
		
	dagoth fix
This commit is contained in:
		
							parent
							
								
									69bbbefc09
								
							
						
					
					
						commit
						8afdf0f46b
					
				
					 2 changed files with 21 additions and 4 deletions
				
			
		| 
						 | 
					@ -16,18 +16,23 @@ namespace MWScript
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct ExplicitRef
 | 
					    struct ExplicitRef
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const
 | 
					        MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true,
 | 
				
			||||||
 | 
					            bool activeOnly = false) const
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            std::string id = runtime.getStringLiteral (runtime[0].mInteger);
 | 
					            std::string id = runtime.getStringLiteral (runtime[0].mInteger);
 | 
				
			||||||
            runtime.pop();
 | 
					            runtime.pop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return MWBase::Environment::get().getWorld()->getPtr (id, false);
 | 
					            if (required)
 | 
				
			||||||
 | 
					                return MWBase::Environment::get().getWorld()->getPtr (id, activeOnly);
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                return MWBase::Environment::get().getWorld()->searchPtr (id, activeOnly);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct ImplicitRef
 | 
					    struct ImplicitRef
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true) const
 | 
					        MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true,
 | 
				
			||||||
 | 
					            bool activeOnly = false) const
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            MWScript::InterpreterContext& context
 | 
					            MWScript::InterpreterContext& context
 | 
				
			||||||
                = static_cast<MWScript::InterpreterContext&> (runtime.getContext());
 | 
					                = static_cast<MWScript::InterpreterContext&> (runtime.getContext());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -217,6 +217,8 @@ namespace MWScript
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                virtual void execute (Interpreter::Runtime& runtime)
 | 
					                virtual void execute (Interpreter::Runtime& runtime)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    int peek = runtime[0].mInteger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    MWWorld::Ptr ptr = R()(runtime);
 | 
					                    MWWorld::Ptr ptr = R()(runtime);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Interpreter::Type_Float diff = runtime[0].mFloat;
 | 
					                    Interpreter::Type_Float diff = runtime[0].mFloat;
 | 
				
			||||||
| 
						 | 
					@ -224,7 +226,17 @@ namespace MWScript
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // workaround broken endgame scripts that kill dagoth ur
 | 
					                    // workaround broken endgame scripts that kill dagoth ur
 | 
				
			||||||
                    if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "dagoth_ur_1"))
 | 
					                    if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "dagoth_ur_1"))
 | 
				
			||||||
                        return;
 | 
					                    {
 | 
				
			||||||
 | 
					                        runtime.push (peek);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        if (R()(runtime, false, true).isEmpty())
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            std::cerr
 | 
				
			||||||
 | 
					                                << "Compensating for broken script in Morrowind.esm by "
 | 
				
			||||||
 | 
					                                << "ignoring remote access to dagoth_ur_1" << std::endl;
 | 
				
			||||||
 | 
					                            return;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
 | 
					                    MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue