Skip to content

Commit

Permalink
Remove dead code (#10845)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jan 22, 2021
1 parent 67aa75d commit 4c76239
Show file tree
Hide file tree
Showing 31 changed files with 8 additions and 331 deletions.
20 changes: 0 additions & 20 deletions src/client/client.cpp
Expand Up @@ -159,20 +159,6 @@ void Client::loadMods()
scanModIntoMemory(BUILTIN_MOD_NAME, getBuiltinLuaPath());
m_script->loadModFromMemory(BUILTIN_MOD_NAME);

// TODO Uncomment when server-sent CSM and verifying of builtin are complete
/*
// Don't load client-provided mods if disabled by server
if (checkCSMRestrictionFlag(CSMRestrictionFlags::CSM_RF_LOAD_CLIENT_MODS)) {
warningstream << "Client-provided mod loading is disabled by server." <<
std::endl;
// If builtin integrity is wrong, disconnect user
if (!checkBuiltinIntegrity()) {
// TODO disconnect user
}
return;
}
*/

ClientModConfiguration modconf(getClientModsLuaPath());
m_mods = modconf.getMods();
// complain about mods with unsatisfied dependencies
Expand Down Expand Up @@ -216,12 +202,6 @@ void Client::loadMods()
m_script->on_minimap_ready(m_minimap);
}

bool Client::checkBuiltinIntegrity()
{
// TODO
return true;
}

void Client::scanModSubfolder(const std::string &mod_name, const std::string &mod_path,
std::string mod_subpath)
{
Expand Down
7 changes: 0 additions & 7 deletions src/client/client.h
Expand Up @@ -415,11 +415,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
return m_csm_restriction_flags & flag;
}

u32 getCSMNodeRangeLimit() const
{
return m_csm_restriction_noderange;
}

inline std::unordered_map<u32, u32> &getHUDTranslationMap()
{
return m_hud_server_to_client;
Expand All @@ -437,7 +432,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
}
private:
void loadMods();
bool checkBuiltinIntegrity();

// Virtual methods from con::PeerHandler
void peerAdded(con::Peer *peer) override;
Expand Down Expand Up @@ -587,7 +581,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef

// Client modding
ClientScripting *m_script = nullptr;
bool m_modding_enabled;
std::unordered_map<std::string, ModMetadata *> m_mod_storages;
float m_mod_storage_save_timer = 10.0f;
std::vector<ModSpec> m_mods;
Expand Down
7 changes: 0 additions & 7 deletions src/client/clientenvironment.cpp
Expand Up @@ -334,13 +334,6 @@ GenericCAO* ClientEnvironment::getGenericCAO(u16 id)
return NULL;
}

bool isFreeClientActiveObjectId(const u16 id,
ClientActiveObjectMap &objects)
{
return id != 0 && objects.find(id) == objects.end();

}

u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
{
// Register object. If failed return zero id
Expand Down
2 changes: 0 additions & 2 deletions src/client/hud.cpp
Expand Up @@ -571,8 +571,6 @@ void Hud::drawCompassTranslate(HudElement *e, video::ITexture *texture,
void Hud::drawCompassRotate(HudElement *e, video::ITexture *texture,
const core::rect<s32> &rect, int angle)
{
core::dimension2di imgsize(texture->getOriginalSize());

core::rect<s32> oldViewPort = driver->getViewPort();
core::matrix4 oldProjMat = driver->getTransform(video::ETS_PROJECTION);
core::matrix4 oldViewMat = driver->getTransform(video::ETS_VIEW);
Expand Down
7 changes: 0 additions & 7 deletions src/client/mapblock_mesh.cpp
Expand Up @@ -1176,13 +1176,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
}

if (m_mesh[layer]) {
#if 0
// Usually 1-700 faces and 1-7 materials
std::cout << "Updated MapBlock has " << fastfaces_new.size()
<< " faces and uses " << m_mesh[layer]->getMeshBufferCount()
<< " materials (meshbuffers)" << std::endl;
#endif

// Use VBO for mesh (this just would set this for ever buffer)
if (m_enable_vbo)
m_mesh[layer]->setHardwareMappingHint(scene::EHM_STATIC);
Expand Down
2 changes: 0 additions & 2 deletions src/client/mapblock_mesh.h
Expand Up @@ -125,8 +125,6 @@ class MapBlockMesh
m_animation_force_timer--;
}

void updateCameraOffset(v3s16 camera_offset);

private:
scene::IMesh *m_mesh[MAX_TILE_LAYERS];
MinimapMapblock *m_minimap_mapblock;
Expand Down
1 change: 0 additions & 1 deletion src/client/mesh_generator_thread.h
Expand Up @@ -40,7 +40,6 @@ struct QueuedMeshUpdate
{
v3s16 p = v3s16(-1337, -1337, -1337);
bool ack_block_to_server = false;
bool urgent = false;
int crack_level = -1;
v3s16 crack_pos;
MeshMakeData *data = nullptr; // This is generated in MeshUpdateQueue::pop()
Expand Down
1 change: 0 additions & 1 deletion src/client/minimap.h
Expand Up @@ -138,7 +138,6 @@ class Minimap {
size_t getMaxModeIndex() const { return m_modes.size() - 1; };
void nextMode();

void setModesFromString(std::string modes_string);
MinimapModeDef getModeDef() const { return data->mode; }

video::ITexture *getMinimapTexture();
Expand Down
2 changes: 0 additions & 2 deletions src/client/tile.cpp
Expand Up @@ -429,7 +429,6 @@ class TextureSource : public IWritableTextureSource
// Cached settings needed for making textures from meshes
bool m_setting_trilinear_filter;
bool m_setting_bilinear_filter;
bool m_setting_anisotropic_filter;
};

IWritableTextureSource *createTextureSource()
Expand All @@ -450,7 +449,6 @@ TextureSource::TextureSource()
// for these settings to take effect
m_setting_trilinear_filter = g_settings->getBool("trilinear_filter");
m_setting_bilinear_filter = g_settings->getBool("bilinear_filter");
m_setting_anisotropic_filter = g_settings->getBool("anisotropic_filter");
}

TextureSource::~TextureSource()
Expand Down
9 changes: 1 addition & 8 deletions src/emerge.cpp
Expand Up @@ -396,14 +396,7 @@ int EmergeManager::getGroundLevelAtPoint(v2s16 p)
// TODO(hmmmm): Move this to ServerMap
bool EmergeManager::isBlockUnderground(v3s16 blockpos)
{
#if 0
v2s16 p = v2s16((blockpos.X * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2,
(blockpos.Y * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2);
int ground_level = getGroundLevelAtPoint(p);
return blockpos.Y * (MAP_BLOCKSIZE + 1) <= min(water_level, ground_level);
#endif

// Use a simple heuristic; the above method is wildly inaccurate anyway.
// Use a simple heuristic
return blockpos.Y * (MAP_BLOCKSIZE + 1) <= mgparams->water_level;
}

Expand Down
5 changes: 0 additions & 5 deletions src/exceptions.h
Expand Up @@ -72,11 +72,6 @@ class SettingNotFoundException : public BaseException {
SettingNotFoundException(const std::string &s): BaseException(s) {}
};

class InvalidFilenameException : public BaseException {
public:
InvalidFilenameException(const std::string &s): BaseException(s) {}
};

class ItemNotFoundException : public BaseException {
public:
ItemNotFoundException(const std::string &s): BaseException(s) {}
Expand Down
15 changes: 0 additions & 15 deletions src/filesys.cpp
Expand Up @@ -401,21 +401,6 @@ void GetRecursiveSubPaths(const std::string &path,
}
}

bool DeletePaths(const std::vector<std::string> &paths)
{
bool success = true;
// Go backwards to succesfully delete the output of GetRecursiveSubPaths
for(int i=paths.size()-1; i>=0; i--){
const std::string &path = paths[i];
bool did = DeleteSingleFileOrEmptyDirectory(path);
if(!did){
errorstream<<"Failed to delete "<<path<<std::endl;
success = false;
}
}
return success;
}

bool RecursiveDeleteContent(const std::string &path)
{
infostream<<"Removing content of \""<<path<<"\""<<std::endl;
Expand Down
3 changes: 0 additions & 3 deletions src/filesys.h
Expand Up @@ -85,9 +85,6 @@ void GetRecursiveSubPaths(const std::string &path,
bool list_files,
const std::set<char> &ignore = {});

// Tries to delete all, returns false if any failed
bool DeletePaths(const std::vector<std::string> &paths);

// Only pass full paths to this one. True on success.
bool RecursiveDeleteContent(const std::string &path);

Expand Down
1 change: 0 additions & 1 deletion src/gui/guiButtonItemImage.cpp
Expand Up @@ -39,7 +39,6 @@ GUIButtonItemImage::GUIButtonItemImage(gui::IGUIEnvironment *environment,
item, getActiveFont(), client);
sendToBack(m_image);

m_item_name = item;
m_client = client;
}

Expand Down
1 change: 0 additions & 1 deletion src/gui/guiButtonItemImage.h
Expand Up @@ -42,7 +42,6 @@ class GUIButtonItemImage : public GUIButton
Client *client);

private:
std::string m_item_name;
Client *m_client;
GUIItemImage *m_image;
};
2 changes: 0 additions & 2 deletions src/gui/guiChatConsole.h
Expand Up @@ -68,8 +68,6 @@ class GUIChatConsole : public gui::IGUIElement
// Irrlicht draw method
virtual void draw();

bool canTakeFocus(gui::IGUIElement* element) { return false; }

virtual bool OnEvent(const SEvent& event);

virtual void setVisible(bool visible);
Expand Down
2 changes: 0 additions & 2 deletions src/gui/guiEngine.cpp
Expand Up @@ -486,8 +486,6 @@ void GUIEngine::drawHeader(video::IVideoDriver *driver)
splashrect += v2s32((screensize.Width/2)-(splashsize.X/2),
((free_space/2)-splashsize.Y/2)+10);

video::SColor bgcolor(255,50,50,50);

draw2DImageFilterScaled(driver, texture, splashrect,
core::rect<s32>(core::position2d<s32>(0,0),
core::dimension2di(texture->getOriginalSize())),
Expand Down
4 changes: 1 addition & 3 deletions src/gui/guiFormSpecMenu.cpp
Expand Up @@ -3505,8 +3505,6 @@ bool GUIFormSpecMenu::getAndroidUIInput()

GUIInventoryList::ItemSpec GUIFormSpecMenu::getItemAtPos(v2s32 p) const
{
core::rect<s32> imgrect(0, 0, imgsize.X, imgsize.Y);

for (const GUIInventoryList *e : m_inventorylists) {
s32 item_index = e->getItemIndexAtPos(p);
if (item_index != -1)
Expand Down Expand Up @@ -3837,7 +3835,7 @@ ItemStack GUIFormSpecMenu::verifySelectedItem()
return ItemStack();
}

void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode=quit_mode_no)
void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode)
{
if(m_text_dst)
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/guiFormSpecMenu.h
Expand Up @@ -253,7 +253,7 @@ class GUIFormSpecMenu : public GUIModalMenu
void updateSelectedItem();
ItemStack verifySelectedItem();

void acceptInput(FormspecQuitMode quitmode);
void acceptInput(FormspecQuitMode quitmode=quit_mode_no);
bool preprocessEvent(const SEvent& event);
bool OnEvent(const SEvent& event);
bool doPause;
Expand Down

0 comments on commit 4c76239

Please sign in to comment.