1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-14 10:09:11 +00:00

(svn r14528) -Codechange: cache the closest town for all road tiles instead of only roads owned by tiles. This replaces a O(n) search over all towns from the road's tileloop with a O(1) lookup (PhilSophus)

This commit is contained in:
rubidium
2008-10-25 13:51:47 +00:00
parent 9075a2bbfc
commit a14ad77a36
9 changed files with 64 additions and 10 deletions

View File

@@ -513,6 +513,7 @@
<td valign=top nowrap>&nbsp;</td>
<td>
<ul>
<li>m2: Index into the array of towns (owning town for town roads; closest town otherwise, INVALID_TOWN if not yet calculated)</li>
<li>m3 bit 7 set = on snow or desert</li>
<li>m7 bits 7..5: present road types
<table>
@@ -534,7 +535,6 @@
</li>
<li>m5 bits 7 clear: road or level-crossing
<ul>
<li>m2: Index into the array of towns, 0 for non-town roads</li>
<li>m3 bits 6..4:
<table>
<tr>

View File

@@ -157,7 +157,7 @@ the array so you can quickly see what is used and what is not.
<td class="caption">road depot</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits">-inherit-</td>
<td class="bits">X<span class="free">OOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XX<span class="free">OO OO</span>XX</td>