tron
5fa6b7eb06
(svn r3179) - RandomRange() and RandomTile() instead of home brewed versions
...
- CHANCE*() instead of mumbling strange numbers
2005-11-14 09:21:05 +00:00
tron
833032adc0
(svn r3177) GB, CLRBIT, HASBIT, TOGGLEBIT
2005-11-14 08:09:57 +00:00
tron
ee15e3de13
(svn r3172) static, const
2005-11-13 13:43:55 +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
tron
2cc2154ad2
(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
2005-10-22 06:39:32 +00:00
tron
ece9b9b2b6
(svn r3066) Constify the parameter of GetSlopeZ_*()
2005-10-19 14:49:46 +00:00
tron
758ae7e8f6
(svn r3064) Replace some numbers by sprite names
2005-10-19 06:46:41 +00:00
tron
3397e202c8
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
2005-10-07 07:35:15 +00:00
tron
ae4a1f3675
(svn r3019) -Codechange: Replace explicit shifting/anding/oring with GB and SB
2005-10-05 07:20:26 +00:00
tron
db3b1228bf
(svn r3010) Get rid of quite some dubious casts, either by using GB(), proper types or just removing them
2005-10-03 21:20:01 +00:00
tron
ce1c72cf6e
(svn r2995) Replace 0xFF/0xFFFF with CT_INVALID/OWNER_SPECTATOR/INVALID_STATION where appropriate
2005-09-28 19:35:36 +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
Darkvater
180997534c
(svn r2956) - Fix: [ 1253736 ] creating many town crash to desktop. Now it 'dies' with an ingame error message informing the gamer if it couldn't generate any towns in user-space. Still if it happens during new-game generation it crashes since we don't yet have actions to do in such a circumstance.
2005-09-16 00:33:33 +00:00
Darkvater
2131f68ae2
(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
...
- Add IsLocalPlayer() which substitutes _local_player == _current_player
2005-09-14 18:03:38 +00:00
tron
b45aeb5c36
(svn r2886) Rename the "owner" attribute to "m1", because when it stores an owner it is accessed by [GS]etOwner anyway and when it doesn't store an owner, but arbitrary data, accessing a field called "owner" is confusing.
2005-08-23 18:47:04 +00:00
tron
9b676d2cd9
(svn r2758) Add the AB() macro to add a value to a bit range and use it in a few places, also make use of GB and SB nearby
2005-07-30 09:29:20 +00:00
celestar
238e47cd42
(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.
2005-07-24 15:56:31 +00:00
tron
a227065ab7
(svn r2701) Insert Id tags into all source files
2005-07-24 14:12:37 +00:00
tron
559babcdc9
(svn r2673) Include functions.h directly, not globally via openttd.h
2005-07-22 07:02:20 +00:00
tron
0762aa9ec9
(svn r2669) Shuffle some more stuff around to reduce dependencies
2005-07-21 22:15:02 +00:00
tron
d71788c402
(svn r2660) Get rid of some more shifting/anding/casting
2005-07-21 06:31:02 +00:00
celestar
85f06d6e7b
(svn r2658) -Codechange: Use MAKE_TRANSPARENT to display a transparented sprite
2005-07-20 22:05:13 +00:00
tron
ac66e3e28f
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
2005-07-20 15:29:28 +00:00
ludde
3486e7e9d5
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
...
- The formatting of the industry name can be controlled with the string STR_INDUSTRY_FORMAT.
Change: Changed several occurences of {STRING1} into {TOWN} to get rid of townnametype being used directly.
2005-07-15 18:30:13 +00:00
ludde
20e60e5411
(svn r2574) Fix: AnimatedTile leak in town_cmd.c (this one has probably been here since day 1)
2005-07-15 16:29:30 +00:00
ludde
b21ee889fe
(svn r2570) Fix: Removed some code that had no effect.
2005-07-15 12:16:16 +00:00
ludde
6013b327f7
(svn r2560) Fix: various minor code changes.
...
Added RandomTile/RandomTileSeed functions to generate a random tile.
Changed landscape routines so they don't assume that the Y map side is a power of two. (support for this is not complete, though)
Changed some frequently used map macros to not compute the values each time.
Silence some warnings on MSVC.
2005-07-13 19:51:31 +00:00
tron
8c1d74162f
(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.
2005-07-13 18:04:01 +00:00
tron
bec5e4fb4c
(svn r2487) Replace TILE_XY by TileXY/TileDiffXY
2005-06-25 16:44:57 +00:00
tron
61f6f07edd
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
2005-06-25 06:15:43 +00:00
tron
3154e7148d
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
2005-06-24 12:38:35 +00:00
celestar
aa7334a3ec
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
2005-06-21 16:28:17 +00:00
tron
ea0f21fbcc
(svn r2434) Fix some defects in r2433
2005-06-08 09:03:29 +00:00
Darkvater
0171aae109
(svn r2433) - CodeChange: unmagicify all road/train crossings with IsLevelCrossing() function (peter1138)
2005-06-07 21:37:00 +00:00
tron
74541c1dcc
(svn r2408) Introduce SetTileOwner() and use it
2005-06-04 12:13:24 +00:00
tron
0c4ecbe9ec
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
2005-06-04 11:56:32 +00:00
Darkvater
b438b1248c
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
2005-06-02 19:30:21 +00:00
Darkvater
55423efb06
(svn r2387) - CodeChange: made the saveload code more readable and also removed the 'byte' saveload arrays which means you can save an array of more than 255 elements, or bigger structs than 255 bytes. This doesn't yet solve the problem that a chunk can be a maximum of 16384 big.
...
- Fix: also fix an unnoticed error in SlSaveLoadConv() due to wrong types.
2005-05-30 22:16:05 +00:00
Darkvater
cb5107f97f
(svn r2345) - Fix: Don't allow stuff to be renamed to nothing if we don't support it. Only valid ones are signs (delete) and waypoints (rename to default).
2005-05-17 20:58:58 +00:00
tron
fea5965679
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
2005-05-15 18:50:55 +00:00
Darkvater
921cc4e94a
(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.
2005-05-12 00:11:37 +00:00
Darkvater
fc411d3675
(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[]!
2005-04-03 13:37:35 +00:00
pasky
087d78d465
(svn r2033) - Fix: Fix some more desync by saving the town growth frequency iterator _cur_town_iter. Needed to bump a svg revision for that thanks to the braindead SlGlob thing, or at least I don't know how to do it without bumping it.
2005-03-20 00:32:26 +00:00
pasky
ad579912f4
(svn r2021) Fix: Enlarge _cur_town_ctr from byte to uint32 so that all the towns are considered when growing them even for big maps, where much more than 256 towns are around; reported by Tomasz Dubiński <uboottd@hydra.polsl.gliwice.pl>. The savegame still saves just the lowest 8 bits but that doesn't hurt so much.
2005-03-17 23:12:23 +00:00
Darkvater
010d1a9be3
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
...
- Fix: [ 1153926 ] All my settings in vain... IGNORED!
- Change: I hope I got it all right. Pressing 'New Game' (either choosing random or a preset scenario) and 'Create Scenario' will start a new game with the settings and difficulty in the intro menu. Using 'Load Game' and 'Play Scenario' will take the values from the savegame/scenario itself.
2005-03-12 21:21:47 +00:00
pasky
0e4828e732
(svn r1955) Fix: Make the town growth frequency scale properly both up and down. The scaling is now also based on the number of towns instead of the map size. (In cooperation with HackyKid.)
2005-03-07 13:20:22 +00:00
pasky
f1f1783aa8
(svn r1952) Fix: Hopefully fixed the enormous towns growth slowdown in large maps. (Inspired by toholio.)
2005-03-06 23:46:52 +00:00
pasky
b5a96ff9c1
(svn r1925) Fixed an infinite loop if the town generator runs out of town names. The number of generated towns is then limited by the number of available names.
2005-03-05 13:49:43 +00:00
celestar
fe6f9e9a65
(svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
2005-02-17 10:56:19 +00:00
celestar
77d26759e3
(svn r1866) -Fix: Intercepted generated maps with 0 towns on it. Currently just an
...
error() is called, some more graceful handling should be implemented
later.
2005-02-13 09:42:49 +00:00
tron
f8d97a5f61
(svn r1839) Move GetTileSlope() and GetTileZ() into tile.[ch] and use more explicit types as parameters
2005-02-07 10:41:45 +00:00
tron
27dc506a03
(svn r1832) Next byte -> char iteration: custom names
2005-02-06 20:53:31 +00:00
truelight
cc8fc19d4a
(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)
2005-02-06 20:29:32 +00:00
tron
0381073e56
(svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c)
2005-02-06 08:18:00 +00:00
tron
7aae12d55d
(svn r1808) Use strcmp() instead of home brewed function str_eq()
2005-02-05 22:50:33 +00:00
truelight
7241f42e9d
(svn r1784) -Fix: removed ClosestTownFromTile where possible, or replaced it
...
with _map2-data if possible (Celestar / TrueLight)
2005-02-04 13:56:51 +00:00
celestar
30a328705e
(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
2005-02-02 14:17:13 +00:00
truelight
0be987391b
(svn r1765) -Fix: on loading, the total amount of towns wasn't reset to zero
2005-02-01 18:46:49 +00:00
truelight
777dd99585
(svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
...
you have that amount of towns in a map ;))
2005-02-01 18:32:01 +00:00
tron
aa592190dc
(svn r1756) Cleanup: if cascade -> switch, uint -> TileIndex
2005-01-31 21:57:05 +00:00
tron
7bbcf5875c
(svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names
2005-01-31 07:23:15 +00:00
tron
5885b31bb4
(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
2005-01-29 12:19:05 +00:00
tron
3617d24318
(svn r1706) Implement ScaleByMapSize() and ScaleByMapSize1D()
...
These scale a number relative to the map size/circumference.
Use them to scale the amount of map objects.
Of course at the moment they return just the input, because there are no bigger/smaller maps yet.
2005-01-28 15:31:04 +00:00
tron
993a106679
(svn r1676) Increase the size of TileIndex and TileIndexDiff to 32bits and adapt the save/load data and some other parts of the code to that change
...
WARNING: If i made any mistake here it WILL lead to corrupted savegames!
2005-01-25 21:43:57 +00:00
tron
189ca73707
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
2005-01-22 20:23:18 +00:00
celestar
962dd27a8c
(svn r1581) Added a display for the total map population to the town display (Jango)
2005-01-21 16:51:25 +00:00
tron
ef923fae44
(svn r1542) Rename TileHeight to TilePixelHeight, because this is what it actually returns
2005-01-16 14:06:22 +00:00
tron
ae796740aa
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
2005-01-16 11:24:58 +00:00
celestar
febac23b25
(svn r1504) enummed town ratings (Jango)
2005-01-14 09:20:12 +00:00
tron
7ca6b2b8b0
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
2005-01-07 17:02:43 +00:00
truelight
63e97754fb
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
...
(in prepare of dynamic arrays):
- DEREF_XXX is changed into GetXXX
- All direct call are directed via GetXXX
- struct Industry has now an index-field
- ENUM'd some stuff
- Replaced home built loops with FOR_ALL_XXX
- Added _stations_size, _vehicles_size, ... which gives the length of the
array (which will be dynamic in the near future)
- Changed lengtof(XXX) to _XXX_size (e.g. _stations_size)
- Removed all endof(XXX) (because mostly it was part of a FOR_ALL_XXX)
- Made the sort-functions of all 4 dynamic
- Made all 4 Initialize functions more of the same
- Some minor tab-fixing and stuff
(tnx to Tron for proof-reading my 100kb patch ;))
Note for all: please do NOT directly call _stations, _vehicles, _towns and
_industries, but use the right wrapper to access them. Thank you.
Ps: please also do not use 'v++', where v is of type Vehicle *.
2005-01-06 22:31:58 +00:00
tron
f8c95a1dbe
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
2005-01-06 11:39:00 +00:00
tron
67161506ad
(svn r1386) Move TileIndexDiff to map.h
...
Move _tileoffs_by_dir to map.[ch] and encapsulate it in TileOffsByDir()
2005-01-05 13:32:03 +00:00
tron
c0702318d2
(svn r1344) Use MapSize[XY]() (or MapSize()/MapMax[XY]() where appropriate) instead of TILES_[XY]
2005-01-03 18:59:58 +00:00
truelight
2ebc5011f3
(svn r1313) -Fix: fixed MSVC problem
2004-12-31 18:59:22 +00:00
truelight
92ac503b74
(svn r1312) -Add: Patch which is on by default: population in label of the town
...
-Fix: Expand town is a bit more agressive
-Fix: Fixed a bug in growing algorithm
2004-12-31 18:57:24 +00:00
truelight
546fcfa3ec
(svn r1301) -Codechange: _industries finally has FOR_ALL_INDUSTRIES too
2004-12-30 10:03:35 +00:00
truelight
c2ee8d70e4
(svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
...
an uint8 till the savegame version is bumped to version 5. Then it works
automaticly as a fully uint16. So _stations[] can not be increased till
after the bump!!
2004-12-28 11:51:31 +00:00
tron
765ecfed84
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
2004-12-15 22:18:54 +00:00
truelight
b8f6d41418
(svn r942) -Merged branch/network back into the trunk
2004-12-04 17:54:56 +00:00
tron
fdb447ac55
(svn r901) Small step in the process to clean up the DPARAM mess:
...
- reduce to 2 sizes (*DParam64 for 64bit values, *DParam for the rest)
- use inline functions instead of macros
- add assert()s to check for buffer overruns
2004-12-02 22:53:07 +00:00
pasky
97c533eb9c
(svn r831) Remove station-specific roadbits magic. Tron already fixed road stations so that they don't give out roadbits in r780.
2004-11-26 22:29:02 +00:00
pasky
0554031514
(svn r830) Move the MP_STATION roadbits guard to GetTownRoadBitsByTile() wrapper of GetRoadBitsByTile(). This should really and for once fix the road-behind-road-station bug.
2004-11-26 22:21:12 +00:00
tron
acbd1801c7
(svn r815) Include strings.h only in the files which need it.
...
This should reduce the compile time after altering english.txt by about 1/3, because "only" 62 instead of 90 .c files must be recompiled.
2004-11-25 10:47:30 +00:00
tron
e8537f5512
(svn r787) Invert the sense of the DO_TRANS_BUILDINGS flag to be consistent with its own name and all other DO_* flags.
...
Now it is active-true.
2004-11-23 22:36:11 +00:00
tron
d51887fbed
(svn r764) Enumerate the houses only one per town can exist and use the enums instead of magic numbers to check for these
2004-11-22 18:42:03 +00:00
tron
8a3d7cce1c
(svn r760) Replace some bit-juggling with bit fields
2004-11-22 11:01:30 +00:00
tron
40a04816a4
(svn r756) Demystify and explain some piece of code regarding which house sprite to draw
2004-11-22 10:09:37 +00:00
tron
57adc97733
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
...
This especially enables houses to accept passengers, mail, goods AND food.
Add string templates for up to 5 cargo types for the tile info window. If more are needed just add them.
Simplify (de-uglify) the logic for cargo acceptence for houses and split the goods/food table into two. The acceptance is unmodified, but accepting goods AND food is now trivially possible. The exact amounts have to be decided.
This is based on Celestar's changes in the map branch plus some further bits that will be merged there soon.
2004-11-21 10:49:40 +00:00
pasky
bf6dace925
(svn r703) Attempt to improve the town growth algorithm - now it scales over 76 houses, is slightly exponential and travels further for larger towns.
2004-11-20 11:57:45 +00:00
pasky
578bde9aae
(svn r698) Merge a town growth fix from TTDPatch - in arctic and desert climate, require food (and possibly water) only if the population is more than 90, so that the town gets chance to actually accept it. (By Marcin?)
2004-11-20 02:36:10 +00:00
pasky
5650257c0c
(svn r696) Do not consider a road station as street when growing the town.
2004-11-20 01:49:42 +00:00
pasky
7a8fb5d2fd
(svn r694) Make the town sometimes build streets on slopes.
2004-11-20 01:08:41 +00:00
truelight
3dc8dcf312
(svn r320) -Fix: some last _current_player fixes
2004-09-25 17:37:32 +00:00
truelight
a69e422cdd
(svn r266) -Fix: hopefully fixed the desync problem nicely (and reverted the
...
workaround for it)
2004-09-15 18:36:33 +00:00
truelight
eb49a19460
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
2004-09-10 19:02:27 +00:00
truelight
10d54ac604
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
...
-Fix: some minor fixes around GetTileTrackStatus (blathijs)
2004-09-05 16:15:22 +00:00
dominik
770f86bbbe
(svn r122) Change: exclusive transport rights are now stored per town instead of per station
...
Exclusive rights from old savegames will be reset.
2004-08-23 21:04:39 +00:00
dominik
ca120eedad
(svn r40) Final slope graphics fix
2004-08-13 18:27:33 +00:00
darkvater
a32d8553e7
(svn r5) -Fix: townname generation of TTDLX savegames. All work
...
except for German Townnames (also fix one typo on
English town-names)
-CodeChange: *act_paper to *act_water in Town to
more resemble its use
-Fix: AI players now retain AI status. Since TTDLX
savegame status is not fully documented, some holes
exist (AI state is set to one without a vehicle, otherwise
it crashes)
2004-08-10 14:42:52 +00:00