Commit Graph

571 Commits (7c37dcb8e3ede2b3c3e89dd2eb3d762441289726)

Author SHA1 Message Date
Tyler Trahan 1dda7d6486
Fix: don't walk out of the map when trying to build tunnels (#8600) 3 years ago
SamuXarick 8da5cff210
Fix #8462: Don't check whether to grow a town road on water (#8471) 4 years ago
Patric Stout 8e6574dcdb
Revert 78f92130: "Fix #8506: Towns shouldn't add junctions to NewGRF roads they cannot build (#8535)" (#8541)
As per https://github.com/OpenTTD/OpenTTD/pull/8535#issuecomment-757122918,
jumped the gun here.
4 years ago
Tyler Trahan b0456669c9
Fix #8506: Towns shouldn't add junctions to NewGRF roads they cannot build (#8535) 4 years ago
Tyler Trahan b08c66a796
Fix 7bdfb38: Drive-thru road stations can be connected at either end (#8528) 4 years ago
Tyler Trahan 9c0da686da
Add: Towns can build tunnels (#8473) 4 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 4 years ago
Patric Stout c7609e767f
Fix #7604: prevent houses to wander too far from town center when rebuilding (#8507)
When a multi-tile house is rebuild, it always used the most northern
tile to build the new house. This can very easily lead to houses
wandering off in the north-ish direction (either NW or NE).

To prevent this, pick the tile closest to town center when rebuilding
on a multi-tile house. This still means a house can be build away
from a road, but it is no longer wandering around finding another
town to call home.
4 years ago
Patric Stout a4e34e824c Change: towns can now bridge 4 rails (up from 3)
Having 4 rails is a pretty common design, and towns now couldn't
bridge out of this common design.
4 years ago
Didac Perez Parera 64eddaeb49 Feature: Make maximum length of town bridges depend on population. 4 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 4 years ago
Tyler Trahan 7bdfb382a8
Change: Towns don't build dead-end road bridges (#8401) 4 years ago
dP 7045186594 Change #8159: Remove now unused town cargo caches without bumping the savegame version 4 years ago
Yexo a82572d0f5 Codechange: remove has_newhouses global 4 years ago
Michael Lutz 63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 4 years ago
dP 93d1d8773f Fix: Desync after house replacement 4 years ago
dP f2a9a1e2a5 Fix #8137: New clients can't join (desync) after funding an industry 4 years ago
dP 7bd52970a1 Codechange: Refactor FindStationsAroundTiles to avoid code duplication 4 years ago
Jonathan G Rennison c3223903ed Codechange: Cache resolved town, station and industry name strings 5 years ago
Jonathan G Rennison 22ba048c89 Change: Only resort town directory window on population change if necessary 5 years ago
glx 39e6247bec Fix #7899, 196d5868: don't trigger filter changes more than expected 5 years ago
Niels Martin Hansen f401622149 Feature: Script API to change town rating of companies 5 years ago
glx ee7a8eebca Codechange: Replace FOR_ALL_TOWNS with range-based for loops 5 years ago
glx 514565fad6 Codechange: Replace FOR_ALL_OBJECTS with range-based for loops 5 years ago
glx 00c2a98cf3 Codechange: Replace FOR_ALL_INDUSTRIES with range-based for loops 5 years ago
glx fa9769f81a Codechange: Replace FOR_ALL_DEPOTS with range-based for loops 5 years ago
glx ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 5 years ago
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 5 years ago
Niels Martin Hansen 9900af38f5
Fix #7847: Use ViewportSign coordinates for sign Kdtree coordinates (#7849)
Ensure the same coordinates are used for station/town/player signs regardless of how the landscape changes below it after the coordinates were first determined.

By keeping track of whether each ViewportSign is valid for Kdtree use (and only ever registering the viewport sign when the object is valid) a lot of code can be simplified and become more robust at the same time.
5 years ago
frosch 61dba850af Revert #7837, 7e22f243e: OpenTTD tries to replicate the original game mechanics.
Making numbers look nice and correlate is no goal, and in this case they actually did not correlate.
5 years ago
Yourself 7e22f243ed Fix: typo in town growth rates (#7837) 5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Gabda b870596f15 Add #6887: Option to show zone inside local authority boundary of towns
Can be found at town information > local authority window
Layout for button is same as Graph Keys
Turn on/off for every town individually
5 years ago
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 5 years ago
Charles Pigott 5b34c8019f Codechange: Remove Company/OwnerByte types 5 years ago
Charles Pigott f20b75d712 Codechange: Remove TownLayoutByte type 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Niels Martin Hansen cebdd72146 Fix #7440: Remove town sign when deleting town, not add it once more 5 years ago
Henry Wilson cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 5 years ago
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 5 years ago
Gabda dea7f078f4 Codechange: Update town sign on population change only when population is shown (#7368) 5 years ago
Niels Martin Hansen e8d397e4ee Codechange: Make a merged k-d tree index of all viewport signs 5 years ago
Niels Martin Hansen d84b67e54d Codechange: Make a k-d tree index of stations 5 years ago
Niels Martin Hansen 7b56be0f3a Codechange: Make a k-d tree index of towns 5 years ago
Peter Nelson 8b1b3fd0f9 Feature: Non-rectangular sparse station catchment area. 5 years ago
Niels Martin Hansen 52572cafa6 Add: Option for population-linear town cargo generation
Introduce a new default algorithm for town cargo generation (passengers and mail), and a game setting to choose between the new and original algorithm.

The original town cargo generation algorithm has the property of the generated amount relating to the square of each building's population, meaning large towns easily produce more cargo than can realistically be transported. The problem is excessive cargo is amplified if playing with cargodist.

The new algorithm introduced instead has a linear relation to the population. The result is that smaller towns will produce slightly more cargo, while the largest towns will produce about a fourth of what they would with the original algorithm.

Existing savegames will use the original algorithm, while new games will default to the new algorithm.
5 years ago
PeterN ebc3934ee6
Fix #7043, Fix #7274: Delete town owned bridge based on adjacent tile ownership, not nearest town. (#7284)
This only affects failed town generation, as towns do not delete bridges under any other circumstances.

The existing test performed badly with a large number of towns due to having to calculate the
nearest town, and also by its nature assumed a bridge was built by the nearest town, leading
to bridges of nearby large towns be removed incorrectly.

If we gain the ability to quickly retrieve the correct town (which is _not_ the nearest town) from the bridge, this change should be reviewed.
5 years ago
SamuXarick 50a0cf1915 Change: Allow towns to build bridges over rails and one-way roads. (#7291) 5 years ago
Niels Martin Hansen 48b334cf97 Add: Houses can accept up to 16 different cargo types via NewGRF.
New Action0 property 23 for feature 07, variable length, format B n*(B B). Initial byte is number of structures following. First byte in structure is cargo id, second is acceptance level in 1/8 units.
6 years ago
nikolas d8ccad91f9 Fix: Some code and comment typos
Found with codespell
6 years ago
Joan Josep 9aecbac2b4 Codechange: Define INVALID_TOWN as a TownID (#7044) 6 years ago
Charles Pigott b5028efc1f Fix: Protect against a few out of bounds or uninitialised usage errors 6 years ago
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 6 years ago
Max Maton eed0da60a2 Fix #6622: Fixes empty company name in news when gamescript constructs a town 6 years ago
Pavel Stupnikov 9fc3212679 Feature #6397: Keep town growth rate in sync with house count
Takes some code and ideas from #6378 patch, but doesn't change anything GS-related.
6 years ago
PeterN 4cebebcf68
Change: Add CargoTypes type for cargo masks. (#6790) 6 years ago
Pavel Stupnikov fef8b831a9 Change: Switch town growth rate and counter to actual game ticks (#6763) 6 years ago
Pavel Stupnikov 8d8b9a026a Feature #6610: Allow towns to build houses on road turns (#6758) 6 years ago
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 7 years ago
frosch bcc2c7d06e (svn r27739) -Cleanup/Revert (r12162): Clearing MP_HOUSE with DC_EXEC always fails, so there is no effect in testing for houses first. (adf88) 8 years ago
frosch ab7ebdcfd9 (svn r27423) -Fix: When towns expanded single-bit roadtiles using a grid-layout, they used the layout position of the neighbouring tile. 9 years ago
frosch d626962a38 (svn r27420) -Fix [FS#6362]: GrowTownAtRoad sometimes returned false, even when a house was built. (_dp_) 9 years ago
frosch ab69952f2a (svn r27306) -Fix (r27305): Confused tiles. 9 years ago
frosch 0e378747db (svn r27305) -Fix [FS#6320]: Account for road-bridges and drive-through-stops in CanFollowRoad. 9 years ago
frosch 813e85f301 (svn r27260) -Fix (r27244): economy.allow_town_roads should not affect town placement during world generation. 9 years ago
frosch 5992f4fa1b (svn r27259) -Fix (r27244): Incorrect merge. (_dp_) 9 years ago
frosch 9aa0ba43f7 (svn r27249) -Fix [FS#6240]: In some cases town growth failure was considered as success. (_dp_) 9 years ago
frosch 9fb56ca02e (svn r27248) -Fix [FS#6257]: Town labels on smallmap and zoomed-out viewports were not centered. (_dp_) 9 years ago
frosch 93d7db0b36 (svn r27247) -Cleanup: Make GrowTownAtRoad return a bool. 9 years ago
frosch 915aad7603 (svn r27244) -Change [FS#6245]: Do not consider road junctions with trivial dead ends as branch points during town growth. (_dp_) 9 years ago
rubidium 30f778e933 (svn r27105) -Fix [FS#6195]: grow_counter was not properly bounded by growth_rate, but by some other value used to calculate growth_rate. 10 years ago
rubidium d534c80e94 (svn r27020) -Cleanup: some coding style consistency improvements (mostly spaces) 10 years ago
rubidium 9daf7e749c (svn r26879) -Codechange: remove most MayHaveBridgeAbove calls since the data is now always accessible 10 years ago
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 10 years ago
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 10 years ago
frosch 55502341ac (svn r26346) -Fix [FS#5870]: Call Layouter::ReduceLineCache from GenerateTownName in all cases. 11 years ago
frosch 20785c79fc (svn r26345) -Cleanup (r26310): Spawning towns does not touch persistent NewGRF storage. ClearPersistentStorageChanges is a dangerous/magic function which should not be called without reason. 11 years ago
rubidium 9f6b8aea49 (svn r26313) -Codechange: use a set for finding unique town names instead of iterating all just created town names (MJP) 11 years ago
rubidium d05ff6e77b (svn r26311) -Codechange: use a different method for finding whether there is a nearby town when the map has thousands of towns (MJP) 11 years ago
rubidium fcb122124b (svn r26310) -Codechange: clean up some caches during town generation to keep memory usage significantly lower (MJP) 11 years ago
rubidium 30a95966ec (svn r26308) -Fix-ish: do not try to build more towns/industries than the pool can hold (MJP) 11 years ago
rubidium c143ca729a (svn r26104) -Fix: do not attempt to do stuff with an invalid direction, especially using it as index into a table 11 years ago
rubidium 8e27031492 (svn r26051) -Fix: out of bounds access in CmdTownCargoGoal 11 years ago
frosch 9a41aefcc4 (svn r25968) -Add: [Script] ScriptTown::TOWN_GROWTH_NONE to indicate no town growth via ScriptTown::SetGrowthRate and GetGrowthRate. 11 years ago
frosch cef342d57c (svn r25931) -Fix [FS#5786-ish]: [NoGo] Preserve the relative town growth progress when changing the town growth rate. 11 years ago
frosch 12b30103b1 (svn r25922) -Codechange: Rename TOWN_IS_FUNDED to TOWN_IS_GROWING. It is not tied to funding a town. 11 years ago
zuu dfb5663313 (svn r25849) -Codechange: Introduce IsTileFlat to not compute full slope information for situations when we only want to know if a tile is flat or not (cirdan, LordAro) 11 years ago
frosch 6a0439a789 (svn r25838) -Codechange: Rename HOUSE_MAX to NUM_HOUSES. 11 years ago
frosch 35d7e8bca4 (svn r25833) -Codechange: Move ObjectType from map array into pool item. 11 years ago
zuu ffec9b41e8 (svn r25789) -Fix (r25783): Calling GSTown.FoundTown in world gen caused world gen to terminate and start the game 11 years ago
zuu 67ab3108d6 (svn r25785) -Feature: [Script] Allow AIs and GS to found towns. Allow GS to rename towns 11 years ago
frosch 87fae6ba57 (svn r25140) -Fix [FS#5519]: Towns are build as OWNER_TOWN, so they also need to be removed as OWNER_TOWN. 11 years ago
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 12 years ago
alberth 732e073261 (svn r24776) -Doc: Typo fixes, additions, and additional dots collected from various sources (including Eagle_rainbow, MinchinWeb) 12 years ago
frosch 6c2e201133 (svn r24391) -Change [FS#5229]: Disallow original and better road layouts to build roads under bridges along the bridge direction. 12 years ago
frosch 95d3d6fdef (svn r24291) -Add: [Script] ScriptEventRoadReconstruction. 12 years ago
frosch 8dc553a039 (svn r24290) -Add: [Script] ScriptEventExclusiveTransportRights. 12 years ago
frosch ec91dc5ffc (svn r24287) -Feature [FS#2688]: News item for exclusive transport rights. (based on patch by Grantovich) 12 years ago
frosch a8c88f43b6 (svn r24284) -Codechange: Remove NewsSubtypes and directly use NewsTypes and NewsFlag instead. 12 years ago
frosch a0be398da9 (svn r24283) -Codechange: Add AddTileNewsItem function to preemptively deduplicate code. 12 years ago