[CrystalSpace] #981: Loop in terrain2 can exit sooner (fix included)
"CrystalSpace" <[email protected]> Sun, 30 Jun 2013 17:56:51 -0000
| Newsgroups | gmane.comp.graphics.crystalspace.tracker |
|---|---|
| Message-ID | <[email protected]> |
#981: Loop in terrain2 can exit sooner (fix included)
---------------------------+------------------------------------------------
Reporter: ralphcampbell | Owner: admin
Type: defect | Status: new
Priority: minor | Milestone:
Component: libs | Version: V2.1
Keywords: |
---------------------------+------------------------------------------------
The two csTerrainSystem::GetCell() functions search the whole list and
return the last matching cell. I can't think of a good reason that would
be needed and breaking the loop when the first entry is found seems to
work.
{{{
Index: plugins/mesh/terrain/terrain2/terrainsystem.cpp
===================================================================
--- plugins/mesh/terrain/terrain2/terrainsystem.cpp (revision 39432)
+++ plugins/mesh/terrain/terrain2/terrainsystem.cpp (working copy)
@@ -141,6 +141,7 @@
if (!strcmp (cells[i]->GetName (), name))
{
cell = cells[i];
+ break;
}
}
@@ -167,6 +168,7 @@
cell_pos.y + cell_size.z >= pos.y - EPSILON)
{
cell = cells[i];
+ break;
}
}
}}}
--
Ticket URL: <http://www.crystalspace3d.org/trac/CS/ticket/981>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev