*/
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;
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
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
}
// 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()
}
/******************************************************************************/
-void TextDestGuiEngine::gotText(std::wstring text)
+void TextDestGuiEngine::gotText(const std::wstring &text)
{
m_engine->getScriptIface()->handleMainMenuEvent(wide_to_utf8(text));
}
}
/******************************************************************************/
-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);
* 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 */
* @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
{
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;
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;
};
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;
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;
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;
};
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) {
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);
}
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();
};
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;