forked from teamnwah/openmw-tes3coop
		
	Display school in the spell tooltip
This commit is contained in:
		
							parent
							
								
									fc789265e2
								
							
						
					
					
						commit
						df262e53ae
					
				
					 2 changed files with 11 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
#include "../mwbase/windowmanager.hpp"
 | 
			
		||||
 | 
			
		||||
#include "../mwworld/class.hpp"
 | 
			
		||||
#include "../mwmechanics/spellcasting.hpp"
 | 
			
		||||
 | 
			
		||||
#include "mapwindow.hpp"
 | 
			
		||||
#include "inventorywindow.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -19,6 +20,7 @@
 | 
			
		|||
 | 
			
		||||
namespace MWGui
 | 
			
		||||
{
 | 
			
		||||
    std::string ToolTips::sSchoolNames[] = {"#{sSchoolAlteration}", "#{sSchoolConjuration}", "#{sSchoolDestruction}", "#{sSchoolIllusion}", "#{sSchoolMysticism}", "#{sSchoolRestoration}"};
 | 
			
		||||
 | 
			
		||||
    ToolTips::ToolTips() :
 | 
			
		||||
        Layout("openmw_tooltips.layout")
 | 
			
		||||
| 
						 | 
				
			
			@ -220,6 +222,12 @@ namespace MWGui
 | 
			
		|||
                        params.mNoTarget = false;
 | 
			
		||||
                        effects.push_back(params);
 | 
			
		||||
                    }
 | 
			
		||||
                    if (MWMechanics::spellIncreasesSkill(spell)) // display school of spells that contribute to skill progress
 | 
			
		||||
                    {
 | 
			
		||||
                        MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
 | 
			
		||||
                        int school = MWMechanics::getSpellSchool(spell, player);
 | 
			
		||||
                        info.text = "#{sSchool}: " + sSchoolNames[school];
 | 
			
		||||
                    }
 | 
			
		||||
                    info.effects = effects;
 | 
			
		||||
                    tooltipSize = createToolTip(info);
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			@ -739,19 +747,11 @@ namespace MWGui
 | 
			
		|||
        icon.insert(slashPos+1, "b_");
 | 
			
		||||
        icon = Misc::ResourceHelpers::correctIconPath(icon);
 | 
			
		||||
 | 
			
		||||
        std::vector<std::string> schools;
 | 
			
		||||
        schools.push_back ("#{sSchoolAlteration}");
 | 
			
		||||
        schools.push_back ("#{sSchoolConjuration}");
 | 
			
		||||
        schools.push_back ("#{sSchoolDestruction}");
 | 
			
		||||
        schools.push_back ("#{sSchoolIllusion}");
 | 
			
		||||
        schools.push_back ("#{sSchoolMysticism}");
 | 
			
		||||
        schools.push_back ("#{sSchoolRestoration}");
 | 
			
		||||
 | 
			
		||||
        widget->setUserString("ToolTipType", "Layout");
 | 
			
		||||
        widget->setUserString("ToolTipLayout", "MagicEffectToolTip");
 | 
			
		||||
        widget->setUserString("Caption_MagicEffectName", "#{" + name + "}");
 | 
			
		||||
        widget->setUserString("Caption_MagicEffectDescription", effect->mDescription);
 | 
			
		||||
        widget->setUserString("Caption_MagicEffectSchool", "#{sSchool}: " + schools[effect->mData.mSchool]);
 | 
			
		||||
        widget->setUserString("Caption_MagicEffectSchool", "#{sSchool}: " + sSchoolNames[effect->mData.mSchool]);
 | 
			
		||||
        widget->setUserString("ImageTexture_MagicEffectImage", icon);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -96,6 +96,8 @@ namespace MWGui
 | 
			
		|||
        /// Adjust position for a tooltip so that it doesn't leave the screen and does not obscure the mouse cursor
 | 
			
		||||
        void position(MyGUI::IntPoint& position, MyGUI::IntSize size, MyGUI::IntSize viewportSize);
 | 
			
		||||
 | 
			
		||||
        static std::string sSchoolNames[6];
 | 
			
		||||
 | 
			
		||||
	int mHorizontalScrollIndex;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue