Optimized worldgenutil.iterate* functions.

master
Robert Zenz 2015-10-10 16:59:46 +02:00
parent 915d4d82a4
commit 363f1b39fe
5 changed files with 23 additions and 17 deletions

View File

@ -31,9 +31,9 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="modules/worldgenutil.html">worldgenutil</a></li>
<li><a href="modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><a href="modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><a href="modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>
@ -44,6 +44,10 @@
<h2>Modules</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="modules/worldgenutil.html">worldgenutil</a></td>
<td class="summary">Provides various utility functions for generation worlds.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/ramps.rampplacer.html">ramps.rampplacer</a></td>
<td class="summary">RampPlacer is an object that allows to place ramps in the world.</td>
@ -52,10 +56,6 @@
<td class="name" nowrap><a href="modules/ramps.ramputil.html">ramps.ramputil</a></td>
<td class="summary">Utility functions for the creation and registration of ramps.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/worldgenutil.html">worldgenutil</a></td>
<td class="summary">Provides various utility functions for generation worlds.</td>
</tr>
</table>
</div> <!-- id="content" -->

View File

@ -38,9 +38,9 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
<li><strong>ramps.rampplacer</strong></li>
<li><a href="../modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>

View File

@ -38,9 +38,9 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
<li><a href="../modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><strong>ramps.ramputil</strong></li>
<li><a href="../modules/worldgenutil.html">worldgenutil</a></li>
</ul>
</div>

View File

@ -38,9 +38,9 @@
<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
<li><strong>worldgenutil</strong></li>
<li><a href="../modules/ramps.rampplacer.html">ramps.rampplacer</a></li>
<li><a href="../modules/ramps.ramputil.html">ramps.ramputil</a></li>
<li><strong>worldgenutil</strong></li>
</ul>
</div>

View File

@ -42,8 +42,10 @@ function worldgenutil.iterate2d(minp, maxp, action, action_x)
action_x(x)
end
for z = minp.z, maxp.z, 1 do
action(x, z)
if action ~= nil then
for z = minp.z, maxp.z, 1 do
action(x, z)
end
end
end
end
@ -62,13 +64,17 @@ function worldgenutil.iterate3d(minp, maxp, action, action_x, action_z)
action_x(x)
end
for z = minp.z, maxp.z, 1 do
if action_z ~= nil then
action_z(x, z)
end
for y = minp.y, maxp.y, 1 do
action(x, z, y)
if action_z ~= nil and action ~= nil then
for z = minp.z, maxp.z, 1 do
if action_z ~= nil then
action_z(x, z)
end
if action ~= nil then
for y = minp.y, maxp.y, 1 do
action(x, z, y)
end
end
end
end
end