mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 02:56:39 +00:00 
			
		
		
		
	Replace more C-style casts with C++ style
This commit is contained in:
		
							parent
							
								
									a3a1b6d11f
								
							
						
					
					
						commit
						cf24063226
					
				
					 3 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
					@ -59,7 +59,7 @@ namespace MWGui
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void CountDialog::setCount(int count)
 | 
					    void CountDialog::setCount(int count)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        count = std::clamp(count, 1, (int)mSlider->getScrollRange());
 | 
					        count = std::clamp(count, 1, static_cast<int>(mSlider->getScrollRange()));
 | 
				
			||||||
        mSlider->setScrollPosition(count - 1);
 | 
					        mSlider->setScrollPosition(count - 1);
 | 
				
			||||||
        mItemEdit->setValue(count);
 | 
					        mItemEdit->setValue(count);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -105,7 +105,7 @@ namespace MWGui
 | 
				
			||||||
        else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
 | 
					        else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
 | 
				
			||||||
            setCount(1);
 | 
					            setCount(1);
 | 
				
			||||||
        else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
 | 
					        else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
 | 
				
			||||||
            setCount((int)mSlider->getScrollRange());
 | 
					            setCount(static_cast<int>(mSlider->getScrollRange()));
 | 
				
			||||||
        else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
 | 
					        else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
 | 
				
			||||||
            MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
 | 
					            MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
 | 
				
			||||||
        else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
 | 
					        else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@ namespace MWGui
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        mRows = std::max(maxHeight / 42, 1);
 | 
					        mRows = std::max(maxHeight / 42, 1);
 | 
				
			||||||
        mItemCount = dragArea->getChildCount();
 | 
					        mItemCount = dragArea->getChildCount();
 | 
				
			||||||
        bool showScrollbar = int(std::ceil(mItemCount / float(mRows))) > mScrollView->getWidth() / 42;
 | 
					        bool showScrollbar = static_cast<int>(std::ceil(mItemCount / float(mRows))) > mScrollView->getWidth() / 42;
 | 
				
			||||||
        if (showScrollbar)
 | 
					        if (showScrollbar)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            maxHeight -= 18;
 | 
					            maxHeight -= 18;
 | 
				
			||||||
| 
						 | 
					@ -264,14 +264,14 @@ namespace MWGui
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (prevFocus >= 0 && prevFocus < mItemCount)
 | 
					        if (prevFocus >= 0 && prevFocus < mItemCount)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ItemWidget* prev = (ItemWidget*)dragArea->getChildAt(prevFocus);
 | 
					            ItemWidget* prev = static_cast<ItemWidget*>(dragArea->getChildAt(prevFocus));
 | 
				
			||||||
            if (prev)
 | 
					            if (prev)
 | 
				
			||||||
                prev->setControllerFocus(false);
 | 
					                prev->setControllerFocus(false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (mControllerActiveWindow && newFocus >= 0 && newFocus < mItemCount)
 | 
					        if (mControllerActiveWindow && newFocus >= 0 && newFocus < mItemCount)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ItemWidget* focused = (ItemWidget*)dragArea->getChildAt(newFocus);
 | 
					            ItemWidget* focused = static_cast<ItemWidget*>(dragArea->getChildAt(newFocus));
 | 
				
			||||||
            if (focused)
 | 
					            if (focused)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                focused->setControllerFocus(true);
 | 
					                focused->setControllerFocus(true);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -899,7 +899,8 @@ namespace MWGui
 | 
				
			||||||
            if (state.mWindows.size() == 0)
 | 
					            if (state.mWindows.size() == 0)
 | 
				
			||||||
                return nullptr;
 | 
					                return nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            int activeIndex = std::clamp(mActiveControllerWindows[mode], 0, (int)state.mWindows.size() - 1);
 | 
					            int activeIndex
 | 
				
			||||||
 | 
					                = std::clamp(mActiveControllerWindows[mode], 0, static_cast<int>(state.mWindows.size()) - 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // If the active window is no longer visible, find the next visible window.
 | 
					            // If the active window is no longer visible, find the next visible window.
 | 
				
			||||||
            if (!state.mWindows[activeIndex]->isVisible())
 | 
					            if (!state.mWindows[activeIndex]->isVisible())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue