Performance fixes.
parent
5d08ada224
commit
0fd1ee0380
|
@ -372,7 +372,7 @@ void ReliablePacketBuffer::insert(BufferedPacket &p,u16 next_expected)
|
||||||
fprintf(stderr, "Old: seqnum: %05d size: %04d, address: %s\n",
|
fprintf(stderr, "Old: seqnum: %05d size: %04d, address: %s\n",
|
||||||
readU16(&(i->data[BASE_HEADER_SIZE+1])),i->data.getSize(),
|
readU16(&(i->data[BASE_HEADER_SIZE+1])),i->data.getSize(),
|
||||||
i->address.serializeString().c_str());
|
i->address.serializeString().c_str());
|
||||||
fprintf(stderr, "New: seqnum: %05d size: %04d, address: %s\n",
|
fprintf(stderr, "New: seqnum: %05d size: %04u, address: %s\n",
|
||||||
readU16(&(p.data[BASE_HEADER_SIZE+1])),p.data.getSize(),
|
readU16(&(p.data[BASE_HEADER_SIZE+1])),p.data.getSize(),
|
||||||
p.address.serializeString().c_str());
|
p.address.serializeString().c_str());
|
||||||
throw IncomingDataCorruption("duplicated packet isn't same as original one");
|
throw IncomingDataCorruption("duplicated packet isn't same as original one");
|
||||||
|
|
|
@ -130,7 +130,7 @@ void assert_fail(const char *assertion, const char *file,
|
||||||
unsigned int line, const char *function)
|
unsigned int line, const char *function)
|
||||||
{
|
{
|
||||||
DEBUGPRINT("\nIn thread %lx:\n"
|
DEBUGPRINT("\nIn thread %lx:\n"
|
||||||
"%s:%d: %s: Assertion '%s' failed.\n",
|
"%s:%u: %s: Assertion '%s' failed.\n",
|
||||||
(unsigned long)get_current_thread_id(),
|
(unsigned long)get_current_thread_id(),
|
||||||
file, line, function, assertion);
|
file, line, function, assertion);
|
||||||
|
|
||||||
|
|
|
@ -374,7 +374,7 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
|
||||||
if (selected == "true")
|
if (selected == "true")
|
||||||
fselected = true;
|
fselected = true;
|
||||||
|
|
||||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
std::wstring wlabel = narrow_to_wide(label);
|
||||||
|
|
||||||
core::rect<s32> rect = core::rect<s32>(
|
core::rect<s32> rect = core::rect<s32>(
|
||||||
pos.X, pos.Y + ((imgsize.Y/2) - m_btn_height),
|
pos.X, pos.Y + ((imgsize.Y/2) - m_btn_height),
|
||||||
|
@ -382,7 +382,7 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
|
||||||
pos.Y + ((imgsize.Y/2) + m_btn_height));
|
pos.Y + ((imgsize.Y/2) + m_btn_height));
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
wlabel, //Needed for displaying text on MSVC
|
wlabel, //Needed for displaying text on MSVC
|
||||||
wlabel,
|
wlabel,
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
|
@ -434,7 +434,7 @@ void GUIFormSpecMenu::parseScrollBar(parserData* data, std::string element)
|
||||||
core::rect<s32>(pos.X, pos.Y, pos.X + dim.X, pos.Y + dim.Y);
|
core::rect<s32>(pos.X, pos.Y, pos.X + dim.X, pos.Y + dim.Y);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
L"",
|
L"",
|
||||||
L"",
|
L"",
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
|
@ -572,10 +572,10 @@ void GUIFormSpecMenu::parseButton(parserData* data,std::string element,
|
||||||
|
|
||||||
label = unescape_string(label);
|
label = unescape_string(label);
|
||||||
|
|
||||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
std::wstring wlabel = narrow_to_wide(label);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
wlabel,
|
wlabel,
|
||||||
L"",
|
L"",
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
|
@ -697,7 +697,7 @@ void GUIFormSpecMenu::parseTable(parserData* data,std::string element)
|
||||||
|
|
||||||
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
|
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
|
||||||
|
|
||||||
std::wstring fname_w = narrow_to_wide(name.c_str());
|
std::wstring fname_w = narrow_to_wide(name);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
fname_w,
|
fname_w,
|
||||||
|
@ -771,7 +771,7 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element)
|
||||||
|
|
||||||
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
|
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
|
||||||
|
|
||||||
std::wstring fname_w = narrow_to_wide(name.c_str());
|
std::wstring fname_w = narrow_to_wide(name);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
fname_w,
|
fname_w,
|
||||||
|
@ -836,7 +836,7 @@ void GUIFormSpecMenu::parseDropDown(parserData* data,std::string element)
|
||||||
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y,
|
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y,
|
||||||
pos.X + width, pos.Y + (m_btn_height * 2));
|
pos.X + width, pos.Y + (m_btn_height * 2));
|
||||||
|
|
||||||
std::wstring fname_w = narrow_to_wide(name.c_str());
|
std::wstring fname_w = narrow_to_wide(name);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
fname_w,
|
fname_w,
|
||||||
|
@ -899,10 +899,10 @@ void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element)
|
||||||
|
|
||||||
label = unescape_string(label);
|
label = unescape_string(label);
|
||||||
|
|
||||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
std::wstring wlabel = narrow_to_wide(label);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
wlabel,
|
wlabel,
|
||||||
L"",
|
L"",
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
|
@ -965,12 +965,12 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,
|
||||||
default_val = unescape_string(default_val);
|
default_val = unescape_string(default_val);
|
||||||
label = unescape_string(label);
|
label = unescape_string(label);
|
||||||
|
|
||||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
std::wstring wlabel = narrow_to_wide(label);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
wlabel,
|
wlabel,
|
||||||
narrow_to_wide(default_val.c_str()),
|
narrow_to_wide(default_val),
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1055,12 +1055,12 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,
|
||||||
default_val = unescape_string(default_val);
|
default_val = unescape_string(default_val);
|
||||||
label = unescape_string(label);
|
label = unescape_string(label);
|
||||||
|
|
||||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
std::wstring wlabel = narrow_to_wide(label);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
wlabel,
|
wlabel,
|
||||||
narrow_to_wide(default_val.c_str()),
|
narrow_to_wide(default_val),
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1158,7 +1158,7 @@ void GUIFormSpecMenu::parseLabel(parserData* data,std::string element)
|
||||||
// in the integer cases: 0.4 is not exactly
|
// in the integer cases: 0.4 is not exactly
|
||||||
// representable in binary floating point.
|
// representable in binary floating point.
|
||||||
s32 posy = pos.Y + ((float)i) * spacing.Y * 2.0 / 5.0;
|
s32 posy = pos.Y + ((float)i) * spacing.Y * 2.0 / 5.0;
|
||||||
std::wstring wlabel = narrow_to_wide(lines[i].c_str());
|
std::wstring wlabel = narrow_to_wide(lines[i]);
|
||||||
core::rect<s32> rect = core::rect<s32>(
|
core::rect<s32> rect = core::rect<s32>(
|
||||||
pos.X, posy - m_btn_height,
|
pos.X, posy - m_btn_height,
|
||||||
pos.X + m_font->getDimension(wlabel.c_str()).Width,
|
pos.X + m_font->getDimension(wlabel.c_str()).Width,
|
||||||
|
@ -1279,12 +1279,12 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,
|
||||||
pressed_image_name = unescape_string(pressed_image_name);
|
pressed_image_name = unescape_string(pressed_image_name);
|
||||||
label = unescape_string(label);
|
label = unescape_string(label);
|
||||||
|
|
||||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
std::wstring wlabel = narrow_to_wide(label);
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
wlabel,
|
wlabel,
|
||||||
narrow_to_wide(image_name.c_str()),
|
narrow_to_wide(image_name),
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
);
|
);
|
||||||
spec.ftype = f_Button;
|
spec.ftype = f_Button;
|
||||||
|
@ -1344,7 +1344,7 @@ void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element)
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
L"",
|
L"",
|
||||||
L"",
|
L"",
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
|
@ -1431,16 +1431,16 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
|
||||||
item.deSerialize(item_name, idef);
|
item.deSerialize(item_name, idef);
|
||||||
video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
|
video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
|
||||||
|
|
||||||
m_tooltips[narrow_to_wide(name.c_str())] =
|
m_tooltips[narrow_to_wide(name)] =
|
||||||
TooltipSpec (item.getDefinition(idef).description,
|
TooltipSpec (item.getDefinition(idef).description,
|
||||||
m_default_tooltip_bgcolor,
|
m_default_tooltip_bgcolor,
|
||||||
m_default_tooltip_color);
|
m_default_tooltip_color);
|
||||||
|
|
||||||
label = unescape_string(label);
|
label = unescape_string(label);
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
narrow_to_wide(name.c_str()),
|
narrow_to_wide(name),
|
||||||
narrow_to_wide(label.c_str()),
|
narrow_to_wide(label),
|
||||||
narrow_to_wide(item_name.c_str()),
|
narrow_to_wide(item_name),
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1550,13 +1550,13 @@ void GUIFormSpecMenu::parseTooltip(parserData* data, std::string element)
|
||||||
std::vector<std::string> parts = split(element,';');
|
std::vector<std::string> parts = split(element,';');
|
||||||
if (parts.size() == 2) {
|
if (parts.size() == 2) {
|
||||||
std::string name = parts[0];
|
std::string name = parts[0];
|
||||||
m_tooltips[narrow_to_wide(name.c_str())] = TooltipSpec (parts[1], m_default_tooltip_bgcolor, m_default_tooltip_color);
|
m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], m_default_tooltip_bgcolor, m_default_tooltip_color);
|
||||||
return;
|
return;
|
||||||
} else if (parts.size() == 4) {
|
} else if (parts.size() == 4) {
|
||||||
std::string name = parts[0];
|
std::string name = parts[0];
|
||||||
video::SColor tmp_color1, tmp_color2;
|
video::SColor tmp_color1, tmp_color2;
|
||||||
if ( parseColorString(parts[2], tmp_color1, false) && parseColorString(parts[3], tmp_color2, false) ) {
|
if ( parseColorString(parts[2], tmp_color1, false) && parseColorString(parts[3], tmp_color2, false) ) {
|
||||||
m_tooltips[narrow_to_wide(name.c_str())] = TooltipSpec (parts[1], tmp_color1, tmp_color2);
|
m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], tmp_color1, tmp_color2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,9 +727,9 @@ void ICraftAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGam
|
||||||
ItemStack crafted;
|
ItemStack crafted;
|
||||||
ItemStack craftresultitem;
|
ItemStack craftresultitem;
|
||||||
int count_remaining = count;
|
int count_remaining = count;
|
||||||
bool found = getCraftingResult(inv_craft, crafted, false, gamedef);
|
getCraftingResult(inv_craft, crafted, false, gamedef);
|
||||||
PLAYER_TO_SA(player)->item_CraftPredict(crafted, player, list_craft, craft_inv);
|
PLAYER_TO_SA(player)->item_CraftPredict(crafted, player, list_craft, craft_inv);
|
||||||
found = !crafted.empty();
|
bool found = !crafted.empty();
|
||||||
|
|
||||||
while(found && list_craftresult->itemFits(0, crafted))
|
while(found && list_craftresult->itemFits(0, crafted))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1871,7 +1871,6 @@ bool ClientLauncher::launch_game(std::wstring *error_message,
|
||||||
simple_singleplayer_mode = menudata.simple_singleplayer_mode;
|
simple_singleplayer_mode = menudata.simple_singleplayer_mode;
|
||||||
|
|
||||||
std::vector<WorldSpec> worldspecs = getAvailableWorlds();
|
std::vector<WorldSpec> worldspecs = getAvailableWorlds();
|
||||||
worldspecs = getAvailableWorlds();
|
|
||||||
|
|
||||||
if (menudata.selected_world >= 0
|
if (menudata.selected_world >= 0
|
||||||
&& menudata.selected_world < (int)worldspecs.size()) {
|
&& menudata.selected_world < (int)worldspecs.size()) {
|
||||||
|
|
|
@ -247,7 +247,7 @@ void* AsyncWorkerThread::Thread()
|
||||||
|
|
||||||
// Register thread for error logging
|
// Register thread for error logging
|
||||||
char number[21];
|
char number[21];
|
||||||
snprintf(number, sizeof(number), "%d", threadnum);
|
snprintf(number, sizeof(number), "%u", threadnum);
|
||||||
log_register_thread(std::string("AsyncWorkerThread_") + number);
|
log_register_thread(std::string("AsyncWorkerThread_") + number);
|
||||||
|
|
||||||
porting::setThreadName((std::string("AsyncWorkTh_") + number).c_str());
|
porting::setThreadName((std::string("AsyncWorkTh_") + number).c_str());
|
||||||
|
|
|
@ -1508,7 +1508,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
||||||
<<"tried to connect from "<<addr_s<<" "
|
<<"tried to connect from "<<addr_s<<" "
|
||||||
<<"but it was disallowed for the following reason: "
|
<<"but it was disallowed for the following reason: "
|
||||||
<<reason<<std::endl;
|
<<reason<<std::endl;
|
||||||
DenyAccess(peer_id, narrow_to_wide(reason.c_str()));
|
DenyAccess(peer_id, narrow_to_wide(reason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ public:
|
||||||
|
|
||||||
// Try to use local texture instead if asked to
|
// Try to use local texture instead if asked to
|
||||||
if(prefer_local){
|
if(prefer_local){
|
||||||
std::string path = getTexturePath(name.c_str());
|
std::string path = getTexturePath(name);
|
||||||
if(path != ""){
|
if(path != ""){
|
||||||
video::IImage *img2 = driver->createImageFromFile(path.c_str());
|
video::IImage *img2 = driver->createImageFromFile(path.c_str());
|
||||||
if(img2){
|
if(img2){
|
||||||
|
@ -245,7 +245,7 @@ public:
|
||||||
return n->second;
|
return n->second;
|
||||||
}
|
}
|
||||||
video::IVideoDriver* driver = device->getVideoDriver();
|
video::IVideoDriver* driver = device->getVideoDriver();
|
||||||
std::string path = getTexturePath(name.c_str());
|
std::string path = getTexturePath(name);
|
||||||
if(path == ""){
|
if(path == ""){
|
||||||
infostream<<"SourceImageCache::getOrLoad(): No path found for \""
|
infostream<<"SourceImageCache::getOrLoad(): No path found for \""
|
||||||
<<name<<"\""<<std::endl;
|
<<name<<"\""<<std::endl;
|
||||||
|
|
Loading…
Reference in New Issue