Cleanup: Avoid using identical variable names in outer and inner scopes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5853 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2019-08-17 16:30:41 +00:00
parent cc07570496
commit 5ff51c947e
8 changed files with 26 additions and 34 deletions

View File

@ -253,10 +253,10 @@ namespace core
{
// This catches some floating point troubles.
// Unfortunately slightly expensive and we don't really know the best epsilon for iszero.
vector3d<f64> cp1 = bminusa.normalize().crossProduct((p1 - a).normalize());
if (core::iszero(cp1.X, (f64)ROUNDING_ERROR_f32)
&& core::iszero(cp1.Y, (f64)ROUNDING_ERROR_f32)
&& core::iszero(cp1.Z, (f64)ROUNDING_ERROR_f32) )
vector3d<f64> cp1n = bminusa.normalize().crossProduct((p1 - a).normalize());
if (core::iszero(cp1n.X, (f64)ROUNDING_ERROR_f32)
&& core::iszero(cp1n.Y, (f64)ROUNDING_ERROR_f32)
&& core::iszero(cp1n.Z, (f64)ROUNDING_ERROR_f32) )
{
res = 0.f;
}

View File

@ -322,7 +322,7 @@ void CAnimatedMeshHalfLife::initModel()
// initBodyparts
u32 meshBuffer = 0;
BodyList.clear();
SHalflifeBody *body = (SHalflifeBody *) ((u8*) Header + Header->bodypartindex);
const SHalflifeBody *body = (const SHalflifeBody *) ((u8*) Header + Header->bodypartindex);
for (i=0; i < Header->numbodyparts; ++i)
{
BodyPart part;
@ -369,7 +369,7 @@ void CAnimatedMeshHalfLife::initModel()
for (u32 bodypart=0 ; bodypart < Header->numbodyparts ; ++bodypart)
{
const SHalflifeBody *body = (SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart;
body = (const SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart;
for (u32 modelnr = 0; modelnr < body->nummodels; ++modelnr)
{

View File

@ -2901,10 +2901,9 @@ bool CD3D9Driver::retrieveDevice(int numTries, int msSleepBetweenTries)
//! resets the device
bool CD3D9Driver::reset()
{
u32 i;
os::Printer::log("Resetting D3D9 device.", ELL_INFORMATION);
for (i = 0; i<RenderTargets.size(); ++i)
for (u32 i = 0; i<RenderTargets.size(); ++i)
{
if (RenderTargets[i]->getDriverType() == EDT_DIRECT3D9)
{
@ -2926,7 +2925,7 @@ bool CD3D9Driver::reset()
tex->releaseTexture();
}
}
for (i=0; i<Textures.size(); ++i)
for (u32 i=0; i<Textures.size(); ++i)
{
if (Textures[i].Surface->isRenderTarget())
{
@ -2936,7 +2935,7 @@ bool CD3D9Driver::reset()
tex->releaseTexture();
}
}
for (i=0; i<OcclusionQueries.size(); ++i)
for (u32 i=0; i<OcclusionQueries.size(); ++i)
{
if (OcclusionQueries[i].PID)
{
@ -3016,12 +3015,12 @@ bool CD3D9Driver::reset()
}
// restore RTTs
for (i=0; i<Textures.size(); ++i)
for (u32 i=0; i<Textures.size(); ++i)
{
if (Textures[i].Surface->isRenderTarget())
((CD3D9Texture*)(Textures[i].Surface))->generateRenderTarget();
}
for (i = 0; i<RenderTargets.size(); ++i)
for (u32 i = 0; i<RenderTargets.size(); ++i)
{
if (RenderTargets[i]->getDriverType() == EDT_DIRECT3D9)
{
@ -3045,7 +3044,7 @@ bool CD3D9Driver::reset()
}
// restore occlusion queries
for (i=0; i<OcclusionQueries.size(); ++i)
for (u32 i=0; i<OcclusionQueries.size(); ++i)
{
pID3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, reinterpret_cast<IDirect3DQuery9**>(&OcclusionQueries[i].PID));
}

View File

@ -289,12 +289,12 @@ bool CGUIContextMenu::OnEvent(const SEvent& event)
{
setEventParent(p);
SEvent event;
event.EventType = EET_GUI_EVENT;
event.GUIEvent.Caller = this;
event.GUIEvent.Element = 0;
event.GUIEvent.EventType = EGET_ELEMENT_CLOSED;
if ( !p->OnEvent(event) )
SEvent eventClose;
eventClose.EventType = EET_GUI_EVENT;
eventClose.GUIEvent.Caller = this;
eventClose.GUIEvent.Element = 0;
eventClose.GUIEvent.EventType = EGET_ELEMENT_CLOSED;
if ( !p->OnEvent(eventClose) )
{
if ( CloseHandling & ECMC_HIDE )
{

View File

@ -1472,10 +1472,7 @@ void CGUIEditBox::calculateScrollPos()
if (!AutoScroll)
return;
IGUISkin* skin = Environment->getSkin();
if (!skin)
return;
IGUIFont* font = OverrideFont ? OverrideFont : skin->getFont();
IGUIFont* font = getActiveFont();
if (!font)
return;
@ -1489,10 +1486,6 @@ void CGUIEditBox::calculateScrollPos()
// NOTE: Calculations different to vertical scrolling because setTextRect interprets VAlign relative to line but HAlign not relative to row
{
// get cursor position
IGUIFont* font = getActiveFont();
if (!font)
return;
// get cursor area
irr::u32 cursorWidth = font->getDimension(CursorChar.c_str()).Width;
core::stringw *txtLine = hasBrokenText ? &BrokenText[cursLine] : &Text;

View File

@ -113,11 +113,11 @@ void CGUIProfiler::updateDisplay()
{
for ( u32 i=1; i<Profiler->getGroupCount(); ++i )
{
const SProfileData& groupData = Profiler->getGroupData(i);
if ( groupData.getCallsCounter() >= MinCalls )
const SProfileData& groupDataOv = Profiler->getGroupData(i);
if (groupDataOv.getCallsCounter() >= MinCalls )
{
rowIndex = DisplayTable->addRow(rowIndex);
fillRow(rowIndex, groupData, false, false);
fillRow(rowIndex, groupDataOv, false, false);
++rowIndex;
}
}

View File

@ -171,8 +171,7 @@ IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
os::Printer::log("LWO loader: Creating geometry.");
os::Printer::log("LWO loader: Assigning UV maps.");
#endif
u32 i;
for (i=0; i<Materials.size(); ++i)
for (u32 i=0; i<Materials.size(); ++i)
{
u16 uvTag;
for (u32 j=0; j<2; ++j) // max 2 texture coords
@ -206,11 +205,11 @@ IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
{
core::array<u32> vertexCount;
vertexCount.reallocate(Materials.size());
for (i=0; i<Materials.size(); ++i)
for (u32 i=0; i<Materials.size(); ++i)
vertexCount.push_back(0);
for (u32 polyIndex=0; polyIndex<Indices.size(); ++polyIndex)
vertexCount[MaterialMapping[polyIndex]] += Indices[polyIndex].size();
for (i=0; i<Materials.size(); ++i)
for (u32 i=0; i<Materials.size(); ++i)
{
Materials[i]->Meshbuffer->Vertices.reallocate(vertexCount[i]);
Materials[i]->Meshbuffer->Indices.reallocate(vertexCount[i]);

View File

@ -255,6 +255,7 @@
<Rule Id="C26449" Action="None" />
<Rule Id="C26451" Action="None" />
<Rule Id="C26455" Action="None" />
<Rule Id="C26466" Action="None" />
<Rule Id="C26477" Action="None" />
<Rule Id="C26481" Action="None" />
<Rule Id="C26482" Action="None" />