Code cleanup

Prefer static_cast to reinterpret_cast.
Declare variables later with init values to avoid having uninitialized variables around.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6161 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-11-14 16:56:16 +00:00
parent 42b881ee74
commit 4cb289fc91
2 changed files with 5 additions and 10 deletions

View File

@ -203,17 +203,15 @@ void CGUIFont::setMaxHeight()
return;
MaxHeight = 0;
s32 t;
core::array< core::rect<s32> >& p = SpriteBank->getPositions();
for (u32 i=0; i<p.size(); ++i)
{
t = p[i].getHeight();
const s32 t = p[i].getHeight();
if (t>MaxHeight)
MaxHeight = t;
}
}
void CGUIFont::pushTextureCreationFlags(bool(&flags)[3])

View File

@ -754,10 +754,7 @@ bool CGUITreeView::OnEvent( const SEvent &event )
void CGUITreeView::mouseAction( s32 xpos, s32 ypos, bool onlyHover /*= false*/ )
{
IGUITreeViewNode* oldSelected = Selected;
IGUITreeViewNode* hitNode = 0;
s32 selIdx=-1;
s32 n;
IGUITreeViewNode* node;
SEvent event;
event.EventType = EET_GUI_EVENT;
@ -774,9 +771,9 @@ void CGUITreeView::mouseAction( s32 xpos, s32 ypos, bool onlyHover /*= false*/ )
selIdx = ( ( ypos - 1 ) + scrollBarVPos ) / ItemHeight;
}
hitNode = 0;
node = Root->getFirstChild();
n = 0;
IGUITreeViewNode* hitNode = 0;
IGUITreeViewNode* node = Root->getFirstChild();
s32 n = 0;
while( node )
{
if( selIdx == n )
@ -1024,7 +1021,7 @@ void CGUITreeView::draw()
iconWidth += ImageList->getImageSize().Width + 3;
textRect.UpperLeftCorner.X += ImageList->getImageSize().Width + 3;
}
else if( ( IconFont && reinterpret_cast<CGUITreeViewNode*>( node )->Icon.size() )
else if( ( IconFont && static_cast<CGUITreeViewNode*>( node )->Icon.size() )
&& ( ( ImageLeftOfIcon && n == 1 )
|| ( !ImageLeftOfIcon && n == 0 ) ) )
{