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
Giel van Schijndel
832f8728d2
Use the Protocol class to find out what port to listen on, instead of manually configuring
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7215 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-28 00:46:45 +02:00
Giel van Schijndel
cdc8412bd7
Convert wztest.py to use the latest lobby code for testing the lobby
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7212 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 22:46:38 +02:00
Giel van Schijndel
eebb624276
* Change the lobby IRC bot to use the same code as the lobby server for protocol handling and game representation
...
* Move the "list" function (to retrieve the lobby's list of games) to the Protocol class
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7211 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 22:46:38 +02:00
Giel van Schijndel
32417e1bb9
* Allow Protocol's encode and decode functions to work directly on * sockets and file objects (in addition to strings)
...
- This removes the requirement for the socket handler to be aware of the size of a single game
- I.e. this allows variable sized games without another API change
* Read and write Protocol data directly from and to the sockets, decoding and encoding on the fly
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7209 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:41 +02:00
Giel van Schijndel
b68ab0bb6d
Log tracebacks when exceptions occur and aren't handled
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7208 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:41 +02:00
Per Inge Mathisen
952fc1a708
Correct some not-very-important comments. Closes ticket:422, patch by stiv.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7205 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:41 +02:00
Buginator
2dc8626d75
whoops! :o I applied the wrong patch.
...
Reverting.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7204 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:41 +02:00
Per Inge Mathisen
a0b9188899
Make use of ASSERT_OR_RETURN to clean up asserts and error conditions in structure code.
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7201 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:40 +02:00
Giel van Schijndel
d1d787c8d6
* Make the game server's port version dependant
...
* Move checking of game's vitality to from the Game class to the Protocol class
- Do this because checking of games is inherently protcol dependant
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7200 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:40 +02:00
Giel van Schijndel
4b74fd0cc5
Don't deal with requestHandler stuff in the Game class
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7199 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:40 +02:00
Giel van Schijndel
57aefa7a85
* Use unpack_from, instead of unpack, if multiple items are contained in the same buffer
...
* Use xrange() instead of range() when looping over its items
- xrange() is faster and more lightweight as iterable
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7198 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:40 +02:00
Giel van Schijndel
227ecdb1f8
Lobby protocol: Workaround the fact that the 2.0.x versions don't perform endian swapping
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7197 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:40 +02:00
Giel van Schijndel
322c10e7a4
* Use struct.Struct objects instead of free functions from the "struct" module to perform encoding and decoding
...
* Perform version range comparisons like this: lowest_version <= version < one_higher_than_largest_version
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7196 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:39 +02:00
Giel van Schijndel
9ff472fad5
Fix a syntax and semantical error:
...
* Use the % operator for formatting strings
* Use struct.unpack for decoding a struct (instead of struct.pack)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7195 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:39 +02:00
Giel van Schijndel
8bfd2acef1
Use a single function to perform the encoding as a C string
...
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7194 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 21:30:39 +02:00