Commit Graph

173 Commits (b5fe577523f25765888b2b813107e98e3f8bb069)

Author SHA1 Message Date
tron a90e46bf03 (svn r3981) More work for the rail accessing functions and enums 19 years ago
tron bf3811122d (svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles 19 years ago
tron 7b1c7c31fb (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}() 19 years ago
tron 6e988259a4 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX 19 years ago
tron 26815f7405 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges 19 years ago
tron ec8f335e9d (svn r3812) Remove a pointless goto 19 years ago
tron 86550c94bc (svn r3795) Add a function to request the orientation of a depot 19 years ago
tron 03254940a4 (svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes 19 years ago
tron 6fa5f041f8 (svn r3770) Remove the _road_special_gettrackstatus hack. Egladil and me deem it unnecessary 19 years ago
tron 4da99989b9 (svn r3766) Add a function to get the RoadBits from an arbitrary tile 19 years ago
tron 4efa560ffc (svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme 19 years ago
tron b2c5ecaa22 (svn r3699) Replace some magic numbers for checking for a suitable slope for a level crossing by some less magic numbers 19 years ago
tron 5d6ec6b4f0 (svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them 19 years ago
tron 7b106a3d8f (svn r3697) Rename DIAG1/DIAG2 to X resp. Y as this conveys a bit better in which direction a pieces of rail goes 19 years ago
tron 28fc670fe2 (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring 19 years ago
tron 7a3a9e6262 (svn r3695) Add 2 MarkTileByTile() which I forgot in r3689 (noticed by Belugas) 19 years ago
tron a8febcf209 (svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot 19 years ago
tron 38122ba0f5 (svn r3687) Complete some bits I missed whenn adding accessor functions for road types and pieces 19 years ago
tron 0f898e168d (svn r3686) Dispel some strange magic regarding level crossings and foundations:
if a level crossing is on a sloped tile, it has to be on a level foundation
19 years ago
tron c998cf0750 (svn r3680) Fix some magic numbers which got damaged in r1768
-Fix: Correctly restore the roadside after roadworks are finished
19 years ago
tron b26d54585f (svn r3660) Convert further road bits and type references to the functions/enums 19 years ago
tron a975616303 (svn r3659) Add function to get the road bits of a level crossing 19 years ago
tron 2f8e3dcc05 (svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces 19 years ago
tron d239ec0e96 (svn r3657) Fix indentation and remove now unused variable, which i forgot in r3655 19 years ago
tron ad1e7c1da8 (svn r3656) Simplify the overly complicated check for road pieces under a bridge 19 years ago
tron 147b661d6c (svn r3655) Simplify a boolean expression and turn 3 if-cascades into switches 19 years ago
tron 8e6b55c9a0 (svn r3650) Fix braino in r3649, spotted by Mihamix 19 years ago
tron 6f531eb9f6 (svn r3649) Turn several if-cascades into switch()es 19 years ago
tron b8b6084da2 (svn r3644) Don't use FindLandscapeHeightByTile() when it's overkill - often it was just a complicated way of writing GetTileSlope(tile, NULL) 19 years ago
tron 5352e9fbcb (svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff 19 years ago
tron 087fe86ed2 (svn r3564) Several smaller changes:
- Don't treat non-booleans as booleans
- Reduce variable scope
- Bracing
- Use DeMorgan's law to make conditionals easier to read
- if cascade -> switch
- Replace some magic numbers by symbolic names
- Avoid assignments within other statements
19 years ago
tron 17ec6ed70d (svn r3520) Remove unused parameters from some functions 19 years ago
tron 1c3e8630fe (svn r3511) More whitespace ([FS#46] by Rubidium) 19 years ago
tron 9712d6f639 (svn r3510) Fiddle with whitespace and parentheses 19 years ago
tron 244d4ab5cb (svn r3490) -Fix: A bunch (10) of off-by-one errors when checking if a TileIndex points to a tile on the map 19 years ago
Darkvater 4014e36aec (svn r3472) - [PBS] Remove from trunk. Anyone interested can still find it in branch/pbs. This reverts revisions r3158, r3140, r3075, r2977, r2674, r2625, r2621, r2529, r2528, r2525, r2524, r2519, r2517, r2516, r2507, r2499. (in conjunction with Tron)
- The only change is that the nsignalsw.grf file is kept and that existing nightlies with PBS signals get those signals converted to combo-signals.
19 years ago
peter1138 79e5f8286c (svn r3420) - Fix typo made back in r2997... 19 years ago
peter1138 1c4f9cf2e9 (svn r3413) - Fix: Under certain conditions placing a road tile parallel under a bridge would, instead of failing, succeed and place a perpendicular piece. 19 years ago
tron 318fe153eb (svn r3365) Staticise 36 functions 19 years ago
tron d5aa95b87e (svn r3313) Remove GPMI related changes from trunk
Revisions in detail: 2542, 3226 (partial), 3229, 3231, 3232, 3238, 3242-3245, 3251, 3253, 3260, 3263, 3265, 3266, 3269, 3277, 3278, 3279, 3283 (partial), 3304, 3305, 3306
19 years ago
truelight 6ca528ec82 (svn r3305) -Rename: Changed all instances of ottd_ related to the AI to ttai_ 19 years ago
peter1138 80986fcd32 (svn r3282) - Codechange: Replace tests against CMD_ERROR with CmdFailed() 19 years ago
truelight d90e3118ed (svn r3253) -Add: add BuildRoad event for AIs 19 years ago
truelight 8315736569 (svn r3232) -Add: implemented the event-system for AIs
-Add: added several hooks (event-callbacks) for road-related-stuff
19 years ago
tron 9d0e7b6458 (svn r3181) -Bracing
-Indentation
-Whitespace
-DeMorgan's Law
-Test with NULL or 0 for non-booleans
-'\0' instead of 0 for chars
-Remove redundantly redundant comments (like DoFoo(); // Do foo)
-Join multiple short lines with a single statement
-Split single lines with multiple statements
-Avoid assignments in if
19 years ago
tron 181d586a7c (svn r3078) Some more stuff, which piled up:
- const, whitespace, indentation, bracing, GB/SB, pointless casts
- use the trinary operator where appropriate
- data types (uint[] -> AcceptedCargo, ...)
- if cascade -> switch
- if (ptr) -> if (ptr != NULL)
- DeMorgan's Law
- Fix some comments
- 0 -> '\0', change magic numbers to symbolic constants
19 years ago
tron 0b936c3222 (svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
nothing spectacular, just some stuff, which piled up
19 years ago
tron d7cbd0d4c3 (svn r3073) int/byte -> EngineID/PlayerID/VehicleID
0/-1 -> INVALID_ENGINE
0x10 -> OWNER_NONE
19 years ago
tron 71d293f2a3 (svn r3066) Constify the parameter of GetSlopeZ_*() 19 years ago
tron b17b87469c (svn r3064) Replace some numbers by sprite names 19 years ago
tron 4529d1fc8e (svn r3037) Don't deduce the sprites for tunnels and level crossings from magic numbers, but fetch them from the central rail info array. This is a preparation step for electrified rails 19 years ago
tron 7ab7d79190 (svn r3028) s/255/OWNER_SPECTATOR/ 19 years ago
tron 39f5dbfd3b (svn r3019) -Codechange: Replace explicit shifting/anding/oring with GB and SB 19 years ago
peter1138 d11e5bf7fb (svn r2997) -Codechange: Split road drawing code off from DrawTile_Road into a separate function to be used elsewhere. 19 years ago
tron 90e33aed22 (svn r2995) Replace 0xFF/0xFFFF with CT_INVALID/OWNER_SPECTATOR/INVALID_STATION where appropriate 19 years ago
Darkvater 4a58250cb9 (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
- change a lot of byte player types to PlayerID
- beautify header files, same "#endif /* filename */" ending
19 years ago
Darkvater c0c75ef16e (svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
- Add IsLocalPlayer() which substitutes _local_player == _current_player
19 years ago
truelight 4936e93654 (svn r2948) -Fix: the old AI needs a special flag that triggers all kind of special
abilities you really don't want to know about (free bridges, etc..)
       I removed this flag some revisions ago, but the Aircraft part
       depends on it, so I re-enabled it again..
19 years ago
celestar a3739aecdf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
by enums. There remains work in gfx.c to move the "transparency" and
"recolor" bits around to make space for more sprites. However, 2800
additional sprites can now be loaded. There also remains cleanup and
Doxygen work on many of the header files.
19 years ago
tron 647cbd6bdd (svn r2701) Insert Id tags into all source files 19 years ago
tron 54cbd01825 (svn r2673) Include functions.h directly, not globally via openttd.h 19 years ago
celestar 1fed0046ac (svn r2658) -Codechange: Use MAKE_TRANSPARENT to display a transparented sprite 19 years ago
tron f09638ad3d (svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read 19 years ago
tron 7269771544 (svn r2643) Get rid of some unnecessary casts 19 years ago
tron 857a3a1ffc (svn r2634) Fix typo: IsSteepTile expects a tileh, not a TileIndex (thanks to peter1138) 19 years ago
celestar de19186be3 (svn r2595) -Codechange: Introduced "IsSteepTileh" to find whether a tile is steep
(i.e. spans two height levels) and use it throughout the code.
-Codechange: Add CanBuildDepotByTileh to find if a tile is suitable to
build a depot on it. Wraps some bitmagic which seems quite unreadable at
first glance
19 years ago
Darkvater 4ea2214993 (svn r2584) - Fix: Game no longer asserts when you use the remove-road tool on a town building or industry. 19 years ago
tron a4bf608d40 (svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes. 19 years ago
hackykid ab9c6f126d (svn r2516) - Feature: [pbs] Implement path-based-signalling. This allows multiple trains within the same signal block, provided their paths dont intersect. For this the block must have all exit and entry signals be pbs signals. Place these by ctrl-clicking 4 times on a normal signal.
- Feature: [pbs] Implement autoplacement of pbs blocks, when a block has an entry and an exit pbs signal, covert the entire block to pbs. Can be turned off in the patch settings.
 - Feature: [pbs] Allow showing of reserved status by making the tracks darker, when the pbs debug level is at least 1.
19 years ago
tron 5cbd8b598c (svn r2492) Remove some pointless casts and fix some nearby indentation 19 years ago
tron 9617614b04 (svn r2487) Replace TILE_XY by TileXY/TileDiffXY 19 years ago
tron 2b73dec567 (svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY 19 years ago
tron 80760b4f69 (svn r2485) Missed two uint -> TileIndex, thanks _Luca_ 19 years ago
tron a733fede9b (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile" 19 years ago
matthijs 1876744744 (svn r2448) General cleanup of rail related code, more to follow.
* Add: rail.[ch] for rail-related enums and wrapper functions.
* Codechange: Removed dozens of magic numbers with below enums.
* Codechange: Rewrote CheckTrackCombination().
* Add: TILE_SIZE, TILE_PIXELS and TILE_HEIGHT constants.
* Add: enums RailTileType, RailTileSubtype, SignalType to mask against the map arrays.
* Add: enums Track, TrackBits, Trackdir, TrackdirBits for railway track data. (Note that the old RAIL_BIT constants are replaced by TRACK_BIT ones).
* Add: enums Direction and DiagDirection
* Codechange: Moved a bunch of track(dir) related lookup arrays from npf.[ch] to rail.[ch].
* Codechange: move RailType enum from tile.h to rail.h.
* Add: Wrapper functions for masking signal status in the map arrays: SignalAlongTrackdir, SignalAgainstTrackdir and SignalOnTrack.
* Add: Wrapper functions to access rail tiles, using above enums
* Add: Wrapper functions to modify tracks, trackdirs, directions, etc.
* Add: Wrapper functions for all lookup arrays in rail.[ch] (Arrays are still used in parts of the code)
* Codechange: Renamed some variables and arguments to better represent what they contain (railbit -> track, bits -> trackdirbits, etc.). 
* Codechange: Don't use FindLandscapeHeight() in CmdRemoveSingleRail(), since it returns way too much info. Use GetTileSlope() instead.
* Codechange: [NPF] Removed some unused globals and code from npf.c.
19 years ago
Darkvater c37cf285ce (svn r2433) - CodeChange: unmagicify all road/train crossings with IsLevelCrossing() function (peter1138) 19 years ago
tron ff0030936e (svn r2408) Introduce SetTileOwner() and use it 19 years ago
tron a9b95b3cbb (svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner 19 years ago
Darkvater ba8c649fac (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files. 19 years ago
Darkvater ea9a6ed27b (svn r2289) - Fix (regression): check p1 param of road-depot building instead of unused p2 (typo). Thanks peter1138. 19 years ago
Darkvater 6d349b6284 (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
- CodeChange: changed the airport gui airport-type checking. Added function GetValidAirports() that returns bitmasked availibility, is also used for checking.
- CodeChange: to check tree-planting, 2 const arrays have been moved to table/tree_land.h (type and count)
- CodeChange: added IsTownIndex() in following of IsStationIndex(), etc.
- Fix (regression): road tunnels did not work anymore, forgot that their type was 0x200 (documented now)
19 years ago
Darkvater 2aa7b2d7ea (svn r2142) - Fix: Game no longer crashes when you want to remove a piece of road under a bridge that belongs to the town. TODO: railcrossings store owner somewhere else, put it into _map_owner[]! 20 years ago
tron 70135e74b5 (svn r1902) Replace some casts with proper typing 20 years ago
tron 6d2b9d2c3a (svn r1863) Give the effect vehicle type enums more descriptive names and use the enum as parameter type for CreateEffectVehicle*()
-Fix: [1116619] Generate the correct smoke type for diesel trains
20 years ago
truelight f1610872de (svn r1831) -Fix: Scenario Editor now handles human-made roads better (try to build
a city layout before placing the city, finally that works very nice)
20 years ago
truelight bd7f37d592 (svn r1817) -Codechange: Moved depot-functions to depot.c
-Codechange: Added wrappers around depot-access (GetDepot no exists)
-Codechange: Made depot-functions a bit more logic (no longer 
GetDepotByTile crashes your game when you request it on a non-depot tile)
-Add: made depots dynamic (yes, 64k depots are possible now)
20 years ago
truelight c7eda1b15e (svn r1785) -Fix: space-correctness in road_cmd.c, and one wrong line from last
commit (tnx to DarkVater)
20 years ago
truelight 40323bbce2 (svn r1784) -Fix: removed ClosestTownFromTile where possible, or replaced it
with _map2-data if possible (Celestar / TrueLight)
20 years ago
celestar 2e357e69f9 (svn r1768) -Codechange: Store town index in _map2 of town tiles
Moved house type from _map2 to _map3_hi for MP_HOUSE
  Moved foundation and roadworks from _map2 to _map3 for
MP_STREET
  This increases game speed by a factor of around 15(!) if many cities are around.
  Converting an old game is done automagically, but can take a while
20 years ago
matthijs eb78cdb2d4 (svn r1751) - Feature: New PathFinder (NPF).
- Supports trains, road vehicles and ships.
	- Uses A* pathfinding (same codebase as the new ai).
	- Currently unlimited search depth, so might perform badly on large maps/networks (especially ships).
	- Will always find a route if there is one.
	- Allows custom penalties for obstacles to be set in openttd.cfg (npf_ values).
	- With NPF enabled, ships can have orders that are very far apart. Be careful, this will break (ships get lost) when the old pathfinder is used again.
- Feature: Disabling 90 degree turns for trains and ships.
	- Requires NPF to be enabled.
	- Ships and trains can no longer make weird 90 degree turns on tile borders.
- Codechange: Removed table/directions.h.
	- table/directions.h contained ugly static tables but was included more than once. The tables, along with a few new ones are in npf.[ch] now. Better suggestions for a location?
- Fix: Binary heap in queue.c did not allocate enough space, resulting in a segfault.
- Codechange: Rewritten FindFirstBit2x64, added KillFirstBit2x64.
- Codechange: Introduced constant INVALID_TILE, to replace the usage of 0 as an invalid tile. Also replaces TILE_WRAPPED.
- Codechange: Moved TileAddWrap() to map.[ch] 
- Add TileIndexDiffCByDir(), TileIndexDiffCByDir(). 
- Codechange: Moved IsTrainStationTile() to station.h
- Add: IsRoadStationTile() and GetRoadStationDir().
20 years ago
tron bb680056b1 (svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names 20 years ago
tron 38587b60f7 (svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
This makes it necessary to rename TileType() to GetTileType() because a type and a function may not share the same name.
20 years ago
tron 39858e696b (svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h 20 years ago
tron 97f893ae2f (svn r1596) Add some more statics 20 years ago
tron 94d5aeabb2 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile 20 years ago
tron 90cafa9b15 (svn r1560) Introduce SetTileType() and SetTileHeight()
Replace direct references to _map_type_and_height with these
20 years ago
tron ca8eb44828 (svn r1542) Rename TileHeight to TilePixelHeight, because this is what it actually returns 20 years ago
tron 61a6bc544d (svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts 20 years ago
celestar 957635121c (svn r1504) enummed town ratings (Jango) 20 years ago
tron 4450ff105c (svn r1451) Fix some of the signed/unsigned comparison warnings 20 years ago