Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused functions reported by cppcheck #10463

Merged
merged 2 commits into from Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/chat.cpp
Expand Up @@ -123,14 +123,14 @@ void ChatBuffer::deleteByAge(f32 maxAge)
deleteOldest(count);
}

u32 ChatBuffer::getColumns() const
u32 ChatBuffer::getRows() const
{
return m_cols;
return m_rows;
}

u32 ChatBuffer::getRows() const
void ChatBuffer::scrollTop()
{
return m_rows;
m_scroll = getTopScrollPos();
}

void ChatBuffer::reformat(u32 cols, u32 rows)
Expand Down Expand Up @@ -220,11 +220,6 @@ void ChatBuffer::scrollBottom()
m_scroll = getBottomScrollPos();
}

void ChatBuffer::scrollTop()
{
m_scroll = getTopScrollPos();
SmallJoker marked this conversation as resolved.
Show resolved Hide resolved
}

u32 ChatBuffer::formatChatLine(const ChatLine& line, u32 cols,
std::vector<ChatFormattedLine>& destination) const
{
Expand Down
2 changes: 0 additions & 2 deletions src/chat.h
Expand Up @@ -94,8 +94,6 @@ class ChatBuffer
// Delete lines older than maxAge.
void deleteByAge(f32 maxAge);

// Get number of columns, 0 if reformat has not been called yet.
u32 getColumns() const;
// Get number of rows, 0 if reformat has not been called yet.
u32 getRows() const;
// Update console size and reformat all formatted lines.
Expand Down
5 changes: 0 additions & 5 deletions src/client/client.cpp
Expand Up @@ -1664,11 +1664,6 @@ ClientEvent *Client::getClientEvent()
return event;
}

bool Client::connectedToServer()
{
return m_con->Connected();
}

const Address Client::getServerAddress()
{
return m_con->GetPeerAddress(PEER_ID_SERVER);
Expand Down
1 change: 0 additions & 1 deletion src/client/client.h
Expand Up @@ -337,7 +337,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
u16 getProtoVersion()
{ return m_proto_ver; }

bool connectedToServer();
void confirmRegistration();
bool m_is_registration_confirmation_state = false;
bool m_simple_singleplayer_mode;
Expand Down
15 changes: 0 additions & 15 deletions src/client/clientenvironment.cpp
Expand Up @@ -368,21 +368,6 @@ bool isFreeClientActiveObjectId(const u16 id,

}

u16 getFreeClientActiveObjectId(ClientActiveObjectMap &objects)
{
// try to reuse id's as late as possible
static u16 last_used_id = 0;
u16 startid = last_used_id;
for(;;) {
last_used_id ++;
if (isFreeClientActiveObjectId(last_used_id, objects))
return last_used_id;

if (last_used_id == startid)
return 0;
}
}

u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
{
// Register object. If failed return zero id
Expand Down
2 changes: 1 addition & 1 deletion src/client/clientmap.cpp
Expand Up @@ -36,7 +36,7 @@ ClientMap::ClientMap(
MapDrawControl &control,
s32 id
):
Map(dout_client, client),
Map(client),
scene::ISceneNode(RenderingEngine::get_scene_manager()->getRootSceneNode(),
RenderingEngine::get_scene_manager(), id),
m_client(client),
Expand Down
27 changes: 0 additions & 27 deletions src/client/mapblock_mesh.cpp
Expand Up @@ -81,33 +81,6 @@ void MeshMakeData::fill(MapBlock *block)
}
}

void MeshMakeData::fillSingleNode(MapNode *node)
{
m_blockpos = v3s16(0,0,0);

v3s16 blockpos_nodes = v3s16(0,0,0);
VoxelArea area(blockpos_nodes-v3s16(1,1,1)*MAP_BLOCKSIZE,
blockpos_nodes+v3s16(1,1,1)*MAP_BLOCKSIZE*2-v3s16(1,1,1));
s32 volume = area.getVolume();
s32 our_node_index = area.index(1,1,1);

// Allocate this block + neighbors
m_vmanip.clear();
m_vmanip.addArea(area);

// Fill in data
MapNode *data = new MapNode[volume];
for(s32 i = 0; i < volume; i++)
{
if (i == our_node_index)
data[i] = *node;
else
data[i] = MapNode(CONTENT_AIR, LIGHT_MAX, 0);
}
m_vmanip.copyFrom(data, area, area.MinEdge, area.MinEdge, area.getExtent());
delete[] data;
}

