Commit Graph

293 Commits (75dd135e8d8aeb376d6bf8e2e3f71bb8fd88d4d8)

Author SHA1 Message Date
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Jonathan G Rennison 1ac0d4a5b2 Fix: Thread unsafe use of NetworkAddress::GetAddressAsString
Remove static buffer form of NetworkAddress::GetAddressAsString.
This is used in multiple threads concurrently, and is not thread-safe.

Replace it with a form returning std::string.
4 years ago
Jonathan G Rennison f8d6e781ba Merge branch 'master' into jgrpp
# Conflicts:
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj.filters
#	src/base_consist.h
#	src/company_base.h
#	src/newgrf_config.cpp
#	src/newgrf_config.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/settings.cpp
#	src/signs_base.h
#	src/string.cpp
#	src/string_func.h
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_cmd.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/null_v.cpp
4 years ago
Michael Lutz 43cd892e0c Codechange: Replace custom linked list for GRF texts with STL vectors and strings. 4 years ago
Jonathan G Rennison ef7e658dee Network: Remove static buffer form of NetworkAddress::GetAddressAsString
This is used in multiple threads concurrently
4 years ago
Jonathan G Rennison 7960db35f2 Merge branch 'master' into jgrpp
# Conflicts:
#	config.lib
#	projects/openttd_vs140.vcxproj
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj
#	projects/openttd_vs142.vcxproj.filters
#	src/aircraft_cmd.cpp
#	src/base_station_base.h
#	src/core/pool_type.hpp
#	src/disaster_vehicle.cpp
#	src/economy.cpp
#	src/engine.cpp
#	src/group.h
#	src/group_cmd.cpp
#	src/group_gui.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/linkgraph/linkgraph_gui.cpp
#	src/network/network_command.cpp
#	src/network/network_server.cpp
#	src/openttd.cpp
#	src/order_cmd.cpp
#	src/road_cmd.cpp
#	src/saveload/afterload.cpp
#	src/saveload/cargopacket_sl.cpp
#	src/saveload/linkgraph_sl.cpp
#	src/saveload/order_sl.cpp
#	src/saveload/station_sl.cpp
#	src/saveload/town_sl.cpp
#	src/saveload/vehicle_sl.cpp
#	src/screenshot.cpp
#	src/screenshot.h
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/smallmap_gui.cpp
#	src/station.cpp
#	src/station_cmd.cpp
#	src/table/settings.ini
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/train.h
#	src/train_cmd.cpp
#	src/train_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/vehiclelist.cpp
#	src/window_type.h
5 years ago
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 5 years ago
Jonathan G Rennison cbdd9f84d8 Merge branch 'master' into jgrpp
# Conflicts:
#	src/console_gui.cpp
#	src/lang/korean.txt
#	src/video/sdl2_v.cpp
#	src/video/sdl2_v.h
#	src/window.cpp
#	src/window_gui.h
5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Jonathan G Rennison c84a454d70 Network: Use shorter UDP MTU where data can be split across multiple packets. 5 years ago
Jonathan G Rennison 674732cd68 Merge: Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Jonathan G Rennison f887b12be2 Add 3rd party mingw-std-threads headers to fix MinGW compilation 5 years ago
Jonathan G Rennison 361758b516 Merge branches 'crashlog_improvements', 'save_ext' into jgrpp
# Conflicts:
#	Makefile.src.in
#	projects/openttd_vs140.vcxproj
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj
#	projects/openttd_vs142.vcxproj.filters
#	src/core/smallstack_type.hpp
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/linkgraphjob.h
#	src/misc.cpp
#	src/network/network_udp.cpp
#	src/openttd.cpp
#	src/saveload/saveload.cpp
5 years ago
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.
5 years ago
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.
5 years ago
Jonathan G Rennison ba34ec7ade Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations
Fix template creation build and refit

# Conflicts:
#	Makefile.bundle.in
#	config.lib
#	src/animated_tile.cpp
#	src/blitter/32bpp_anim.hpp
#	src/blitter/32bpp_base.hpp
#	src/blitter/8bpp_base.hpp
#	src/blitter/null.hpp
#	src/build_vehicle_gui.cpp
#	src/command.cpp
#	src/command_func.h
#	src/console_gui.cpp
#	src/core/smallstack_type.hpp
#	src/date.cpp
#	src/debug.cpp
#	src/genworld_gui.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/lang/korean.txt
#	src/linkgraph/linkgraph_gui.h
#	src/main_gui.cpp
#	src/misc_gui.cpp
#	src/network/core/game.h
#	src/network/core/packet.cpp
#	src/network/core/udp.cpp
#	src/network/core/udp.h
#	src/network/network_content.cpp
#	src/network/network_type.h
#	src/network/network_udp.cpp
#	src/newgrf_house.h
#	src/openttd.cpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/os/unix/crashlog_unix.cpp
#	src/os/windows/crashlog_win.cpp
#	src/osk_gui.cpp
#	src/pathfinder/opf/opf_ship.cpp
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/saveload/saveload.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/smallmap_gui.h
#	src/station_base.h
#	src/station_cmd.cpp
#	src/table/gameopt_settings.ini
#	src/table/newgrf_debug_data.h
#	src/table/settings.ini
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/train_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/vehiclelist.cpp
#	src/viewport.cpp
#	src/widgets/dropdown.cpp
#	src/window_gui.h
5 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 5 years ago
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 5 years ago
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 5f8354f358 Change: Make a shortened network revision string for use in server queries 5 years ago
Jonathan G Rennison a6c5951b2f Fix flags field not being received in Reply_CLIENT_FIND_SERVER_extended 6 years ago
Jonathan G Rennison 21040dc00b Implementing sending server GRF info list response in multiple packets
Add/adjust GRF info message logging
6 years ago
Jonathan G Rennison 6342099c4d Allow 256 NewGRFs in multiplayer
Add extended network format for server info
Add general UDP packet fragmentation system
Fix map dimensions >= 64k
Increase length of server revision string
Maintain backwards compatibility with trunk for advertisement/server listing
6 years ago
frosch 31f046bd9b (svn r27670) -Add: [FS#6471] Assign descriptive names to (GNU pthread) threads. (JGR) 8 years ago
Jonathan G Rennison a3768d3a29 Label threads with a descriptive name where supported (pthreads). 9 years ago
rubidium ff5c05c1b4 (svn r27400) -Fix [FS#6368] (r26449): when a dedicated server was paused with no clients the tick length was increased significantly, making any assumptions about the tick length used further down in the code are not true anymore. One of such assumptions was that one should readvertise every 15 minutes worth of original ticks, but due to the lengthening this timeframe would be more like 45-60 minutes. Now we'll take the operating system's millisecond counter instead 9 years ago
rubidium e8788019fa (svn r27400) -Fix [FS#6368] (r26449): when a dedicated server was paused with no clients the tick length was increased significantly, making any assumptions about the tick length used further down in the code are not true anymore. One of such assumptions was that one should readvertise every 15 minutes worth of original ticks, but due to the lengthening this timeframe would be more like 45-60 minutes. Now we'll take the operating system's millisecond counter instead 9 years ago
rubidium 5b82822c12 (svn r26486) -Codechange: replace a number of snprintfs with seprintf 10 years ago
rubidium 6ecc602050 (svn r26486) -Codechange: replace a number of snprintfs with seprintf 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 2be4215f43 (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
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 12 years ago
planetmaker f00d9976f9 (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 12 years ago
rubidium 1adb9a5c85 (svn r24070) -Fix [FS#5098]: the 'last joined' server was not properly selected anymore (adf88) 12 years ago
rubidium 5791feadf0 (svn r24070) -Fix [FS#5098]: the 'last joined' server was not properly selected anymore (adf88) 12 years ago
rubidium d2c643df63 (svn r23754) -Fix (r23752): the locks aren't reentrant 13 years ago
rubidium 1481ae6899 (svn r23754) -Fix (r23752): the locks aren't reentrant 13 years ago
rubidium c530450193 (svn r23752) -Fix [FS#4938]: missing locking causing crash is extreme case when being in the MP lobby 13 years ago
rubidium 22be2a7f43 (svn r23752) -Fix [FS#4938]: missing locking causing crash is extreme case when being in the MP lobby 13 years ago
rubidium 531e501b5a (svn r23751) -Codechange: rename NetworkUDPGameLoop to a more descriptive name, and move the UDP specific bits to network_udp 13 years ago
rubidium f8faaebaf0 (svn r23751) -Codechange: rename NetworkUDPGameLoop to a more descriptive name, and move the UDP specific bits to network_udp 13 years ago
yexo 7a7d9a7b6b (svn r23494) -Feature: [NewGRF] action14 node INFO->URL_ to add an url 13 years ago
yexo 38102a96b9 (svn r23494) -Feature: [NewGRF] action14 node INFO->URL_ to add an url 13 years ago
rubidium 289133be14 (svn r22695) -Fix [FS#4697]: mark addresses that could not be resolved as 'do not resolve anymore' as well, instead of trying to resolve them each and every time the address is accessed 13 years ago
rubidium 7c9432f94d (svn r22695) -Fix [FS#4697]: mark addresses that could not be resolved as 'do not resolve anymore' as well, instead of trying to resolve them each and every time the address is accessed 13 years ago
rubidium 944a5cb7aa (svn r22423) -Document: some network stuff 13 years ago
rubidium 1ef751e855 (svn r22423) -Document: some network stuff 13 years ago
rubidium 536c581923 (svn r22401) -Codechange: replace some defines in the udp code so doxygen can create better documentation 13 years ago
rubidium 8a58e2cd16 (svn r22401) -Codechange: replace some defines in the udp code so doxygen can create better documentation 13 years ago
yexo 93533b603a (svn r22162) -Fix [FS#4533]: No update of NewGRF window when unknown GRF name becomes available 13 years ago
yexo d1d3084a82 (svn r22162) -Fix [FS#4533]: No update of NewGRF window when unknown GRF name becomes available 13 years ago
rubidium 71e3562f76 (svn r21463) -Fix [FS#4296] (r21405): when packets are filled their pos and size aren't the same as when they're read. As a check was incorrect. 14 years ago
rubidium 8bcba1000f (svn r21463) -Fix [FS#4296] (r21405): when packets are filled their pos and size aren't the same as when they're read. As a check was incorrect. 14 years ago
rubidium 378e233023 (svn r21417) -Fix: ofcourse MSVC x64 has something to complain about 14 years ago
rubidium cd7b7ca9d8 (svn r21417) -Fix: ofcourse MSVC x64 has something to complain about 14 years ago
rubidium 9139a6c858 (svn r21405) -Codechange: prepare sending of company information in the UDP packet for longer company names (in bytes), by truncating the names if needed 14 years ago
rubidium 95934b9f49 (svn r21405) -Codechange: prepare sending of company information in the UDP packet for longer company names (in bytes), by truncating the names if needed 14 years ago
rubidium b6c2216749 (svn r21358) -Codechange: make some network function names conform to coding style 14 years ago
rubidium c7066d00af (svn r21358) -Codechange: make some network function names conform to coding style 14 years ago
frosch 3972c790c2 (svn r20957) -Codechange: Add another parameter to FindGRFConfig() to define search restrictions. 14 years ago
frosch a7e486360d (svn r20957) -Codechange: Add another parameter to FindGRFConfig() to define search restrictions. 14 years ago
yexo d3c1be9abd (svn r20249) -Codechange: change the newgrf name/description from a char* to a GRFText* to make translations possible 14 years ago
yexo 6117b0abc7 (svn r20249) -Codechange: change the newgrf name/description from a char* to a GRFText* to make translations possible 14 years ago
alberth be6c058424 (svn r20211) -Codechange: Indented code should have curly braces around it. 14 years ago
alberth 137e2b64c9 (svn r20211) -Codechange: Indented code should have curly braces around it. 14 years ago
rubidium 062dd0e24c (svn r19814) -Codechange: give some more unnamed enums a name, in case they consisted of unrelated values use static const (u)int 14 years ago
rubidium a70fd540fc (svn r19814) -Codechange: give some more unnamed enums a name, in case they consisted of unrelated values use static const (u)int 14 years ago
yexo 404df87b1f (svn r19295) -Codechange: introduce wrapper functions for GRFConfig::name/info 15 years ago
yexo 23af928ce9 (svn r19295) -Codechange: introduce wrapper functions for GRFConfig::name/info 15 years ago
frosch 3926b62446 (svn r19283) -Fix (r19256): GRFConfig is not zeroed for non-dynamic construction. GRFIdentifier is sufficient though. 15 years ago
frosch e175c704a3 (svn r19283) -Fix (r19256): GRFConfig is not zeroed for non-dynamic construction. GRFIdentifier is sufficient though. 15 years ago
yexo a9c8dbc0a0 (svn r19255) -Codechange: encapsulate GRFIdentifier in GRFConfig instead of subclassing it 15 years ago
yexo b21278659c (svn r19255) -Codechange: encapsulate GRFIdentifier in GRFConfig instead of subclassing it 15 years ago
yexo 6406b75b8f (svn r19094) -Codechange: don't check for NULL values before calling StrEmpty 15 years ago
yexo 9a80d81f4c (svn r19094) -Codechange: don't check for NULL values before calling StrEmpty 15 years ago
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 15 years ago
rubidium 9467b7c6d6 (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 15 years ago
rubidium 1967084bc3 (svn r18746) -Fix [FS#3489]: clear the cached NewGRFs of a server when receiving a reply instead of when requesting the information. With slow/unstable network connections it would look like the NewGRF settings button went randomly missing. 15 years ago
rubidium 0a54cc9335 (svn r18746) -Fix [FS#3489]: clear the cached NewGRFs of a server when receiving a reply instead of when requesting the information. With slow/unstable network connections it would look like the NewGRF settings button went randomly missing. 15 years ago
rubidium 860b9b1cea (svn r18028) -Codechange: unglobalise some functions 15 years ago
rubidium 224f4e0197 (svn r18028) -Codechange: unglobalise some functions 15 years ago
rubidium c2221885f4 (svn r18027) -Codechange: make some unneededly global variables static and remove some unused variables 15 years ago
rubidium b2d7edddfa (svn r18027) -Codechange: make some unneededly global variables static and remove some unused variables 15 years ago
smatz 6c7f8fc8b4 (svn r17701) -Codechange: don't start line with a space if it's not inside comment 15 years ago
smatz fa937901cb (svn r17701) -Codechange: don't start line with a space if it's not inside comment 15 years ago
rubidium d6cded5380 (svn r17693) -Cleanup: remove some unneeded includes 15 years ago
rubidium 982b8ee5fc (svn r17693) -Cleanup: remove some unneeded includes 15 years ago
rubidium 07d2af338e (svn r17339) -Codechange: move thread related files to their own directory (like done for video, music, sound, etc) 15 years ago
rubidium 533e3da493 (svn r17339) -Codechange: move thread related files to their own directory (like done for video, music, sound, etc) 15 years ago
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 15 years ago
rubidium 99d46e0ad7 (svn r17248) -Fix: add GPL license notice where appropriate 15 years ago
rubidium f8bccce555 (svn r16573) -Fix: [Network] Always send the starting date from the game you're currently playing instead the starting date from the config file. 15 years ago
rubidium 8b8920533b (svn r16573) -Fix: [Network] Always send the starting date from the game you're currently playing instead the starting date from the config file. 15 years ago
smatz 10d1ef5447 (svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead 15 years ago
smatz d6e203ebe2 (svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead 15 years ago
smatz d4971a22d0 (svn r16265) -Fix (r16238): wrong format string for debug output 15 years ago
smatz e5529d8995 (svn r16265) -Fix (r16238): wrong format string for debug output 15 years ago
rubidium 951b9e7615 (svn r16238) -Change: improve/clarify some network related debug "error" messages by adding more information to them. Also give some clues on how to fix certain issues (like failing advertising). 15 years ago