aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/clientmedia.cpp14
-rw-r--r--src/clientmedia.h4
-rw-r--r--src/guiEngine.cpp4
-rw-r--r--src/guiEngine.h7
-rw-r--r--src/guiFormSpecMenu.h65
-rw-r--r--src/network/connection.cpp5
-rw-r--r--src/network/connection.h4
-rw-r--r--src/settings.h33
8 files changed, 59 insertions, 77 deletions
diff --git a/src/clientmedia.cpp b/src/clientmedia.cpp
index bca3f67c2..14a38ca66 100644
--- a/src/clientmedia.cpp
+++ b/src/clientmedia.cpp
@@ -42,12 +42,12 @@ static std::string getMediaCacheDir()
*/
ClientMediaDownloader::ClientMediaDownloader():
- m_media_cache(getMediaCacheDir())
+ m_media_cache(getMediaCacheDir()),
+ m_initial_step_done(false),
+ m_uncached_count(0),
+ m_uncached_received_count(0),
+ m_name_bound("")
{
- m_initial_step_done = false;
- m_name_bound = ""; // works because "" is an invalid file name
- m_uncached_count = 0;
- m_uncached_received_count = 0;
m_httpfetch_caller = HTTPFETCH_DISCARD;
m_httpfetch_active = 0;
m_httpfetch_active_limit = 0;
@@ -69,7 +69,7 @@ ClientMediaDownloader::~ClientMediaDownloader()
delete m_remotes[i];
}
-void ClientMediaDownloader::addFile(std::string name, std::string sha1)
+void ClientMediaDownloader::addFile(const std::string &name, const std::string &sha1)
{
assert(!m_initial_step_done); // pre-condition
@@ -104,7 +104,7 @@ void ClientMediaDownloader::addFile(std::string name, std::string sha1)
m_files.insert(std::make_pair(name, filestatus));
}
-void ClientMediaDownloader::addRemoteServer(std::string baseurl)
+void ClientMediaDownloader::addRemoteServer(const std::string &baseurl)
{
assert(!m_initial_step_done); // pre-condition
diff --git a/src/clientmedia.h b/src/clientmedia.h
index 1f0da70d9..e292be5ea 100644
--- a/src/clientmedia.h
+++ b/src/clientmedia.h
@@ -58,10 +58,10 @@ public:
}
// Add a file to the list of required file (but don't fetch it yet)
- void addFile(std::string name, std::string sha1);
+ void addFile(const std::string &name, const std::string &sha1);
// Add a remote server to the list; ignored if not built with cURL
- void addRemoteServer(std::string baseurl);
+ void addRemoteServer(const std::string &baseurl);
// Steps the media downloader:
// - May load media into client by calling client->loadMedia()
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp
index e0ee00ad6..ebc4aac44 100644
--- a/src/guiEngine.cpp
+++ b/src/guiEngine.cpp
@@ -60,7 +60,7 @@ void TextDestGuiEngine::gotText(const StringMap &fields)
}
/******************************************************************************/
-void TextDestGuiEngine::gotText(std::wstring text)
+void TextDestGuiEngine::gotText(const std::wstring &text)
{
m_engine->getScriptIface()->handleMainMenuEvent(wide_to_utf8(text));
}
@@ -540,7 +540,7 @@ bool GUIEngine::setTexture(texture_layer layer, std::string texturepath,
}
/******************************************************************************/
-bool GUIEngine::downloadFile(std::string url, std::string target)
+bool GUIEngine::downloadFile(const std::string &url, const std::string &target)
{
#if USE_CURL
std::ofstream target_file(target.c_str(), std::ios::out | std::ios::binary);
diff --git a/src/guiEngine.h b/src/guiEngine.h
index 98e88574c..e7e5ca05d 100644
--- a/src/guiEngine.h
+++ b/src/guiEngine.h
@@ -80,7 +80,7 @@ public:
* receive text/events transmitted by guiFormSpecMenu
* @param text textual representation of event
*/
- void gotText(std::wstring text);
+ void gotText(const std::wstring &text);
private:
/** target to transmit data to */
@@ -260,14 +260,11 @@ private:
* @param url url to download
* @param target file to store to
*/
- static bool downloadFile(std::string url,std::string target);
+ static bool downloadFile(const std::string &url, const std::string &target);
/** array containing pointers to current specified texture layers */
image_definition m_textures[TEX_LAYER_MAX];
- /** draw version string in topleft corner */
- void drawVersion();
-
/**
* specify text to appear as top left string
* @param text to set
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h
index 4bc2448d8..ec122b617 100644
--- a/src/guiFormSpecMenu.h
+++ b/src/guiFormSpecMenu.h
@@ -78,22 +78,19 @@ class GUIFormSpecMenu : public GUIModalMenu
{
struct ItemSpec
{
- ItemSpec()
- {
- i = -1;
- }
+ ItemSpec() :
+ i(-1)
+ {}
+
ItemSpec(const InventoryLocation &a_inventoryloc,
const std::string &a_listname,
- s32 a_i)
- {
- inventoryloc = a_inventoryloc;
- listname = a_listname;
- i = a_i;
- }
- bool isValid() const
- {
- return i != -1;
- }
+ s32 a_i) :
+ inventoryloc(a_inventoryloc),
+ listname(a_listname),
+ i(a_i)
+ {}
+
+ bool isValid() const { return i != -1; }
InventoryLocation inventoryloc;
std::string listname;
@@ -208,14 +205,13 @@ class GUIFormSpecMenu : public GUIModalMenu
const std::wstring &default_text, int id) :
fname(name),
flabel(label),
+ fdefault(unescape_enriched(default_text)),
fid(id),
send(false),
ftype(f_Unknown),
is_exit(false)
- {
- //flabel = unescape_enriched(label);
- fdefault = unescape_enriched(default_text);
- }
+ {}
+
std::string fname;
std::wstring flabel;
std::wstring fdefault;
@@ -239,17 +235,14 @@ class GUIFormSpecMenu : public GUIModalMenu
};
struct TooltipSpec {
- TooltipSpec()
- {
- }
+ TooltipSpec() {}
TooltipSpec(std::string a_tooltip, irr::video::SColor a_bgcolor,
irr::video::SColor a_color):
+ tooltip(utf8_to_wide(a_tooltip)),
bgcolor(a_bgcolor),
color(a_color)
- {
- //tooltip = unescape_enriched(utf8_to_wide(a_tooltip));
- tooltip = utf8_to_wide(a_tooltip);
- }
+ {}
+
std::wstring tooltip;
irr::video::SColor bgcolor;
irr::video::SColor color;
@@ -271,12 +264,11 @@ class GUIFormSpecMenu : public GUIModalMenu
StaticTextSpec(const std::wstring &a_text,
const core::rect<s32> &a_rect,
gui::IGUIButton *a_parent_button):
+ text(a_text),
rect(a_rect),
parent_button(a_parent_button)
- {
- //text = unescape_enriched(a_text);
- text = a_text;
- }
+ {}
+
std::wstring text;
core::rect<s32> rect;
gui::IGUIButton *parent_button;
@@ -550,22 +542,19 @@ private:
class FormspecFormSource: public IFormSource
{
public:
- FormspecFormSource(const std::string &formspec)
- {
- m_formspec = formspec;
- }
+ FormspecFormSource(const std::string &formspec):
+ m_formspec(formspec)
+ {}
~FormspecFormSource()
{}
- void setForm(const std::string &formspec) {
+ void setForm(const std::string &formspec)
+ {
m_formspec = FORMSPEC_VERSION_STRING + formspec;
}
- std::string getForm()
- {
- return m_formspec;
- }
+ std::string getForm() { return m_formspec; }
std::string m_formspec;
};
diff --git a/src/network/connection.cpp b/src/network/connection.cpp
index e11b4a953..f9a4821a6 100644
--- a/src/network/connection.cpp
+++ b/src/network/connection.cpp
@@ -930,7 +930,7 @@ void Peer::DecUseCount()
delete this;
}
-void Peer::RTTStatistics(float rtt, std::string profiler_id,
+void Peer::RTTStatistics(float rtt, const std::string &profiler_id,
unsigned int num_samples) {
if (m_last_rtt > 0) {
@@ -969,8 +969,7 @@ void Peer::RTTStatistics(float rtt, std::string profiler_id,
m_rtt.jitter_avg = m_rtt.jitter_avg * (num_samples/(num_samples-1)) +
jitter * (1/num_samples);
- if (profiler_id != "")
- {
+ if (profiler_id != "") {
g_profiler->graphAdd(profiler_id + "_rtt", rtt);
g_profiler->graphAdd(profiler_id + "_jitter", jitter);
}
diff --git a/src/network/connection.h b/src/network/connection.h
index 7ba0d086e..dc86d2293 100644
--- a/src/network/connection.h
+++ b/src/network/connection.h
@@ -732,8 +732,8 @@ class Peer {
virtual void reportRTT(float rtt) {};
void RTTStatistics(float rtt,
- std::string profiler_id="",
- unsigned int num_samples=1000);
+ const std::string &profiler_id = "",
+ unsigned int num_samples = 1000);
bool IncUseCount();
void DecUseCount();
diff --git a/src/settings.h b/src/settings.h
index 777d0eff5..8c4f6e559 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -74,24 +74,21 @@ struct ValueSpec {
};
struct SettingsEntry {
- SettingsEntry()
- {
- group = NULL;
- is_group = false;
- }
-
- SettingsEntry(const std::string &value_)
- {
- value = value_;
- group = NULL;
- is_group = false;
- }
-
- SettingsEntry(Settings *group_)
- {
- group = group_;
- is_group = true;
- }
+ SettingsEntry() :
+ group(NULL),
+ is_group(false)
+ {}
+
+ SettingsEntry(const std::string &value_) :
+ value(value_),
+ group(NULL),
+ is_group(false)
+ {}
+
+ SettingsEntry(Settings *group_) :
+ group(group_),
+ is_group(true)
+ {}
std::string value;
Settings *group;