void MeshMakeData::setCrack(int crack_level, v3s16 crack_pos)
{
if (crack_level >= 0)
Expand Down
5 changes: 0 additions & 5 deletions src/client/mapblock_mesh.h
Expand Up @@ -62,11 +62,6 @@ struct MeshMakeData
*/
void fill(MapBlock *block);

/*
Set up with only a single node at (1,1,1)
*/
void fillSingleNode(MapNode *node);

/*
Set the (node) position of a crack
*/
Expand Down
1 change: 0 additions & 1 deletion src/content/CMakeLists.txt
@@ -1,6 +1,5 @@
set(content_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/content.cpp
${CMAKE_CURRENT_SOURCE_DIR}/packages.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mods.cpp
${CMAKE_CURRENT_SOURCE_DIR}/subgames.cpp
PARENT_SCOPE
Expand Down
69 changes: 0 additions & 69 deletions src/content/packages.cpp

This file was deleted.

52 changes: 0 additions & 52 deletions src/content/packages.h

This file was deleted.

5 changes: 0 additions & 5 deletions src/gui/guiChatConsole.cpp
Expand Up @@ -136,11 +136,6 @@ void GUIChatConsole::closeConsoleAtOnce()
recalculateConsolePosition();
}

f32 GUIChatConsole::getDesiredHeight() const
{
return m_desired_height_fraction;
}

void GUIChatConsole::replaceAndAddToHistory(const std::wstring &line)
{
ChatPrompt& prompt = m_chat_backend->getPrompt();
Expand Down
4 changes: 0 additions & 4 deletions src/gui/guiChatConsole.h
Expand Up @@ -55,10 +55,6 @@ class GUIChatConsole : public gui::IGUIElement
// Set whether to close the console after the user presses enter.
void setCloseOnEnter(bool close) { m_close_on_enter = close; }

// Return the desired height (fraction of screen size)
// Zero if the console is closed or getting closed
f32 getDesiredHeight() const;

// Replace actual line when adding the actual to the history (if there is any)
void replaceAndAddToHistory(const std::wstring &line);

Expand Down
11 changes: 1 addition & 10 deletions src/log.cpp
Expand Up @@ -97,16 +97,7 @@ LogBuffer verbose_buf(g_logger, LL_VERBOSE);
std::ostream *dout_con_ptr = &null_stream;
std::ostream *derr_con_ptr = &verbosestream;

// Server
std::ostream *dout_server_ptr = &infostream;
std::ostream *derr_server_ptr = &errorstream;

#ifndef SERVER
// Client
std::ostream *dout_client_ptr = &infostream;
std::ostream *derr_client_ptr = &errorstream;
#endif

// Common streams
std::ostream rawstream(&raw_buf);
std::ostream dstream(&none_buf);
std::ostream errorstream(&error_buf);
Expand Down
10 changes: 0 additions & 10 deletions src/log.h
Expand Up @@ -192,14 +192,8 @@ extern std::ostream null_stream;

extern std::ostream *dout_con_ptr;
extern std::ostream *derr_con_ptr;
extern std::ostream *dout_server_ptr;
extern std::ostream *derr_server_ptr;

#ifndef SERVER
extern std::ostream *dout_client_ptr;
extern std::ostream *derr_client_ptr;
#endif

extern Logger g_logger;

// Writes directly to all LL_NONE log outputs for g_logger with no prefix.
Expand All @@ -222,8 +216,4 @@ extern std::ostream dstream;

#define dout_con (*dout_con_ptr)
#define derr_con (*derr_con_ptr)
#define dout_server (*dout_server_ptr)

#ifndef SERVER
#define dout_client (*dout_client_ptr)
#endif