forked from Mirrorlandia_minetest/minetest
Various code cleanup & little performance improvement on HTTP download (#5772)
* Disable or remove unused enum members/functions * Tiny code style fixes * Make some functions const * Replace ClientMediaDownloader std::unordered_map with std::map
This commit is contained in:
parent
35267406aa
commit
ce9802266e
@ -28,9 +28,9 @@ enum ActiveObjectType {
|
||||
ACTIVEOBJECT_TYPE_TEST = 1,
|
||||
// Deprecated stuff
|
||||
ACTIVEOBJECT_TYPE_ITEM = 2,
|
||||
ACTIVEOBJECT_TYPE_RAT = 3,
|
||||
ACTIVEOBJECT_TYPE_OERKKI1 = 4,
|
||||
ACTIVEOBJECT_TYPE_FIREFLY = 5,
|
||||
// ACTIVEOBJECT_TYPE_RAT = 3,
|
||||
// ACTIVEOBJECT_TYPE_OERKKI1 = 4,
|
||||
// ACTIVEOBJECT_TYPE_FIREFLY = 5,
|
||||
ACTIVEOBJECT_TYPE_MOBV2 = 6,
|
||||
// End deprecated stuff
|
||||
ACTIVEOBJECT_TYPE_LUAENTITY = 7,
|
||||
|
20
src/camera.h
20
src/camera.h
@ -64,22 +64,6 @@ public:
|
||||
Client *client);
|
||||
~Camera();
|
||||
|
||||
// Get player scene node.
|
||||
// This node is positioned at the player's torso (without any view bobbing),
|
||||
// as given by Player::m_position. Yaw is applied but not pitch.
|
||||
inline scene::ISceneNode* getPlayerNode() const
|
||||
{
|
||||
return m_playernode;
|
||||
}
|
||||
|
||||
// Get head scene node.
|
||||
// It has the eye transformation and pitch applied,
|
||||
// but no view bobbing.
|
||||
inline scene::ISceneNode* getHeadNode() const
|
||||
{
|
||||
return m_headnode;
|
||||
}
|
||||
|
||||
// Get camera scene node.
|
||||
// It has the eye transformation, pitch and view bobbing applied.
|
||||
inline scene::ICameraSceneNode* getCameraNode() const
|
||||
@ -160,13 +144,13 @@ public:
|
||||
else
|
||||
m_camera_mode = CAMERA_MODE_FIRST;
|
||||
}
|
||||
|
||||
|
||||
// Set the current camera mode
|
||||
inline void setCameraMode(CameraMode mode)
|
||||
{
|
||||
m_camera_mode = mode;
|
||||
}
|
||||
|
||||
|
||||
//read the current camera mode
|
||||
inline CameraMode getCameraMode()
|
||||
{
|
||||
|
@ -77,11 +77,6 @@ u32 ChatBuffer::getLineCount() const
|
||||
return m_unformatted.size();
|
||||
}
|
||||
|
||||
u32 ChatBuffer::getScrollback() const
|
||||
{
|
||||
return m_scrollback;
|
||||
}
|
||||
|
||||
const ChatLine& ChatBuffer::getLine(u32 index) const
|
||||
{
|
||||
assert(index < getLineCount()); // pre-condition
|
||||
|
@ -86,8 +86,6 @@ public:
|
||||
|
||||
// Get number of lines currently in buffer.
|
||||
u32 getLineCount() const;
|
||||
// Get scrollback size, maximum number of lines in buffer.
|
||||
u32 getScrollback() const;
|
||||
// Get reference to i-th chat line.
|
||||
const ChatLine& getLine(u32 index) const;
|
||||
|
||||
@ -162,8 +160,7 @@ public:
|
||||
std::wstring getLine() const { return m_line; }
|
||||
|
||||
// Get section of line that is currently selected
|
||||
std::wstring getSelection() const
|
||||
{ return m_line.substr(m_cursor, m_cursor_len); }
|
||||
std::wstring getSelection() const { return m_line.substr(m_cursor, m_cursor_len); }
|
||||
|
||||
// Clear the current line
|
||||
void clear();
|
||||
|
@ -1723,7 +1723,7 @@ float Client::getRTT()
|
||||
|
||||
float Client::getCurRate()
|
||||
{
|
||||
return ( m_con.getLocalStat(con::CUR_INC_RATE) +
|
||||
return (m_con.getLocalStat(con::CUR_INC_RATE) +
|
||||
m_con.getLocalStat(con::CUR_DL_RATE));
|
||||
}
|
||||
|
||||
|
@ -467,8 +467,7 @@ public:
|
||||
Minimap* getMinimap() { return m_minimap; }
|
||||
void setCamera(Camera* camera) { m_camera = camera; }
|
||||
|
||||
Camera* getCamera ()
|
||||
{ return m_camera; }
|
||||
Camera* getCamera () { return m_camera; }
|
||||
|
||||
bool shouldShowMinimap() const;
|
||||
|
||||
|
@ -590,7 +590,7 @@ void RemoteClient::notifyEvent(ClientStateEvent event)
|
||||
}
|
||||
}
|
||||
|
||||
u32 RemoteClient::uptime()
|
||||
u32 RemoteClient::uptime() const
|
||||
{
|
||||
return porting::getTime(PRECISION_SECONDS) - m_connection_time;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ public:
|
||||
{ serialization_version = m_pending_serialization_version; }
|
||||
|
||||
/* get uptime */
|
||||
u32 uptime();
|
||||
u32 uptime() const;
|
||||
|
||||
/* set version information */
|
||||
void setVersionInfo(u8 major, u8 minor, u8 patch, const std::string &full)
|
||||
@ -360,7 +360,6 @@ public:
|
||||
u8 getMajor() const { return m_version_major; }
|
||||
u8 getMinor() const { return m_version_minor; }
|
||||
u8 getPatch() const { return m_version_patch; }
|
||||
std::string getVersion() const { return m_full_version; }
|
||||
private:
|
||||
// Version is stored in here after INIT before INIT2
|
||||
u8 m_pending_serialization_version;
|
||||
|
@ -348,7 +348,7 @@ void ClientMediaDownloader::remoteMediaReceived(
|
||||
|
||||
std::string name;
|
||||
{
|
||||
std::map<unsigned long, std::string>::iterator it =
|
||||
UNORDERED_MAP<unsigned long, std::string>::iterator it =
|
||||
m_remote_file_transfers.find(fetch_result.request_id);
|
||||
assert(it != m_remote_file_transfers.end());
|
||||
name = it->second;
|
||||
|
@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include "util/cpp11_container.h"
|
||||
|
||||
class Client;
|
||||
struct HTTPFetchResult;
|
||||
@ -137,7 +138,7 @@ private:
|
||||
s32 m_httpfetch_active;
|
||||
s32 m_httpfetch_active_limit;
|
||||
s32 m_outstanding_hash_sets;
|
||||
std::map<unsigned long, std::string> m_remote_file_transfers;
|
||||
UNORDERED_MAP<unsigned long, std::string> m_remote_file_transfers;
|
||||
|
||||
// All files up to this name have either been received from a
|
||||
// remote server or failed on all remote servers, so those files
|
||||
|
@ -49,18 +49,13 @@ public:
|
||||
virtual aabb3f *getSelectionBox() { return NULL; }
|
||||
virtual bool getCollisionBox(aabb3f *toset) const { return false; }
|
||||
virtual bool collideWithObjects() const { return false; }
|
||||
virtual v3f getPosition(){return v3f(0,0,0);}
|
||||
virtual float getYaw() const {return 0;}
|
||||
virtual scene::ISceneNode *getSceneNode(){return NULL;}
|
||||
virtual scene::IMeshSceneNode *getMeshSceneNode(){return NULL;}
|
||||
virtual scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode(){return NULL;}
|
||||
virtual WieldMeshSceneNode *getWieldMeshSceneNode(){return NULL;}
|
||||
virtual scene::IBillboardSceneNode *getSpriteSceneNode(){return NULL;}
|
||||
virtual bool isPlayer() const {return false;}
|
||||
virtual v3f getPosition(){ return v3f(0,0,0); }
|
||||
virtual float getYaw() const { return 0; }
|
||||
virtual scene::ISceneNode *getSceneNode() { return NULL; }
|
||||
virtual scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode() { return NULL; }
|
||||
virtual bool isLocalPlayer() const {return false;}
|
||||
virtual void setAttachments(){}
|
||||
virtual void setAttachments() {}
|
||||
virtual bool doShowSelectionBox(){return true;}
|
||||
virtual void updateCameraOffset(v3s16 camera_offset){};
|
||||
|
||||
// Step object in time
|
||||
virtual void step(float dtime, ClientEnvironment *env){}
|
||||
|
@ -706,26 +706,11 @@ scene::ISceneNode* GenericCAO::getSceneNode()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scene::IMeshSceneNode* GenericCAO::getMeshSceneNode()
|
||||
{
|
||||
return m_meshnode;
|
||||
}
|
||||
|
||||
scene::IAnimatedMeshSceneNode* GenericCAO::getAnimatedMeshSceneNode()
|
||||
{
|
||||
return m_animated_meshnode;
|
||||
}
|
||||
|
||||
WieldMeshSceneNode* GenericCAO::getWieldMeshSceneNode()
|
||||
{
|
||||
return m_wield_meshnode;
|
||||
}
|
||||
|
||||
scene::IBillboardSceneNode* GenericCAO::getSpriteSceneNode()
|
||||
{
|
||||
return m_spritenode;
|
||||
}
|
||||
|
||||
void GenericCAO::setChildrenVisible(bool toset)
|
||||
{
|
||||
for (std::vector<u16>::size_type i = 0; i < m_children.size(); i++) {
|
||||
|
@ -146,19 +146,8 @@ public:
|
||||
|
||||
scene::ISceneNode *getSceneNode();
|
||||
|
||||
scene::IMeshSceneNode *getMeshSceneNode();
|
||||
|
||||
scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode();
|
||||
|
||||
WieldMeshSceneNode *getWieldMeshSceneNode();
|
||||
|
||||
scene::IBillboardSceneNode *getSpriteSceneNode();
|
||||
|
||||
inline bool isPlayer() const
|
||||
{
|
||||
return m_is_player;
|
||||
}
|
||||
|
||||
inline bool isLocalPlayer() const
|
||||
{
|
||||
return m_is_local_player;
|
||||
|
@ -881,7 +881,6 @@ public:
|
||||
void serialize(std::ostream &os, u16 protocol_version) const;
|
||||
void deSerialize(std::istream &is);
|
||||
|
||||
inline virtual bool getNodeRegistrationStatus() const;
|
||||
inline virtual void setNodeRegistrationStatus(bool completed);
|
||||
|
||||
virtual void pendNodeResolve(NodeResolver *nr);
|
||||
@ -1805,13 +1804,6 @@ void ContentFeatures::deSerializeOld(std::istream &is, int version)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline bool CNodeDefManager::getNodeRegistrationStatus() const
|
||||
{
|
||||
return m_node_registration_complete;
|
||||
}
|
||||
|
||||
|
||||
inline void CNodeDefManager::setNodeRegistrationStatus(bool completed)
|
||||
{
|
||||
m_node_registration_complete = completed;
|
||||
|
@ -432,8 +432,6 @@ public:
|
||||
|
||||
virtual void serialize(std::ostream &os, u16 protocol_version) const=0;
|
||||
|
||||
virtual bool getNodeRegistrationStatus() const=0;
|
||||
|
||||
virtual void pendNodeResolve(NodeResolver *nr)=0;
|
||||
virtual bool cancelNodeResolveCallback(NodeResolver *nr)=0;
|
||||
virtual bool nodeboxConnects(const MapNode from, const MapNode to, u8 connect_face)=0;
|
||||
@ -491,7 +489,6 @@ public:
|
||||
virtual void serialize(std::ostream &os, u16 protocol_version) const=0;
|
||||
virtual void deSerialize(std::istream &is)=0;
|
||||
|
||||
virtual bool getNodeRegistrationStatus() const=0;
|
||||
virtual void setNodeRegistrationStatus(bool completed)=0;
|
||||
|
||||
virtual void pendNodeResolve(NodeResolver *nr)=0;
|
||||
|
Loading…
Reference in New Issue
Block a user