Commit Graph

49 Commits (725cfc26d0a323b8649369c048acf6192d8875e4)

Author SHA1 Message Date
tron dd180a1e18 (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums 18 years ago
celestar 01cd0f6fd3 (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions 18 years ago
celestar 62ded2f58d (svn r4376) -Codechange Renamed GetSignalState to GetSignalStateByTrackdir 18 years ago
peter1138 b87b68842a (svn r4354) [Elrail][NewGRF] Codechange: Drawing of custom waypoints with custom ground sprites used the index of the rail type as an offset. With the introduction of elrails this offset is incorrect, so instead there is now a lookup table within the RailTypeInfo struct to explicitly list the offset. 18 years ago
tron 28dfdd7863 (svn r4351) Simplify ReverseTrackdir() to use a simple arithmetic operation instead of a table lookup 18 years ago
tron 93789afac7 (svn r4349) Remove GetCrossingTransportType(), it's slightly overkill 18 years ago
tron a9b607f259 (svn r4348) Move IsLevelCrossing() from rail.h to road_map.h 18 years ago
orudge ff3c61b011 (svn r4204) - Get trunk compiling again on OS/2 19 years ago
celestar 6c44bf5012 (svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas. 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 76ae9585dd (svn r3946) Add short hand names for common track combinations 19 years ago
tron dabfa14778 (svn r3941) Get rid of RAIL_TYPE_SPECIAL 19 years ago
tron 853a9b2da4 (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round 19 years ago
tron 4fb11f23ad (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions 19 years ago
tron 0e3699bd5c (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore) 19 years ago
tron f6176a89f9 (svn r3767) Move all direction related enums and functions to a separate header 19 years ago
tron d851781663 (svn r3747) Change HASBIT() to return 0/1 instead of 0/value of tested bit, because the name suggests it does the former and current behavior broke in some places in very subtle ways (for example HASBIT(x, 0) != HASBIT(y, 1) doesn't work, returning a bool after HASBIT(x, 9) neither) 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 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 9712d6f639 (svn r3510) Fiddle with whitespace and parentheses 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
Darkvater 9eb1589827 (svn r3466) - Codechange: Some changes to increase readability of signals code. 19 years ago
peter1138 e8e7794c97 (svn r3443) - Fix signed/unsigned comparison warning when compiling with gcc 2.95 (tokai) 19 years ago
tron 318fe153eb (svn r3365) Staticise 36 functions 19 years ago
matthijs 30397b6561 (svn r3329) - Doc: Some documentation cleanups.
- Add: TracksOverlap() (from the map branch), TrackdirBitsToTrackBits(), DiagdirReachesTrackdirs(), DiagdirReachesTracks().
 - Fix: Infinite loop in the pathfinder introduces in r3321.
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
celestar ab049c7bca (svn r3065) -Codechange/Add: Modified the bridge drawing code so that the basic offset is read from the RailTypeInfo struct. This is (hopefully) the last DrawTile change on the way to electrified railways. While being at it, de-mystified the function a bit and added some asserts. 19 years ago
tron e3d1e43559 (svn r3049) Replace byte/int/uint by RailType where appropriate 19 years ago
tron 8d4ed0840b (svn r3040) Don't deduce the cursor sprites when building rails from magic numbers, but fetch them from the central rail info array. 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
peter1138 fdebfbe8d5 (svn r2998) -Codechange: Split rail drawing code off from DrawTile_Rail into a separate function to be used elsewhere. (Deja vu?) 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
celestar 940872e51f (svn r2798) -Codechange: Unified the rail toolbars into one that is modified by
request using the RailtypeInfo struct
19 years ago
celestar 5352ad4582 (svn r2774) -Codechange: Removed TRACKTYPE_SPRITE_PITCH globally and replaced it by a member of RailtypeInfo 19 years ago
ludde b8c9194b7c (svn r2756) Renamed railtypes into _railtypes
Renamed railtypes.c into railtypes.h, all other tables are in .h files. (It should be in the tables dir but I couldn't figure out how to get it there without deleting it first).
Added const and extern.
19 years ago
celestar f287f2ff8d (svn r2753) -Codechange: Introduced a new struct "RailtypeInfo" to store rail type specific information. Begun populating it with a bunch of sprites, more to come later. This should result in cleaner, more compact code which allows easy introduction of new railtypes. 19 years ago
celestar a855a54686 (svn r2752) -Doc: Added some doxygen stuff to rail.h. I'm gonna mess around with this file and wanted to get rid of this first 19 years ago
tron 647cbd6bdd (svn r2701) Insert Id tags into all source files 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
celestar 84faec4c43 (svn r2541) -Feature: Modified IsCompatibleRail so that an engine can move on more
than one railtype (like Diesel engines on electrified rail).
-Codechange: Use IsCompatibleRail where it should be used
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
matthijs e675794812 (svn r2514) - Codechange: [NPF] Move the checking of railtype into a funciton IsCompatibleRail().
- Codechange: [NPF] Check the railtype along a route against the engine type instead of against the previouse tile. This clears the way for electriefied rails.
- Add: [NPF] [ 1209644 ] A penalty for crossings (peter1138)
19 years ago
celestar edf89d7950 (svn r2507) -Fix: Forgot to change an enum in rail.h in r2499 (thanks blathijs for
pointing it out)
19 years ago
matthijs c074f4e935 (svn r2473) - Add: VehicleMayEnterTile(), which checks if the tile owner of a tile is correct for a vehicle to enter it. Based upon glx's code.
- Fix: [ 1203769 ] [NPF] NPF tries to plan over bridges, through tunnels, over level crossings of other players. (glx)
- Codechange: Renamed TRANSPORT_MAX to TRANSPORT_END and added INVALID_TRANSPORT.
- Codechange: Moved IsLevelCrossing() from tile.h to rail.h
- Add: GetCrossingTransportType(), which returns the transport type (road, rail) of both tracks on a level crossing.
- Removed old TODO that was fulfilled already.
19 years ago
matthijs 84655ddb15 (svn r2456) * Prettyfied npf.c using enums and wrappers from rail.h.
* Moved GetTileRailType() from npf.c to rail.[ch].
19 years ago
matthijs ee4d9dbf0d (svn r2454) * Codechange: Move #include "stdafx.h" and "openttd.h" from rail.h to rail.c
* Codechange: Move declaration of lookup arrays into the functions that need them. This doesn't pollute the global namespace with the array names.
* Add: rail.h to the openttd.vcproj and openttd.dsp for MSVC.
19 years ago
matthijs 17750a66f3 (svn r2453) * CodeChange: Declared the lookup arrays in rail.h as extern, so the linker will complain if they are not defined (ie when rail.c is not included). 19 years ago
matthijs a63a84ef5d (svn r2450) * Codechange: Replaced all uses of the arrays in tile.h with calls to the associated wrapper functions.
* Codechange: Made npf.c use some map array accessing wrappers instead of direct access.
* Codechange/Fix: Named every enum in tile.h. Fixes a nasty bug on MSVC where arrays would be initialised with zeroes (tnx Asterix_)
* Removed magic numbers from tables in tile.c.
* Added some explicit casts in tile.h.
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