Commit Graph

205 Commits

Author SHA1 Message Date
peter1138 0a532f8491 (svn r4760) - Newstations: change the way custom stations are allocated when loading from GRF, as the current way was flawed (reallocing memory which is referenced elsewhere) 2006-05-06 22:20:16 +00:00
peter1138 82037a5abe (svn r4752) - NewGRF: brokenness slipped through... 2006-05-06 20:27:32 +00:00
peter1138 416f8ec5fb (svn r4751) - NewGRF: when assigning new texts, ignore the feature byte as some sets use generic feature always. Also, don't add vehicle id shifts if the vehicle id is out of range. 2006-05-06 20:20:02 +00:00
peter1138 a55ac6efac (svn r4738) - Newstations: attach all sprite group cargo types, not just the default and purchase pseudo types, to a station spec. 2006-05-04 19:15:02 +00:00
peter1138 b4a254cd43 (svn r4722) - Newstations: release station sprite layout data when uninitializing NewGRF data. 2006-05-03 21:07:44 +00:00
peter1138 debfc88862 (svn r4720) - Newstations: instead of literally copying sprite layout data, just copy the pointer to the existing data. 2006-05-03 20:42:45 +00:00
peter1138 76411cef63 (svn r4719) - Newstations: instead of drawing nothing, fall back to the default sprite layout if a station layout specifies so. 2006-05-03 20:35:41 +00:00
peter1138 6b01384faf (svn r4716) - NewGRF: fix problem with loading custom station class id; use BSWAP32() only on variables, not functions. 2006-05-03 19:31:00 +00:00
peter1138 a8bd882577 (svn r4704) - NewGRF: in Action 0x03, set the engine type's GRF ID on the 'default' cargo type, not for each specific cargo. Fixes '(undefined string)' issues, as some engines weren't set properly. 2006-05-02 21:58:02 +00:00
peter1138 b1f436df59 (svn r4658) - NewGRF: add Action 0xNN comments before each action handler. This mainly aids code navigation... 2006-05-02 09:31:59 +00:00
peter1138 b1e928e889 (svn r4657) - NewGRF: use grf_load_byte() in favour of array accesses 2006-05-02 09:18:51 +00:00
Darkvater 08e10e167f (svn r4655) - Fix [NewGRF r4654]: /me bangs head against the wall....gaah 2006-05-01 21:47:30 +00:00
Darkvater c0cf93a9b0 (svn r4654) - Fix [NewGRF]: Properly read in the GRFID. This fixes GRFID checking and activation/deactivation. Do swap the GRFID for displaying purposes. 2006-05-01 21:45:35 +00:00
peter1138 6ed002db53 (svn r4652) - NewGRF: support loading of foundation and canal graphics from NewGRF files via action 5 2006-05-01 18:57:43 +00:00
peter1138 6942f235cc (svn r4651) - NewGRF: support loading of catenary sprites from NewGRF files. This actually works by replacing our hardcoded sprites. 2006-05-01 16:54:18 +00:00
peter1138 4e85de164c (svn r4650) - NewGRF: use the correct type for _cur_spriteid 2006-05-01 16:52:43 +00:00
peter1138 f4dcf22f2c (svn r4645) - NewGRF: pretend to be the last alpha version of TTDPatch in our version value. 2006-05-01 12:07:44 +00:00
peter1138 ddbb61199b (svn r4632) - NewGRF: support loading of helicopter rotor sprites (mart3p) 2006-04-30 18:41:16 +00:00
peter1138 967752fe7c (svn r4631) - NewGRF: fix incorrect length check 2006-04-30 18:39:31 +00:00
belugas 187013b6a3 (svn r4593) CodeChange : Renamed spec (when using StationSpec) to statspec.
This is following the same scheme as for IndustrySpec
2006-04-27 18:28:56 +00:00
peter1138 a0c9b03801 (svn r4588) - NewGRF: silence a false compiler warning 2006-04-27 06:33:21 +00:00
peter1138 2f01c7d990 (svn r4583) - NewGRF: Revamp sprite group loading to support advanced varadjusts and variable size. These are not yet processed, however. 2006-04-26 20:44:28 +00:00
peter1138 b81e6dd6a2 (svn r4582) - NewGRF: include an additional check to see if a spriteset id is within range. 2006-04-26 20:18:29 +00:00
peter1138 2b96c107fa (svn r4581) - NewGRF: replace replicated action 2 code with two functions to simplify code somewhat. Also check that a sprite id is
valid.
2006-04-26 19:42:05 +00:00
peter1138 7555d8528b (svn r4559) - NewGRF: keep a record of which grf an engine is defined in. Will be used in the future. 2006-04-23 22:25:33 +00:00
peter1138 72d3fabb58 (svn r4552) - NewGRF: fix braino... in r4550, new_scheme should true when the version is 7 or higher, not less than 7... 2006-04-23 18:37:53 +00:00
peter1138 70bd867d71 (svn r4551) - NewGRF: add string handling for newstations. 2006-04-23 18:37:06 +00:00
peter1138 baebc8d47e (svn r4550) - NewGRF: update string system to new rules: a grf version of less than 6 uses the old scheme, of 7 or more uses the new scheme. (Moving targets, yay...) 2006-04-23 18:27:53 +00:00
peter1138 b54ebaba70 (svn r4549) - NewGRF: store the grf version from Action 0x08. 2006-04-23 18:03:55 +00:00
peter1138 14b6860e62 (svn r4546) - NewGRF: add support for Action 0x05, type 0x04: replacement signal graphics. Thanks to Purno for supplying data to test
with.
2006-04-23 15:57:34 +00:00
peter1138 b5ce99c52d (svn r4540) - NewGRF: don't treat integer values as boolean. 2006-04-23 11:13:06 +00:00
peter1138 c77f77304a (svn r4539) - NewGRF: always check that the action 0x2 feature matches the action 0x1, not just on 'normal' sprite groups. 2006-04-23 10:50:09 +00:00
peter1138 f74a683f90 (svn r4537) - NewGRF: replace if cascade with a switch block in the sprite group loader 2006-04-23 09:46:23 +00:00
Darkvater 5a8d992eaa (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 2006-04-22 13:56:16 +00:00
Darkvater e3280971b1 (svn r4527) - Feature [NewGRF]: Add support for specifying parameters to GRF files. Usage: "mygrf = 1". You can pass up to 128 parameters, each one seperated by a comma or a space-character. Big thanks to peter1138 for the inspiration and examples. 2006-04-22 13:17:13 +00:00
peter1138 2e7034f059 (svn r4517) - NewGRF: fix and complete the feature list 2006-04-22 06:54:25 +00:00
peter1138 0b3659b41a (svn r4510) - NewGRF bounds checking:
- check Engine ID is within range
  - don't try setting a vehicle name if the string id is not a valid Engine ID
2006-04-21 20:59:04 +00:00
peter1138 ae94d7b26f (svn r4496) - NewGRF: switch custom engine names from storing a char* to using the new StringID based text system. Vehicle name
translations now work.
2006-04-21 07:06:31 +00:00
belugas aab91d287a (svn r4493) Newgrf : Action 04. Beginning of implementation.
Some TODOs left, but the core is there.
Thanks to Peter1138 for code, advice and patience
And to Patchman for letting us define a lot of langids :)
2006-04-21 03:00:20 +00:00
peter1138 92d8af75db (svn r4486) - NewGRF: Create and use a memory pool to manage sprite groups. This
reduces the amount of house keeping we do and the chance of memory 
leaks.
2006-04-20 20:51:57 +00:00
peter1138 9ed8c6d4ac (svn r4483) - NewGRF: Dynamically allocate memory for 'real' spritegroups. This removes the limit of 16 loading/unloading states, although will result in less memory usage as most of the time the full fixed allocation wasn't used. 2006-04-20 13:33:40 +00:00
peter1138 0c889ec8c6 (svn r4474) - NewGRF: Skip non-fatal errors when not in stage 2. 2006-04-19 07:50:16 +00:00
celestar 22f82bba2e (svn r4463) -Codechange. Include vehicle.h directly instead of implicitly via station.h in a number of source files 2006-04-18 05:16:13 +00:00
peter1138 e3cd311d35 (svn r4453) - NewGRF: fix two compile warnings. 2006-04-16 20:24:10 +00:00
peter1138 2766728629 (svn r4452) - NewGRF: switch to unsigned ints for array indices. 2006-04-16 18:57:07 +00:00
Darkvater b5bbc23b2c (svn r4447) - NewGRF: It seems I committed printing action NOP Action 0x0C which is mainly used for comments. So leave it in, but fix the created warning. Use proper action name for check_length() in Action 0x10 2006-04-16 11:33:26 +00:00
Darkvater 12770adba6 (svn r4439) - NewGRF: Add support for Action 0x10. This also required an extra pre-stage (before initialize and activation) to scan the GRF file for GOTO labels. Big thanks for peter1138 for the guidance and answers, as well as parts of the code. 2006-04-15 21:27:59 +00:00
peter1138 3e8423f5d8 (svn r4431) - NewGRF: rename nfo_line to _nfo_line, to avoid confusing Darkvater ;) 2006-04-15 16:40:54 +00:00
Darkvater 5c9acdb182 (svn r4429) - CodeChange[newgrf]: Action0, prop 0x0D. use calloc to allocate memory and zero it out and change the loop a little 2006-04-15 16:03:45 +00:00
peter1138 1a1148c247 (svn r4414) - NewGRF: Don't execute sprite replacements (action 0x0A) in the
initialization stage.
2006-04-14 15:58:38 +00:00
peter1138 96e794be2d (svn r4356) - NewGRF: Load more newstation properties. 2006-04-11 13:00:06 +00:00
peter1138 64a237b192 (svn r4355) - NewGRF: Minor clean up; use the correct return type and remove extraneous brackets. 2006-04-11 10:53:07 +00:00
peter1138 5e345e0e7f (svn r4352) - NewGRF Codechange: dynamically allocate the memory used to store custom station data. This saves us approximately 40KB per GRF file, if there are no stations defined. 2006-04-11 10:05:52 +00:00
peter1138 32622f2c7b (svn r4339) - Comment Change: NewGRF, update comments for units of speed 2006-04-09 18:08:20 +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
peter1138 56c3f42397 (svn r3684) - NewGRF: Support loading of miscellaneous flags (not used yet) 2006-02-28 08:13:15 +00:00
peter1138 d6cb4c82da (svn r3678) - NewGRF Codechange: remove redundant braces and temporary variables. 2006-02-27 15:35:22 +00:00
tron 49c7eb934b (svn r3613) Some more const, indentation, whitespace and similar stuff 2006-02-18 14:41:24 +00:00
peter1138 9936e39924 (svn r3606) - NewGRF: Convert from TTDP railtype values to our own railtypes. (These are currently the same, but won't be forever...) 2006-02-15 12:53:36 +00:00
peter1138 b5b4491471 (svn r3603) - NewGRF: Support loading of AI rank data 2006-02-13 22:19:23 +00:00
peter1138 67573ed605 (svn r3586) - NewGRF: Load callback masks for all vehicle types. 2006-02-11 07:34:05 +00:00
peter1138 500a7e6627 (svn r3546) - NewGRF feature: Implement rail vehicle 'property' 0x1A: allows shuffling order of rail vehicle purchase list (and replace vehicle list) 2006-02-04 21:48:46 +00:00
peter1138 b88904f345 (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files. 2006-02-03 12:55:21 +00:00
tron b844aa2db3 (svn r3520) Remove unused parameters from some functions 2006-02-02 07:15:46 +00:00
peter1138 e2dda7bce6 (svn r3491) - NewGRF Fix: Handle loading of rail vehicle flags (unimplemented) 2006-01-30 18:42:46 +00:00
peter1138 876813cd9d (svn r3486) - NewGRF fix: Always reinitialize the ttdpatch flags as patch settings may have changed. 2006-01-30 14:50:55 +00:00
peter1138 571bbc06d7 (svn r3449) - NewGRF Fix: When changing the sprite ID of a vehicle, if it is not FD (custom graphics), the value needs to changed from a 16bit array offset to an array index. (fixes tropicstw.grf) 2006-01-27 07:13:58 +00:00
peter1138 ec7d2fbb39 (svn r3424) - NewGRF fix: Only power should decide whether a rail vehicle is an engine or a wagon. (fixes SHIKI 810 in jpsetw.grf) 2006-01-24 09:33:51 +00:00
peter1138 2a746ffa2d (svn r3397) - NewGRF fix: Show nfo sprite number instead of current sprite id for warning messages -- this makes this output more useful... 2006-01-13 18:40:39 +00:00
peter1138 2067b2e7b4 (svn r3394) - NewGRF fix: ignore non-climate dependent cargo types. The spec is rather vague on this, but we don't support newcargos anyway. 2006-01-12 07:57:40 +00:00
peter1138 e81c316134 (svn r3388) - NewGRF: Allow train running cost class to differ from engine class. Also fix typo in r3384. 2006-01-07 16:47:59 +00:00
peter1138 793a0099d4 (svn r3386) - NewGRF: Small comment update, and fix for possible issue with engine class not getting set. 2006-01-07 13:26:52 +00:00
peter1138 473b3072ea (svn r3384) - NewGRF fix: running cost should be halved for dual head vehicles. 2006-01-07 13:20:02 +00:00
peter1138 f55153ce3c (svn r3360) Fix initialization of engines for precalculation of default refit mask. 2006-01-02 22:40:39 +00:00
peter1138 3532b91eef (svn r3316) - NewGRF: Unload engine names before loading grf files. This fixes names in climates where the engines don't get loaded. Renamed function to reflect its purpose. 2005-12-18 14:03:28 +00:00
tron 2956b119b2 (svn r3311) Remove the unnecessary global variable _grffile_count: It's just the scroll count of a list and furthermore only used in one file 2005-12-18 08:01:05 +00:00
tron 23bfc03054 (svn r3297) Staticise 2005-12-14 06:20:23 +00:00
tron 24f857ed5e (svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing 2005-11-15 09:47:25 +00:00
peter1138 422bea5a0b (svn r3170) - NewGRF: make ttdpatch flags to reflect patch option status, and added some more values. 2005-11-12 09:30:52 +00:00
peter1138 b3056bc799 (svn r3169) Little bit of coding style fixing, and change from value to lengthof() 2005-11-12 08:51:46 +00:00
peter1138 ff8223150a (svn r3167) - NewGRF: Start moving custom station code to separate files.
Rewrite handling of station classes.
          Allow for more than 8 station tile layouts.
          Start of code to unload custom stations.
2005-11-12 00:19:34 +00:00
peter1138 b1075ca7a4 (svn r3166) Constify read-only accesses of custom stations 2005-11-11 20:34:16 +00:00
peter1138 7304bbe500 (svn r3152) - NewGRF: [ 1340189 ] Action 7/9 new value : is it TTDPatch or OpenTTD? (belugas) 2005-11-07 14:34:23 +00:00
peter1138 bc25cd89bf (svn r3148) -NewGRF, Feature: Add support for cargo refitting specification by cargo classes. 2005-11-06 13:42:26 +00:00
tron 422a8654e3 (svn r3119) Don't pretend to be the Windows version of TTD all the time. When being asked answer according to _use_dos_palette. (Suggestion by Belugas) 2005-11-02 16:05:45 +00:00
tron 47137cefb7 (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
2005-10-23 13:04:44 +00:00
peter1138 8bf11c2e41 (svn r3074) -NewGrf: Fix stupid typo in weight setting. 2005-10-20 19:44:41 +00:00
peter1138 d5eb4183b8 (svn r3071) -NewGRF: Add support for rail vehicle weight greater than 255 tons. 2005-10-20 15:15:58 +00:00
tron f3de172560 (svn r3059) Use bitfields to encode railtype and climates of engines instead of manual shifting/anding 2005-10-18 11:23:58 +00:00
peter1138 ab41ccb23c (svn r3045) -NewGRF, Codechange: Don't attempt to map and empty sprite group to a vehicle. 2005-10-15 07:40:22 +00:00
peter1138 5c3625b88f (svn r3044) -NewGRF, Codechange: Improve handling of non-existent sprite sets. 2005-10-14 20:10:12 +00:00
peter1138 5551b423fc (svn r3034) -NewGRF: Improve error checking of setting price bases. 2005-10-12 09:54:29 +00:00
peter1138 c78e87d4da (svn r3032) -NewGRF, Feature: Add support for changing base prices. 2005-10-12 07:27:56 +00:00
peter1138 abe60acbbb (svn r3017) -NewGRF: Implement sprite group unreferencing and unloading. 2005-10-04 21:42:00 +00:00
peter1138 c655e13e92 (svn r3016) -NewGRF: Implement the start of reference counting for sprite groups. This will allow unloading. 2005-10-04 20:58:10 +00:00
peter1138 d1591e864d (svn r3015) -NewGRF: Add a new sprite group result type, and support loading of callbacks results within random and "real" groups. (Not fully supported yet.) 2005-10-04 20:38:26 +00:00
peter1138 9fabe008a0 (svn r3014) -NewGRF, Codechange: Make all sprite group references be pointers instead of copying the data around. 2005-10-04 19:52:26 +00:00
peter1138 c294de06b9 (svn r3006) -Fix, NewGRF: Don't assert on user input, skip data instead.
-Codechange, NewGRF: Remove unnecessary NULL check.
2005-10-02 12:00:30 +00:00
peter1138 4fe06ceecc (svn r3005) -Fix, NewGRF: Some GRF files don't specify a name or description, in which case the Action 8 is 8 bytes, not 9. (pb_viaduct) 2005-10-01 17:41:41 +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