summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-15 08:48:24 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:43 +0200
commite71744b918898b98ffa5ae949fbf2a1b877b254c (patch)
tree0de31e6f86d5bfb9027ca4a0eb4494b059055721 /src
parent40e7a1a5c9155f40ed07e09658e677533cac33f9 (diff)
downloadminetest-e71744b918898b98ffa5ae949fbf2a1b877b254c.tar.gz
minetest-e71744b918898b98ffa5ae949fbf2a1b877b254c.tar.bz2
minetest-e71744b918898b98ffa5ae949fbf2a1b877b254c.zip
Modify mod and texture directory hierarchies
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp4
-rw-r--r--src/server.cpp28
-rw-r--r--src/tile.cpp2
3 files changed, 24 insertions, 10 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6c75863c0..fc87deb29 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -256,9 +256,9 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
/*
Draw hearts
*/
+ video::ITexture *heart_texture = tsrc->getTextureRaw("heart.png");
+ if(heart_texture)
{
- video::ITexture *heart_texture =
- driver->getTexture(getTexturePath("heart.png").c_str());
v2s32 p = pos + v2s32(0, -20);
for(s32 i=0; i<halfheartcount/2; i++)
{
diff --git a/src/server.cpp b/src/server.cpp
index ee5e301f1..9a7f1e972 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -997,13 +997,27 @@ Server::Server(
// Export API
scriptapi_export(m_lua, this);
// Load and run scripts
- std::string defaultscript = porting::path_data + DIR_DELIM
- + "scripts" + DIR_DELIM + "default.lua";
- bool success = script_load(m_lua, defaultscript.c_str());
- if(!success){
- errorstream<<"Server: Failed to load and run "
- <<defaultscript<<std::endl;
- assert(0);
+ core::list<std::string> modspaths;
+ modspaths.push_back(porting::path_data + DIR_DELIM + "mods");
+ for(core::list<std::string>::Iterator i = modspaths.begin();
+ i != modspaths.end(); i++){
+ std::string modspath = *i;
+ std::vector<fs::DirListNode> dirlist = fs::GetDirListing(modspath);
+ for(u32 j=0; j<dirlist.size(); j++){
+ if(!dirlist[j].dir)
+ continue;
+ std::string modname = dirlist[j].name;
+ infostream<<"Server: Loading mod \""<<modname<<"\" script..."
+ <<std::endl;
+ std::string scriptpath = modspath + DIR_DELIM + modname
+ + DIR_DELIM + "init.lua";
+ bool success = script_load(m_lua, scriptpath.c_str());
+ if(!success){
+ errorstream<<"Server: Failed to load and run "
+ <<scriptpath<<std::endl;
+ assert(0);
+ }
+ }
}
// Initialize Environment
diff --git a/src/tile.cpp b/src/tile.cpp
index c8fffffa7..eb3616f02 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -132,7 +132,7 @@ std::string getTexturePath(const std::string &filename)
*/
if(fullpath == "")
{
- std::string rel_path = std::string("textures")+DIR_DELIM+filename;
+ std::string rel_path = std::string("clienttextures")+DIR_DELIM+filename;
std::string testpath = porting::path_data + DIR_DELIM + rel_path;
// Check all filename extensions. Returns "" if not found.
fullpath = getImagePath(testpath);