Commit Graph

219 Commits

Author SHA1 Message Date
tron 8bd664f81f (svn r4771) -Regression: It was possible to remove a bridge while a vehicle was on it 2006-05-07 11:55:28 +00:00
tron 24854be59e (svn r4766) -Fix: Vehicles on a sloped tile under a bridge were affected by the bridge speed limit 2006-05-07 08:18:12 +00:00
tron 5622ad4b5e (svn r4765) Add GetTileMaxZ(), which returns the height of the highest corner of a tile, and use it to simplify the code in a few places 2006-05-07 07:55:05 +00:00
tron 18ad0ae50e (svn r4572) Remove vehicle_leave_tile_proc
There's exactly one implemented function (unbarring a level crossing) and one place where it can be triggered (a train leaves a level crossing)
It's a bit overkill, so just handle this one case where it can happen
2006-04-25 07:32:33 +00:00
tron c1dc517dab (svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE} 2006-04-23 19:35:36 +00:00
tron 0347fb2ab6 (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums 2006-04-23 13:48:16 +00:00
Darkvater e21b7eebfa (svn r4430) - NewGRF: Use the bridge's sprite layout for drawing high pillars. This fixes newgrf's high-bridge pillars drawing. Also remove the now obsolete _bridge_poles_table which was already integrated into the bridge sprite tables 2006-04-15 16:07:00 +00:00
tron c26601eabd (svn r4402) Fix a faulty entry in the table for slopes under bridges, remove a now unnecessary test which hid the faulty entry till now and undo r4398 (don't do this!) 2006-04-12 19:05:31 +00:00
celestar a588d816ff (svn r4398) -Fix: Quick and Dirty solution for FS#116. Just for the nightlies 2006-04-12 17:58:58 +00:00
celestar 5c3c4d190e (svn r4392) -Codechange: Use water map accessors in bridge code 2006-04-12 15:23:32 +00:00
celestar 75f978626a (svn r4391) -Fix: faulty ")" in previous commit 2006-04-12 15:21:33 +00:00
celestar 17da0bb976 (svn r4390) -Codechange: Upon merging elrails, one direct map access to the railtype went unnoticed... 2006-04-12 15:08:48 +00:00
tron 4615a26552 (svn r4374) Never directly commit something you prepared the evening before, mysteriously it will break in the morning, fix r4373 2006-04-12 05:26:36 +00:00
tron 82afa4caf2 (svn r4373) Rewrite GetSlopeZ_TunnelBridge() and slightly change its behavior:
- Report the correct z alongside the ramp when a foundation is present
- Always report the z under the bridge for a bridge middle part, except if the z hack is used
This should fix some weird behavior of the tile selector near bridges
2006-04-12 05:19:19 +00:00
tron 7a3345f4df (svn r4344) Use tile coordinates or even TileIndices instead of virtual tile coordinates where it suffices. 2006-04-10 12:36:04 +00:00
tron 81e6d68f95 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
Remove DoCommandByTile(), because now it does the same as DoCommand()
2006-04-10 07:15:58 +00:00
Darkvater fc68881906 (svn r4265) - Fix: compile warning on VS2005 (parameter 2 different from declaration) 2006-04-03 18:11:42 +00:00
celestar cc87f682b9 (svn r4249) -Codechange: Replace more occurences of 16 by TILE_SIZE and of 8 by TILE_HEIGHT. Reverted one change from the previous commit because it was faulty 2006-04-03 09:07:21 +00:00
tron 892a4c587d (svn r4242) Pass TileIndex and slope to GetSlopeTileh_*() instead of TileInfo 2006-04-02 12:49:18 +00:00
belugas 80570009dd (svn r4181) CodeChange : Replaced [G/S]etMapExtraBits by [G/S]etTropicZone. Although it was an accessor, nor his usage nor the values were clear. 2006-03-30 19:16:44 +00:00
tron d9e705ae52 (svn r4164) Use acessor functions 2006-03-30 09:08:43 +00:00
belugas 3633d56923 (svn r4157) CodeChange : Keep on cleaning up Celestar's elrail merge 2006-03-29 20:35:39 +00:00
celestar a7d8ad0004 (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. 2006-03-29 16:30:26 +00:00
tron 9d216c1c56 (svn r4047) Remove two calls to FindLandscapeHeight() and some confusing use of the comma operator 2006-03-23 06:30:39 +00:00
tron 77e5cf4bc1 (svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles 2006-03-19 12:06:12 +00:00
tron dacbf1a433 (svn r3922) Fix copy&pasto in r3916 (Slowly it's getting a bad habit) 2006-03-17 13:28:50 +00:00
tron 89090790c2 (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}() 2006-03-17 10:10:31 +00:00
tron b8da06ddb1 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX 2006-03-16 15:16:27 +00:00
tron d6134455a5 (svn r3906) Before removing a rail/setting the owner of a road to none check if there's a transport route at all under the bridge 2006-03-16 13:35:35 +00:00
tron 483c8f7018 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper 2006-03-16 10:00:50 +00:00
tron a3c45635a7 (svn r3903) Fix a copy&pasto in last commit and remove a redundant comment (the line above already says what's going on) 2006-03-16 07:18:38 +00:00
tron 1257d9e565 (svn r3902) When drawing a bridge middle part get the bridge axis only once instead of again and again 2006-03-16 07:12:28 +00:00
tron efb64283df (svn r3901) Remove the last user of FindEdgesOfBridge() by using functions with similar functionality 2006-03-16 06:38:51 +00:00
tron fedebdd09b (svn r3900) When clearing a bridge determine the bridge direction and tile offset once instead of all over the place; also use UpdateSignalsOnSegment() instead of SetSignalsOnBothDir(), because this is sufficient 2006-03-16 06:30:47 +00:00
tron 8a77808f65 (svn r3899) Use wrapper functions to make more clear how deleting stuff under bridges works; also remove an unnecessary local variable 2006-03-16 06:06:05 +00:00
tron ec33376fa3 (svn r3898) Add functions to find a bridge end starting at a middle tile 2006-03-16 05:28:15 +00:00
Darkvater 748d082a79 (svn r3893) - Fix: Properly set back the owner of a crossing/road-under bridge after removing it. For crossings we can always use .m2 because it is already 0 when not owned by a town. 2006-03-15 21:27:19 +00:00
tron 76aa40cecf (svn r3891) Fix r3885 2006-03-15 19:53:25 +00:00
tron b36203f671 (svn r3890) Simplify deleting a bridge by handling the ramps outside of the removal loop 2006-03-15 17:38:00 +00:00
tron f262ae6c8b (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors 2006-03-15 17:27:15 +00:00
tron dcf6c85bf2 (svn r3888) If you think you've checked everything, check once more. *sigh* Fix r3887 2006-03-15 16:47:35 +00:00
tron 3d9c76d8b8 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp 2006-03-15 16:44:50 +00:00
tron 962852b732 (svn r3885) Simplify DoConvertTunnelBridgeRail() a bit 2006-03-15 16:09:23 +00:00
tron 251242165c (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part 2006-03-15 07:10:41 +00:00
tron 42d1731cc1 (svn r3857) Add and use GetBridgeRampDirection()
Note: This slightly changes the behavior of GetAnyRoadBits() to only return a road piece for the start of the bridge ramp instead of a full ROAD_[XY]
2006-03-14 12:00:11 +00:00
tron b812bbeda3 (svn r3849) Fix bug in r3846 2006-03-13 15:38:52 +00:00
tron e8ccd9641f (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges 2006-03-13 12:55:20 +00:00
tron 1067069e33 (svn r3838) Demystify building bridge middle parts a bit by removing some magic numbers and generic names 2006-03-13 07:12:49 +00:00
tron 2732fc8d6f (svn r3837) Partially unmagicfy restoring the tiles when deleting a bridge
Existing bug: When restoring a road piece which belongs to a town the town index unconditionally gets set to 0
2006-03-12 20:59:56 +00:00
tron 78083f0da7 (svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does 2006-03-12 15:04:03 +00:00
tron b394f72fa9 (svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable 2006-03-12 12:19:25 +00:00
tron b9ade45008 (svn r3823) Remove dead code: A value for 'image' gets calculated and overwritten just a few lines later without being used in between 2006-03-12 08:47:18 +00:00
tron e63e3bb84c (svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types 2006-03-11 17:06:16 +00:00
tron 6892e04d14 (svn r3814) Remove another call to FindLandscapeHeight() 2006-03-10 17:01:51 +00:00
tron 78a7b15ce0 (svn r3803) Change the second parameter of UpdateSignalsOnSegment() from Direction to DiagDirection as that's what it really operates on 2006-03-09 12:32:25 +00:00
tron fbe939b31f (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends 2006-03-08 06:55:33 +00:00
tron 313754011d (svn r3779) Move CheckTunnelInWay() to a more appropriate place, invert its result and give it a less ambiguous name (IsTunnelInWay) 2006-03-07 07:51:05 +00:00
tron f2dc736554 (svn r3777) Add some functions to handle tunnels 2006-03-06 20:55:24 +00:00
tron 2d3c28f2b3 (svn r3776) Replace many ints and magic numbers by Direction, DiagDirection and friends 2006-03-06 20:28:28 +00:00
tron cc4f5b4e6f (svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme 2006-03-05 10:19:33 +00:00
tron df156dacb2 (svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces 2006-02-23 08:20:28 +00:00
tron ae02bd6506 (svn r3654) Turn another if-cascade into a switch 2006-02-22 21:35:45 +00:00
tron 9a364389cb (svn r3653) -Fix: You didn't pay for terraforming at the end tile when building a tunnel 2006-02-22 21:11:31 +00:00
tron d451db7a5f (svn r3652) Rewrite CmdBuildTunnel in the hope to make it a bit more comprehensible
This implementation is also significantly shorter because it removes many redundant checks
2006-02-22 21:09:55 +00:00
tron 2e3e9daf32 (svn r3645) Fix stupid typos in last (r3644) commit *sigh* 2006-02-21 07:44:33 +00:00
tron 4b46883751 (svn r3644) Don't use FindLandscapeHeightByTile() when it's overkill - often it was just a complicated way of writing GetTileSlope(tile, NULL) 2006-02-21 07:41:54 +00:00
tron 49c7eb934b (svn r3613) Some more const, indentation, whitespace and similar stuff 2006-02-18 14:41:24 +00:00
tron ea73b46684 (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 2006-02-13 21:15:00 +00:00
tron 453b30e387 (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
2006-02-06 09:18:04 +00:00
tron b844aa2db3 (svn r3520) Remove unused parameters from some functions 2006-02-02 07:15:46 +00:00
tron 84fb96fe85 (svn r3511) More whitespace ([FS#46] by Rubidium) 2006-02-01 07:36:15 +00:00
tron 22dc05faf2 (svn r3510) Fiddle with whitespace and parentheses 2006-02-01 06:32:03 +00:00
tron 5e1e902600 (svn r3490) -Fix: A bunch (10) of off-by-one errors when checking if a TileIndex points to a tile on the map 2006-01-30 17:18:45 +00:00
tron 2f668b8669 (svn r3487) -Fix: Price for demolishing a bridge was dependent on orientation and map size 2006-01-30 16:48:24 +00:00
Darkvater 4e09974975 (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.
2006-01-29 18:57:26 +00:00
peter1138 cc7a9d1ce6 (svn r3418) - Fix: When removing a town-owned tunnel the player's rating was not reduced, as it checked the ownership of the tunnel after clearing it. Now we perform the rating adjustment before clearing the tiles. (spotted by glx) 2006-01-22 16:23:05 +00:00
peter1138 019e794234 (svn r3391) - PBS Fix: Keep PBS reservation state when building a bridge over rail. 2006-01-08 12:44:11 +00:00
tron 28fe368b7f (svn r3308) BAD
foo.h: int bar;

GOOD
foo.h: extern int bar;
foo.c: int bar;
2005-12-15 17:55:59 +00:00
peter1138 809b03c81a (svn r3282) - Codechange: Replace tests against CMD_ERROR with CmdFailed() 2005-12-10 12:05:39 +00:00
bjarni 22a4679837 (svn r3218) -Feature: Multiheaded train engines will now stay in the same train
This means that any user attempt to remove a rear engine will tell the user to move the front engine instead
	This fixes the assert when moving multiheaded engines (introduced in r3144)
	Note: to make old savegames use this feature, some engines might be turned around in order to link engines in pairs

-Codechange: train subtype is now a bitmask
	This allows fast access to info like if it is a wagon or engine and if it is in front and so on
	Note: savegame version bump
2005-11-18 23:41:03 +00:00
tron ec57ef78a2 (svn r3205) Some more uses for GB/SB 2005-11-16 13:11:28 +00:00
tron 9f8c5d8fd2 (svn r3186) Unnecessary casts and truncation 2005-11-15 09:05:16 +00:00
tron 1b0091e0d2 (svn r3184) GB/SB 2005-11-15 08:49:46 +00:00
tron f7abff5f96 (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
2005-11-14 19:48:04 +00:00
tron 833032adc0 (svn r3177) GB, CLRBIT, HASBIT, TOGGLEBIT 2005-11-14 08:09:57 +00:00
tron ece9b9b2b6 (svn r3066) Constify the parameter of GetSlopeZ_*() 2005-10-19 14:49:46 +00:00
celestar 5f604ec63a (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. 2005-10-19 08:34:37 +00:00
tron 758ae7e8f6 (svn r3064) Replace some numbers by sprite names 2005-10-19 06:46:41 +00:00
tron d5042d4ab2 (svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list 2005-10-15 11:06:54 +00:00
tron 7520ef8f33 (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 2005-10-13 16:00:14 +00:00
tron 76db75d81a (svn r3028) s/255/OWNER_SPECTATOR/ 2005-10-10 10:36:37 +00:00
tron ae4a1f3675 (svn r3019) -Codechange: Replace explicit shifting/anding/oring with GB and SB 2005-10-05 07:20:26 +00:00
peter1138 adc5c1230f (svn r3004) -Feature, NewGRF: Support loading of bridge attributes and tables from GRF. Currently drawing tall pillars uses old data. 2005-10-01 17:38:48 +00:00
Darkvater 8e6a911700 (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
2005-09-18 20:56:44 +00:00
truelight 2e87864d0b (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..
2005-09-13 12:19:27 +00:00
tron af819c3822 (svn r2840) Remove 3 unnecessary strings (they're empty) and fix the alignment of the musick track display 2005-08-08 10:42:02 +00:00
bjarni ed8e2bac04 (svn r2817) -Codechange: [autoreplace]: moved autoreplace and autorenew to serverside
-This means that one company can only have one setting for renew and replacing
    more clients will not fight due to different settings anymore
  -This is a needed step in the line to fix autoreplacing dualheaded locomotives
  NOTE: savegame revision bump (peter1138 + me in coop)
2005-08-06 16:07:22 +00:00
celestar 66fa62b3ea (svn r2782) -Codechange: Started cleaning the bridge code. Removed numerous global variables containing bridge information and joined them in a struct. Introduced GetBridgeType and GetBridgePiece and fixed some minor stuff (whitespace etc) 2005-08-01 20:23:38 +00:00
ludde 29564f9fcf (svn r2781) Fix some of the issues with variables in .h files. 2005-08-01 16:31:19 +00:00
tron 91353c841f (svn r2780) Remove some more unused strings and make the use of a few strings more explicit 2005-08-01 13:01:14 +00:00