Commit Graph

129 Commits (83d63464db912f030b4cbf2936a878d1c86c338d)

Author SHA1 Message Date
peter1138 07de9d6c3f Codechange: Use override keyword in networking classes. 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
Niels Martin Hansen db2c0ccae0
Fix fdc2e85: Double close of file handles
When unpacking downloaded content, the downloaded .gz file was being opened with `fopen`, the OS file handle given to zlib, and then afterwards zlib told to close the file.

But the `FILE *` object was never closed with `fclose`, meaning the stdio library would have a hanging file object, whose file handle was now invalid or referred to a different file. This caused asserts during shutdown with Microsoft's C library in debug mode.

Fix this by properly duplicating the OS handle and `fclose`ing the `FILE *` object, before giving the handle to zlib.
5 years ago
frosch 4fc43b510d (svn r27576) -Fix (r27570): Compilation failure with all compilers but mine. 8 years ago
frosch 97e6981e39 (svn r27570) -Fix [FS#6449]: Various incorrect but uncritical size computations in the content client. 8 years ago
rubidium 21f991e235 (svn r26489) -Codechange: properly account for the end of buffers in the file io code instead of assuming MAX_PATH is okay 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
rubidium 2e54c8fdfa (svn r26056) -Fix: a number of possibly uninitialised variables 11 years ago
rubidium ed4e14dc20 (svn r26047) -Fix: possible, but very unlikely, null pointer dereference when gunziping just downloaded files 11 years ago
rubidium 5eac3a77d2 (svn r25597) -Fix [FS#5635]: [Content] When the server closed the connection, the client would for eternity try to read a packet and never timeout making it impossible to reconnect 11 years ago
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 12 years ago
yexo 483d878d5f (svn r24466) -Codechange [FS#5236]: add general function for ContentType -> Subdirectory conversion (LordAro) 12 years ago
rubidium 8371ecc922 (svn r23719) -Fix [FS#4930]: extraction of music packs failed 13 years ago
truebrain 963802e9a7 (svn r23612) -Add: allow importing libraries in the same way as AI does, only with GS prefix (and in game/library) 13 years ago
truebrain b4f832f29f (svn r23605) -Add: GAME_DIR and CONTENT_TYPE_GAME, and read gamescript from that directory 13 years ago
truebrain 561b25d031 (svn r23601) -Fix: fix the conflict in window number 13 years ago
rubidium fefe22b4aa (svn r23590) -Codechange: make the string validation settings better expandable 13 years ago
rubidium 58423b26d1 (svn r23474) -Codechange: move the declaration error related functions to error.h 13 years ago
truebrain cc12942d70 (svn r23384) -Remove: no longer allow a binary to be without AI support; the parts some compilers failed at, are integrated in other parts of the code now too 13 years ago
truebrain e37149a1de (svn r23362) -Codechange: refactor AIScanner, splitting it in AIScannerInfo and AIScannerLibrary 13 years ago
rubidium a3a2fdcfc2 (svn r23234) -Fix [FS#4840]: crash when after downloading content 13 years ago
rubidium 2b897b4fa0 (svn r23219) -Change: different directories for basesets and newgrfs. So data to baseset or newgrf, and gm to baseset 13 years ago
rubidium 160294ff22 (svn r23216) -Codechange: introduce the concept of having different tar lists 13 years ago
rubidium 0061b5f184 (svn r22822) -Codechange: make a distinction between base sets and newgrfs for their directory 13 years ago
rubidium 944a5cb7aa (svn r22423) -Document: some network stuff 13 years ago
rubidium d4737e0724 (svn r22399) -Codechange: replace some defines in the tcp/content code so doxygen can create better documentation 13 years ago
rubidium db6121f361 (svn r22208) -Fix [FS#4543]: When downloading a file via HTTP failed mid-way and OpenTTD fell back to the old system the partial downloaded amount would be counted twice 14 years ago
alberth 1dbc0a20be (svn r22144) -Codechange: Unify 'while (true)' to 'for (;;)' 14 years ago
rubidium 81ef0dbcfc (svn r21898) -Fix [FS#4438]: using a pointer-iterator and adding things (thus reallocating) to the iterated array caused OpenTTD to crash on invalid pointers 14 years ago
rubidium eb299736c1 (svn r21886) -Codechange: move documentation towards the code to make it more likely to be updated [n]. 14 years ago
rubidium b6c2216749 (svn r21358) -Codechange: make some network function names conform to coding style 14 years ago
smatz 9594a3f7c5 (svn r21319) -Fix: crash when creating file download by the content download system failed 14 years ago
smatz eb4516e50c (svn r21318) -Fix: parameters to ShowErrorMessage() were swapped when content download failed 14 years ago
frosch 3972c790c2 (svn r20957) -Codechange: Add another parameter to FindGRFConfig() to define search restrictions. 14 years ago
rubidium f555e6d72e (svn r20933) -Codechange: move some more client related methods and such to network_client.cpp 14 years ago
alberth 35fec79700 (svn r20499) -Doc: Spelling fixes, and one doxygen comment addition. 14 years ago
rubidium b8487afe54 (svn r20192) -Cleanup: bye bye variables.h, bye bye VARDEF... you won't be missed :) 14 years ago
frosch 4ce5c6d93d (svn r20089) -Fix [FS#3932]: Access of already freed memory, esp. due to hidden destructor call from Swap(). 14 years ago
rubidium 5ca4098443 (svn r20082) -Fix [FS#3899]: reading deleted memory when selecting a NewGRF in the content download window of which the data has not been acquired from the content server. The crash would occur after the content server's reply was processed and the ContentInfo object was replaced with another. 14 years ago
rubidium 948beec597 (svn r19777) -Change: use the file scanner to find the .tars 14 years ago
smatz 32510296b6 (svn r19686) -Fix (r15126): truncated archives were not detected when using zlib 1.2.3. This also fixes zlib 1.2.4 compatibility, zlib 1.2.5 is bugfree 14 years ago
smatz 0ef33548c2 (svn r19614) -Codechange: "it's" => "its" where appropriate 14 years ago
frosch ba5f5c1ce1 (svn r19600) -Fix (r18994): Presence of online content was not properly updated after download due to duplicate slashes in the path. 14 years ago
rubidium 0f6d82df7e (svn r19262) -Feature: finalise BaNaNaS support for music sets 15 years ago
smatz f051066bc4 (svn r19224) -Codechange: change parameters passed to ShowErrorMessage() a bit 15 years ago
rubidium 21bd2722cd (svn r19081) -Codechange: make it possible to disable compilation of the AI+Squirrel 15 years ago
rubidium 228da0ccd3 (svn r19001) -Fix: some GCC compile warnings 15 years ago
rubidium d818c7c7b1 (svn r18996) -Fix (r18993, r18994): MSVC 64 bits had somethings to complain about 15 years ago
rubidium 2db44fc18e (svn r18994) -Change: content mirroring support (based on work by TrueBrain). 15 years ago
rubidium e437362c7b (svn r18992) -Codechange: move the file opening/closing out of the content download function 15 years ago
rubidium 589aee0cee (svn r18991) -Codechange: simplify memory management of DownloadSelectedContent 15 years ago
rubidium 28c7c49855 (svn r18638) -Fix: downloading music sets would fail 15 years ago
alberth 44aacfc59f (svn r17928) -Codechange: ShowErrorMessage() now takes the summary string before the details string.
Gentlemen, swap your string parameters.
15 years ago
rubidium d6cded5380 (svn r17693) -Cleanup: remove some unneeded includes 15 years ago
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 15 years ago
rubidium 865fc40e29 (svn r17245) -Fix [FS#3137] (r17015): you could, via unselect all, also unselect already installed content; it would not uninstall it though 15 years ago
rubidium 9ee2a66c86 (svn r17139) -Change: add the concept of sound sets 15 years ago
rubidium f118932643 (svn r17133) -Codechange: generalise the code that searches for base graphics 15 years ago
rubidium 95c204ebee (svn r17038) -Fix (r17015): don't download the stuff we already have 15 years ago
rubidium 26070726ac (svn r16361) -Fix: pointer incremented with wrong count 15 years ago
rubidium 22d9306889 (svn r15967) -Codechange: do not access NetworkSocketHandler::has_quit directly 15 years ago
rubidium ce06df313d (svn r15941) -Codechange: jonty-comp's wish partly implemented (content server) ;) 15 years ago
rubidium 804370d964 (svn r15914) -Codechange: let the content handling make use of NetworkAddress. 15 years ago
rubidium 9d018723b7 (svn r15711) -Codechange: lots of whitespace cleanup/fixes 16 years ago
rubidium 406832fed8 (svn r15632) -Feature: allow downloading scenarios and heightmaps via bananas. 16 years ago
rubidium 3ae9851bd8 (svn r15580) -Fix [FS#2684]: last activity time not properly updated causing downloads to be aborted after a minute. 16 years ago
rubidium 4bf2f4a166 (svn r15565) -Fix [FS#2675]: dependency information wasn't requested after the content state was reset causing the dependencies not always being selected (and thus downloaded) automatically. 16 years ago
rubidium 54f852f094 (svn r15552) -Fix (r15544): some compiler/OS combinations don't like closing the same FD twice and zlib's docs weren't very clear about whether it would close a FD it didn't open. 16 years ago
rubidium fdc2e85184 (svn r15544) -Fix [FS#2650]: extracting downloaded content didn't work for Windows if one uses a non-ASCII. 16 years ago
smatz 0d3f5e6e74 (svn r15299) -Cleanup: remove many redundant includes 16 years ago
rubidium 8382b76b0f (svn r15221) -Change [FS#2574]: only show missing NewGRFs when opening the content download window from a NewGRF list and there are missing NewGRFs, otherwise show just all NewGRFs the system knows. 16 years ago
rubidium 6f5078b555 (svn r15217) -Fix [FS#2573] (r15176): more corner cases when removing things from iterated vectors 16 years ago
rubidium 83e1288c6a (svn r15215) -Fix: various MSVC x64 compiler warnings 16 years ago
rubidium 86c1d49c08 (svn r15196) -Fix (r15195): != != == :( 16 years ago
rubidium 4bf2326bd1 (svn r15195) -Fix: don't crash when removing from something you're iterating over 16 years ago
rubidium ff328bf68b (svn r15178) -Change: rename 'update' to 'upgrade' as that's a bit more clear 16 years ago
rubidium eeb38a8e3a (svn r15176) -Fix [FS#2554]: querying the content server could free when resolving the hostname or connecting takes long/is timing out. 16 years ago
rubidium 07e135547e (svn r15135) -Fix/Change: allow str_validate (part of receiving strings from the network) to pass newlines instead of replacing them with question marks, but only when asked to do so. 16 years ago
rubidium 3a13b75e37 (svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates. 16 years ago