mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 11:26:37 +00:00 
			
		
		
		
	Make Show fallback to global variables when sensible (bug #5278)
This commit is contained in:
		
							parent
							
								
									3ce3f364ea
								
							
						
					
					
						commit
						aadf13b123
					
				
					 2 changed files with 5 additions and 10 deletions
				
			
		|  | @ -197,6 +197,7 @@ | ||||||
|     Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello |     Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello | ||||||
|     Bug #5261: Creatures can sometimes become stuck playing idles and never wander again |     Bug #5261: Creatures can sometimes become stuck playing idles and never wander again | ||||||
|     Bug #5269: Editor: Cell lighting in resaved cleaned content files is corrupted |     Bug #5269: Editor: Cell lighting in resaved cleaned content files is corrupted | ||||||
|  |     Bug #5278: Console command Show doesn't fall back to global variable after local var not found | ||||||
|     Feature #1774: Handle AvoidNode |     Feature #1774: Handle AvoidNode | ||||||
|     Feature #2229: Improve pathfinding AI |     Feature #2229: Improve pathfinding AI | ||||||
|     Feature #3025: Analogue gamepad movement controls |     Feature #3025: Analogue gamepad movement controls | ||||||
|  |  | ||||||
|  | @ -923,11 +923,7 @@ namespace MWScript | ||||||
|                 if (!ptr.isEmpty()) |                 if (!ptr.isEmpty()) | ||||||
|                 { |                 { | ||||||
|                     const std::string& script = ptr.getClass().getScript(ptr); |                     const std::string& script = ptr.getClass().getScript(ptr); | ||||||
|                     if (script.empty()) |                     if (!script.empty()) | ||||||
|                     { |  | ||||||
|                         output << ptr.getCellRef().getRefId() << " has no script " << std::endl; |  | ||||||
|                     } |  | ||||||
|                     else |  | ||||||
|                     { |                     { | ||||||
|                         const Compiler::Locals& locals = |                         const Compiler::Locals& locals = | ||||||
|                             MWBase::Environment::get().getScriptManager()->getLocals(script); |                             MWBase::Environment::get().getScriptManager()->getLocals(script); | ||||||
|  | @ -941,13 +937,11 @@ namespace MWScript | ||||||
|                         case 'f': |                         case 'f': | ||||||
|                             output << ptr.getCellRef().getRefId() << "." << var << ": " << ptr.getRefData().getLocals().getFloatVar(script, var); |                             output << ptr.getCellRef().getRefId() << "." << var << ": " << ptr.getRefData().getLocals().getFloatVar(script, var); | ||||||
|                             break; |                             break; | ||||||
|                         default: |                         // Do nothing otherwise
 | ||||||
|                             output << "unknown local '" << var << "' for '" << ptr.getCellRef().getRefId() << "'"; |  | ||||||
|                             break; |  | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 else |                 if (output.rdbuf()->in_avail() == 0) | ||||||
|                 { |                 { | ||||||
|                     MWBase::World *world = MWBase::Environment::get().getWorld(); |                     MWBase::World *world = MWBase::Environment::get().getWorld(); | ||||||
|                     char type = world->getGlobalVariableType (var); |                     char type = world->getGlobalVariableType (var); | ||||||
|  | @ -964,7 +958,7 @@ namespace MWScript | ||||||
|                         output << runtime.getContext().getGlobalFloat (var); |                         output << runtime.getContext().getGlobalFloat (var); | ||||||
|                         break; |                         break; | ||||||
|                     default: |                     default: | ||||||
|                         output << "unknown global variable"; |                         output << "unknown variable"; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 runtime.getContext().report(output.str()); |                 runtime.getContext().report(output.str()); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue