~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/town_cmd.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matthijs Kooijman, cdcb73a
  • Date: 2009-12-24 00:55:45 UTC
  • mfrom: (1.1.9 upstream) (2.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091224005545-ffwi801t8mvqtgwz
[cdcb73a] Imported Upstream version 0.7.5. This release fixes
CVE-2009-4007.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: town_cmd.cpp 17629 2009-09-24 19:22:32Z rubidium $ */
 
1
/* $Id: town_cmd.cpp 18477 2009-12-13 00:24:53Z rubidium $ */
2
2
 
3
3
/** @file town_cmd.cpp Handling of town tiles. */
4
4
 
760
760
                }
761
761
 
762
762
                cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile, NULL) : GetTileSlope(tile, NULL);
763
 
                if (cur_slope == SLOPE_FLAT) {
764
 
no_slope:
765
 
                        /* Tile has no slope */
766
 
                        switch (t->layout) {
767
 
                                default: NOT_REACHED();
768
 
 
769
 
                                case TL_ORIGINAL: // Disallow the road if any neighboring tile has a road (distance: 1)
770
 
                                        return !IsNeighborRoadTile(tile, dir, 1);
771
 
 
772
 
                                case TL_BETTER_ROADS: // Disallow the road if any neighboring tile has a road (distance: 1 and 2).
773
 
                                        return !IsNeighborRoadTile(tile, dir, 2);
774
 
                        }
775
 
                }
 
763
                bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
 
764
                if (cur_slope == SLOPE_FLAT) return ret;
776
765
 
777
766
                /* If the tile is not a slope in the right direction, then
778
767
                 * maybe terraform some. */
787
776
                                }
788
777
                                if (CmdFailed(res) && Chance16(1, 3)) {
789
778
                                        /* We can consider building on the slope, though. */
790
 
                                        goto no_slope;
 
779
                                        return ret;
791
780
                                }
792
781
                        }
793
782
                        return false;
794
783
                }
795
 
                return true;
 
784
                return ret;
796
785
        }
797
786
}
798
787