Commit Graph

5851 Commits (d2f3f8bd4214eda213ad957c088b5d418cf63767)

Author SHA1 Message Date
Guangcong Luo 5a974ed226 Windows installer fixes:
* Make the cross-compile script Ubuntu-compatible
 * Don't redownload the music mod if we already have it
 * Download sequences (if we don't already have it)
 * Remove EULA agreement (The GPL is not a EULA)
 * Install OpenAL silently (Its license is not a EULA; see ML discussion)

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7327 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:40 +02:00
Giel van Schijndel e672ad000e Fix error introduced in r7323: gameHost is a member of "self" now, not a local variable
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7324 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:40 +02:00
Giel van Schijndel d02f591709 Lobby protocol; change the way the "addg" command works:
* Make the "addg" command return a status code (ranging 200-299 on success) and message (MOTD on succes)
 * Don't use the "motd" command anymore to check the lobby status, instead use the returned status code for that purpose.
 * Allow MOTD strings of arbitrary length (by sending along the length)

This modification ensures that ''proper'' connectivity checking is being performed on the game server (and reported to the user accurately).

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7323 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:40 +02:00
Per Inge Mathisen cd07168f5c Silence valgrind warning about uninitialized local variable in visibility code.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7322 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:40 +02:00
Per Inge Mathisen 74a0ad9a94 Fix valgrind warning about an uninitialized variable in display3d.c
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7321 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:40 +02:00
Per Inge Mathisen c8b522c092 Make sure we clean up allocated memory from effects to stop memory checkers from complaining. Reviewed by devurandom.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7320 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:39 +02:00
Per Inge Mathisen 5c68cb0e9a Improve error reporting in research loading code, trying to hunt down memory leak reported by valgrind.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7319 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:39 +02:00
Per Inge Mathisen 870c18b66d Make sure game time variables are properly initialized first time we refer to them. Detected by valgrind.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7318 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:39 +02:00
Buginator 967b1bcb74 Reset version string back to "trunk", accidentally changed in r7079.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7315 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:39 +02:00
Buginator cb32aca203 Get rid of magic numbers, and use #define instead.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7313 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:39 +02:00
Buginator 331b98f46e Use strcasecmp() not stricmp()
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7311 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:39 +02:00
Buginator bb848f5582 Add error messages in case the values we have read in from the config file don't match the default values.
In fact, I am not really sure why we allow those to be changed when we release a new version?

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7309 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:38 +02:00
Giel van Schijndel 38cfef4e6d Make sure to #undef the errno Exxxx symbols on Windows to prevent collision with the predefined ones by MinGW
Also lets :sort the Exxxx #define list

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7308 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:38 +02:00
Buginator 7e1a1d714c Slight fixes for the BSD socket overhaul to make it compile OK on MSVC again.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7307 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:38 +02:00
Giel van Schijndel 9fa9402919 Work around MSVC's weak & stinky preprocessor:
* Duplicate the entire ASSERT() call instead of conditionally expanding its parameter
  - Depending on whether we are or are not compiling on Windows

Thanks go to Buginator for reporting this.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7306 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:38 +02:00
Giel van Schijndel 7c49ed6628 Lobby utility library:
* Create another custom context manager (can be used in with-statement) for creating a connection to a given (host, port): "connection"
  - Perform manual name-resolution, using each returned entry until one can be succesfully connected to (allows IPv4 + IPv6 through the same function)
 * Use this context manager instead of connecting manually

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7305 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:38 +02:00
Giel van Schijndel 24cc8fda66 Use the "Protocol" constructor function instead of trying to use "BinaryProtocol" (which doesn't exist anymore)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7304 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:38 +02:00
Giel van Schijndel fcf40c7eb2 For incoming connections print the address from which the connection originates.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7303 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:38 +02:00
Giel van Schijndel a3cbe4c0c3 Use a single function for address to text translation (instead of duplicating code)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7302 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:37 +02:00
Giel van Schijndel dc70524cd2 Take advantage of SocketAccept's non-blocking nature
Just go ahead and try to accept incoming connections without waiting for
a notification that connections are pending.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7301 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:37 +02:00
Giel van Schijndel 63b6d37a94 Make SocketAccept non-blocking
This way it is no longer required to first explicitly check whether
connections are pending (through checkSockets, which select(2)s) and
only then accept(2) it. Now you can attempt to accept the connection,
and if one is available it'll get returned, NULL otherwise.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7300 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:37 +02:00
Giel van Schijndel 36f536fcdb Check for EAGAIN as well to confirm connect(2) has started
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7299 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:37 +02:00
Giel van Schijndel 73a29daefd * Use camelCase instead of CamelCase and under_squores (as requested by Per, see #435)
* Rename read_all to readNoInt because that function is a read(2) variant that doesn't get interrupted by signals (EINTR)
 * Add Doxygen comments to readNoInt and writeAll

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7298 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:37 +02:00
Giel van Schijndel 9c340eb3f7 Use winsock 2 on all build systems (not just autohell like in r7284)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7297 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:37 +02:00
Giel van Schijndel a8f8357904 Mark the server socket as not-ready when we've just accept(2)ed on it
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7296 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:36 +02:00
Giel van Schijndel 99c1ed95e8 Always use SocketClose to clean up sockets
Additionally make SocketClose work properly on Windows as well.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7295 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:36 +02:00
Giel van Schijndel 0bc6be39b1 Fix logic in handling return value of addSocket
When a socket set is full (in addSocket) print a debug message

This is the last change, part of, and closes #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7294 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:36 +02:00
Giel van Schijndel ba9d49acd5 Get rid of duplicated code
Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7293 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:36 +02:00
Giel van Schijndel ab6b694420 Bugfix: set SOCKET_ERROR to -1 to *correctly* check for errors
Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7292 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:36 +02:00
Giel van Schijndel a9070e60a9 For non-blocking sockets lets not block on read_all()
Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7291 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:36 +02:00
Giel van Schijndel 37d3b9535f Replace -1 for socket API errors with SOCKET_ERROR
Additionaly, on Unix systems define constants SOCKET_ERROR and INVALID_SOCKET to -1

Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7290 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:36 +02:00
Giel van Schijndel f412eb5a6f Port NetPlay's BSD socket usage to Windows
* Use the "SOCKET" typedef to represent socket descriptors (instead of "int")
 * Add wrapper functions for getting & setting the last socket error ("errno" on Unix)
 * Add a wrapper function for strerror, strsockerror, that works on Windows
 * Use recv(2) and send(2) instead of read(2) and write(2) respectively
 * Use INVALID_SOCKET and SOCKET_ERROR instead of -1 to find errors
 * Move setting of sockets to blocking/non-blocking to a separate function
 * Add Windows-specific wrapper functions for getaddrinfo() and freeaddrinfo()
  - Currently work only from 2000 *or* XP upwards, documentation is fuzzy.

Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7289 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:35 +02:00
Giel van Schijndel ae878a7880 Change write_all such that it will always return "size" or -1 (error)
* Check for write_all() == -1 (error) instead of "< 0" and "!= size" to
   see whether sending has failed.
 * Don't just mark sockets as "invalid" on error (by setting them to
   NULL), close them as well.
 * Give decent error messages on write failure (most likely a disconnect)

Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7288 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:35 +02:00
Giel van Schijndel 61e0a18a6a Pass the Socket* structure to read_all and write_all instead of a plain file descriptor
This way it becomes possible to modify a socket's state when
reading/writing.

Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7287 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:35 +02:00
Giel van Schijndel 939f4902ad Replace SDL-net by using BSD sockets instead
NOTE: Still needs some checking and work for Windoze compatibility.

Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7286 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:35 +02:00
Giel van Schijndel 8e57c65386 Use "struct timeval" from winsock2.h instead of our own
On Windows <sys/time.h> doesn't exist (MinGW being an exception) and
"struct timeval" is thus defined in winsock2.h.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7285 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:35 +02:00
Giel van Schijndel c48e302bcb Lets use Winsock 2!
Even Windows 98 provides Winsock 2 (95 in an add on package). So we can
safely upgrade.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7284 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:35 +02:00
Giel van Schijndel 8f7322f717 Improve buildsystem for cross compiling
* Make sure to pass CXXFLAGS to ./configure as well
 * Allow for overriding of CFLAGS and CXXFLAGS when building for the building system
  - CFLAGS_FOR_BUILD
  - CXXFLAGS_FOR_BUILD

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7283 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:34 +02:00
Per Inge Mathisen 0a599f9818 Attempt to fix ticket:449 - Warzone crashed when destroyed repair facility. Reviewed by Zarel.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7281 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:34 +02:00
Per Inge Mathisen 83cb5626e4 Stylistic cleanup of bridge code
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7280 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:34 +02:00
Guangcong Luo 43f184fa22 Fix target prediction broken by Rhamphoryncus's patch.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7278 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:34 +02:00
Giel van Schijndel e0adf0d0e8 Revert r7276's accidental change to wzmasterserver.py
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7277 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:34 +02:00
Giel van Schijndel 9943cf6b01 Lets not mark utility modules as executable
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7276 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:34 +02:00
Giel van Schijndel 7297008ed5 Fix spelling error: rename "ERROR_WRONGVESION" to "ERROR_WRONGVERSION"
Thanks to Kreuvf for noting the mistake.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7275 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:33 +02:00
Giel van Schijndel 8b7f17e2e5 Fix _swap_endianness() to return it's argument endian-swapped, not a tuple containing that result
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7273 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:33 +02:00
Giel van Schijndel f8a70ebf2b Lets not use an intermediate buffer for the MOTD before adding it to the console (as a message)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7271 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:33 +02:00
Giel van Schijndel 47bbacc7bb Bugfix: NUL terminate the MOTD string buffer
If registering with the lobby server failed once, we don't want part of
the failure message to be kept at the end of the MOTD string.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7270 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:33 +02:00
Giel van Schijndel 7e7ba74801 Move exception handling to the location where RequestHandler.handle(self) is being invoked from
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7269 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:33 +02:00
Giel van Schijndel 36dc3d8c6c Use the RequestHandler's finish() method for cleaning up any open games instead of a try-finally block
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7268 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:33 +02:00
Giel van Schijndel 6618674111 Fix a syntax error from r7266 (and a disconnected spelling error while we're at it)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7267 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:33 +02:00