diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-01-15 10:24:22 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-02-24 20:38:57 +0100 |
commit | 9860dacbb6526138ae8edf57adc42ddc3e6073fa (patch) | |
tree | 342c63b7cf515644be7e1a005813c75c0bc1bca6 | |
parent | 30a62acef45fb1652d0992dcbf30e473cea6bf74 (diff) | |
download | manaserv-9860dacbb6526138ae8edf57adc42ddc3e6073fa.tar.gz manaserv-9860dacbb6526138ae8edf57adc42ddc3e6073fa.tar.xz manaserv-9860dacbb6526138ae8edf57adc42ddc3e6073fa.zip |
Made the scripts being able to install
The game server will now look for the scripts in this order:
- serverPath - config value
- current working directory
- the PKG_DATADIR #define
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | docs/manaserv.xml.example | 1 | ||||
-rw-r--r-- | scripts/CMakeLists.txt | 1 | ||||
-rw-r--r-- | scripts/lua/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/common/resourcemanager.cpp | 10 |
5 files changed, 15 insertions, 5 deletions
@@ -47,7 +47,6 @@ Default option values: gameServerAddress localhost gameServerPort 9604 - serverPath . worldDataPath example diff --git a/docs/manaserv.xml.example b/docs/manaserv.xml.example index 4a203d1..ef220a6 100644 --- a/docs/manaserv.xml.example +++ b/docs/manaserv.xml.example @@ -65,7 +65,6 @@ Set here the different paths used by both the server to find data. --> <!-- Paths to data files --> - <option name="serverPath" value="." /> <option name="worldDataPath" value="example" /> <!-- end of paths configuration ******************************************* --> diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100644 index 0000000..b0e653e --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY(lua) diff --git a/scripts/lua/CMakeLists.txt b/scripts/lua/CMakeLists.txt new file mode 100644 index 0000000..ba58be5 --- /dev/null +++ b/scripts/lua/CMakeLists.txt @@ -0,0 +1,7 @@ +SET (FILES + libmana-constants.lua + libmana.lua + npclib.lua + ) + +INSTALL(FILES ${FILES} DESTINATION ${PKG_DATADIR}/scripts/lua/) diff --git a/src/common/resourcemanager.cpp b/src/common/resourcemanager.cpp index edff1e0..45735b4 100644 --- a/src/common/resourcemanager.cpp +++ b/src/common/resourcemanager.cpp @@ -38,17 +38,21 @@ #include <physfs.h> +#ifndef PKG_DATADIR +#define PKG_DATADIR "." +#endif + void ResourceManager::initialize() { PHYSFS_permitSymbolicLinks(1); - const std::string serverPath = - Configuration::getValue("serverPath", "."); const std::string worldDataPath = Configuration::getValue("worldDataPath", "example"); - PHYSFS_addToSearchPath(serverPath.c_str(), 1); + // world first to allow overriding of server's libraries PHYSFS_addToSearchPath(worldDataPath.c_str(), 1); + PHYSFS_addToSearchPath(".", 1); + PHYSFS_addToSearchPath(PKG_DATADIR, 1); } /** |