Commit Graph

27 Commits (13f5044e0dafc22dbaa25a04d1b9aa7676636799)

Author SHA1 Message Date
Giel van Schijndel 5f5489b650 * Stuff SESSIONDESC.dwUser[1-4] in an array: SESSIONDESC.dwUserFlags\[4]
* Rewrite NETgetGameFlagsUnjoined such that it's not hardcoded for its `flag` parameter anymore

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6150 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-14 12:58:59 +00:00
Dennis Schridde 022315eef0 Hardcode top_srcdir to make building from non-topdir possible, dont depend on the touch command, fix LDFLAGS to not depend on the removed TARGET variable
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5476 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:10:16 +00:00
Dennis Schridde 302a557478 Rename "raw" Makefiles to "win32" Makefiles
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5402 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-06 14:29:04 +00:00
Dennis Schridde 45f23a4926 Merge commit 'HEAD@{3}'
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5347 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-28 22:32:44 +00:00
Dennis Schridde 050ec39c11 Use the (also new in this commit) relative variants of the directories almost everywhere.
Exception is when generating the .wz files, where we need the path to the build directory and building a reverse relative path to $(srcdir) will be messy.
Also silence submake.mk a great deal.
Bug #11883 should be fixed now for the most part.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5325 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 23:41:52 +00:00
Dennis Schridde fd2bfb0e0f Prepare for another fix for parts of bug #11883: Issues with the improved raw Makefiles
- Rename Makefile.raw to lowercase


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5321 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 22:48:45 +00:00
Dennis Schridde 73b35ab8d6 Rename top_srcdir/top_builddir to abs_top_srcdir/abs_top_builddir, to make this more obvious.
Their use is currently flawed, since it will not work in directories with spaces in them... (


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5319 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 20:19:54 +00:00
Dennis Schridde 9bd8b24921 Boost raw Makefiles
- Use PACKAGE, PACKAGE_VERSION, remove VERSION
- Allow out-of-source-dir builds (mkdir build && cd build && make -f ../Makefile.raw)
- Move config.mk from $(top_srcdir)/makerules/config.mk to $(top_builddir)/config.mk
   When keeping current behaviour (srcdir=builddir), this means: Move it from makerules into the main directory


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5308 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-23 13:54:47 +00:00
Giel van Schijndel bb4c6e56c2 * Mark some variables as volatile (they're shared across threads)
* Assert proper usage of ReadWriteMutex


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4374 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-27 16:30:41 +00:00
Giel van Schijndel 1d83be8064 * s/tagWriteSeparator/tagWriteNext/g for consistency's sake (to match the tagReadNext function, which is the reading equivalent)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3334 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-04 13:37:42 +00:00
Giel van Schijndel c8b99f0ae0 * Don't #include <boost/utility.hpp> and inherit from boost::noncopyable;
* Instead declare our copy constructor and copy assignment operator private, also we don't provide an implementation of those

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2137 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-18 22:01:07 +00:00
Giel van Schijndel aa54cee726 * Check hosts that attempt to register a game with the lobby server for reachability on port 9999 (e.g. a NAT/firewall might obstruct this)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1957 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-24 17:43:57 +00:00
Giel van Schijndel 12f21d0b0c * Replace usage of uint8_t with char for C-strings; while (u)int8_t works perfectly nice for numbers it isn't nice for text (char-array)
* To make sure we still have the guarantee that a char is 8bit I've inserted a static assertion for this (CHAR_BIT == 8)
 * Use exact length types for lobbyserver

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1821 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-05 12:01:59 +00:00
Giel van Schijndel a62d8fce62 * Move iteration interface out of class GameLobby into a new member class: GameLobby::iterator_interface
Previous implementation could hit a deadlock since every single const_iterator class attempted to acquire a scoped_readonlylock on the lobby's mutex. Since the ReadWriteMutex doesn't grant readonlylocks anymore when a writer is pending for a lock this could deadlock if you ever would need two iterators at the same time. Therefore we now only acquire one readonly lock through the iterator_interface class.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1673 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-21 11:27:58 +00:00
Giel van Schijndel f4abaf4efc A run of `astyle --suffix=none --brackets=break --indent-switches --pad=oper --unpad=paren --min-conditional-indent=0 --mode=c --indent-classes --indent-namespaces` on the lobbyserver's codebase with "Artistic Style <http://astyle.sourceforge.net/>".
It seems that "Artistic Style":
 * somehow treats "lock" as a keyword, since it puts spaces behind every instance of "lock", this is not nice.
 * doesn't recognize std::cout and std::cerr iostreams so doesn't properly line out multiline statements with stream operators
 * doesn't indent subclasses correctly (it treats them as if they're one of the keywords "public", "protected", or "private")
 * lines out multiline if-statements on their logical operators rather than their values, example:
> if (bla == bleh
>     && mooh == meeh)
instead of:
> if (bla == bleh
>  && mooh == meeh)

I've corrected all of the above manually before committing.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1669 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-20 18:19:06 +00:00
Giel van Schijndel 685af73e85 * Use htonl and ntohl for conversion to and from network-byte order
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1651 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 21:36:55 +00:00
Giel van Schijndel 2a396b563a * Split out lobby code
* GameLobby::gameLock now has a separate file
  * GameLobby::const_iterator now also has a separate file
 * move class RAIICounter to files of its own for ease of reusability
 * remove dummy game (from lobbyprotocol::requestHandler in requesthandler.cpp)
 * Remove commented out code (main.cpp)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1650 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 21:31:33 +00:00
Giel van Schijndel 9773356a67 Less PImpl, More Impl
* Add new class lobbyprotocol::requestHandler which deals with protocol specific tasks
 * Move all protocol dependant code from class GameLobby to lobbyprotocol::requestHandler
 * Add some comments to code

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1649 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 21:23:30 +00:00
Giel van Schijndel 87d8648c8b * Cleanup of directory structure
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1648 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 21:18:41 +00:00
Giel van Schijndel 94044a0e9c * move function printGame to new file game.cpp
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1647 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 21:13:32 +00:00
Giel van Schijndel 8f66b5246b * set host IP on incoming game
* Modify class TCPServer to take a boost::asio::ip::tcp::endpoint for member-function listen instead of a port number
 * Now use command line arguments for addresses to listen on (on each of those addresses we open port 9998 still)
 * Fix wrongly named include guards (lobby.hpp)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1646 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 21:07:46 +00:00
Giel van Schijndel d85d317842 * Add a lobby class
* handles incoming connections from TCPServer (functions properly now)
  * uses an std::list to store GAMESTRUCTs in
  * uses ReadWriteMutex for multithreading synchronisation
  * handles "addg" requests
   * handles game persistence (with specialized "game" locks, which will die along with the connection)
  * handles "list" requests
   * dumps the entire list of current games to the user

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1645 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 21:01:02 +00:00
Giel van Schijndel 831dbe0c1d * Add utility class: ReadWriteMutex;
This class allows multiple readers to obtain a lock at the same time. Until a writer attempts to obtain a lock, then attempts by readers to lock will block. Also second writers that attempt to lock will block until the first releases its lock.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1644 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 20:57:49 +00:00
Giel van Schijndel aaac0278f5 * Handle the "list" command in a proper way by answering with a dummy game
* Add asynchronous TCP server class: TCPServer
 * Add comparison operators for SESSIONDESC and GAMESTRUCT respectively
 * Add -D_WIN32_WINNT=0x0501 to the compiletime options (needed for Boost::Asio on WinXP, 2k needs -D_WIN32_WINNT=0x0500, GNU/Linux systems define it themselves automatically)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1643 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 20:51:29 +00:00
Giel van Schijndel 7a0457e6e0 * Use EOF as connection and as such game termination
* move inclusion of definition of GAMESTRUCT to new header file game.hpp
  * Allow game.hpp including files to be compiled without SDL (useful for crosscompiling), by internally (in game.hpp) declaring GAMESTRUCT as well
 * Stay connected when an "addg" command is received (client needs to disconnect to indicate the game should be removed from the lobbylist)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1642 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 20:42:28 +00:00
Giel van Schijndel 771d1efa9e * Add a "pretty"-printing function for printing games to a terminal (through std::cout)
* switch to using IPv4 instead of IPv6 (for testing)
 * Use correct buffersize for retrieval of a command/method (5 bytes/chars right now, ought to be NUL-terminated)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1641 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 20:34:26 +00:00
Giel van Schijndel a2f477edcf * Add _premature_ C++ testing lobby server
(one of my first, and probably ugly, versions, going to commit incrementally till the last)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1639 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-15 20:30:22 +00:00