summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-19 21:50:38 +0000
committertron <tron@openttd.org>2005-01-19 21:50:38 +0000
commite9c25f827461083c2d9d2a9ce32bb0f2186b57f2 (patch)
treebbe5bad62d60c82f5f8534c80e8d495e735c64d6
parentaaf09ceb268cc79fde648ab0bba8026c5277d77e (diff)
downloadopenttd-e9c25f827461083c2d9d2a9ce32bb0f2186b57f2.tar.xz
(svn r1572) Remove dead code from ludde's autorail implementation which was left over by revision 1571
-rw-r--r--rail_gui.c152
1 files changed, 0 insertions, 152 deletions
diff --git a/rail_gui.c b/rail_gui.c
index 2acd53583..2e86c535b 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -320,123 +320,6 @@ static void DoRailroadTrack(int mode)
);
}
-/* This code was used for ludde's special autorail autocomplete.
- * It analyzes the adjecent tiles and bases it's decision which
- * rail piece to place on this.
-
-typedef struct {
- byte bit, a,b, mouse;
-} BestFitStruct;
-
-#define M(d,m) (d << 6) | (m)
-static const BestFitStruct _bestfit[] = {
- // both edges have rail
- {2, M(0, 1+8), M(3, 2+8), 0}, // upper track
- {3, M(2, 1+4), M(1, 2+4), 0}, // lower track
-
- {4, M(2, 1+32), M(3, 2+32), 1<<2}, // left track
- {5, M(0, 1+16), M(1, 2+16), 1<<3}, // right track
-
- {0, M(0,1+8+16), M(2,1+4+32), 0}, // diag1 track
- {1, M(3,2+8+32), M(1,2+4+16), 0}, // diag2 track
-
- // one edge with rail
- {0, M(0,1), 0, 0}, // diag1 track
- {0, M(2,1), 0, 0}, // diag1 track
-
- {1, M(1,2), 0, 0}, // diag2 track
- {1, M(3,2), 0, 0}, // diag2 track
-
- {2, M(0,8), 0, 1<<0}, // upper track
- {2, M(3,8), 0, 1<<0}, // upper track
-
- {3, M(1,4), 0, 1<<1}, // lower track
- {3, M(2,4), 0, 1<<1}, // lower track
-
- {4, M(2,32), 0, 1<<2}, // left track
- {4, M(3,32), 0, 1<<2}, // left track
-
- {5, M(0,16), 0, 1<<3}, // right track
- {5, M(1,16), 0, 1<<3}, // right track
-
- {0xff, 0, 0, 0},
-};
-#undef M
-
-static int GetBestArea(int x, int y)
-{
- int r = 0;
- if (x + y > 0x10) r += 2;
- else if (x + y == 0x10) return -1;
- if (y - x > 0) r += 1;
- else if (y - x == 0) return -1;
- return r;
-}
-
-static int GetBestFit1x1(int x, int y)
-{
- byte m[5];
- const BestFitStruct *bfs;
- byte mouse;
- uint tile;
- int best;
- int i;
-
- // determine the mouse regions
- mouse = ((x & 0xF) + (y & 0xF) < 0x10 ? 1 << 0 : 1 << 1) +
- ((x & 0xF) > (y & 0xF) ? 1 << 2 : 1 << 3);
-
- // get the rail in each direction
- tile = TILE_FROM_XY(x,y);
- for(i=0; i!=5; i++) {
- static const TileIndexDiffC _tile_inc[] = {
- {-1 , 0 },
- { 0 - -1, 1 - 0},
- { 1 - 0, 0 - 1},
- { 0 - 1, -1 - 0},
- { 0 - 0, 0 - -1}
- };
- tile += ToTileIndexDiff(_tile_inc[i]);
- m[i] = 0;
- if (IsTileType(tile, MP_RAILWAY) && _map5[tile] < 0x80)
- m[i] = _map5[tile]&0x3F;
-
- // handle tracks under bridge
- if(IsTileType(tile, MP_TUNNELBRIDGE) && (_map5[tile]&0xF8)==0xE0)
- m[i] = (byte) !(_map5[tile]&0x01) + 1;
-
- if (_remove_button_clicked) m[i] ^= 0x3F;
- }
-
- // check "mouse gesture"?
- {
- int a1,a2;
- if ((a1 = GetBestArea(x & 0xF, y & 0xF)) != -1 && (a2 = GetBestArea(_tile_fract_coords.x, _tile_fract_coords.y)) != -1 && a1 != a2) {
- static const byte _get_dir_by_areas[4][4] = {
- {0,2,4,1},
- {2,0,0,5},
- {4,0,0,3},
- {1,5,3,0},
- };
- i = _get_dir_by_areas[a2][a1];
- if (!HASBIT(m[4], i))
- return i;
- }
- }
- // check each bestfit struct
- for(bfs = _bestfit, best=-1; bfs->bit != 0xFF; bfs++) {
- if ((bfs->a & m[bfs->a >> 6]) && (!bfs->b || bfs->b & m[bfs->b >> 6]) && !HASBIT(m[4], bfs->bit)) {
- if ( (byte)(~mouse & bfs->mouse) == 0)
- return bfs->bit;
- if (best != -1)
- return best;
- best = bfs->bit;
- }
- }
-
- return best;
-}
-*/
// This function is more or less a hack because DoRailroadTrack() would otherwise screw up
static void SwapSelection()
@@ -448,41 +331,6 @@ static void SwapSelection()
thd->selend = pt;
}
-/* see above, residue from ludde's special autorail autocomplete
-
-static bool Check2x1AutoRail(int mode)
-{
- TileHighlightData *thd = &_thd;
- int fxpy = _tile_fract_coords.x + _tile_fract_coords.y;
- int sxpy = (thd->selend.x & 0xF) + (thd->selend.y & 0xF);
- int fxmy = _tile_fract_coords.x - _tile_fract_coords.y;
- int sxmy = (thd->selend.x & 0xF) - (thd->selend.y & 0xF);
-
- switch(mode) {
- case 0:
- if (fxpy >= 20 && sxpy <= 12) { SwapSelection(); DoRailroadTrack(0); return true; }
- if (fxmy < -3 && sxmy > 3) { DoRailroadTrack(0); return true; }
- break;
-
- case 1:
- if (fxmy > 3 && sxmy < -3) { SwapSelection(); DoRailroadTrack(0); return true; }
- if (fxpy <= 12 && sxpy >= 20) { DoRailroadTrack(0); return true; }
- break;
-
- case 2:
- if (fxmy > 3 && sxmy < -3) { DoRailroadTrack(3); return true; }
- if (fxpy >= 20 && sxpy <= 12) { SwapSelection(); DoRailroadTrack(0); return true; }
- break;
-
- case 3:
- if (fxmy < -3 && sxmy > 3) { SwapSelection(); DoRailroadTrack(3); return true; }
- if (fxpy <= 12 && sxpy >= 20) { DoRailroadTrack(0); return true; }
- break;
- }
-
- return false;
-}
-*/
static void HandleAutodirPlacement()
{