summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-13 09:55:33 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-13 09:55:33 +0000
commit20b7acf8d94c89452f7d603c703dbf4cfc95f57f (patch)
treec74e75368440ac5eff14b47661afd0c004cb5ccf
parentdddbb52f6724b8b0dd6f99b996e50ad9bfbca432 (diff)
downloadmanaserv-20b7acf8d94c89452f7d603c703dbf4cfc95f57f.tar.gz
manaserv-20b7acf8d94c89452f7d603c703dbf4cfc95f57f.tar.xz
manaserv-20b7acf8d94c89452f7d603c703dbf4cfc95f57f.zip
Deleted obsolete files. Cleaned configuration. Removed obsolete SQL tables.
-rw-r--r--ChangeLog11
-rw-r--r--configure.ac79
-rw-r--r--scripts/init.rb66
-rw-r--r--src/Makefile.am19
-rw-r--r--src/account-server/accounthandler.cpp11
-rw-r--r--src/account-server/dalstorage.cpp2
-rw-r--r--src/account-server/dalstoragesql.hpp133
-rw-r--r--src/account-server/main-account.cpp14
-rw-r--r--src/bindings.i55
-rw-r--r--src/dal/dataproviderfactory.cpp4
-rw-r--r--src/dal/mysqldataprovider.cpp4
-rw-r--r--src/dal/sqlitedataprovider.cpp4
-rw-r--r--src/game-server/main-game.cpp49
-rw-r--r--src/script-squirrel.cpp284
-rw-r--r--src/script-squirrel.h51
-rw-r--r--src/skill.cpp104
-rw-r--r--src/skill.h106
17 files changed, 55 insertions, 941 deletions
diff --git a/ChangeLog b/ChangeLog
index bef5063..927fec1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-08-13 Guillaume Melquiond <guillaume.melquiond@gmail.com>
+
+ * src/bindings.i, src/script-squirrel.cpp, src/script-squirrel.h,
+ src/skill.cpp, src/skill.h, scripts/init.rb: Deleted obsolete files.
+ * configure.ac, src/Makefile.am, src/account-server/main-account.cpp,
+ src/game-server/main-game.cpp, src/dal/sqlitedataprovider.cpp,
+ src/dal/mysqldataprovider.cpp, src/account-server/dalstorage.cpp,
+ src/account-server/dalstoragesql.hpp, src/dal/dataproviderfactory.cpp,
+ src/account-server/accounthandler.cpp: Cleaned configuration. Removed
+ obsolete SQL tables.
+
2007-08-11 Guillaume Melquiond <guillaume.melquiond@gmail.com>
* src/scripting/lua.cpp: Added Lua functions for handling inventories.
diff --git a/configure.ac b/configure.ac
index 203e126..8516666 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl $Id$
AC_PREREQ(2.59)
-AC_INIT([TMW Server], [0.0.1], [b_lindeijer@users.sourceforge.net], [tmwserv])
+AC_INIT([TMW Server], [0.0.1], [themanaworld-devel@lists.sourceforge.net], [tmwserv])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
@@ -35,20 +35,9 @@ LIBS="$LIBS $XML2_LIBS"
AC_HEADER_STDC
AC_HEADER_TIME
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_HEADER_STDBOOL
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_STRUCT_TM
-
-
# Checks for library functions.
-AC_FUNC_ALLOCA
-AC_FUNC_ERROR_AT_LINE
-AC_FUNC_SETVBUF_REVERSED
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([atexit strrchr])
+AC_CHECK_FUNCS([atexit])
# Checks for the storage backend.
@@ -92,64 +81,33 @@ elif test "$with_storage_backend" = "sqlite"; then
# use pkg-config to check libsqlite3.
# SQLITE_CFLAGS and SQLITE_LIBS are set by PKG_CHECK_MODULES.
PKG_CHECK_MODULES(SQLITE,[sqlite3 >= 3.0.6])
-
# update CXXFLAGS and LIBS.
- CXXFLAGS="$CXXFLAGS -DSQLITE_SUPPORT $SQLITE_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $SQLITE_CFLAGS"
LIBS="$LIBS $SQLITE_LIBS"
+ AC_DEFINE(SQLITE_SUPPORT, [], [Define if the Sqlite back-end should be used.])
else
# at the moment, we support only those three databases as backends.
AC_MSG_ERROR([unknown storage backend: $with_storage_backend])
fi
-# Checks for the scripting engine.
-AC_ARG_WITH(
- [scripting-engine],
- AS_HELP_STRING(
- [--with-scripting-engine=ARG],
- [use scripting engine [[ARG=ruby,squirrel,lua]] [(default=no)]]
- ),
- [],
- [with_scripting_engine="no"]
+# Checks for Lua support
+AC_ARG_ENABLE(
+ [lua-engine],
+ AS_HELP_STRING([--enable-lua-engine], [support Lua scripts]),
+ [if test "$enable_lua_engine" = "yes"; then
+ PKG_CHECK_MODULES(LUA, [lua5.1 >= 5.1])
+ CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"
+ LIBS="$LIBS $LUA_LIBS"
+ fi],
+ [enable_lua_engine="no"]
)
-if test "$with_scripting_engine" = "ruby"; then
- # AC_MSG_ERROR([sorry, $with_scripting_engine is not supported yet])
- AC_CHECK_LIB([ruby], [ruby_init])
- AC_PATH_PROG(swig_path, swig, no)
- if test "$swig_path" = "no"; then
- AC_MSG_ERROR(Could not find swig in PATH)
- fi
- SWIG="$swig_path"
- SWIGFLAGS="-c++ -ruby -minherit"
- AC_SUBST(SWIG)
- AC_SUBST(SWIGFLAGS)
- CXXFLAGS="$CXXFLAGS -DSCRIPT_SUPPORT -DRUBY_SUPPORT -I/usr/lib/ruby/1.8/linux/"
- LIBS="$LIBS -lruby"
-elif test "$with_scripting_engine" = "squirrel"; then
- AC_CHECK_LIB([squirrel], [sq_open])
-
- # update CXXFLAGS and LIBS
- CXXFLAGS="$CXXFLAGS -DSCRIPT_SUPPORT -DSQUIRREL_SUPPORT"
- # there is no need to append -lsquirrel as it is already done by
- # AC_CHECK_LIB
- LIBS="$LIBS -lsqstdlib"
-elif test "$with_scripting_engine" = "lua"; then
- PKG_CHECK_MODULES(LUA, [lua5.1 >= 5.1])
- CXXFLAGS="$CXXFLAGS -DSCRIPT_SUPPORT -DLUA_SUPPORT $LUA_CFLAGS"
- LIBS="$LIBS $LUA_LIBS"
-elif test "$with_scripting_engine" != "no"; then
- AC_MSG_ERROR([unknown scripting engine: $with_scripting_engine])
-fi
-
-
AM_CONDITIONAL(BUILD_MYSQL, test "$with_storage_backend" = "mysql")
AM_CONDITIONAL(BUILD_POSTGRESQL, test "$with_storage_backend" = "postgresql")
AM_CONDITIONAL(BUILD_SQLITE, test "$with_storage_backend" = "sqlite")
-AM_CONDITIONAL(BUILD_RUBY, test "$with_scripting_engine" = "ruby")
-AM_CONDITIONAL(BUILD_SQUIRREL, test "$with_scripting_engine" = "squirrel")
-AM_CONDITIONAL(BUILD_LUA, test "$with_scripting_engine" = "lua")
+AM_CONDITIONAL(BUILD_LUA, test "$enable_lua_engine" = "yes")
AC_CONFIG_FILES([Makefile src/Makefile])
@@ -158,10 +116,9 @@ AC_OUTPUT
echo
echo "-------------------------------------------------------"
-echo " $PACKAGE_NAME will be compiled with these options: "
+echo " $PACKAGE_NAME will be compiled with these options:"
echo
-echo " + storage backend : $with_storage_backend "
-echo " + scripting engine: $with_scripting_engine "
-echo " + with unit tests : $enable_unit_tests "
+echo " + storage backend : $with_storage_backend"
+echo " + Lua scripting engine: $enable_lua_engine"
echo "-------------------------------------------------------"
echo
diff --git a/scripts/init.rb b/scripts/init.rb
deleted file mode 100644
index 290598f..0000000
--- a/scripts/init.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-print "enter init.rb\n"
-
-class EquipHandler < Tmw::MessageHandler
- def initialize()
- super
- end
-
- def receiveMessage(computer, message)
- print "Message ID: ", message.getId(), "\n"
- item = message.readLong()
- slot = message.readByte()
- print "Trying to equip ", item, " at ", slot.to_i(), "\n"
-
- result = Tmw::MessageOut.new()
- result.writeShort(Tmw::SMSG_EQUIP_RESPONSE)
- result.writeByte(Tmw::EQUIP_OK)
- computer.send(result.getPacket())
- end
-end
-
-# Override default equip message handler
-Tmw::connectionHandler.registerHandler(Tmw::CMSG_EQUIP, EquipHandler.new())
-
-
-# Remote Ruby expression execution
-class RubyHandler < Tmw::MessageHandler
- def initialize()
- super
- print "Ruby message handler activated\n"
- end
-
- def receiveMessage(computer, message)
- src = message.readString()
- print src, "\n";
- # doesn't work properly yet (need to have SWIG use std::string nicely)
- #eval(src, TOPLEVEL_BINDING)
- end
-end
-
-Tmw::connectionHandler.registerHandler(0x800, RubyHandler.new())
-
-
-# simple enemy
-class SimpleEnemy < Tmw::Being
- def initialize()
- super
- end
-
- def update()
- print "Updating!\n"
- end
-end
-
-# simple item
-class SimpleItem < Tmw::Item
- def initialize()
- super
- type = 100
- end
-
- def use()
- print "USE THIS THING!!"
- end
-end
-
-print "exit init.rb\n"
diff --git a/src/Makefile.am b/src/Makefile.am
index 588f3ca..5108774 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,8 +12,6 @@ tmwserv_account_SOURCES = \
point.h \
resourcemanager.h \
resourcemanager.cpp \
- skill.h \
- skill.cpp \
account-server/account.hpp \
account-server/account.cpp \
account-server/accountclient.hpp \
@@ -77,8 +75,6 @@ tmwserv_game_SOURCES = \
point.h \
resourcemanager.h \
resourcemanager.cpp \
- skill.h \
- skill.cpp \
common/inventorydata.hpp \
game-server/accountconnection.hpp \
game-server/accountconnection.cpp \
@@ -175,21 +171,6 @@ tmwserv_account_SOURCES += \
dal/sqlitedataprovider.cpp
endif
-if BUILD_SQUIRREL
-tmwserv_game_SOURCES += \
- script.h \
- script.cpp \
- script-squirrel.h \
- script-squirrel.cpp
-endif
-
-if BUILD_RUBY
-bindings_wrap.cpp: bindings.i
- $(SWIG) $(SWIGFLAGS) -o bindings_wrap.cpp bindings.i
-tmwserv_game_SOURCES += \
- bindings_wrap.cpp
-endif
-
if BUILD_LUA
tmwserv_game_SOURCES += \
scripting/lua.cpp
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index c86d06d..3c1d61a 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -83,17 +83,6 @@ AccountHandler::processMessage(NetComputer *comp, MessageIn &message)
{
AccountClient &computer = *static_cast< AccountClient * >(comp);
- Storage &store = Storage::instance("tmw");
-
-#if defined (SQLITE_SUPPORT)
- // Reopen the db in this thread for sqlite, to avoid
- // Library Call out of sequence problem due to thread safe.
- store.setUser(config.getValue("dbuser", ""));
- store.setPassword(config.getValue("dbpass", ""));
- store.close();
- store.open();
-#endif
-
switch (message.getId())
{
case PAMSG_LOGIN:
diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp
index b8243f3..7f46f7b 100644
--- a/src/account-server/dalstorage.cpp
+++ b/src/account-server/dalstorage.cpp
@@ -180,8 +180,6 @@ void DALStorage::open()
createTable(ACCOUNTS_TBL_NAME, SQL_ACCOUNTS_TABLE);
createTable(CHARACTERS_TBL_NAME, SQL_CHARACTERS_TABLE);
- createTable(ITEMS_TBL_NAME, SQL_ITEMS_TABLE);
- createTable(WORLD_ITEMS_TBL_NAME, SQL_WORLD_ITEMS_TABLE);
createTable(INVENTORIES_TBL_NAME, SQL_INVENTORIES_TABLE);
createTable(CHANNELS_TBL_NAME, SQL_CHANNELS_TABLE);
createTable(GUILDS_TBL_NAME, SQL_GUILDS_TABLE);
diff --git a/src/account-server/dalstoragesql.hpp b/src/account-server/dalstoragesql.hpp
index 54026d4..81ceaf4 100644
--- a/src/account-server/dalstoragesql.hpp
+++ b/src/account-server/dalstoragesql.hpp
@@ -24,11 +24,13 @@
#ifndef _TMWSERV_DALSTORAGE_SQL_H_
#define _TMWSERV_DALSTORAGE_SQL_H_
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#if !defined (MYSQL_SUPPORT) && !defined (SQLITE_SUPPORT) && \
!defined (POSTGRESQL_SUPPORT)
-
-#error "(dalstorage.h) no database backend defined"
+#error "(dalstorage.hpp) no database backend defined"
#endif
@@ -60,9 +62,6 @@
*/
-namespace {
-
-
/**
* TABLE: tmw_accounts.
*
@@ -73,8 +72,8 @@ namespace {
* 2: administrator (i am god :))
* - the 'banned' field contains the UNIX time of unban (default = 0)
*/
-const std::string ACCOUNTS_TBL_NAME("tmw_accounts");
-const std::string SQL_ACCOUNTS_TABLE(
+static char const *ACCOUNTS_TBL_NAME = "tmw_accounts";
+static char const *SQL_ACCOUNTS_TABLE =
"CREATE TABLE tmw_accounts ("
#if defined (MYSQL_SUPPORT)
"id INTEGER PRIMARY KEY AUTO_INCREMENT,"
@@ -99,8 +98,7 @@ const std::string SQL_ACCOUNTS_TABLE(
"level INTEGER NOT NULL,"
"banned INTEGER NOT NULL"
#endif
- ");"
-);
+ ");";
/**
@@ -112,8 +110,8 @@ const std::string SQL_ACCOUNTS_TABLE(
* separate table for storing the skill levels.
* - gender is 0 for male, 1 for female.
*/
-const std::string CHARACTERS_TBL_NAME("tmw_characters");
-const std::string SQL_CHARACTERS_TABLE(
+static char const *CHARACTERS_TBL_NAME = "tmw_characters";
+static char const *SQL_CHARACTERS_TABLE =
"CREATE TABLE tmw_characters ("
#if defined (MYSQL_SUPPORT)
"id INTEGER PRIMARY KEY AUTO_INCREMENT,"
@@ -190,94 +188,14 @@ const std::string SQL_CHARACTERS_TABLE(
"FOREIGN KEY (user_id) REFERENCES tmw_accounts(id),"
"FOREIGN KEY (map_id) REFERENCES tmw_maps(id)"
#endif
- ");"
-);
-
-
-/**
- * TABLE: tmw_items.
- *
- * Notes:
- * - amount: indicates how many items of the same kind can stack.
- * - state: (optional) item state saved by script.
- */
-const std::string ITEMS_TBL_NAME("tmw_items");
-const std::string SQL_ITEMS_TABLE(
- "CREATE TABLE tmw_items ("
-#if defined (MYSQL_SUPPORT)
- "id SMALLINT PRIMARY KEY AUTO_INCREMENT,"
- "amount TINYINT UNSIGNED NOT NULL,"
- "type TINYINT UNSIGNED NOT NULL,"
- "state TEXT,"
- "INDEX (id)"
-#elif defined (SQLITE_SUPPORT)
- "id INTEGER PRIMARY KEY,"
- "amount INTEGER NOT NULL,"
- "type INTEGER NOT NULL,"
- "state TEXT"
-#elif defined (POSTGRESQL_SUPPORT)
- "id SERIAL PRIMARY KEY,"
- "amount INTEGER NOT NULL,"
- "type INTEGER NOT NULL,"
- "state TEXT"
-#endif
- ");"
-);
-
-
-/**
- * TABLE: tmw_world_items.
- *
- * Notes:
- * - store items on the ground in the game world.
- */
-const std::string WORLD_ITEMS_TBL_NAME("tmw_world_items");
-// NOTE: Problem here with primary key (only one type of item is allowed on the same map at one time).
-const std::string SQL_WORLD_ITEMS_TABLE(
- "CREATE TABLE tmw_world_items ("
-#if defined (MYSQL_SUPPORT)
- "id SMALLINT UNSIGNED NOT NULL,"
- // location on the map
- "x SMALLINT UNSIGNED NOT NULL,"
- "y SMALLINT UNSIGNED NOT NULL,"
- "map_id TINYINT NOT NULL,"
- // time to die (UNIX time)
- "deathtime INTEGER UNSIGNED NOT NULL,"
- "PRIMARY KEY (id, map_id),"
- "FOREIGN KEY (id) REFERENCES tmw_items(id),"
- "FOREIGN KEY (map_id) REFERENCES tmw_maps(id)"
-#elif defined (SQLITE_SUPPORT)
- "id INTEGER NOT NULL,"
- // location on the map
- "x INTEGER NOT NULL,"
- "y INTEGER NOT NULL,"
- "map_id INTEGER NOT NULL,"
- // time to die (UNIX time)
- "deathtime INTEGER NOT NULL,"
- "PRIMARY KEY (id, map_id),"
- "FOREIGN KEY (id) REFERENCES tmw_items(id),"
- "FOREIGN KEY (map_id) REFERENCES tmw_maps(id)"
-#elif defined (POSTGRESQL_SUPPORT)
- "id INTEGER NOT NULL,"
- // location on the map
- "x INTEGER NOT NULL,"
- "y INTEGER NOT NULL,"
- "map_id INTEGER NOT NULL,"
- // time to die (UNIX time)
- "deathtime INTEGER NOT NULL,"
- "PRIMARY KEY (id, map_id),"
- "FOREIGN KEY (id) REFERENCES tmw_items(id),"
- "FOREIGN KEY (map_id) REFERENCES tmw_maps(id)"
-#endif
- ");"
-);
+ ");";
/**
* TABLE: tmw_inventories.
*/
-const std::string INVENTORIES_TBL_NAME("tmw_inventories");
-const std::string SQL_INVENTORIES_TABLE(
+static char const *INVENTORIES_TBL_NAME("tmw_inventories");
+static char const *SQL_INVENTORIES_TABLE =
"CREATE TABLE tmw_inventories ("
#if defined (MYSQL_SUPPORT)
"id INTEGER PRIMARY KEY AUTO_INCREMENT,"
@@ -302,15 +220,14 @@ const std::string SQL_INVENTORIES_TABLE(
"amount INTEGER NOT NULL,"
"FOREIGN KEY (owner_id) REFERENCES tmw_characters(id)"
#endif
- ");"
-);
+ ");";
/**
* TABLE: tmw_channels.
* Keeps opened public Channel list
*/
-const std::string CHANNELS_TBL_NAME("tmw_channels");
-const std::string SQL_CHANNELS_TABLE(
+static char const *CHANNELS_TBL_NAME = "tmw_channels";
+static char const *SQL_CHANNELS_TABLE =
"CREATE TABLE tmw_channels ("
#if defined (MYSQL_SUPPORT)
"id INTEGER PRIMARY KEY,"
@@ -328,15 +245,14 @@ const std::string SQL_CHANNELS_TABLE(
"announcement TEXT NOT NULL,"
"password TEXT NOT NULL"
#endif
- ");"
-);
+ ");";
/**
* TABLE: tmw_guilds.
* Store player guilds
*/
-const std::string GUILDS_TBL_NAME("tmw_guilds");
-const std::string SQL_GUILDS_TABLE(
+static char const *GUILDS_TBL_NAME = "tmw_guilds";
+static char const *SQL_GUILDS_TABLE =
"CREATE TABLE tmw_guilds ("
#if defined (MYSQL_SUPPORT)
"id INTEGER PRIMARY KEY AUTO_INCREMENT,"
@@ -351,15 +267,14 @@ const std::string SQL_GUILDS_TABLE(
"name TEXT NOT NULL UNIQUE,"
"FOREIGN KEY (name) REFERENCES tmw_characters(name)"
#endif
- ");"
-);
+ ");";
/**
* TABLE: tmw_guild_members.
* Store guild members
*/
-const std::string GUILD_MEMBERS_TBL_NAME("tmw_guild_members");
-const std::string SQL_GUILD_MEMBERS_TABLE(
+static char const *GUILD_MEMBERS_TBL_NAME = "tmw_guild_members";
+static char const *SQL_GUILD_MEMBERS_TABLE =
"CREATE TABLE tmw_guild_members ("
#if defined (MYSQL_SUPPORT)
"guild_id INTEGER NOT NULL,"
@@ -377,11 +292,7 @@ const std::string SQL_GUILD_MEMBERS_TABLE(
"FOREIGN KEY (guild_id) REFERENCES tmw_guilds(id),"
"FOREIGN KEY (member_name) REFERENCES tmw_characters(name)"
#endif
- ");"
-);
-
-
-} // anonymous namespace
+ ");";
#endif // _TMWSERV_DALSTORAGE_SQL_H_
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp
index 70cde48..a53e693 100644
--- a/src/account-server/main-account.cpp
+++ b/src/account-server/main-account.cpp
@@ -33,7 +33,6 @@
#include "configuration.h"
#include "resourcemanager.h"
-#include "skill.h"
#include "account-server/accounthandler.hpp"
#include "account-server/guildmanager.hpp"
#include "account-server/serverhandler.hpp"
@@ -53,8 +52,6 @@
bool running = true; /**< Determines if server keeps running */
-Skill skillTree("base"); /**< Skill tree */
-
Configuration config; /**< XML config reader */
utils::StringFilter *stringFilter; /**< Slang's Filter */
@@ -167,17 +164,6 @@ void initialize()
exit(2);
}
-
-#if defined (MYSQL_SUPPORT)
- LOG_INFO("Using MySQL DB Backend.");
-#elif defined (POSTGRESQL_SUPPORT)
- LOG_INFO("Using PostGreSQL DB Backend.");
-#elif defined (SQLITE_SUPPORT)
- LOG_INFO("Using SQLite DB Backend.");
-#else
- LOG_WARN("No Database Backend Support.");
-#endif
-
// Initialize configuration defaults
config.setValue("dbuser", "");
config.setValue("dbpass", "");
diff --git a/src/bindings.i b/src/bindings.i
deleted file mode 100644
index d420be2..0000000
--- a/src/bindings.i
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * The Mana World Server
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it 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 any later version.
- *
- * The Mana World is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with The Mana World; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-%module(directors="1") Tmw
-
-%{
-#include "defines.h"
-#include "messagehandler.h"
-#include "packet.h"
-#include "messagein.h"
-#include "messageout.h"
-#include "netcomputer.h"
-#include "connectionhandler.h"
-#include "object.h"
-#include "being.h"
-#include "items.h"
-
-extern ConnectionHandler connectionHandler;
-%}
-
-%feature("director") MessageHandler;
-%feature("director") Object;
-%feature("director") Item;
-%feature("director") Being;
-
-%include "defines.h"
-%include "messagehandler.h"
-%include "packet.h"
-%include "messagein.h"
-%include "messageout.h"
-%include "netcomputer.h"
-%include "connectionhandler.h"
-%include "object.h"
-%include "being.h"
-%include "items.h"
-
-extern ConnectionHandler connectionHandler;
diff --git a/src/dal/dataproviderfactory.cpp b/src/dal/dataproviderfactory.cpp
index d9c144f..d6fb319 100644
--- a/src/dal/dataproviderfactory.cpp
+++ b/src/dal/dataproviderfactory.cpp
@@ -23,6 +23,10 @@
#include "dataproviderfactory.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#if defined (MYSQL_SUPPORT)
#include "mysqldataprovider.h"
#elif defined (POSTGRESQL_SUPPORT)
diff --git a/src/dal/mysqldataprovider.cpp b/src/dal/mysqldataprovider.cpp
index 5c4af36..85084dc 100644
--- a/src/dal/mysqldataprovider.cpp
+++ b/src/dal/mysqldataprovider.cpp
@@ -20,8 +20,6 @@
* $Id$
*/
-#if defined(MYSQL_SUPPORT)
-
#include "mysqldataprovider.h"
#include "dalexcept.h"
@@ -198,5 +196,3 @@ MySqlDataProvider::disconnect(void)
} // namespace dal
-
-#endif
diff --git a/src/dal/sqlitedataprovider.cpp b/src/dal/sqlitedataprovider.cpp
index ea16be9..f9c3ed5 100644
--- a/src/dal/sqlitedataprovider.cpp
+++ b/src/dal/sqlitedataprovider.cpp
@@ -20,7 +20,6 @@
* $Id$
*/
-#if defined(SQLITE_SUPPORT)
#include "sqlitedataprovider.h"
#include <stdexcept>
@@ -197,6 +196,3 @@ SqLiteDataProvider::disconnect(void)
} // namespace dal
-
-#endif
-
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index e7f334f..0325f28 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -33,7 +33,6 @@
#include "configuration.h"
#include "resourcemanager.h"
-#include "skill.h"
#include "game-server/accountconnection.hpp"
#include "game-server/gamehandler.hpp"
#include "game-server/itemmanager.hpp"
@@ -48,27 +47,6 @@
#include "utils/timer.h"
#include "utils/mathutils.h"
-// Scripting
-#ifdef SCRIPT_SUPPORT
-
-extern "C" void Init_Tmw();
-
-#if defined (SQUIRREL_SUPPORT)
-std::string scriptLanguage = "squirrel";
-#elif defined (RUBY_SUPPORT)
-#include <ruby.h>
-int rubyStatus;
-std::string scriptLanguage = "ruby";
-#elif defined (LUA_SUPPORT)
-std::string scriptLanguage = "lua";
-#else
-#error "Scripting enabled, but no language selected"
-#endif
-
-#else
-std::string scriptLanugage = "none";
-#endif // SCRIPT_SUPPORT
-
// Default options that automake should be able to override.
#define DEFAULT_LOG_FILE "tmwserv-game.log"
#define DEFAULT_CONFIG_FILE "tmwserv.xml"
@@ -80,8 +58,6 @@ utils::Timer worldTimer(100, false); /**< Timer for world tics set to 100 ms *
int worldTime = 0; /**< Current world time in 100ms ticks */
bool running = true; /**< Determines if server keeps running */
-Skill skillTree("base"); /**< Skill tree */
-
Configuration config; /**< XML config reader */
utils::StringFilter *stringFilter; /**< Slang's Filter */
@@ -183,25 +159,6 @@ void initialize()
// Set enet to quit on exit.
atexit(enet_deinitialize);
- // --- Initialize scripting subsystem.
-#ifdef RUBY_SUPPORT
- LOG_INFO("Script language: " << scriptLanguage);
-
- // Initialize ruby
- ruby_init();
- ruby_init_loadpath();
- ruby_script("tmw");
-
- // Initialize bindings
- Init_Tmw();
-
- // Run test script
- rb_load_file("scripts/init.rb");
- rubyStatus = ruby_exec();
-#else
- LOG_WARN("No scripting language support.");
-#endif
-
// Pre-calulate the needed trigomic function values
utils::math::init();
@@ -224,12 +181,6 @@ void deinitialize()
// Stop world timer
worldTimer.stop();
-#ifdef RUBY_SUPPORT
- // Finish up ruby
- ruby_finalize();
- ruby_cleanup(rubyStatus);
-#endif
-
// Destroy message handlers
delete gameHandler;
delete accountHandler;
diff --git a/src/script-squirrel.cpp b/src/script-squirrel.cpp
deleted file mode 100644
index 7f7739b..0000000
--- a/src/script-squirrel.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-#include "script-squirrel.h"
-#include <cstring>
-
-#ifdef SCRIPT_SUPPORT
-
-void registerStdLib(HSQUIRRELVM);
-
-/*
- * printfunc - Print function for Squirrel
- */
-void printfunc(HSQUIRRELVM v, const SQChar *s, ...)
-{
- va_list arglist;
- va_start(arglist, s);
- vprintf(s, arglist);
- va_end(arglist);
-}
-
-/*
- * functionCall - Call function with arguments
- * fn - name of function
- * args - string with argument types.
- * 's' = String
- * 'i' = Integer
- * 'f' = Float
- */
-bool functionCall(HSQUIRRELVM v, const char *fn, const char *args, ...)
-{
- int argCount = 0;
- va_list arglist;
- va_start(arglist, args);
-
- int top = sq_gettop(v); //save stack
- sq_pushroottable(v); //pushes global table
- sq_pushstring(v, _SC(fn), -1);
-
- if (SQ_SUCCEEDED(sq_get(v, -2)))
- {
- sq_pushroottable(v); //push 'this'
-
- if (args != NULL)
- {
- for (int i = 0; i < strlen(args); i++)
- {
- switch (args[i])
- {
- case 'S':
- case 's':
- //string
- argCount++;
- sq_pushstring(v, va_arg(arglist, char*), -1);
- break;
- case 'I':
- case 'i':
- //integer
- argCount++;
- sq_pushinteger(v, va_arg(arglist, int));
- break;
- case 'F':
- case 'f':
- //float
- argCount++;
- sq_pushfloat(v, va_arg(arglist, float));
- break;
- }
- }
- }
-
- sq_call(v, argCount + 1, 0);
- }
- else return false;
-
- sq_settop(v, top);
- va_end(arglist);
-
- return true;
-}
-
-/*
- * functionRegister
- * Registers a function in Squirrel VM
- */
-void functionRegister(HSQUIRRELVM v, SQFUNCTION f, const char *name)
-{
- sq_pushroottable(v);
- sq_pushstring(v, name, -1);
- sq_newclosure(v, f, 0);
- sq_createslot(v, -3);
- sq_pop(v, 1);
-}
-
-/*
- * Test function called from Squirrel (modified form Squirrel docs)
- * Prints the type of all arguments.
- */
-int testFunc(HSQUIRRELVM v)
-{
- int nargs = sq_gettop(v);
-
- for (int n = 1; n <= nargs; n++)
- {
- printf("arg: %d is ", n);
-
- switch (sq_gettype(v, n))
- {
- case OT_NULL:
- printf("null");
- break;
- case OT_INTEGER:
- printf("integer");
- break;
- case OT_FLOAT:
- printf("float");
- break;
- case OT_STRING:
- printf("string");
- break;
- case OT_TABLE:
- printf("table");
- break;
- case OT_ARRAY:
- printf("array");
- break;
- case OT_USERDATA:
- printf("userdata");
- break;
- case OT_CLOSURE:
- printf("closure");
- break;
- case OT_NATIVECLOSURE:
- printf("nativeclosure");
- break;
- case OT_GENERATOR:
- printf("generator");
- break;
- case OT_USERPOINTER:
- printf("userpointer");
- break;
- default:
- printf("unknown");
- }
- }
- printf("\n");
- sq_pushinteger(v, nargs);
- return 1;
-}
-
-/******/
-
-ScriptSquirrel::ScriptSquirrel(const std::string &file) :
- Script(file)
-{
- vm = sq_open(1024); //1024 byte stack
- sqstd_seterrorhandlers(vm);
- sq_setprintfunc(vm, printfunc);
-
- sq_pushroottable(vm);
-
- if (!SQ_SUCCEEDED(sqstd_dofile(vm, _SC(scriptName.c_str()), 0, 1)))
- {
- std::cerr << "Error: ScriptSquirrel: could not execute "
- << scriptName << std::endl;
- }
- else
- {
- registerStdLib(vm);
-
- functionCall(vm, "", NULL);
- functionCall(vm, "init", NULL);
- }
-}
-
-ScriptSquirrel::~ScriptSquirrel()
-{
- functionCall(vm, "destroy", NULL);
-
- sq_pop(vm, 1);
- sq_close(vm);
-}
-
-void ScriptSquirrel::update()
-{
- functionCall(vm, "update", NULL);
-}
-
-bool ScriptSquirrel::execute(const std::string &functionName)
-{
- return functionCall(vm, functionName.c_str(), NULL);
-}
-
-void ScriptSquirrel::message(char *msg)
-{
- functionCall(vm, "message", "s", msg);
-}
-
-/******************************/
-/*
- * Standard Library Functions
- */
-int getName(HSQUIRRELVM v)
-{
- sq_pushstring(v, "no name", -1);
- return 1;
-}
-
-int getX(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getY(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getMap(HSQUIRRELVM v)
-{
- sq_pushstring(v, "map1.map", -1);
- return 1;
-}
-
-int getLevel(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getHealth(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getMaxHealth(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getAttack(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getDefense(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getLuck(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-int getVitality(HSQUIRRELVM v)
-{
- sq_pushinteger(v, 0);
- return 1;
-}
-
-/*
- * Register standard functions for game script
- */
-void registerStdLib(HSQUIRRELVM v)
-{
- functionRegister(v, getName, "getName");
- functionRegister(v, getX, "getX");
- functionRegister(v, getY, "getY");
- functionRegister(v, getMap, "getMap");
- functionRegister(v, getLevel, "getLevel");
- functionRegister(v, getHealth, "getHealth");
- functionRegister(v, getMaxHealth, "getMaxHealth");
- functionRegister(v, getAttack, "getAttack");
- functionRegister(v, getDefense, "getDefense");
- functionRegister(v, getLuck, "getLuck");
- functionRegister(v, getVitality, "getVitality");
-}
-
-#endif
diff --git a/src/script-squirrel.h b/src/script-squirrel.h
deleted file mode 100644
index ed16e15..0000000
--- a/src/script-squirrel.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * The Mana World Server
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it 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
- * any later version.
- *
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-
-#ifndef SCRIPT_SQUIRREL_H
-#define SCRIPT_SQUIRREL_H
-
-#ifdef SCRIPT_SUPPORT
-
-#include "script.h"
-#include <cstdio>
-#include <cstdlib>
-#include <cstdarg>
-#include <squirrel.h>
-#include <sqstdio.h>
-#include <sqstdaux.h>
-
-class ScriptSquirrel : public Script
-{
- HSQUIRRELVM vm;
-
- public:
- ScriptSquirrel(const std::string &);
- ~ScriptSquirrel();
- void update();
- bool execute(const std::string &);
- void message(char *);
-};
-
-#endif
-
-#endif
diff --git a/src/skill.cpp b/src/skill.cpp
deleted file mode 100644
index d897e54..0000000
--- a/src/skill.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * The Mana World Server
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it 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 any later version.
- *
- * The Mana World is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with The Mana World; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-
-#include "skill.h"
-
-#include "utils/logger.h"
-
-Skill::Skill(const std::string &ident) :
- id(ident),
- light(0.0),
- dark(0.0)
-{
- //
-}
-
-Skill::~Skill()
-{
- //cleanup
- for (unsigned int i = 0; i < children.size(); i++) {
- if (children[i])
- delete children[i];
- }
-}
-
-bool Skill::addSkill(const std::string &ident, Skill *skill)
-{
- if (ident == id) {
- // add skill to children
- children.push_back(skill);
- return true;
- }
-
- for (unsigned int i = 0; i < children.size(); i++) {
- //recurse
- if (children[i]->addSkill(ident, skill))
- return true;
- }
- return false;
-}
-
-bool Skill::useSkill()
-{
-#ifdef SCRIPT_SUPPORT
- //run skill script
- LOG_ERROR("Skill: Skills not implemented.");
-#else
- LOG_ERROR("Skill: Could not use skill; scripting disabled.");
-#endif
- return true;
-}
-
-bool Skill::setScript(const std::string &scriptName)
-{
- return true;
-}
-
-bool Skill::deleteSkill(const std::string &ident, bool delTree)
-{
- //prevent deletion of self
- if (ident == id) {
- LOG_ERROR("Skill: Attempt to delete self.");
- return false;
- }
-
- for (unsigned int i = 0; i < children.size(); i++) {
- if (children[i]->id == ident) {
- if (children[i]->children.size() > 0 && delTree)
- return false;
- else {
- //delete skill & remove from children
- std::vector<Skill*>::iterator tmp = children.begin() + i;
- delete children[i];
- children.erase(tmp);
-
- return true;
- }
- } else {
- //recurse
- if (children[i]->deleteSkill(ident))
- return true;
- }
- }
- return false;
-}
-
diff --git a/src/skill.h b/src/skill.h
deleted file mode 100644
index 2893b18..0000000
--- a/src/skill.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * The Mana World Server
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it 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
- * any later version.
- *
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-
-#ifndef SKILL_H
-#define SKILL_H
-
-#include <iostream>
-#include <vector>
-
-class Script;
-
-class Skill
-{
- /*
- * Skill identifier
- */
- std::string id;
-
- /*
- * Skill description
- */
- std::string description;
-
- /*
- * Children skills
- */
- std::vector<Skill*> children;
-
- /*
- * Skill properties/weighting (used when calculating player class)
- */
- float light;
- float dark;
- float life;
- float death;
-
- /*
- * Skill script
- */
-#ifdef SCRIPT_SUPPORT
- Script *script;
-#endif
-
- public:
- Skill(const std::string &ident);
- virtual ~Skill();
-
- /*
- * addSkill
- * Add skill to parent with id
- */
- bool addSkill(const std::string &, Skill *);
-
- /*
- * deleteSkill
- * Delete skill from tree with id
- */
- bool deleteSkill(const std::string &, bool delTree = false);
-
- /*
- * useSkill
- * Uses skill (runs skill script). Returns true upon successful
- * skill completion, false otherwise.
- */
- bool useSkill();
-
- /*
- * setScript
- * Set script for the skill to execute when used.
- */
- bool setScript(const std::string &);
-
- /*
- * printTree
- * Print tree to stderr
- */
- void printTree(const std::string &indent) {
- std::cerr << indent << id << std::endl;
- for (unsigned int i = 0; i < children.size(); i++) {
- children[i]->printTree(indent + " ");
- }
- }
-};
-
-#endif
-