Commit Graph

5689 Commits (e5006affb7c2af411c8c8b1c3fa3bfba03e716d3)

Author SHA1 Message Date
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
Gerard Krol 98acead64b Prevent power assert for "instant" (no research points needed) research. This fixes bug #424. 2009-04-27 14:04:32 +02:00
Buginator 8a11947b31 Let's only send the map to the person that needs the map.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7178 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 12:46:39 +02:00
Buginator 88c534c213 closes ticket:37 Which had a bad case of bitrot.
Adds a new console command 'showorders'  (Must be in debug/cheat mode)
This toggle allows realtime information on the selected unit, and always shows the order / action it is doing.  When the unit is deselected, then it doesn't display anything.




git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7172 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 12:46:39 +02:00
Buginator 7ef71df9cb Fixes ticket:419
Add check to make sure logfile is available.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7169 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 12:46:38 +02:00
Buginator b69d82d99f Fixes ticket:421
--host works correctly again.


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7166 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 12:46:38 +02:00
Guangcong Luo 8c06496525 Fix assert when attempting to research free topics.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7165 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-27 12:46:38 +02:00
Buginator b095418a42 Fixes ticket: 369
Don't always assume that the (lobby) server will not be available, and give up on all future attempts.
We now reset the flag on NETclose().



git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7159 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-24 14:16:08 +02:00
Guangcong Luo b17b7823a8 Reformat r7155 to follow coding style
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7157 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-24 14:16:08 +02:00
Guangcong Luo 2a4a462502 Commit patch #374: Fix artillery prediction, submitted by Adam Olsen.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7155 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-24 14:16:08 +02:00
Freddie Witherden b54722604a Update the default configuration so that we do not pause on focus loss.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7154 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-24 14:16:07 +02:00
Buginator 367110ec57 Disable password button for skirmish games.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7150 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-24 14:16:07 +02:00
Per Inge Mathisen af5182dc1a Fix compile on MSVC. Cannot use #ifdef inside a macro.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7149 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-24 14:16:07 +02:00