Commit Graph

227 Commits (f9f6b5f341b8b296e58fa33a719bfd1ede5ebd05)

Author SHA1 Message Date
peter1138 70306b544f (svn r4910) - NewGRF: add and initialize cargo subtype for vehicle visual variations 18 years ago
bjarni f17a23e06a (svn r4826) -Fix: [autoreplace] fixed possible problem when autoreplacing and was number of vehicles (of a type, not total) was reached
now the new vehicle gets the same number as the old one, completely removing the problem where we could run out of numbers
	since we don't have to find free numbers for the new vehicles, autoreplace should be somewhat faster, specially in late games
	NOTE: in CmdBuildRailVehicle(), bit 0 and 1 in p2 have been switched to make the meaning of bit 0 consistent with the other build commands. CmdCloneVehicle() is modified to follow this as well
18 years ago
rubidium 2a337ab009 (svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency 18 years ago
tron 6dbc9c9ced (svn r4554) Replace magic numbers by TILE_{HEIGHT,SIZE} 18 years ago
Darkvater 0a0b8f22aa (svn r4529) - Codechange: Use proper naming for hex numbers in debug prints eg. 0xF3A6. Use fixed lengths where applicable (newgrf). Unfortunately '%#X' is unusable since it gives 0XFF3 and '%#x' gives 0xff3 while we want 0xFF3 :P 18 years ago
celestar 78f95ecdeb (svn r4507) Just a comment 18 years ago
celestar dd3a3adbbd (svn r4506) -Fix: (FS#95) Use the tile hash when pathfinding to a depot. Eats a tiny bit of performance, but the likelihood that the depot is found is greatly increased 18 years ago
Darkvater fd8e02119c (svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron. 18 years ago
belugas fbf6dd2cb9 (svn r4359) MSV6 Release mode now compiles (problem of UINT_MAX. stdafx.h should be the first include). Thanks to KUDr for solution and testing 18 years ago
tron 35e93e451f (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()
18 years ago
tron d68d287708 (svn r4326) Only reduce the slot age of a vehicle if it has a slot assigned 18 years ago
celestar 8cbe98a3fd (svn r4259) -[multistop] Fix/Feature/Codechange:
1) Improved the road vehicle allocation (aka slotting) for multistop. Stops can now accept unlimited, er... 256, vehicles.
2) Removed the "wait for stop" feature, because it did not work in practise.
3) Slotting now ignores unreachable stations. Uses NPF at the moment because the old pathfinder cannot do it (yet)
4) Now matter how many vehicles approach a station, they will always be distributed evenly over existing stops.
5) Hopefully the last fundamental change to multistop
19 years ago
celestar 6443c14ebd (svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE 19 years ago
celestar 2ab5b8e666 (svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency 19 years ago
tron c40740e058 (svn r4120) Use the new station functions where appropriate 19 years ago
tron f6285a659c (svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile 19 years ago
celestar d0908375f4 (svn r3909) [multistop]
-Codechange: No longer hijack the VS_STOPPED flag when waiting for a slot.
-Fix: Vehicles waiting for slots can still be controlled (sent to depot, orders modified, ...)
-Fix: Vehicles no longer stop on crossings and during overtake operations
19 years ago
tron 00cf5c9acf (svn r3832) Replace some magic numbers by (Diag)Direction enums 19 years ago
tron 0100871412 (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 19 years ago
tron 7803f259e2 (svn r3798) Fix typo in r3795 19 years ago
tron cf7b94254e (svn r3796) When unmagicfying code, do it Right(tm) and also give the variables sensible names. I flipped a 'b' and a 'd' in r3785 19 years ago
tron 86550c94bc (svn r3795) Add a function to request the orientation of a depot 19 years ago
tron ab9af3b05d (svn r3787) Use DirToDiagDir() instead of >> 1 19 years ago
tron fa6632ec32 (svn r3786) More work for DirDiff 19 years ago
tron f0d82204e0 (svn r3785) Replace some if-magic to determine the turning direction for road vehicles with the new DirDiff stuff 19 years ago
tron 8cfcdaa733 (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends 19 years ago
tron 49cb8eb470 (svn r3776) Replace many ints and magic numbers by Direction, DiagDirection and friends 19 years ago
tron 4efa560ffc (svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme 19 years ago
tron ca0862c3f4 (svn r3758) Remove the news validation callback. It is superseded by r3757. 19 years ago
tron 332b54d5a6 (svn r3757) -Feature: Delete news items about vehicles, when they get stale
This is used to delete
- all news about a vehicle, when it gets deleted
- "vehicle has stopped in depot" news, when it gets started
- "vehicle has invalid orders" news, when the orders get changed
19 years ago
tron f383a038f0 (svn r3754) Miscellaneous changes: indentation, reduce variable scope, constness, avoid some more function pointer casts 19 years ago
tron 622b4d4036 (svn r3752) FYOS avoid to cast function pointers 19 years ago
tron 36467a4bcf (svn r3751) -Fix: Correctly implement minimum search, so road vehicles head twoards the closest station, not the last one in the list 19 years ago
tron 2942939ad1 (svn r3750) Use INVALID_STATION instead of -1 in NPF 19 years ago
celestar db4777c818 (svn r3730) Multistop modifications:
-Codechange: Completely rewritten the slot assignment system. It now consumes less CPU cycles and memory
-Codechange: Increased maximum number of roadstops to 16.
-Fix: Several conditions where a slot becomes unliked from a vehicle
-Codechange: ClearSlot now only takes one parameter, the vehicle
-Feature: Console command 'clearslots' to clear ALL currently assinged slots. debug usage only
-Feature: vehicles that cannot get a slot now wait on the road instead of planlessly blocking stops or circling around
-Codechange: Adjusted debug levels
TODO: Make the slot finder compatible with (a) pathfinder(s).
19 years ago
peter1138 b32bd10590 (svn r3681) - [Multistop] Check the RoadStop type before check its status. This fixes an assert introduced in r3663. Also fix the return type of GetRoadStopType(). 19 years ago
peter1138 ea59cc4a26 (svn r3663) - Fix: [Multistop] Check the status of the destination road stop instead of a station's first road stop. This only has effect with road vehicle queuing disabled. 19 years ago
tron 2f8e3dcc05 (svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces 19 years ago
tron 661bad9032 (svn r3643) Remove a local variable which is just a pointer to a road stop status field and had the sensible name 'b'; instead directly use the road stop status field 19 years ago
tron 7692556c62 (svn r3613) Some more const, indentation, whitespace and similar stuff 19 years ago
peter1138 95ce125633 (svn r3612) - RoadStop->slot[] stores a vehicle index. Adjust its type and use INVALID_VEHICLE instead of nonsense INVALID_SLOT. 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
peter1138 30429dc4fb (svn r3589) - Rename u.road.unk2 to u.road.blocked_ctr 19 years ago
tron c60b3216ae (svn r3584) Replace the rather obscure control flow for handling road vehicle orders by something remotly comprehensible 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
peter1138 6c28b1cec7 (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files. 19 years ago
peter1138 2a71cd9dcf (svn r3513) Fix strange typo in last commit ... 19 years ago
peter1138 49e51cf27f (svn r3512) Yet more whitespace fixes (mostly by Rubidium) 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 ec74a57ada (svn r3489) Remove an unused declaration 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
bjarni 2b31f5fe7e (svn r3402) -Fix: [building/cloning] added a string telling if build failed due to not being able to build a vehicle. Triggered when cloning a retired design 19 years ago
truelight 6b7d0a2641 (svn r3371) -Fix: don't allow road-vehicles to perform an out-of-bound operation while overtaking in a curve (tnx to guru3, Tron and peter1138)
-Codechange: while at that, removed a local variable (more pretty :))
19 years ago
tron 2053685fb5 (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
As side effect this is a
-Fix: The default AI tried to change the service intervals of vehicles via the CMD_CHANGE_TRAIN_SERVICE_INT command - regardless of the type of the vehicle - which of course failed for non-trains
19 years ago
tron 318fe153eb (svn r3365) Staticise 36 functions 19 years ago
tron 2cfdfb5d96 (svn r3358) Remove another piece of unused code 19 years ago
peter1138 901068fd6e (svn r3352) - NewGRF: Move initialization of vehicle random_bits to DC_EXEC blocks to allow use of Random() instead of InteractiveRandom(), which will alleviate some possible network desyncs. 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
tron a2533d5ee6 (svn r3298) Remove unused and write-only variables 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
peter1138 2a9d325930 (svn r3213) - Codechange: Clean up handling of road stops, avoiding unnecessary use of pointers and using the *BIT() macros. 19 years ago
tron d09db07ca1 (svn r3204) Make handling of clicking on vehicles a bit less ugly by avoiding function declarations in .c files and unnecessary indirection 19 years ago
tron 6509e42db3 (svn r3179) - RandomRange() and RandomTile() instead of home brewed versions
- CHANCE*() instead of mumbling strange numbers
19 years ago
tron 81e5b16d71 (svn r3172) static, const 19 years ago
bjarni 1b3e626ff9 (svn r3156) -Fix: removed some cases where autoreplace windows were redrawn when nothing was changed
due to the FOR_ALL_VEHICLES(), redrawing those windows are slow
19 years ago
bjarni fa5ca040e9 (svn r3111) -Fix: [autoreplace] [ 1341783 ] Assertion failure in vehicle.c line 378
running MaybeReplaceVehicle() is now delayed until after the loop in CallVehicleTicks()
	This avoids selling the vehicle the loop currently works with (and continues to work with afterwards)
19 years ago
bjarni 17d341b902 (svn r3101) -Codechange: added _new_vehicle_id
this var works like _new_train_id and the rest of that kind of vars, except it is set each time a vehicle is build, nomatter what type
	this is a nice tool to code vehicle independent code, which in turn can reduce code duplication
	Right now it's used in ReplaceVehicle() and CmdCloneVehicle()
19 years ago
bjarni 0f5c8787f8 (svn r3081) -Codechange: [autoreplace] complete rewrite of autoreplace
this is a complete rewrite, that makes use of existing commands like build and sell
        this means that multiheaded train engines are replaced correctly
19 years ago
tron 355d834c6e (svn r3079) Determine the type of the "first arrival" message for road vehicles using the cargo type and not a magic engine number 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 39f5dbfd3b (svn r3019) -Codechange: Replace explicit shifting/anding/oring with GB and SB 19 years ago
tron 6d7c7e67b2 (svn r3010) Get rid of quite some dubious casts, either by using GB(), proper types or just removing them 19 years ago
tron 0ad3902acf (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts) 19 years ago
peter1138 9e20ae4222 (svn r2990) Remove _engine_original_sprites and replace all uses with references to our (new) original engine/vehicle tables. 19 years ago
tron 2ae758a32b (svn r2780) Remove some more unused strings and make the use of a few strings more explicit 19 years ago
celestar 1e67dfffe7 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167 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
tron 6ad3895306 (svn r2660) Get rid of some more shifting/anding/casting 19 years ago
Darkvater 5261529887 (svn r2617) - Fix: fix some warnings, and reenable vs.net2003 signed/unsigned warnings 19 years ago
ludde 8257102045 (svn r2604) Fix: removed unused variable 19 years ago
ludde 05dc6ecebc (svn r2603) Fix [multistop] Fix problem with multistop handling, the range in my fix was way too high. Also only lock a slot for 5 days instead of 30. 19 years ago
ludde d4e0c72867 (svn r2599) Fix: Road vehicle multistop handling used NPF even if NPF was off????
- Also simplified/optimized the code.
 - Now it uses manhattan distance as an approximation instead of actual distance to find the distance. Much faster.
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
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
tron 62b5e913c6 (svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies 19 years ago
tron 5cbd8b598c (svn r2492) Remove some pointless casts and fix some nearby indentation 19 years ago
tron 2b73dec567 (svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY 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
celestar c7de834059 (svn r2441) -Feature: You can now give transfer order to set up feeder systems 19 years ago
Darkvater c37cf285ce (svn r2433) - CodeChange: unmagicify all road/train crossings with IsLevelCrossing() function (peter1138) 19 years ago
tron d2364f1d51 (svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[] 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 562a32c3ee (svn r2297) - CodeChange: server-check the next batch of commands.
- CodeChange: since only the server will be able to modify difficulty settings, leave the checking of correct values besides, and trust users will join legit servers.
- CodeChange: for renaming signs, only check if GetDParam(); eg _decode_parameters is empty ('\0') or not, instead of the extra check of players, etc. That basically does the same thing. Also dirty sign two times when renaming, once before, once after the action. Because if the name becomes shorter and you update only after, garbage remains on the screen.
- CodeChange: made GetMaskOfTownActions() available to the town-cmd to double-check if the action was available to the player. For this purpose the hardcoded _local_player has been removed from the function and is now passed as a parameter.
19 years ago
Darkvater 5693f22f18 (svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points. 19 years ago