Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO34
-rw-r--r--src/core/application.cc55
-rw-r--r--src/core/netconnection.cc4
-rw-r--r--src/core/netserver.cc9
4 files changed, 46 insertions, 56 deletions
diff --git a/TODO b/TODO
index acf00d7..698466b 100644
--- a/TODO
+++ b/TODO
@@ -1,36 +1,44 @@
TODO
-filesystem::
+filesystem:
write a filesystem based on streams
write handlers for zip
-core::
+core:
connection to remote game (ok)
read/write configuration file (ok)
- split client and server configuration
- parse command line options
+ split client and server configuration (ok)
+ parse command line options (ok)
+ game module loading/unloading
+ execute command line options
+ globe entity
-network::
- UDP datagrams
+network:
+ UDP datagrams (ok)
protocol description
chat, channels
rcon, commands
buffered sends (ok)
zlib compression
fix lag
- client connection state
+ client connection state (ok)
-client::
+client:
keyboard handler, must be able to handle keyboard layouts
decent input handling implementation
key bindings
input handler switching (ok)
console chars (ok)
-render::
- render pipelines
- pipeline for Lines AlphaLines Quads AlphaQuads Characters
+render:
+ render pipeline (ok)
.map models (ok)
+ write RLE tga screenshots (ok)
+ texture registry
+ text quads render pipe
+
+win32 port:
+ network not functional
+ texture loading is broken
+ screenshots are broken
-sys::
- win32 (requires removal or #ifdef of the select() calls) \ No newline at end of file
diff --git a/src/core/application.cc b/src/core/application.cc
index 485bac2..4964e50 100644
--- a/src/core/application.cc
+++ b/src/core/application.cc
@@ -57,43 +57,6 @@ void func_disconnect(std::string const &args)
application()->disconnect();
}
-/*
-void func_name(std::string const &args) {
- std::istringstream argstream(args);
- std::string name;
- if (argstream >> name) {
- if (name.size() > 16)
- name = name.substr(0,16);
- } else {
- con_print << "name " << Player::local.name() << "\n";
- return;
- }
-
- if (name == Player::local.name()) {
- con_print << "name " << name << "\n";
- return;
- }
-
- if (application()->netserver) {
- std::ostringstream osstream;
- osstream << "msg info " << Player::local.name() << " renamed to " << name << "\n";
- application()->netserver->broadcast(osstream.str());
-
- con_print << "msg info " << Player::local.name() << " renamed to " << name << "\n";
- } else if (application()->netconnection.connected()) {
- std::ostringstream osstream;
- osstream << "name " << name << "\n";
- application()->netconnection.send(osstream.str());
-
- con_print << "name " << name << "\n";
- } else {
- con_print << "name " << name << "\n";
- }
-
- Player::local.player_name = name;
-}
-*/
-
// --------------- signal_handler -----------------------------------
extern "C" void signal_handler(int signum)
@@ -175,6 +138,15 @@ void Application::init()
Cvar::net_maxclients = Cvar::get("net_maxclients", "16", Cvar::Archive);
Cvar::net_timeout = Cvar::get("net_timeout", "20", Cvar::Archive);
+#ifdef _WIN32
+ // Initialize win32 socket library
+ WSADATA wsa_data;
+ WORD wsa_version = MAKEWORD(2, 0);
+ if (WSAStartup(wsa_version, wsa_data) != 0 ) {
+ con_warn << "Could not initialize scoket library!" << std::endl;
+ }
+#endif
+
// register our engine functions
Func::add("print", func_print);
Func::add("help", func_help);
@@ -182,8 +154,6 @@ void Application::init()
Func::add("connect", func_connect);
Func::add("disconnect", func_disconnect);
-
- //Func::add("name", func_name);
}
void Application::shutdown()
@@ -207,7 +177,11 @@ void Application::shutdown()
Func::remove("connect");
Func::remove("disconnect");
- //Func::remove("name");
+
+#ifdef _WIN32
+ // shutdown win32 socket library
+ WSACleanup();
+#endif
CommandBuffer::shutdown();
@@ -254,7 +228,6 @@ void Application::connect(std::string const &host)
void Application::disconnect()
{
-
if(application_game) {
delete application_game;
application_game = 0;
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index 18ae3bc..9fd4e33 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -96,7 +96,11 @@ void NetConnection::disconnect()
transmit();
FD_ZERO(&clientset);
+#ifdef _WIN32
+ closesocket(connection_fd);
+#else
close(connection_fd);
+#endif
}
connection_fd = -1;
diff --git a/src/core/netserver.cc b/src/core/netserver.cc
index e3e01a3..8b9cbe5 100644
--- a/src/core/netserver.cc
+++ b/src/core/netserver.cc
@@ -116,8 +116,13 @@ NetServer::~NetServer()
}
clients.clear();
- if (valid())
- ::close(fd());
+ if (valid()) {
+#ifdef _WIN32
+ closesocket(fd());
+#else
+ close(fd());
+#endif
+ }
}
// remove disconnected clients