summaryrefslogtreecommitdiff
path: root/src/itemdef.cpp
diff options
context:
space:
mode:
authorNer'zhul <nerzhul@users.noreply.github.com>2017-01-09 20:39:22 +0100
committerGitHub <noreply@github.com>2017-01-09 20:39:22 +0100
commit8e7449e09253e138716d8dbad6a2ab5c6e089e28 (patch)
treeca6895fb557229445b04639efe7fc57b3e33157b /src/itemdef.cpp
parent11df7e886a674e280e3ec6f895c11fc1e70eb7b3 (diff)
downloadminetest-8e7449e09253e138716d8dbad6a2ab5c6e089e28.tar.gz
minetest-8e7449e09253e138716d8dbad6a2ab5c6e089e28.tar.bz2
minetest-8e7449e09253e138716d8dbad6a2ab5c6e089e28.zip
Environment & IGameDef code refactoring (#4985)
* Environment code refactoring * Cleanup includes & class declarations in client & server environment to improve build speed * ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts. * Cleanup IGameDef * Move ITextureSource* IGameDef::getTextureSource() to Client only. * Also move ITextureSource *IGameDef::tsrc() helper * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call * drop unused emerge() call * cleanup server unused functions (mentionned before) * Drop one unused parameter from ContentFeatures::updateTextures * move checkLocalPrivilege to Client * Remove some unnecessary casts * create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it * Fix some comments * Change required IGameDef to Server/Client pointers * Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects * Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu * drop ClientMap::sectorWasDrawn which is unused
Diffstat (limited to 'src/itemdef.cpp')
-rw-r--r--src/itemdef.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index 1aa6331dc..5ba9d8f9a 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "itemdef.h"
-#include "gamedef.h"
#include "nodedef.h"
#include "tool.h"
#include "inventory.h"
@@ -29,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mesh.h"
#include "wieldmesh.h"
#include "client/tile.h"
+#include "client.h"
#endif
#include "log.h"
#include "settings.h"
@@ -317,7 +317,7 @@ public:
#ifndef SERVER
public:
ClientCached* createClientCachedDirect(const std::string &name,
- IGameDef *gamedef) const
+ Client *client) const
{
infostream<<"Lazily creating item texture and mesh for \""
<<name<<"\""<<std::endl;
@@ -331,7 +331,7 @@ public:
if(cc)
return cc;
- ITextureSource *tsrc = gamedef->getTextureSource();
+ ITextureSource *tsrc = client->getTextureSource();
const ItemDefinition &def = get(name);
// Create new ClientCached
@@ -345,7 +345,7 @@ public:
ItemStack item = ItemStack();
item.name = def.name;
- scene::IMesh *mesh = getItemMesh(gamedef, item);
+ scene::IMesh *mesh = getItemMesh(client, item);
cc->wield_mesh = mesh;
// Put in cache
@@ -354,7 +354,7 @@ public:
return cc;
}
ClientCached* getClientCached(const std::string &name,
- IGameDef *gamedef) const
+ Client *client) const
{
ClientCached *cc = NULL;
m_clientcached.get(name, &cc);
@@ -363,7 +363,7 @@ public:
if(thr_is_current_thread(m_main_thread))
{
- return createClientCachedDirect(name, gamedef);
+ return createClientCachedDirect(name, client);
}
else
{
@@ -392,18 +392,18 @@ public:
}
// Get item inventory texture
virtual video::ITexture* getInventoryTexture(const std::string &name,
- IGameDef *gamedef) const
+ Client *client) const
{
- ClientCached *cc = getClientCached(name, gamedef);
+ ClientCached *cc = getClientCached(name, client);
if(!cc)
return NULL;
return cc->inventory_texture;
}
// Get item wield mesh
virtual scene::IMesh* getWieldMesh(const std::string &name,
- IGameDef *gamedef) const
+ Client *client) const
{
- ClientCached *cc = getClientCached(name, gamedef);
+ ClientCached *cc = getClientCached(name, client);
if(!cc)
return NULL;
return cc->wield_mesh;
@@ -543,7 +543,7 @@ public:
request = m_get_clientcached_queue.pop();
m_get_clientcached_queue.pushResult(request,
- createClientCachedDirect(request.key, gamedef));
+ createClientCachedDirect(request.key, (Client *)gamedef));
}
#endif
}