mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-30 02:56:44 +00:00 
			
		
		
		
	Fix UI not updating initially for zero stats
This commit is contained in:
		
							parent
							
								
									70ee899691
								
							
						
					
					
						commit
						23e6d52844
					
				
					 2 changed files with 9 additions and 6 deletions
				
			
		|  | @ -288,7 +288,7 @@ namespace MWMechanics | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     MechanicsManager::MechanicsManager() |     MechanicsManager::MechanicsManager() | ||||||
|     : mUpdatePlayer (true), mClassSelected (false), |     : mWatchedStatsEmpty (true), mUpdatePlayer (true), mClassSelected (false), | ||||||
|       mRaceSelected (false), mAI(true) |       mRaceSelected (false), mAI(true) | ||||||
|     { |     { | ||||||
|         //buildPlayer no longer here, needs to be done explicitely after all subsystems are up and running
 |         //buildPlayer no longer here, needs to be done explicitely after all subsystems are up and running
 | ||||||
|  | @ -350,7 +350,7 @@ namespace MWMechanics | ||||||
|             const MWMechanics::NpcStats &stats = mWatched.getClass().getNpcStats(mWatched); |             const MWMechanics::NpcStats &stats = mWatched.getClass().getNpcStats(mWatched); | ||||||
|             for(int i = 0;i < ESM::Attribute::Length;++i) |             for(int i = 0;i < ESM::Attribute::Length;++i) | ||||||
|             { |             { | ||||||
|                 if(stats.getAttribute(i) != mWatchedStats.getAttribute(i)) |                 if(stats.getAttribute(i) != mWatchedStats.getAttribute(i) || mWatchedStatsEmpty) | ||||||
|                 { |                 { | ||||||
|                     std::stringstream attrname; |                     std::stringstream attrname; | ||||||
|                     attrname << "AttribVal"<<(i+1); |                     attrname << "AttribVal"<<(i+1); | ||||||
|  | @ -360,19 +360,19 @@ namespace MWMechanics | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if(stats.getHealth() != mWatchedStats.getHealth()) |             if(stats.getHealth() != mWatchedStats.getHealth() || mWatchedStatsEmpty) | ||||||
|             { |             { | ||||||
|                 static const std::string hbar("HBar"); |                 static const std::string hbar("HBar"); | ||||||
|                 mWatchedStats.setHealth(stats.getHealth()); |                 mWatchedStats.setHealth(stats.getHealth()); | ||||||
|                 winMgr->setValue(hbar, stats.getHealth()); |                 winMgr->setValue(hbar, stats.getHealth()); | ||||||
|             } |             } | ||||||
|             if(stats.getMagicka() != mWatchedStats.getMagicka()) |             if(stats.getMagicka() != mWatchedStats.getMagicka() || mWatchedStatsEmpty) | ||||||
|             { |             { | ||||||
|                 static const std::string mbar("MBar"); |                 static const std::string mbar("MBar"); | ||||||
|                 mWatchedStats.setMagicka(stats.getMagicka()); |                 mWatchedStats.setMagicka(stats.getMagicka()); | ||||||
|                 winMgr->setValue(mbar, stats.getMagicka()); |                 winMgr->setValue(mbar, stats.getMagicka()); | ||||||
|             } |             } | ||||||
|             if(stats.getFatigue() != mWatchedStats.getFatigue()) |             if(stats.getFatigue() != mWatchedStats.getFatigue() || mWatchedStatsEmpty) | ||||||
|             { |             { | ||||||
|                 static const std::string fbar("FBar"); |                 static const std::string fbar("FBar"); | ||||||
|                 mWatchedStats.setFatigue(stats.getFatigue()); |                 mWatchedStats.setFatigue(stats.getFatigue()); | ||||||
|  | @ -398,7 +398,7 @@ namespace MWMechanics | ||||||
|             //Loop over ESM::Skill::SkillEnum
 |             //Loop over ESM::Skill::SkillEnum
 | ||||||
|             for(int i = 0; i < ESM::Skill::Length; ++i) |             for(int i = 0; i < ESM::Skill::Length; ++i) | ||||||
|             { |             { | ||||||
|                 if(stats.getSkill(i) != mWatchedStats.getSkill(i)) |                 if(stats.getSkill(i) != mWatchedStats.getSkill(i) || mWatchedStatsEmpty) | ||||||
|                 { |                 { | ||||||
|                     update = true; |                     update = true; | ||||||
|                     mWatchedStats.getSkill(i) = stats.getSkill(i); |                     mWatchedStats.getSkill(i) = stats.getSkill(i); | ||||||
|  | @ -411,6 +411,8 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|             winMgr->setValue("level", stats.getLevel()); |             winMgr->setValue("level", stats.getLevel()); | ||||||
| 
 | 
 | ||||||
|  |             mWatchedStatsEmpty = false; | ||||||
|  | 
 | ||||||
|             // Update the equipped weapon icon
 |             // Update the equipped weapon icon
 | ||||||
|             MWWorld::InventoryStore& inv = mWatched.getClass().getInventoryStore(mWatched); |             MWWorld::InventoryStore& inv = mWatched.getClass().getInventoryStore(mWatched); | ||||||
|             MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); |             MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ namespace MWMechanics | ||||||
|     { |     { | ||||||
|             MWWorld::Ptr mWatched; |             MWWorld::Ptr mWatched; | ||||||
|             NpcStats mWatchedStats; |             NpcStats mWatchedStats; | ||||||
|  |             bool mWatchedStatsEmpty; | ||||||
|             bool mUpdatePlayer; |             bool mUpdatePlayer; | ||||||
|             bool mClassSelected; |             bool mClassSelected; | ||||||
|             bool mRaceSelected; |             bool mRaceSelected; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue