Updated with initial 3.4.4 codebase includes:

- network fixes for multiplayer defects found
- initial code (disabled currently) for content crc checking and downloading
- code compiles on Win32 using VS2008 express, project files not yet included
This commit is contained in:
Mark Vejvoda
2010-02-03 01:09:50 +00:00
parent 58ea5ec552
commit fb5035c230
47 changed files with 4527 additions and 1329 deletions

View File

@@ -3,9 +3,9 @@
//
// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
@@ -22,6 +22,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>
#include <map>
using std::string;
@@ -51,20 +52,30 @@ public:
class Socket {
protected:
int sock;
public:
Socket(int sock);
Socket();
~Socket();
static bool enableDebugText;
// Int lookup is socket fd while bool result is whether or not that socket was signalled for reading
static bool hasDataToRead(std::map<int,bool> &socketTriggeredList);
static bool hasDataToRead(int socket);
bool hasDataToRead();
void disconnectSocket();
int getSocketId() const { return sock; }
int getDataToRead();
int send(const void *data, int dataSize);
int receive(void *data, int dataSize);
int peek(void *data, int dataSize);
void setBlock(bool block);
bool isReadable();
bool isWritable();
bool isWritable(bool waitOnDelayedResponse);
bool isConnected();
string getHostName() const;

View File

@@ -3,9 +3,9 @@
//
// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
#ifndef _SHARED_PLATFORM_PLATFORMUTIL_H_
@@ -18,6 +18,8 @@
#include <SDL.h>
#include "types.h"
#include "checksum.h"
#include <utility>
using std::string;
using std::vector;
@@ -25,6 +27,8 @@ using std::exception;
using Shared::Platform::int64;
using Shared::Util::Checksum;
namespace Shared{ namespace Platform{
// =====================================================
@@ -41,7 +45,7 @@ private:
public:
void init(float fps, int maxTimes= -1);
bool isTime();
void reset();
};
@@ -85,6 +89,10 @@ public:
// =====================================================
void findAll(const string &path, vector<string> &results, bool cutExtension=false);
int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string &filterFileExt, Checksum *recursiveChecksum);
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector<std::pair<string,int32> > *recursiveMap);
void createDirectoryPaths(string Path);
string extractDirectoryPathFromFile(string filename);
bool changeVideoMode(int resH, int resW, int colorBits, int refreshFrequency);
void restoreVideoMode();

View File

@@ -14,8 +14,8 @@
#include <windows.h>
#include <gl.h>
#include <glu.h>
#include <GL\gl.h>
#include <GL\glu.h>
#include <glprocs.h>
#include <string>

View File

@@ -19,12 +19,15 @@
#include <stdexcept>
#include "types.h"
#include "checksum.h"
#include <utility>
using std::string;
using std::vector;
using std::exception;
using Shared::Platform::int64;
using Shared::Util::Checksum;
namespace Shared{ namespace Platform{
@@ -96,6 +99,10 @@ public:
// =====================================================
void findAll(const string &path, vector<string> &results, bool cutExtension=false);
int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string &filterFileExt, Checksum *recursiveChecksum);
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector<std::pair<string,int32> > *recursiveMap);
void createDirectoryPaths(string Path);
string extractDirectoryPathFromFile(string filename);
bool changeVideoMode(int resH, int resW, int colorBits, int refreshFrequency);
void restoreVideoMode();

View File

@@ -3,9 +3,9 @@
//
// Copyright (C) 2001-2008 Marti<74>o Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
@@ -14,6 +14,7 @@
#include <string>
#include <winsock.h>
#include <map>
using std::string;
@@ -51,20 +52,30 @@ private:
protected:
static SocketManager socketManager;
SOCKET sock;
public:
Socket(SOCKET sock);
Socket();
~Socket();
static bool enableDebugText;
// Int lookup is socket fd while bool result is whether or not that socket was signalled for reading
static bool hasDataToRead(std::map<int,bool> &socketTriggeredList);
static bool hasDataToRead(int socket);
bool hasDataToRead();
void disconnectSocket();
int getSocketId() const { return sock; }
int getDataToRead();
int send(const void *data, int dataSize);
int receive(void *data, int dataSize);
int peek(void *data, int dataSize);
void setBlock(bool block);
bool isReadable();
bool isWritable();
bool isWritable(bool waitOnDelayedResponse);
bool isConnected();
string getHostName() const;