Commit Graph

582 Commits

Author SHA1 Message Date
Patric Stout d15dc9f40f Add: support for emscripten (play-OpenTTD-in-the-browser)
Emscripten compiles to WASM, which can be loaded via
HTML / JavaScript. This allows you to play OpenTTD inside a
browser.

Co-authored-by: milek7 <me@milek7.pl>
2020-12-15 15:46:39 +01:00
Patric Stout 5d0331ecdc
Fix 8bef06a2: don't use "extern" when you want to implement a global (#8373) 2020-12-13 16:56:33 +01:00
Patric Stout c66bd18a10
Add: save openttd.cfg immediately on changing a setting (#8358)
Formally it was only done on exit. This means that if it crashes
changes in settings were not stored. This is often rather
frustrating. Additionally, targets (like emscripten) where people
are unlike to use "Exit Game", will never see their configuration
stored.

The drawback is that on every setting change there is some minor
I/O of writing the ini file to disk again.
2020-12-13 16:28:06 +01:00
Patric Stout 2864d019f0
Fix: useless warning with -snull and no BaseSounds available (#8361)
If I explicitly tell the system I do not want sound, I still get
presented a nice message I do not have any BaseSounds available
on my system, and that I should download one to enjoy sound. Well,
let me tell you, with "-snull" that is really really not going to
help. So please, be quiet, and let me enjoy the game without
"boooooo" and "DING DING DING".

Thank you.
2020-12-08 10:24:59 +01:00
Berbe 8f3d1ec970 Feature: Improve restart command
When the restart command is issued, a normal map is always spawned.

This improvement takes into account the current state of _file_to_saveload to check if a savegame/scenario/heightmap was previously loaded, and loads the same resource again.
2020-09-24 19:17:18 +02:00
Michael Lutz c972a63c8c Codechange: Store info about the dedicated server log file in globals with automatic destruction to simplify control flow in openttd_main. 2020-05-21 20:02:34 +02:00
Michael Lutz 37bc2f8064 Codechange: Use std::string in the driver and blitter selection code. 2020-05-21 20:02:34 +02:00
Michael Lutz a49fdb7ebb Codechange: Store base set related texts in std::strings. 2020-05-21 20:02:34 +02:00
glx22 d15c7dbdeb
Add: stations_near and industries_near cache check (#8139) 2020-05-12 01:19:52 +02:00
glx22 86e9326b7f
Add: docking tiles cache check (#8120) 2020-05-07 01:14:22 +02:00
Niels Martin Hansen 0e78393774 Fix: Reference correct section in README file for baseset info 2019-12-26 19:50:07 +01:00
glx ee7a8eebca Codechange: Replace FOR_ALL_TOWNS with range-based for loops 2019-12-21 20:13:03 +01:00
glx b91abd3af9 Codechange: Replace FOR_ALL_ROADSTOPS with range-based for loops 2019-12-21 20:13:03 +01:00
glx d8a1be48cd Codechange: Replace vehicle related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glx ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
Charles Pigott 5b34c8019f Codechange: Remove Company/OwnerByte types 2019-04-29 17:40:22 +01:00
Niels Martin Hansen 37daf43037 Change: Zoom title game by UI zoom level 2019-04-24 23:04:55 +02:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz e804173595 Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector. 2019-04-09 22:45:15 +02:00
Michael Lutz 05bc2ed7cb Codechange: Replace custom thread code with C++11 thread objects.
We assume a conforming C++11 compiler environment that has a valid <thread>-header.
Failure to run a real thread is handled gracefully.
2019-04-06 11:27:39 +02:00
Michael Lutz 05f4e73608 Codechange: Replace custom mutex code with C++11 mutex'es.
A conforming compiler with a valid <mutex>-header is expected.
Most parts of the code assume that locking a mutex will never fail unexpectedly,
which is generally true on all common platforms that don't just pretend to
be C++11. The use of condition variables in driver code is checked.
2019-04-06 11:27:39 +02:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson 097328c3d7 Codechange: Replaced SmallVector::Get() const with std alternatives 2019-03-26 20:15:57 +00:00
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke
compilation, as no developer compiles OpenTTD without, neither do
any of our official binaries.

Additionaly, it has grown so hugely in our codebase, that it
clearly shows that the current solution was a poor one. 350+
instances of "#ifdef ENABLE_NETWORK" were in the code, of which
only ~30 in the networking code itself. The rest were all around
the code to do the right thing, from GUI to NewGRF.

A more proper solution would be to stub all the functions, and
make sure the rest of the code can simply assume network is
available. This was also partially done, and most variables were
correct if networking was disabled. Despite that, often the #ifdefs
were still used.

With the recent removal of DOS, there is also no platform anymore
which we support where networking isn't working out-of-the-box.

All in all, it is time to remove the ENABLE_NETWORK switch. No
replacement is planned, but if you feel we really need this option,
we welcome any Pull Request which implements this in a way that
doesn't crawl through the code like this diff shows we used to.
2019-03-20 19:24:55 +01:00
Charles Pigott fe448a2616 Remove: OPF 2019-03-16 22:30:11 +00:00
Patric Stout 7784d77713 Remove: MorphOS / AmigaOS support
In 10 years there is no commit to change how MorphOS works, and we
have no active maintainer for it. It is unlikely it works in its
current state (but not impossible).

With the arrival of SDL2 (and removal of SDL), MorphOS is no longer
support. There is an SDL2 port for MorphOS, but it is not maintained
by upstream SDL2, and nobody can currently test it out.

If anyone wants to re-add MorphOS, please do (revert this patch,
fix the problems, and create a Pull Request). If you need any help
doing so, let us know! It is not that we don't like MorphOS, it is
that we don't have anyone fixing the problems :(
2019-03-05 22:03:00 +01:00
Niels Martin Hansen 7e1e2756d4 Add: Show performance of AI and GS in framerate window 2019-02-23 14:29:07 +01:00
Peter Nelson 0f37a683a2 Codechange: Additional type safety for saveload version variables. 2019-02-02 21:39:06 +00:00
glx ba38a7ca65 Fix: don't show OS error box for non GUI video drivers 2019-01-30 22:45:09 +01:00
nikolas d8ccad91f9 Fix: Some code and comment typos
Found with codespell
2019-01-17 22:01:07 +00:00
Peter Nelson 59fe4f28c8 Change: Animate text effects by real time instead of game ticks. 2019-01-11 11:56:21 +00:00
Peter Nelson ead9c9eab5 Change: Switch various window timers to real time instead of game ticks. 2019-01-11 11:56:21 +00:00
Peter Nelson 2a8fa5fef9 Change: Split up Window::OnTick into OnGameTick and OnRealtimeTick. Adjust timers to work with milliseconds instead of ticks. 2019-01-11 11:56:21 +00:00
Gabda87 a0293d313d Add #4115: default company colour setting (#6998)
Works only in single player.
2019-01-10 10:45:38 +01:00
glx c540d72445 Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined macro _WIN32 2018-12-27 18:09:16 +01:00
SamuXarick 4703cd433d Fix #6460: [AI] Add start_date parameter for Random AIs on new game 2018-11-01 17:56:09 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
Niels Martin Hansen 50efaa2372 Fix e00908f: Visual C++ 2015 compile error
Microsoft Visual C++ 2015 Update 3 (and possibly other versions) consider a struct member undefined in a
static_assert in the struct body. Moving the static_assert to a member function solves the issue.
2018-10-27 10:30:24 +02:00
Miguel Horta e00908f5e9 Fix #6898: Replace atoi() with strtoul()
Normalize type and parsing of generation_seed across all files
Add assert_compile() to ensure correct type
2018-10-11 20:22:31 +01:00
Niels Martin Hansen 2a868b9f3b Feature: Framerate display window (#6822)
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
2018-07-19 21:17:07 +02:00
Niels Martin Hansen 6298b96571 Change: Modernise music control logic implementation (#6839)
Rewrite of almost the entire music control logic to a more modern style, hopefully also easier to understand. The old playlist handling made it look like arcane magic, which it doesn't have to be.

- Playlists are now stored in std::vector of objects instead of arrays of bytes with magic sentinel values, that need to be rotated around all the time. Position in playlist is stored as a simple index.
- The theme song is now reserved for the title screen, it doesn't play on any of the standard playlists, but is still available for use on custom playlists.
- When the player enters/leaves the game from the main menu, the music always restarts.
- Playback state (playing or not) is kept even if music becomes unavailable due to an empty playlist (or an empty music set), so it can restart immediately if music becomes available again.
- The shuffle algorithm was changed to a standard Fisher-Yates.
- Possibly better behavior when editing a custom playlist while it's playing.
- Custom playlists should be compatible.
- Framework for supporting custom playlists with songs from multiple music sets.
2018-06-24 20:06:05 +02:00
Patric Stout aef69443e7 Remove: WinCE support 2018-04-29 15:32:16 +02:00
Patric Stout 85adde7485 Remove: PSP support 2018-04-29 15:32:16 +02:00
Ricardo N Feliciano e8de33a61f Cleanup: Use new filename for README file. (#6738) 2018-04-21 11:05:38 +02:00
frosch 7b553d255e (svn r27732) -Change: Turn the message about 'missing baseset sprites' from a popup into a static message that only shows in non-release versions, just like the 'missing translations' message. 2017-01-14 18:30:26 +00:00
alberth 0adfb1ac6f (svn r27653) -Fix(r27647): Rename FileOperation enum and values to SaveLoadOperation to avoid nameclash with windows compiler toolkit. 2016-09-04 16:06:50 +00:00