Commit Graph

221 Commits (56085be9bda8d5682c15544a058d988a6ae00b3b)

Author SHA1 Message Date
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Rubidium 98972a0748 Codechange: use C++ strings for constructing script file paths 1 year ago
Peter Nelson e6740046ee Codechange: Use range-for iteration. 1 year ago
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 1 year ago
Rubidium 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 1 year ago
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 1 year ago
Rubidium 43c65a3fec Codechange: use std::string for base media filename/warning storage 1 year ago
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 1 year ago
Eddi-z 8db4892f49
Codechange: Reshuffle debuglevels in fileio to address spammyness (#10240) 1 year ago
Rubidium 3e4d327451 Codechange: use the C++ std::getenv over the POSIX/C getenv
The C++ std::getenv is guaranteed thread-safe by the C++11 specification,
whereas the POSIX/C getenv might not be thread-safe by the C11 specification.
3 years ago
Patric Stout 75b6051b7a Change: move sensitive information to secrets.cfg and private information to private.cfg
We often ask people for their openttd.cfg, which now includes their
passwords, usernames, etc. It is easy for people to overlook this,
unwillingly sharing information they shouldn't.

By splitting this information over either private.cfg or secrets.cfg,
we make it more obvious they shouldn't be sharing those files, and
hint to what is inside them.
3 years ago
SamuXarick 1e6a2163a5
Fix #9358: Don't skip empty files in tar (#9367) 3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
Patric Stout ed3946e295
Add: '-X' option to ignore global folders in the search path (#9341)
This is extreme useful for automated testing. Without this, OpenTTD
will always look in your personal-dir (like ~/.local/share/openttd
or %USER%\Documents\OpenTTD). For most users this is exactly what
we want, that there is a shared place for all their files.

However, for automated testing this is rather annoying, as your
local development files influence the automated test. As such,
'-X' counters this, and only gives the local folders. This is
especially useful in combination with '-x' and '-c'.
3 years ago
Rubidium fa6abe1646 Cleanup: remove the old FIO slot functions 3 years ago
Rubidium fdc11a9f94 Codechange: introduce SpriteFile to be used by the sprite loader instead of the global FIO slot functionality 3 years ago
Rubidium c097bc9d7d Codechange: let NewGRF sounds make use of RandomAccessFile instead of the FIO slot functions 3 years ago
Rubidium b144e56b2c Codechange: use the new RandomAccessFile as backend for the FIO slot functions 3 years ago
glx22 983c7ade60 Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loops 3 years ago
glx22 34215f7faa Codechange: Replace FOR_ALL_TARS with range-based for loops 3 years ago
Niels Martin Hansen e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 3 years ago
milek7 295f34a9df Fix: Freeing LanguagePack with wrong size. 3 years ago
Charles Pigott 2d7b34bc68 Fix #8886: Don't try to resolve folders within tars named '.' 3 years ago
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Michael Lutz 9ccef816f9 Codechange: [OSX] Re-arrange the OSX video driver code by combining all drawing code and moving the window/event handling to a different file.
This is just a code move/rename, not a functionality change.
3 years ago
Patric Stout ab7da117e0
Add: always set PERSONAL_DIR "/content_download" in search path (#8481)
This means that if you start OpenTTD with "-c" to indicate another
location to store files, it can still read the content you already
downloaded from your PERSONAL_DIR. This folder is, however,
read-only.

This is useful for situations where you downloaded OpenGFX via
the content-service, but want to run the regression or want to
run with a clean configuration. With this change, you no longer
need to download OpenGFX again.
3 years ago
Charles Pigott 3dfee979a7 Codechange: Drop libxdg-basedir dependency in favour of finding the directories ourselves 3 years ago
Michael Lutz b408fe77f7 Codechange: Use std::string in file scanners. 3 years ago
Michael Lutz 358056ec42 Codechange: Keep filenames of loaded Fio files in std::strings. 3 years ago
Michael Lutz 024a3f6259 Codechange: Use automatic memory management for language pack reading. 3 years ago
Michael Lutz 5cbb2da794 Codechange: Even more std::string usage in file IO. 3 years ago
Michael Lutz 65f65ad2ad Codechange: Convert some more FIO functions to take std::string. 3 years ago
Michael Lutz f3326d34e7 Codechange: Use std::string in FIO search path handling. 3 years ago
Michael Lutz 0c6e8a8123 Codechange: Store file search paths as std::string. 3 years ago
Michael Lutz dd138fc460 Codechange: Stringify config file paths. 3 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 3 years ago
Michael Lutz 5575cb9133 Remove: Remnants of PSP support.
No active target is that limited in concurrent file descriptors.
3 years ago
Patric Stout b7851e51ad Fix: set SP_WORKING_DIR earlier with '-c'
On Windows, relative folders don't work so well. So we need to
lookup the full path. This is best done in DetermineBasePaths()
and as a bonus that only sets SP_WORKING_DIR once.
4 years ago
Patric Stout da7c74ba7e Fix: change the working-dir searchpath when using '-c'
Basically, with '-c' you now create a sandbox. It will still use
your personal-dir and global-dir to find files you installed there,
but all new files are stored with a base folder identical to the
folder the configuration is in.

This is a bit of an old bug, that we many have tried to solve in
various of different ways. The code has grown sufficiently complex
that it is hard to see what consequences of actions are. This is
in my opinion the most harmless solution, while increasing the
usefulness of the '-c' flag.

In essence, the problem was that empty folders were always created
in the directory where the configuration was, but as that directory
wasn't added to any searchpath, files weren't stored there, unless
by accident it was a folder already on the searchpath. For example,
if you do './openttd -c local.cfg', it did work as expected. But
in the more generic variant, it did not.

With this patch, you can run './openttd -c /new/folder/local.cfg',
and it will create and prepare that folder to receive new files.

'content_download' is also stored in the directory the
configuration is in; this was already the case. Important to
note that there is only one search-path for 'content_download'.
In other words, when using '-c', it will not look in '~/.openttd'
inside the 'content_download' folder.
4 years ago
Patric Stout 4e12aac9c0 Codechange: to create or not to create a folder, that is the question
This was just weird. With XDG _personal_dir was created already,
but later on it was checked if it was different from config_dir,
and the creation was skipped. All this checking and validation
makes my head spin .. let's make it a bit more simple.
4 years ago
Niels Martin Hansen 84efde8ee3 Change: Log when rejecting a TAR archive for extraction
Based on report in <https://www.tt-forums.net/viewtopic.php?f=31&t=87374>
4 years ago
glx22 87a069c887
Fix #8230: Resolve ".." when opening files in .tar (#8231) 4 years ago
Michael Lutz c972a63c8c Codechange: Store info about the dedicated server log file in globals with automatic destruction to simplify control flow in openttd_main. 4 years ago
Charles Pigott 4bc78835e8 Fix #6399: Create parent directories if they don't already exist 4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Alberth 5981ed248a Codechange: Remove unused FioTarFirstDir and FioTarAddLink functions 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
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.
5 years ago
Patric Stout 72c5f2b3ee Remove: DOS support
In 10 years there was no active development on DOS. Although it
turned out to still work, the FPS was very bad. There is little
interest in the current community to look into this.

Further more, we like to switch to c++11 functions for threads,
which are not implemented by DJGPP, the only current compiler
for DOS.

Additionally, DOS is the only platform which does not support
networking. It is the reason we have tons of #ifdefs to support
disabling networking.

By removing DOS support, we can both use c++11 functions for threads,
and remove all the code related to disabling network. Sadly, this
means we have to see DOS go.

Of course, if you feel up for the task, simply revert this commit,
and implement stub c++11 functions for threads and stub functions
for networking. We are more than happy to accept such Pull Request.
5 years ago