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
Giel van Schijndel
0c7f44ee70
Make gamedblock intrinsic to GameDB itself (i.e. let it contain its own lock)
...
* Return generators instead of entire lists and have the generator keep the lock intact while it's being iterated over
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7266 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:32 +02:00
Giel van Schijndel
3153a9f63d
Make sure to reset the "requests" counter when checkInterval is reached
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7265 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:32 +02:00
Giel van Schijndel
563ff537a1
Lobbyserver: Use separate sockets to listen on IPv4 and IPv6 (instead of a single socket which uses IPv4 to IPv6 mapping)
...
* Use select(2) to wait for a connection on both sockets and accept(2)ing them in a separate thread
* This prevents IPv4 addresses from becoming IPv6 mapped, which might not be properly supported on all platforms
- The IPv6 mapped addresses where transferred back to clients
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7264 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:32 +02:00
Freddie Witherden
d0fec57acf
Minor indentation/spelling fixes in patternManager.[ch].
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7263 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:32 +02:00
Per Inge Mathisen
7bea80efd3
Please use setDroidActionTarget() whenever you change psActionTarget. This helps set dangling pointer debugging information.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7262 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:32 +02:00
Guangcong Luo
d18d80f979
More order/action bugfixes, and some miscellaneous bugfixes, namely:
...
* Make sure all turrets shoot at things they're ordered to shoot at
* Make sure all turrets shoot at things they're supposed to shoot at (this fixes all the multiturret behavior bugs)
* Stop an assert relating to auto-repair
* Internationalize "Hydra"
* Stop repair facility from trying to repair dead units
* Comment the update stage of DACTION_ATTACK and Repair Facility very well.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7260 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:32 +02:00
Guangcong Luo
d2c8a1ccad
Misc. multiplayer bugfixes.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7258 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:31 +02:00
Giel van Schijndel
e4f82dc1e5
Disconnect immediately when we've handled the client's request (or concluded it to be invalid)
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7256 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:31 +02:00
Giel van Schijndel
dd66b9fe33
Fix a bug where we would check the wrong socket for readiness
...
- Would occur when processing a "list" command on the game server
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7255 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:31 +02:00
Giel van Schijndel
4a3b92bd4b
Document the purpose of the different sets of sockets
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7254 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:31 +02:00
Per Inge Mathisen
73ea6f197e
Remove unused functions from text drawing code.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7253 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:31 +02:00
Per Inge Mathisen
b8d3c62005
Remove last of the useless statics from text drawing code.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7252 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:31 +02:00
Per Inge Mathisen
e5006affb7
Remove useless and unused statics from text drawing code.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7251 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:31 +02:00
Buginator
1f9e48ba86
Fixes compile issue that was broken in r7237.
...
In this case, 'Remove unnecessary SDL includes.' Removed the #include for C99 types that we use on non C99 compilers.
In case your wondering, using SDL_stdinc.h, since SDL_types.h is Deprecated.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7250 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:30 +02:00
Giel van Schijndel
fb4c443dd8
Update the lobby server to still be in sync with the 2.2 lobby protocol which was changed in r7239
...
Use 40 bytes for the "host" (IP address) in GAMESTRUCT, this allows for using IPv6 without breaking protocol combatility again
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7249 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:30 +02:00
Giel van Schijndel
b665aa67ba
Update the lobby server to still be in sync with the 2.2 lobby protocol which was changed in r7246
...
Move GAMESTRUCT_VERSION to the top of GAMESTRUCT, thus allowing versioning to work properly at all times
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7248 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:30 +02:00
Giel van Schijndel
f6b3c04c8c
Backport r7244 into trunk from the 2.2 branch
...
Move GAMESTRUCT_VERSION to the top of GAMESTRUCT, thus allowing versioning to work properly at all times
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7246 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:30 +02:00
Per Inge Mathisen
a9b8a20aa5
Make focusState a static to main.c, instead of a global from frame.c
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7240 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:30 +02:00
Giel van Schijndel
e16e034ec7
Use 40 bytes for the "host" (IP address) in GAMESTRUCT, this allows for using IPv6 without breaking protocol combatility again
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7239 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:30 +02:00
Per Inge Mathisen
29a2b2fe35
Change SDL types to stdint.h defined types. Do not depend on SDL.h included system headers.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7238 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:30 +02:00
Per Inge Mathisen
8a0a0af7c0
Remove unnecessary SDL includes.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7237 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:29 +02:00
Guangcong Luo
f3281e7d89
Fix compiler error on a "suggestion".
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7235 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:29 +02:00
Guangcong Luo
c4d38188d3
Commit patch #413 : A minor fix to the order/action code, and a partial rewrite of the repair facility code. It fixes a few bugs, including:
...
Droids with Hold Position and Fire-At-Will will fire upon anything that comes within range.
Droids waiting for repair with Fire-At-Will will fire upon anything that comes within range.
Droids waiting for repair will "snap out of" whatever they're doing and get repaired when it's their turn at a repair facility (fixes bug #92 ).
Droids returning for repair that lose sight of their target will try again (might fix bug #360 ).
Trucks will not help enemies build structures (generally only happened if two trucks were going for the same oil resource).
Repair facilities with nothing better to do will repair nearby units.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7233 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:29 +02:00
Christian Ohm
b04a4a7412
Change some defaults:
...
- Use DejaVu Sans
- Don't pause on focus loss
- Use the whole window for videos
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7232 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:29 +02:00
Guangcong Luo
663321709e
Don't count cheated games as wins/losses in multiplayer stats.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7227 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:20 +02:00
Guangcong Luo
b8772dd066
Singleplayer crashfix.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7226 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:19 +02:00
Giel van Schijndel
ebd93276a6
Make the lobby server listen and operate on IPv6
...
* Also disable IPV6_V6ONLY to make sure that (on systems that support the option) IPv4 is still supported, using the same socket
- This option works on Linux from 2.4.21 and 2.6 (according to "man ipv6")
- On FreeBSD this works from version 6 onward (lower versions might work, I only tested on 6 and 7 and didn't find any note in the manual)
- Furthermore, according to
http://en.wikipedia.org/wiki/IPv4_mapped_address :
* This works on Windows from Vista onward
* This works on NetBSD (version unspecified)
* This doesn't work on OpenBSD (as a design decision for security)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7225 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:19 +02:00
Giel van Schijndel
66b09c68ec
* Fix a copy/paste error
...
- Make sure to use the maxPlayers and currentPlayers variables found in the Game class, not the (non-existing) local variables
* Don't use Game.check() as it doesn't exist, use Protocol.check(Game) instead
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7224 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:19 +02:00
Giel van Schijndel
7db243a59e
Lets correctly indicate in our error message which TCP ports should be open (instead of hardcoding the message and getting it wrong)
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7222 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:19 +02:00
Giel van Schijndel
c2e33dc923
* Make the lobby host and version configurable
...
* Use the "Protocol" instead of "BinaryProtocol" class to communicate with the lobby (in the IRC bot)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7221 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:18 +02:00
Giel van Schijndel
b5e6967f73
* Fix copy-paste error ("output" should be "input")
...
* Stop decoding as soon as an error is encountered
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7220 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:18 +02:00
Giel van Schijndel
b0c5590f6c
Semantical error: call the function instead of evaluating it
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7219 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 20:52:18 +02:00
Giel van Schijndel
05d9661d7a
* Do not change the function _swap_endianness on the fly to prevent it from being used in a 2.1 lobby
...
- Change this because altering _swap_endianness on the fly isn't threadsafe
- Instead revert to code duplication (for now)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7218 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-28 00:46:45 +02:00
Giel van Schijndel
a5aa693b95
Split out the different lobby protocol versions in a class per version:
...
* This removes the need to specify what type of protocol (e.g. BinaryProtocol vs. JsonProtocol) should be used
- Instead only the (Warzone) version needs to be specified, the constructor function (Protocol()) will figure out the correct protocol class to use
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7217 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-28 00:46:45 +02:00
Giel van Schijndel
b64911e732
* For reading use a context managed "readable" as well
...
- However, unlike "writeable" don't return a StringIO object for strings
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7216 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-28 00:46:45 +02:00