forked from Mirrorlandia_minetest/minetest
Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)
* Also remove 2 non declared but defined functions * Make some functions around const ref changes const
This commit is contained in:
parent
f3fe62a0bf
commit
f98bbe193e
@ -185,7 +185,8 @@ void JoystickController::onJoystickConnect(const std::vector<irr::SJoystickInfo>
|
||||
m_joystick_id = id;
|
||||
}
|
||||
|
||||
void JoystickController::setLayoutFromControllerName(std::string name) {
|
||||
void JoystickController::setLayoutFromControllerName(const std::string &name)
|
||||
{
|
||||
if (lowercase(name).find("xbox") != std::string::npos) {
|
||||
m_layout = create_xbox_layout();
|
||||
} else {
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
f32 doubling_dtime;
|
||||
|
||||
private:
|
||||
void setLayoutFromControllerName(std::string name);
|
||||
void setLayoutFromControllerName(const std::string &name);
|
||||
|
||||
JoystickLayout m_layout;
|
||||
|
||||
|
@ -324,14 +324,11 @@ public:
|
||||
*/
|
||||
std::set<u16> m_known_objects;
|
||||
|
||||
ClientState getState()
|
||||
{ return m_state; }
|
||||
ClientState getState() const { return m_state; }
|
||||
|
||||
std::string getName()
|
||||
{ return m_name; }
|
||||
std::string getName() const { return m_name; }
|
||||
|
||||
void setName(std::string name)
|
||||
{ m_name = name; }
|
||||
void setName(const std::string &name) { m_name = name; }
|
||||
|
||||
/* update internal client state */
|
||||
void notifyEvent(ClientStateEvent event);
|
||||
@ -350,7 +347,8 @@ public:
|
||||
u32 uptime();
|
||||
|
||||
/* set version information */
|
||||
void setVersionInfo(u8 major, u8 minor, u8 patch, std::string full) {
|
||||
void setVersionInfo(u8 major, u8 minor, u8 patch, const std::string &full)
|
||||
{
|
||||
m_version_major = major;
|
||||
m_version_minor = minor;
|
||||
m_version_patch = patch;
|
||||
@ -358,10 +356,10 @@ public:
|
||||
}
|
||||
|
||||
/* read version information */
|
||||
u8 getMajor() { return m_version_major; }
|
||||
u8 getMinor() { return m_version_minor; }
|
||||
u8 getPatch() { return m_version_patch; }
|
||||
std::string getVersion() { return m_full_version; }
|
||||
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;
|
||||
|
@ -148,7 +148,8 @@ std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_update_bone_position(std::string bone, v3f position, v3f rotation)
|
||||
std::string gob_cmd_update_bone_position(const std::string &bone, v3f position,
|
||||
v3f rotation)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command
|
||||
@ -160,7 +161,8 @@ std::string gob_cmd_update_bone_position(std::string bone, v3f position, v3f rot
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_update_attachment(int parent_id, std::string bone, v3f position, v3f rotation)
|
||||
std::string gob_cmd_update_attachment(int parent_id, const std::string &bone,
|
||||
v3f position, v3f rotation)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command
|
||||
@ -184,7 +186,8 @@ std::string gob_cmd_update_nametag_attributes(video::SColor color)
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string gob_cmd_update_infant(u16 id, u8 type, std::string client_initialization_data)
|
||||
std::string gob_cmd_update_infant(u16 id, u8 type,
|
||||
const std::string &client_initialization_data)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command
|
||||
|
@ -73,13 +73,16 @@ std::string gob_cmd_update_physics_override(float physics_override_speed,
|
||||
|
||||
std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_blend, bool frame_loop);
|
||||
|
||||
std::string gob_cmd_update_bone_position(std::string bone, v3f position, v3f rotation);
|
||||
std::string gob_cmd_update_bone_position(const std::string &bone, v3f position,
|
||||
v3f rotation);
|
||||
|
||||
std::string gob_cmd_update_attachment(int parent_id, std::string bone, v3f position, v3f rotation);
|
||||
std::string gob_cmd_update_attachment(int parent_id, const std::string &bone,
|
||||
v3f position, v3f rotation);
|
||||
|
||||
std::string gob_cmd_update_nametag_attributes(video::SColor color);
|
||||
|
||||
std::string gob_cmd_update_infant(u16 id, u8 type, std::string client_initialization_data);
|
||||
std::string gob_cmd_update_infant(u16 id, u8 type,
|
||||
const std::string &client_initialization_data);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -602,8 +602,8 @@ void GUIEngine::stopSound(s32 handle)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned int GUIEngine::queueAsync(std::string serialized_func,
|
||||
std::string serialized_params)
|
||||
unsigned int GUIEngine::queueAsync(const std::string &serialized_func,
|
||||
const std::string &serialized_params)
|
||||
{
|
||||
return m_script->queueAsync(serialized_func, serialized_params);
|
||||
}
|
||||
|
@ -178,7 +178,8 @@ public:
|
||||
}
|
||||
|
||||
/** pass async callback to scriptengine **/
|
||||
unsigned int queueAsync(std::string serialized_fct,std::string serialized_params);
|
||||
unsigned int queueAsync(const std::string &serialized_fct,
|
||||
const std::string &serialized_params);
|
||||
|
||||
private:
|
||||
|
||||
@ -188,9 +189,6 @@ private:
|
||||
/** run main menu loop */
|
||||
void run();
|
||||
|
||||
/** handler to limit frame rate within main menu */
|
||||
void limitFrameRate();
|
||||
|
||||
/** update size of topleftext element */
|
||||
void updateTopLeftTextSize();
|
||||
|
||||
|
@ -252,7 +252,7 @@ std::vector<std::string>* GUIFormSpecMenu::getDropDownValues(const std::string &
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseSize(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseSize(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,',');
|
||||
|
||||
@ -278,7 +278,7 @@ void GUIFormSpecMenu::parseSize(parserData* data,std::string element)
|
||||
errorstream<< "Invalid size element (" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseContainer(parserData* data, std::string element)
|
||||
void GUIFormSpecMenu::parseContainer(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element, ',');
|
||||
|
||||
@ -304,7 +304,7 @@ void GUIFormSpecMenu::parseContainerEnd(parserData* data)
|
||||
}
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseList(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseList(parserData* data, const std::string &element)
|
||||
{
|
||||
if (m_client == 0) {
|
||||
warningstream<<"invalid use of 'list' with m_client==0"<<std::endl;
|
||||
@ -359,7 +359,7 @@ void GUIFormSpecMenu::parseList(parserData* data,std::string element)
|
||||
errorstream<< "Invalid list element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseListRing(parserData* data, std::string element)
|
||||
void GUIFormSpecMenu::parseListRing(parserData* data, const std::string &element)
|
||||
{
|
||||
if (m_client == 0) {
|
||||
errorstream << "WARNING: invalid use of 'listring' with m_client==0" << std::endl;
|
||||
@ -394,7 +394,7 @@ void GUIFormSpecMenu::parseListRing(parserData* data, std::string element)
|
||||
<< m_inventorylists.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseCheckbox(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -450,7 +450,7 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
|
||||
errorstream<< "Invalid checkbox element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseScrollBar(parserData* data, std::string element)
|
||||
void GUIFormSpecMenu::parseScrollBar(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -509,7 +509,7 @@ void GUIFormSpecMenu::parseScrollBar(parserData* data, std::string element)
|
||||
errorstream<< "Invalid scrollbar element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseImage(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseImage(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -553,7 +553,7 @@ void GUIFormSpecMenu::parseImage(parserData* data,std::string element)
|
||||
errorstream<< "Invalid image element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseItemImage(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseItemImage(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -583,8 +583,8 @@ void GUIFormSpecMenu::parseItemImage(parserData* data,std::string element)
|
||||
errorstream<< "Invalid ItemImage element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseButton(parserData* data,std::string element,
|
||||
std::string type)
|
||||
void GUIFormSpecMenu::parseButton(parserData* data, const std::string &element,
|
||||
const std::string &type)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -638,7 +638,7 @@ void GUIFormSpecMenu::parseButton(parserData* data,std::string element,
|
||||
errorstream<< "Invalid button element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseBackground(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseBackground(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -676,7 +676,7 @@ void GUIFormSpecMenu::parseBackground(parserData* data,std::string element)
|
||||
errorstream<< "Invalid background element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseTableOptions(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseTableOptions(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -688,7 +688,7 @@ void GUIFormSpecMenu::parseTableOptions(parserData* data,std::string element)
|
||||
}
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseTableColumns(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseTableColumns(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -708,7 +708,7 @@ void GUIFormSpecMenu::parseTableColumns(parserData* data,std::string element)
|
||||
}
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseTable(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseTable(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -776,7 +776,7 @@ void GUIFormSpecMenu::parseTable(parserData* data,std::string element)
|
||||
errorstream<< "Invalid table element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseTextList(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseTextList(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -849,7 +849,7 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element)
|
||||
}
|
||||
|
||||
|
||||
void GUIFormSpecMenu::parseDropDown(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseDropDown(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -913,8 +913,7 @@ void GUIFormSpecMenu::parseDropDown(parserData* data,std::string element)
|
||||
<< element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseFieldCloseOnEnter(parserData *data,
|
||||
const std::string &element)
|
||||
void GUIFormSpecMenu::parseFieldCloseOnEnter(parserData *data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
if (parts.size() == 2 ||
|
||||
@ -923,7 +922,7 @@ void GUIFormSpecMenu::parseFieldCloseOnEnter(parserData *data,
|
||||
}
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parsePwdField(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1084,8 +1083,8 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,
|
||||
m_fields.push_back(spec);
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseTextArea(parserData* data,
|
||||
std::vector<std::string>& parts,std::string type)
|
||||
void GUIFormSpecMenu::parseTextArea(parserData* data, std::vector<std::string>& parts,
|
||||
const std::string &type)
|
||||
{
|
||||
|
||||
std::vector<std::string> v_pos = split(parts[0],',');
|
||||
@ -1196,8 +1195,8 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,
|
||||
m_fields.push_back(spec);
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseField(parserData* data,std::string element,
|
||||
std::string type)
|
||||
void GUIFormSpecMenu::parseField(parserData* data, const std::string &element,
|
||||
const std::string &type)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1215,7 +1214,7 @@ void GUIFormSpecMenu::parseField(parserData* data,std::string element,
|
||||
errorstream<< "Invalid field element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseLabel(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1271,7 +1270,7 @@ void GUIFormSpecMenu::parseLabel(parserData* data,std::string element)
|
||||
errorstream<< "Invalid label element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseVertLabel(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1321,8 +1320,8 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element)
|
||||
errorstream<< "Invalid vertlabel element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,
|
||||
std::string type)
|
||||
void GUIFormSpecMenu::parseImageButton(parserData* data, const std::string &element,
|
||||
const std::string &type)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1410,7 +1409,7 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,
|
||||
errorstream<< "Invalid imagebutton element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseTabHeader(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1482,7 +1481,7 @@ void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element)
|
||||
<< element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseItemImageButton(parserData* data, const std::string &element)
|
||||
{
|
||||
|
||||
if (m_client == 0) {
|
||||
@ -1556,7 +1555,7 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
|
||||
errorstream<< "Invalid ItemImagebutton element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseBox(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseBox(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1592,7 +1591,7 @@ void GUIFormSpecMenu::parseBox(parserData* data,std::string element)
|
||||
errorstream<< "Invalid Box element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseBackgroundColor(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseBackgroundColor(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1610,7 +1609,7 @@ void GUIFormSpecMenu::parseBackgroundColor(parserData* data,std::string element)
|
||||
errorstream<< "Invalid bgcolor element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseListColors(parserData* data,std::string element)
|
||||
void GUIFormSpecMenu::parseListColors(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
@ -1638,7 +1637,7 @@ void GUIFormSpecMenu::parseListColors(parserData* data,std::string element)
|
||||
errorstream<< "Invalid listcolors element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
void GUIFormSpecMenu::parseTooltip(parserData* data, std::string element)
|
||||
void GUIFormSpecMenu::parseTooltip(parserData* data, const std::string &element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
if (parts.size() == 2) {
|
||||
@ -1658,7 +1657,7 @@ void GUIFormSpecMenu::parseTooltip(parserData* data, std::string element)
|
||||
errorstream<< "Invalid tooltip element(" << parts.size() << "): '" << element << "'" << std::endl;
|
||||
}
|
||||
|
||||
bool GUIFormSpecMenu::parseVersionDirect(std::string data)
|
||||
bool GUIFormSpecMenu::parseVersionDirect(const std::string &data)
|
||||
{
|
||||
//some prechecks
|
||||
if (data == "")
|
||||
@ -1682,7 +1681,7 @@ bool GUIFormSpecMenu::parseVersionDirect(std::string data)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GUIFormSpecMenu::parseSizeDirect(parserData* data, std::string element)
|
||||
bool GUIFormSpecMenu::parseSizeDirect(parserData* data, const std::string &element)
|
||||
{
|
||||
if (element == "")
|
||||
return false;
|
||||
|
@ -471,39 +471,41 @@ private:
|
||||
|
||||
void parseElement(parserData* data, std::string element);
|
||||
|
||||
void parseSize(parserData* data, std::string element);
|
||||
void parseContainer(parserData* data, std::string element);
|
||||
void parseSize(parserData* data, const std::string &element);
|
||||
void parseContainer(parserData* data, const std::string &element);
|
||||
void parseContainerEnd(parserData* data);
|
||||
void parseList(parserData* data, std::string element);
|
||||
void parseListRing(parserData* data, std::string element);
|
||||
void parseCheckbox(parserData* data, std::string element);
|
||||
void parseImage(parserData* data, std::string element);
|
||||
void parseItemImage(parserData* data,std::string element);
|
||||
void parseButton(parserData* data,std::string element,std::string typ);
|
||||
void parseBackground(parserData* data,std::string element);
|
||||
void parseTableOptions(parserData* data,std::string element);
|
||||
void parseTableColumns(parserData* data,std::string element);
|
||||
void parseTable(parserData* data,std::string element);
|
||||
void parseTextList(parserData* data,std::string element);
|
||||
void parseDropDown(parserData* data,std::string element);
|
||||
void parseList(parserData* data, const std::string &element);
|
||||
void parseListRing(parserData* data, const std::string &element);
|
||||
void parseCheckbox(parserData* data, const std::string &element);
|
||||
void parseImage(parserData* data, const std::string &element);
|
||||
void parseItemImage(parserData* data, const std::string &element);
|
||||
void parseButton(parserData* data, const std::string &element,
|
||||
const std::string &typ);
|
||||
void parseBackground(parserData* data, const std::string &element);
|
||||
void parseTableOptions(parserData* data, const std::string &element);
|
||||
void parseTableColumns(parserData* data, const std::string &element);
|
||||
void parseTable(parserData* data, const std::string &element);
|
||||
void parseTextList(parserData* data, const std::string &element);
|
||||
void parseDropDown(parserData* data, const std::string &element);
|
||||
void parseFieldCloseOnEnter(parserData *data, const std::string &element);
|
||||
void parsePwdField(parserData* data,std::string element);
|
||||
void parseField(parserData* data,std::string element,std::string type);
|
||||
void parsePwdField(parserData* data, const std::string &element);
|
||||
void parseField(parserData* data, const std::string &element, const std::string &type);
|
||||
void parseSimpleField(parserData* data,std::vector<std::string> &parts);
|
||||
void parseTextArea(parserData* data,std::vector<std::string>& parts,
|
||||
std::string type);
|
||||
void parseLabel(parserData* data,std::string element);
|
||||
void parseVertLabel(parserData* data,std::string element);
|
||||
void parseImageButton(parserData* data,std::string element,std::string type);
|
||||
void parseItemImageButton(parserData* data,std::string element);
|
||||
void parseTabHeader(parserData* data,std::string element);
|
||||
void parseBox(parserData* data,std::string element);
|
||||
void parseBackgroundColor(parserData* data,std::string element);
|
||||
void parseListColors(parserData* data,std::string element);
|
||||
void parseTooltip(parserData* data,std::string element);
|
||||
bool parseVersionDirect(std::string data);
|
||||
bool parseSizeDirect(parserData* data, std::string element);
|
||||
void parseScrollBar(parserData* data, std::string element);
|
||||
const std::string &type);
|
||||
void parseLabel(parserData* data, const std::string &element);
|
||||
void parseVertLabel(parserData* data, const std::string &element);
|
||||
void parseImageButton(parserData* data, const std::string &element,
|
||||
const std::string &type);
|
||||
void parseItemImageButton(parserData* data, const std::string &element);
|
||||
void parseTabHeader(parserData* data, const std::string &element);
|
||||
void parseBox(parserData* data, const std::string &element);
|
||||
void parseBackgroundColor(parserData* data, const std::string &element);
|
||||
void parseListColors(parserData* data, const std::string &element);
|
||||
void parseTooltip(parserData* data, const std::string &element);
|
||||
bool parseVersionDirect(const std::string &data);
|
||||
bool parseSizeDirect(parserData* data, const std::string &element);
|
||||
void parseScrollBar(parserData* data, const std::string &element);
|
||||
bool parsePositionDirect(parserData *data, const std::string &element);
|
||||
void parsePosition(parserData *data, const std::string &element);
|
||||
bool parseAnchorDirect(parserData *data, const std::string &element);
|
||||
|
@ -74,11 +74,10 @@ public:
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
Option(const std::string &name_, const std::string &value_)
|
||||
{
|
||||
name = name_;
|
||||
value = value_;
|
||||
}
|
||||
Option(const std::string &name_, const std::string &value_) :
|
||||
name(name_),
|
||||
value(value_)
|
||||
{}
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -40,16 +40,15 @@ Mutex g_httpfetch_mutex;
|
||||
std::map<unsigned long, std::queue<HTTPFetchResult> > g_httpfetch_results;
|
||||
PcgRandom g_callerid_randomness;
|
||||
|
||||
HTTPFetchRequest::HTTPFetchRequest()
|
||||
HTTPFetchRequest::HTTPFetchRequest() :
|
||||
url(""),
|
||||
caller(HTTPFETCH_DISCARD),
|
||||
request_id(0),
|
||||
timeout(g_settings->getS32("curl_timeout")),
|
||||
connect_timeout(timeout),
|
||||
multipart(false),
|
||||
useragent(std::string(PROJECT_NAME_C "/") + g_version_hash + " (" + porting::get_sysinfo() + ")")
|
||||
{
|
||||
url = "";
|
||||
caller = HTTPFETCH_DISCARD;
|
||||
request_id = 0;
|
||||
timeout = g_settings->getS32("curl_timeout");
|
||||
connect_timeout = timeout;
|
||||
multipart = false;
|
||||
|
||||
useragent = std::string(PROJECT_NAME_C "/") + g_version_hash + " (" + porting::get_sysinfo() + ")";
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,25 +77,23 @@ struct HTTPFetchResult
|
||||
unsigned long caller;
|
||||
unsigned long request_id;
|
||||
|
||||
HTTPFetchResult()
|
||||
{
|
||||
succeeded = false;
|
||||
timeout = false;
|
||||
response_code = 0;
|
||||
data = "";
|
||||
caller = HTTPFETCH_DISCARD;
|
||||
request_id = 0;
|
||||
}
|
||||
HTTPFetchResult() :
|
||||
succeeded(false),
|
||||
timeout(false),
|
||||
response_code(0),
|
||||
data(""),
|
||||
caller(HTTPFETCH_DISCARD),
|
||||
request_id(0)
|
||||
{}
|
||||
|
||||
HTTPFetchResult(const HTTPFetchRequest &fetch_request)
|
||||
{
|
||||
succeeded = false;
|
||||
timeout = false;
|
||||
response_code = 0;
|
||||
data = "";
|
||||
caller = fetch_request.caller;
|
||||
request_id = fetch_request.request_id;
|
||||
}
|
||||
HTTPFetchResult(const HTTPFetchRequest &fetch_request) :
|
||||
succeeded(false),
|
||||
timeout(false),
|
||||
response_code(0),
|
||||
data(""),
|
||||
caller(fetch_request.caller),
|
||||
request_id(fetch_request.request_id)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
|
@ -2347,16 +2347,15 @@ bool ServerMap::saveBlock(MapBlock *block, Database *db)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ServerMap::loadBlock(std::string sectordir, std::string blockfile,
|
||||
void ServerMap::loadBlock(const std::string §ordir, const std::string &blockfile,
|
||||
MapSector *sector, bool save_after_load)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
std::string fullpath = sectordir + DIR_DELIM + blockfile;
|
||||
try {
|
||||
|
||||
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
||||
if(is.good() == false)
|
||||
if (!is.good())
|
||||
throw FileNotGoodException("Cannot open block file");
|
||||
|
||||
v3s16 p3d = getBlockPos(sectordir, blockfile);
|
||||
|
10
src/map.h
10
src/map.h
@ -456,17 +456,11 @@ public:
|
||||
MapSector* loadSectorMeta(std::string dirname, bool save_after_load);
|
||||
bool loadSectorMeta(v2s16 p2d);
|
||||
|
||||
// Full load of a sector including all blocks.
|
||||
// returns true on success, false on failure.
|
||||
bool loadSectorFull(v2s16 p2d);
|
||||
// If sector is not found in memory, try to load it from disk.
|
||||
// Returns true if sector now resides in memory
|
||||
//bool deFlushSector(v2s16 p2d);
|
||||
|
||||
bool saveBlock(MapBlock *block);
|
||||
static bool saveBlock(MapBlock *block, Database *db);
|
||||
// This will generate a sector with getSector if not found.
|
||||
void loadBlock(std::string sectordir, std::string blockfile, MapSector *sector, bool save_after_load=false);
|
||||
void loadBlock(const std::string §ordir, const std::string &blockfile,
|
||||
MapSector *sector, bool save_after_load=false);
|
||||
MapBlock* loadBlock(v3s16 p);
|
||||
// Database version
|
||||
void loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load=false);
|
||||
|
@ -383,7 +383,7 @@ struct OutgoingPacket
|
||||
bool reliable;
|
||||
bool ack;
|
||||
|
||||
OutgoingPacket(u16 peer_id_, u8 channelnum_, SharedBuffer<u8> data_,
|
||||
OutgoingPacket(u16 peer_id_, u8 channelnum_, const SharedBuffer<u8> &data_,
|
||||
bool reliable_,bool ack_=false):
|
||||
peer_id(peer_id_),
|
||||
channelnum(channelnum_),
|
||||
@ -448,7 +448,7 @@ struct ConnectionCommand
|
||||
reliable = reliable_;
|
||||
}
|
||||
|
||||
void ack(u16 peer_id_, u8 channelnum_, SharedBuffer<u8> data_)
|
||||
void ack(u16 peer_id_, u8 channelnum_, const SharedBuffer<u8> &data_)
|
||||
{
|
||||
type = CONCMD_ACK;
|
||||
peer_id = peer_id_;
|
||||
@ -457,7 +457,7 @@ struct ConnectionCommand
|
||||
reliable = false;
|
||||
}
|
||||
|
||||
void createPeer(u16 peer_id_, SharedBuffer<u8> data_)
|
||||
void createPeer(u16 peer_id_, const SharedBuffer<u8> &data_)
|
||||
{
|
||||
type = CONCMD_CREATE_PEER;
|
||||
peer_id = peer_id_;
|
||||
@ -467,7 +467,7 @@ struct ConnectionCommand
|
||||
raw = true;
|
||||
}
|
||||
|
||||
void disableLegacy(u16 peer_id_, SharedBuffer<u8> data_)
|
||||
void disableLegacy(u16 peer_id_, const SharedBuffer<u8> &data_)
|
||||
{
|
||||
type = CONCMD_DISABLE_LEGACY;
|
||||
peer_id = peer_id_;
|
||||
@ -874,7 +874,7 @@ struct ConnectionEvent
|
||||
return "Invalid ConnectionEvent";
|
||||
}
|
||||
|
||||
void dataReceived(u16 peer_id_, SharedBuffer<u8> data_)
|
||||
void dataReceived(u16 peer_id_, const SharedBuffer<u8> &data_)
|
||||
{
|
||||
type = CONNEVENT_DATA_RECEIVED;
|
||||
peer_id = peer_id_;
|
||||
|
@ -218,14 +218,14 @@ struct TileDef
|
||||
|
||||
struct TileAnimationParams animation;
|
||||
|
||||
TileDef()
|
||||
TileDef() :
|
||||
name(""),
|
||||
backface_culling(true),
|
||||
tileable_horizontal(true),
|
||||
tileable_vertical(true),
|
||||
has_color(false),
|
||||
color(video::SColor(0xFFFFFFFF))
|
||||
{
|
||||
name = "";
|
||||
backface_culling = true;
|
||||
tileable_horizontal = true;
|
||||
tileable_vertical = true;
|
||||
has_color = false;
|
||||
color = video::SColor(0xFFFFFFFF);
|
||||
animation.type = TAT_NONE;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
* @param dir direction to set cost for
|
||||
* @cost cost to set
|
||||
*/
|
||||
void setCost(v3s16 dir, PathCost cost);
|
||||
void setCost(v3s16 dir, const PathCost &cost);
|
||||
|
||||
bool valid; /**< node is on surface */
|
||||
bool target; /**< node is target position */
|
||||
@ -496,7 +496,7 @@ PathCost PathGridnode::getCost(v3s16 dir)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void PathGridnode::setCost(v3s16 dir, PathCost cost)
|
||||
void PathGridnode::setCost(v3s16 dir, const PathCost &cost)
|
||||
{
|
||||
if (dir.X > 0) {
|
||||
directions[DIR_XP] = cost;
|
||||
|
@ -408,7 +408,7 @@ bool setSystemPaths()
|
||||
#endif
|
||||
|
||||
for (std::list<std::string>::const_iterator
|
||||
i = trylist.begin(); i != trylist.end(); i++) {
|
||||
i = trylist.begin(); i != trylist.end(); ++i) {
|
||||
const std::string &trypath = *i;
|
||||
if (!fs::PathExists(trypath) ||
|
||||
!fs::PathExists(trypath + DIR_DELIM + "builtin")) {
|
||||
|
@ -100,7 +100,8 @@ void AsyncEngine::initialize(unsigned int numEngines)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned int AsyncEngine::queueAsyncJob(std::string func, std::string params)
|
||||
unsigned int AsyncEngine::queueAsyncJob(const std::string &func,
|
||||
const std::string ¶ms)
|
||||
{
|
||||
jobQueueMutex.lock();
|
||||
LuaJobInfo toAdd;
|
||||
@ -124,7 +125,6 @@ LuaJobInfo AsyncEngine::getJob()
|
||||
jobQueueMutex.lock();
|
||||
|
||||
LuaJobInfo retval;
|
||||
retval.valid = false;
|
||||
|
||||
if (!jobQueue.empty()) {
|
||||
retval = jobQueue.front();
|
||||
@ -137,7 +137,7 @@ LuaJobInfo AsyncEngine::getJob()
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void AsyncEngine::putJobResult(LuaJobInfo result)
|
||||
void AsyncEngine::putJobResult(const LuaJobInfo &result)
|
||||
{
|
||||
resultQueueMutex.lock();
|
||||
resultQueue.push_back(result);
|
||||
@ -264,7 +264,7 @@ void* AsyncWorkerThread::run()
|
||||
// Wait for job
|
||||
LuaJobInfo toProcess = jobDispatcher->getJob();
|
||||
|
||||
if (toProcess.valid == false || stopRequested()) {
|
||||
if (!toProcess.valid || stopRequested()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,16 @@ class AsyncEngine;
|
||||
// Declarations
|
||||
|
||||
// Data required to queue a job
|
||||
struct LuaJobInfo {
|
||||
struct LuaJobInfo
|
||||
{
|
||||
LuaJobInfo() :
|
||||
serializedFunction(""),
|
||||
serializedParams(""),
|
||||
serializedResult(""),
|
||||
id(0),
|
||||
valid(false)
|
||||
{}
|
||||
|
||||
// Function to be called in async environment
|
||||
std::string serializedFunction;
|
||||
// Parameter to be passed to function
|
||||
@ -89,7 +98,7 @@ public:
|
||||
* @param params Serialized parameters
|
||||
* @return jobid The job is queued
|
||||
*/
|
||||
unsigned int queueAsyncJob(std::string func, std::string params);
|
||||
unsigned int queueAsyncJob(const std::string &func, const std::string ¶ms);
|
||||
|
||||
/**
|
||||
* Engine step to process finished jobs
|
||||
@ -116,7 +125,7 @@ protected:
|
||||
* Put a Job result back to result queue
|
||||
* @param result result of completed job
|
||||
*/
|
||||
void putJobResult(LuaJobInfo result);
|
||||
void putJobResult(const LuaJobInfo &result);
|
||||
|
||||
/**
|
||||
* Initialize environment with current registred functions
|
||||
|
@ -77,13 +77,15 @@ void MainMenuScripting::initializeModApi(lua_State *L, int top)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void MainMenuScripting::step() {
|
||||
void MainMenuScripting::step()
|
||||
{
|
||||
asyncEngine.step(getStack());
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned int MainMenuScripting::queueAsync(std::string serialized_func,
|
||||
std::string serialized_param) {
|
||||
unsigned int MainMenuScripting::queueAsync(const std::string &serialized_func,
|
||||
const std::string &serialized_param)
|
||||
{
|
||||
return asyncEngine.queueAsyncJob(serialized_func, serialized_param);
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ public:
|
||||
void step();
|
||||
|
||||
// Pass async events from engine to async threads
|
||||
unsigned int queueAsync(std::string serialized_func,
|
||||
std::string serialized_params);
|
||||
unsigned int queueAsync(const std::string &serialized_func,
|
||||
const std::string &serialized_params);
|
||||
private:
|
||||
void initializeModApi(lua_State *L, int top);
|
||||
|
||||
|
12
src/sound.h
12
src/sound.h
@ -34,13 +34,15 @@ public:
|
||||
|
||||
struct SimpleSoundSpec
|
||||
{
|
||||
SimpleSoundSpec(const std::string &name = "", float gain = 1.0) :
|
||||
name(name),
|
||||
gain(gain)
|
||||
{}
|
||||
|
||||
bool exists() const { return name != ""; }
|
||||
|
||||
std::string name;
|
||||
float gain;
|
||||
SimpleSoundSpec(std::string name = "", float gain = 1.0) : name(name), gain(gain)
|
||||
{
|
||||
}
|
||||
bool exists() { return name != ""; }
|
||||
// Serialization intentionally left out
|
||||
};
|
||||
|
||||
class ISoundManager
|
||||
|
@ -232,7 +232,7 @@ inline std::vector<std::basic_string<T> > str_split(
|
||||
*/
|
||||
inline std::string lowercase(const std::string &str)
|
||||
{
|
||||
std::string s2;
|
||||
std::string s2 = "";
|
||||
|
||||
s2.reserve(str.size());
|
||||
|
||||
|
@ -29,9 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "container.h"
|
||||
|
||||
template<typename T>
|
||||
class MutexedVariable {
|
||||
class MutexedVariable
|
||||
{
|
||||
public:
|
||||
MutexedVariable(T value):
|
||||
MutexedVariable(const T &value):
|
||||
m_value(value)
|
||||
{}
|
||||
|
||||
@ -41,21 +42,14 @@ public:
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void set(T value)
|
||||
void set(const T &value)
|
||||
{
|
||||
MutexAutoLock lock(m_mutex);
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
// You'll want to grab this in a SharedPtr
|
||||
MutexAutoLock *getLock()
|
||||
{
|
||||
return new MutexAutoLock(m_mutex);
|
||||
}
|
||||
|
||||
// You pretty surely want to grab the lock when accessing this
|
||||
T m_value;
|
||||
|
||||
private:
|
||||
Mutex m_mutex;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user