From cdc5a69a108654ff378839e8cf93669de31ff9c5 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 2 Feb 2008 13:23:00 +0000 Subject: removed libcommon modularized client and server --- src/core/Makefile.am | 5 ++--- src/core/applicationinterface.cc | 28 ++++++++++++++++++---------- src/core/applicationinterface.h | 3 +++ 3 files changed, 23 insertions(+), 13 deletions(-) (limited to 'src/core') diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 8046b79..a70652e 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -2,10 +2,9 @@ METASOURCES = AUTO INCLUDES = -I$(top_srcdir)/src libcore_la_SOURCES = applicationinterface.cc gameinterface.cc -libcore_la_LDFLAGS = -avoid-version +libcore_la_LDFLAGS = -avoid-version -no-undefined libcore_la_LIBADD = $(top_builddir)/src/math/libmath.la \ - $(top_builddir)/src/common/libcommon.la $(top_builddir)/src/sys/libsys.la \ - $(top_builddir)/src/filesystem/libfilesystem.la + $(top_builddir)/src/sys/libsys.la $(top_builddir)/src/filesystem/libfilesystem.la noinst_LTLIBRARIES = libcore.la noinst_HEADERS = applicationinterface.h core.h gameinterface.h diff --git a/src/core/applicationinterface.cc b/src/core/applicationinterface.cc index ba22d8c..209a4f5 100644 --- a/src/core/applicationinterface.cc +++ b/src/core/applicationinterface.cc @@ -7,17 +7,14 @@ #include "core/core.h" #include "filesystem/filesystem.h" #include "sys/sys.h" -#include "common/common.h" #include - -#include - #include #include namespace core { +// --------------- signal_handler ----------------------------------- extern "C" void signal_handler(int signum) { switch(signum){ @@ -25,24 +22,30 @@ extern "C" void signal_handler(int signum) case SIGINT: case SIGQUIT: case SIGTERM: - con_warn << "received signal " << signum << ", shutting down..." << std::endl; - if (ApplicationInterface::instance()); + if (ApplicationInterface::instance()) { + con_warn << "received signal " << signum << ", shutting down..." << std::endl; ApplicationInterface::instance()->shutdown(); - exit(1); + ApplicationInterface::instance()->quit(0); + } else { + std::cerr << "received signal " << signum << ", no application found, terminated..." << std::endl; + sys::quit(1); + } break; default: - con_warn << "received signal " << signum << ", terminated..." << std::endl; - exit(1); + std::cerr << "received signal " << signum << ", terminated..." << std::endl; + sys::quit(1); break; } } +// --------------- ApplicationInterface ----------------------------- + ApplicationInterface *ApplicationInterface::applicationinterface_instance = 0; ApplicationInterface::ApplicationInterface() { if (applicationinterface_instance) { std::cerr << "multiple singleton instances: core::ApplicationInterface" << std::endl; - exit(2); + sys::quit(2); } applicationinterface_instance = this; @@ -87,6 +90,11 @@ void ApplicationInterface::shutdown() filesystem::shutdown(); } +void ApplicationInterface::quit(int status) +{ + sys::quit(status); +} + void ApplicationInterface::frame(float seconds) { if (game()) diff --git a/src/core/applicationinterface.h b/src/core/applicationinterface.h index 19eaee6..6093427 100644 --- a/src/core/applicationinterface.h +++ b/src/core/applicationinterface.h @@ -24,6 +24,9 @@ public: /// shutdown the application virtual void shutdown(); + /// quit the application + virtual void quit(int status); + /// run a core frame virtual void frame(float seconds); -- cgit v1.2.3