mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-17 12:08:25 +00:00
refactor: unglob std::wstring
This commit is contained in:
@@ -2,18 +2,18 @@
|
||||
#include "Button.h"
|
||||
#include "../Textures/Textures.h"
|
||||
|
||||
Button::Button(int id, int x, int y, const wstring& msg)
|
||||
Button::Button(int id, int x, int y, const std::wstring& msg)
|
||||
{
|
||||
init(id, x, y, 200, 20, msg);
|
||||
}
|
||||
|
||||
Button::Button(int id, int x, int y, int w, int h, const wstring& msg)
|
||||
Button::Button(int id, int x, int y, int w, int h, const std::wstring& msg)
|
||||
{
|
||||
init(id, x, y, w, h, msg);
|
||||
}
|
||||
|
||||
// 4J - added
|
||||
void Button::init(int id, int x, int y, int w, int h, const wstring& msg)
|
||||
void Button::init(int id, int x, int y, int w, int h, const std::wstring& msg)
|
||||
{
|
||||
active = true;
|
||||
visible = true;
|
||||
|
||||
@@ -9,14 +9,14 @@ protected:
|
||||
int h;
|
||||
public:
|
||||
int x, y;
|
||||
wstring msg;
|
||||
std::wstring msg;
|
||||
int id;
|
||||
bool active;
|
||||
bool visible;
|
||||
|
||||
Button(int id, int x, int y, const wstring& msg);
|
||||
Button(int id, int x, int y, int w, int h, const wstring& msg);
|
||||
void init(int id, int x, int y, int w, int h, const wstring& msg); // 4J - added
|
||||
Button(int id, int x, int y, const std::wstring& msg);
|
||||
Button(int id, int x, int y, int w, int h, const std::wstring& msg);
|
||||
void init(int id, int x, int y, int w, int h, const std::wstring& msg); // 4J - added
|
||||
protected:
|
||||
virtual int getYImage(bool hovered);
|
||||
public:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "EditBox.h"
|
||||
#include "../../Minecraft.World/Util/SharedConstants.h"
|
||||
|
||||
EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const wstring& value)
|
||||
EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const std::wstring& value)
|
||||
{
|
||||
// 4J - added initialisers
|
||||
maxLength = 0;
|
||||
@@ -17,12 +17,12 @@ EditBox::EditBox(Screen *screen, Font *font, int x, int y, int width, int height
|
||||
this->setValue(value);
|
||||
}
|
||||
|
||||
void EditBox::setValue(const wstring& value)
|
||||
void EditBox::setValue(const std::wstring& value)
|
||||
{
|
||||
this->value = value;
|
||||
}
|
||||
|
||||
wstring EditBox::getValue()
|
||||
std::wstring EditBox::getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void EditBox::keyPressed(wchar_t ch, int eventKey)
|
||||
{
|
||||
value = value.substr(0, value.length() - 1);
|
||||
}
|
||||
if (SharedConstants::acceptableLetters.find(ch) != wstring::npos && (value.length() < maxLength || maxLength == 0))
|
||||
if (SharedConstants::acceptableLetters.find(ch) != std::wstring::npos && (value.length() < maxLength || maxLength == 0))
|
||||
{
|
||||
value += ch;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ private:
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
wstring value;
|
||||
std::wstring value;
|
||||
unsigned int maxLength;
|
||||
int frame;
|
||||
|
||||
@@ -23,9 +23,9 @@ private:
|
||||
Screen *screen;
|
||||
|
||||
public:
|
||||
EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const wstring& value);
|
||||
void setValue(const wstring& value);
|
||||
wstring getValue();
|
||||
EditBox(Screen *screen, Font *font, int x, int y, int width, int height, const std::wstring& value);
|
||||
void setValue(const std::wstring& value);
|
||||
std::wstring getValue();
|
||||
void tick();
|
||||
void keyPressed(wchar_t ch, int eventKey);
|
||||
void mouseClicked(int mouseX, int mouseY, int buttonNum);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
#include "../../Minecraft.World/Util/Random.h"
|
||||
|
||||
Font::Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[]/* = nullptr */) : textures(textures)
|
||||
Font::Font(Options *options, const std::wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[]/* = nullptr */) : textures(textures)
|
||||
{
|
||||
int charC = cols * rows; // Number of characters in the font
|
||||
|
||||
@@ -169,36 +169,36 @@ void Font::renderCharacter(wchar_t c)
|
||||
xPos += (float) charWidths[c];
|
||||
}
|
||||
|
||||
void Font::drawShadow(const wstring& str, int x, int y, int color)
|
||||
void Font::drawShadow(const std::wstring& str, int x, int y, int color)
|
||||
{
|
||||
draw(str, x + 1, y + 1, color, true);
|
||||
draw(str, x, y, color, false);
|
||||
}
|
||||
|
||||
void Font::drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h)
|
||||
void Font::drawShadowWordWrap(const std::wstring &str, int x, int y, int w, int color, int h)
|
||||
{
|
||||
drawWordWrapInternal(str, x + 1, y + 1, w, color, true, h);
|
||||
drawWordWrapInternal(str, x, y, w, color, h);
|
||||
}
|
||||
|
||||
void Font::draw(const wstring& str, int x, int y, int color)
|
||||
void Font::draw(const std::wstring& str, int x, int y, int color)
|
||||
{
|
||||
draw(str, x, y, color, false);
|
||||
}
|
||||
|
||||
wstring Font::reorderBidi(const wstring &str)
|
||||
std::wstring Font::reorderBidi(const std::wstring &str)
|
||||
{
|
||||
// 4J Not implemented
|
||||
return str;
|
||||
}
|
||||
|
||||
void Font::draw(const wstring &str, bool dropShadow)
|
||||
void Font::draw(const std::wstring &str, bool dropShadow)
|
||||
{
|
||||
// Bind the texture
|
||||
textures->bindTexture(m_textureName);
|
||||
|
||||
bool noise = false;
|
||||
wstring cleanStr = sanitize(str);
|
||||
std::wstring cleanStr = sanitize(str);
|
||||
|
||||
for (int i = 0; i < (int)cleanStr.length(); ++i)
|
||||
{
|
||||
@@ -250,7 +250,7 @@ void Font::draw(const wstring &str, bool dropShadow)
|
||||
}
|
||||
}
|
||||
|
||||
void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow)
|
||||
void Font::draw(const std::wstring& str, int x, int y, int color, bool dropShadow)
|
||||
{
|
||||
if (!str.empty())
|
||||
{
|
||||
@@ -268,9 +268,9 @@ void Font::draw(const wstring& str, int x, int y, int color, bool dropShadow)
|
||||
}
|
||||
}
|
||||
|
||||
int Font::width(const wstring& str)
|
||||
int Font::width(const std::wstring& str)
|
||||
{
|
||||
wstring cleanStr = sanitize(str);
|
||||
std::wstring cleanStr = sanitize(str);
|
||||
|
||||
if (cleanStr == L"") return 0; // 4J - was NULL comparison
|
||||
int len = 0;
|
||||
@@ -293,9 +293,9 @@ int Font::width(const wstring& str)
|
||||
return len;
|
||||
}
|
||||
|
||||
wstring Font::sanitize(const wstring& str)
|
||||
std::wstring Font::sanitize(const std::wstring& str)
|
||||
{
|
||||
wstring sb = str;
|
||||
std::wstring sb = str;
|
||||
|
||||
for (unsigned int i = 0; i < sb.length(); i++)
|
||||
{
|
||||
@@ -337,7 +337,7 @@ bool Font::CharacterExists(wchar_t c)
|
||||
}
|
||||
}
|
||||
|
||||
void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, int h)
|
||||
void Font::drawWordWrap(const std::wstring &string, int x, int y, int w, int col, int h)
|
||||
{
|
||||
//if (bidirectional)
|
||||
//{
|
||||
@@ -346,12 +346,12 @@ void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, int
|
||||
drawWordWrapInternal(string, x, y, w, col, h);
|
||||
}
|
||||
|
||||
void Font::drawWordWrapInternal(const wstring &string, int x, int y, int w, int col, int h)
|
||||
void Font::drawWordWrapInternal(const std::wstring &string, int x, int y, int w, int col, int h)
|
||||
{
|
||||
drawWordWrapInternal(string, x, y, w, col, false, h);
|
||||
}
|
||||
|
||||
void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, bool darken, int h)
|
||||
void Font::drawWordWrap(const std::wstring &string, int x, int y, int w, int col, bool darken, int h)
|
||||
{
|
||||
//if (bidirectional)
|
||||
//{
|
||||
@@ -360,9 +360,9 @@ void Font::drawWordWrap(const wstring &string, int x, int y, int w, int col, boo
|
||||
drawWordWrapInternal(string, x, y, w, col, darken, h);
|
||||
}
|
||||
|
||||
void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int col, bool darken, int h)
|
||||
void Font::drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h)
|
||||
{
|
||||
vector<wstring>lines = stringSplit(string,L'\n');
|
||||
vector<std::wstring>lines = stringSplit(string,L'\n');
|
||||
if (lines.size() > 1)
|
||||
{
|
||||
AUTO_VAR(itEnd, lines.end());
|
||||
@@ -375,11 +375,11 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int
|
||||
}
|
||||
return;
|
||||
}
|
||||
vector<wstring> words = stringSplit(string,L' ');
|
||||
vector<std::wstring> words = stringSplit(string,L' ');
|
||||
unsigned int pos = 0;
|
||||
while (pos < words.size())
|
||||
{
|
||||
wstring line = words[pos++] + L" ";
|
||||
std::wstring line = words[pos++] + L" ";
|
||||
while (pos < words.size() && width(line + words[pos]) < w)
|
||||
{
|
||||
line += words[pos++] + L" ";
|
||||
@@ -411,9 +411,9 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int
|
||||
|
||||
}
|
||||
|
||||
int Font::wordWrapHeight(const wstring& string, int w)
|
||||
int Font::wordWrapHeight(const std::wstring& string, int w)
|
||||
{
|
||||
vector<wstring> lines = stringSplit(string,L'\n');
|
||||
vector<std::wstring> lines = stringSplit(string,L'\n');
|
||||
if (lines.size() > 1)
|
||||
{
|
||||
int h = 0;
|
||||
@@ -424,12 +424,12 @@ int Font::wordWrapHeight(const wstring& string, int w)
|
||||
}
|
||||
return h;
|
||||
}
|
||||
vector<wstring> words = stringSplit(string,L' ');
|
||||
vector<std::wstring> words = stringSplit(string,L' ');
|
||||
unsigned int pos = 0;
|
||||
int y = 0;
|
||||
while (pos < words.size())
|
||||
{
|
||||
wstring line = words[pos++] + L" ";
|
||||
std::wstring line = words[pos++] + L" ";
|
||||
while (pos < words.size() && width(line + words[pos]) < w)
|
||||
{
|
||||
line += words[pos++] + L" ";
|
||||
@@ -466,7 +466,7 @@ void Font::setBidirectional(bool bidirectional)
|
||||
this->bidirectional = bidirectional;
|
||||
}
|
||||
|
||||
bool Font::AllCharactersValid(const wstring &str)
|
||||
bool Font::AllCharactersValid(const std::wstring &str)
|
||||
{
|
||||
for (int i = 0; i < (int)str.length(); ++i)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
std::map<int, int> m_charMap;
|
||||
|
||||
public:
|
||||
Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL);
|
||||
Font(Options *options, const std::wstring& name, Textures* textures, bool enforceUnicode, TEXTURE_NAME textureName, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL);
|
||||
#ifndef _XBOX
|
||||
// 4J Stu - This dtor clashes with one in xui! We never delete these anyway so take it out for now. Can go back when we have got rid of XUI
|
||||
~Font();
|
||||
@@ -41,9 +41,9 @@ private:
|
||||
void renderCharacter(wchar_t c); // 4J added
|
||||
|
||||
public:
|
||||
void drawShadow(const wstring& str, int x, int y, int color);
|
||||
void drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h); // 4J Added h param
|
||||
void draw(const wstring &str, int x, int y, int color);
|
||||
void drawShadow(const std::wstring& str, int x, int y, int color);
|
||||
void drawShadowWordWrap(const std::wstring &str, int x, int y, int w, int color, int h); // 4J Added h param
|
||||
void draw(const std::wstring &str, int x, int y, int color);
|
||||
/**
|
||||
* Reorders the string according to bidirectional levels. A bit expensive at
|
||||
* the moment.
|
||||
@@ -52,32 +52,32 @@ public:
|
||||
* @return
|
||||
*/
|
||||
private:
|
||||
wstring reorderBidi(const wstring &str);
|
||||
std::wstring reorderBidi(const std::wstring &str);
|
||||
|
||||
void draw(const wstring &str, bool dropShadow);
|
||||
void draw(const wstring& str, int x, int y, int color, bool dropShadow);
|
||||
void draw(const std::wstring &str, bool dropShadow);
|
||||
void draw(const std::wstring& str, int x, int y, int color, bool dropShadow);
|
||||
int MapCharacter(wchar_t c); // 4J added
|
||||
bool CharacterExists(wchar_t c); // 4J added
|
||||
|
||||
public:
|
||||
int width(const wstring& str);
|
||||
wstring sanitize(const wstring& str);
|
||||
void drawWordWrap(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param
|
||||
int width(const std::wstring& str);
|
||||
std::wstring sanitize(const std::wstring& str);
|
||||
void drawWordWrap(const std::wstring &string, int x, int y, int w, int col, int h); // 4J Added h param
|
||||
|
||||
private:
|
||||
void drawWordWrapInternal(const wstring &string, int x, int y, int w, int col, int h); // 4J Added h param
|
||||
void drawWordWrapInternal(const std::wstring &string, int x, int y, int w, int col, int h); // 4J Added h param
|
||||
|
||||
public:
|
||||
void drawWordWrap(const wstring &string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param
|
||||
void drawWordWrap(const std::wstring &string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param
|
||||
|
||||
private:
|
||||
void drawWordWrapInternal(const wstring& string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param
|
||||
void drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h); // 4J Added h param
|
||||
|
||||
public:
|
||||
int wordWrapHeight(const wstring& string, int w);
|
||||
int wordWrapHeight(const std::wstring& string, int w);
|
||||
void setEnforceUnicodeSheet(bool enforceUnicodeSheet);
|
||||
void setBidirectional(bool bidirectional);
|
||||
|
||||
// 4J-PB - check for invalid player name - Japanese local name
|
||||
bool AllCharactersValid(const wstring &str);
|
||||
bool AllCharactersValid(const std::wstring &str);
|
||||
};
|
||||
|
||||
@@ -700,7 +700,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
wchar_t formatted[10];
|
||||
swprintf(formatted, 10, L"%d",minecraft->player->experienceLevel);
|
||||
|
||||
wstring str = formatted;
|
||||
std::wstring str = formatted;
|
||||
int x = iWidthOffset + (screenWidth - font->width(str)) / 2;
|
||||
int y = screenHeight - iSafezoneYHalf - iTooltipsYOffset;
|
||||
// If we're in creative mode, we don't need to offset the XP display so much
|
||||
@@ -795,7 +795,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
|
||||
if(minecraft->level->dimension->id==0)
|
||||
{
|
||||
wstring wfeature[eTerrainFeature_Count];
|
||||
std::wstring wfeature[eTerrainFeature_Count];
|
||||
|
||||
wfeature[eTerrainFeature_Stronghold] = L"Stronghold: ";
|
||||
wfeature[eTerrainFeature_Mineshaft] = L"Mineshaft: ";
|
||||
@@ -806,7 +806,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
{
|
||||
FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i];
|
||||
|
||||
wstring itemInfo = L"[" + _toString<int>( pFeatureData->x*16 ) + L", " + _toString<int>( pFeatureData->z*16 ) + L"] ";
|
||||
std::wstring itemInfo = L"[" + _toString<int>( pFeatureData->x*16 ) + L", " + _toString<int>( pFeatureData->z*16 ) + L"] ";
|
||||
wfeature[pFeatureData->eTerrainFeature] += itemInfo;
|
||||
}
|
||||
|
||||
@@ -940,7 +940,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
y+= iHeightOffset;
|
||||
}
|
||||
|
||||
wstring msg = guiMessages[iPad][i].string;
|
||||
std::wstring msg = guiMessages[iPad][i].string;
|
||||
// 4J-PB - fill the black bar across the whole screen, otherwise it looks odd due to the safe area
|
||||
this->fill(0, y - 1, screenWidth/fScaleFactorWidth, y + 8, (alpha / 2) << 24);
|
||||
glEnable(GL_BLEND);
|
||||
@@ -1050,7 +1050,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
// blit(xLeft, yo, 0, 79, progress, 5);
|
||||
// }
|
||||
//
|
||||
// wstring msg = L"Boss health - NON LOCALISED";
|
||||
// std::wstring msg = L"Boss health - NON LOCALISED";
|
||||
// font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10, 0xff00ff);
|
||||
// glColor4f(1, 1, 1, 1);
|
||||
// glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png"));
|
||||
@@ -1211,9 +1211,9 @@ void Gui::clearMessages(int iPad)
|
||||
}
|
||||
|
||||
|
||||
void Gui::addMessage(const wstring& _string,int iPad,bool bIsDeathMessage)
|
||||
void Gui::addMessage(const std::wstring& _string,int iPad,bool bIsDeathMessage)
|
||||
{
|
||||
wstring string = _string; // 4J - Take copy of input as it is const
|
||||
std::wstring string = _string; // 4J - Take copy of input as it is const
|
||||
//int iScale=1;
|
||||
|
||||
//if((minecraft->player->m_iScreenSection==C4JRender::VIEWPORT_TYPE_SPLIT_TOP) ||
|
||||
@@ -1374,7 +1374,7 @@ float Gui::getJukeboxOpacity(int iPad)
|
||||
return alpha;
|
||||
}
|
||||
|
||||
void Gui::setNowPlaying(const wstring& string)
|
||||
void Gui::setNowPlaying(const std::wstring& string)
|
||||
{
|
||||
// overlayMessageString = L"Now playing: " + string;
|
||||
overlayMessageString = app.GetString(IDS_NOWPLAYING) + string;
|
||||
@@ -1385,7 +1385,7 @@ void Gui::setNowPlaying(const wstring& string)
|
||||
void Gui::displayClientMessage(int messageId, int iPad)
|
||||
{
|
||||
//Language *language = Language::getInstance();
|
||||
wstring languageString = app.GetString(messageId);//language->getElement(messageId);
|
||||
std::wstring languageString = app.GetString(messageId);//language->getElement(messageId);
|
||||
|
||||
addMessage(languageString, iPad);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ private:
|
||||
|
||||
Minecraft *minecraft;
|
||||
public:
|
||||
wstring selectedName;
|
||||
std::wstring selectedName;
|
||||
private:
|
||||
int tickCount;
|
||||
wstring overlayMessageString;
|
||||
std::wstring overlayMessageString;
|
||||
int overlayMessageTime;
|
||||
bool animateOverlayMessageColor;
|
||||
|
||||
@@ -50,16 +50,16 @@ private:
|
||||
public:
|
||||
void tick();
|
||||
void clearMessages(int iPad=-1);
|
||||
void addMessage(const wstring& string, int iPad,bool bIsDeathMessage=false);
|
||||
void setNowPlaying(const wstring& string);
|
||||
void addMessage(const std::wstring& string, int iPad,bool bIsDeathMessage=false);
|
||||
void setNowPlaying(const std::wstring& string);
|
||||
void displayClientMessage(int messageId, int iPad);
|
||||
|
||||
// 4J Added
|
||||
DWORD getMessagesCount(int iPad) { return (int)guiMessages[iPad].size(); }
|
||||
wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; }
|
||||
std::wstring getMessage(int iPad, DWORD index) { return guiMessages[iPad].at(index).string; }
|
||||
float getOpacity(int iPad, DWORD index);
|
||||
|
||||
wstring getJukeboxMessage(int iPad) { return overlayMessageString; }
|
||||
std::wstring getJukeboxMessage(int iPad) { return overlayMessageString; }
|
||||
float getJukeboxOpacity(int iPad);
|
||||
|
||||
// 4J Added
|
||||
|
||||
@@ -95,12 +95,12 @@ GuiComponent::GuiComponent()
|
||||
blitOffset = 0;
|
||||
}
|
||||
|
||||
void GuiComponent::drawCenteredString(Font *font, const wstring& str, int x, int y, int color)
|
||||
void GuiComponent::drawCenteredString(Font *font, const std::wstring& str, int x, int y, int color)
|
||||
{
|
||||
font->drawShadow(str, x - (font->width(str)) / 2, y, color);
|
||||
}
|
||||
|
||||
void GuiComponent::drawString(Font *font, const wstring& str, int x, int y, int color)
|
||||
void GuiComponent::drawString(Font *font, const std::wstring& str, int x, int y, int color)
|
||||
{
|
||||
font->drawShadow(str, x, y, color);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ protected:
|
||||
void fillGradient(int x0, int y0, int x1, int y1, int col1, int col2);
|
||||
public:
|
||||
GuiComponent(); // 4J added
|
||||
void drawCenteredString(Font *font, const wstring& str, int x, int y, int color);
|
||||
void drawString(Font *font, const wstring& str, int x, int y, int color);
|
||||
void drawCenteredString(Font *font, const std::wstring& str, int x, int y, int color);
|
||||
void drawString(Font *font, const std::wstring& str, int x, int y, int color);
|
||||
void blit(int x, int y, int sx, int sy, int w, int h);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../Build/stdafx.h"
|
||||
#include "GuiMessage.h"
|
||||
|
||||
GuiMessage::GuiMessage(const wstring& string)
|
||||
GuiMessage::GuiMessage(const std::wstring& string)
|
||||
{
|
||||
this->string = string;
|
||||
ticks = 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ using namespace std;
|
||||
class GuiMessage
|
||||
{
|
||||
public:
|
||||
wstring string;
|
||||
std::wstring string;
|
||||
int ticks;
|
||||
GuiMessage(const wstring& string);
|
||||
GuiMessage(const std::wstring& string);
|
||||
};
|
||||
@@ -38,13 +38,13 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey)
|
||||
}
|
||||
}
|
||||
|
||||
wstring Screen::getClipboard()
|
||||
std::wstring Screen::getClipboard()
|
||||
{
|
||||
// 4J - removed
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Screen::setClipboard(const wstring& str)
|
||||
void Screen::setClipboard(const std::wstring& str)
|
||||
{
|
||||
// 4J - removed
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ public:
|
||||
protected:
|
||||
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
||||
public:
|
||||
static wstring getClipboard();
|
||||
static void setClipboard(const wstring& str);
|
||||
static std::wstring getClipboard();
|
||||
static void setClipboard(const std::wstring& str);
|
||||
private:
|
||||
Button *clickedButton;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||
if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem())
|
||||
{
|
||||
|
||||
wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
||||
std::wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
||||
|
||||
if (elementName.length() > 0)
|
||||
{
|
||||
|
||||
@@ -77,9 +77,9 @@ void AchievementPopup::render()
|
||||
Lighting::turnOff();
|
||||
prepareWindow();
|
||||
|
||||
wstring title = L"Minecraft " + SharedConstants::VERSION_STRING + L" Unlicensed Copy :(";
|
||||
wstring msg1 = L"(Or logged in from another location)";
|
||||
wstring msg2 = L"Purchase at minecraft.net";
|
||||
std::wstring title = L"Minecraft " + SharedConstants::VERSION_STRING + L" Unlicensed Copy :(";
|
||||
std::wstring msg1 = L"(Or logged in from another location)";
|
||||
std::wstring msg2 = L"Purchase at minecraft.net";
|
||||
|
||||
mc->font->drawShadow(title, 2, 2 + 9 * 0, 0xffffff);
|
||||
mc->font->drawShadow(msg1, 2, 2 + 9 * 1, 0xffffff);
|
||||
|
||||
@@ -10,8 +10,8 @@ private:
|
||||
Minecraft *mc;
|
||||
int width, height;
|
||||
|
||||
wstring title;
|
||||
wstring desc;
|
||||
std::wstring title;
|
||||
std::wstring desc;
|
||||
Achievement *ach;
|
||||
__int64 startTime;
|
||||
ItemRenderer *ir;
|
||||
|
||||
@@ -380,8 +380,8 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||
if (hoveredAchievement != NULL)
|
||||
{
|
||||
Achievement *ach = hoveredAchievement;
|
||||
wstring name = ach->name;
|
||||
wstring descr = ach->getDescription();
|
||||
std::wstring name = ach->name;
|
||||
std::wstring descr = ach->getDescription();
|
||||
|
||||
int x = xm + 12;
|
||||
int y = ym - 4;
|
||||
@@ -405,7 +405,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||
else
|
||||
{
|
||||
int width = Math::_max(font->width(name), 120);
|
||||
wstring msg = I18n::get(L"achievement.requires", ach->requires->name);
|
||||
std::wstring msg = I18n::get(L"achievement.requires", ach->requires->name);
|
||||
int height = font->wordWrapHeight(msg, width);
|
||||
fillGradient(x - 3, y - 3, x + width + 3, y + height + 12 + 3, 0xc0000000, 0xc0000000);
|
||||
font->drawWordWrap(msg, x, y + 12, width, 0xff705050);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "../../../Minecraft.World/Util/SharedConstants.h"
|
||||
#include "../../../Minecraft.World/Util/StringHelpers.h"
|
||||
|
||||
const wstring ChatScreen::allowedChars = SharedConstants::readAcceptableChars();
|
||||
const std::wstring ChatScreen::allowedChars = SharedConstants::readAcceptableChars();
|
||||
|
||||
ChatScreen::ChatScreen()
|
||||
{
|
||||
@@ -35,10 +35,10 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_RETURN)
|
||||
{
|
||||
wstring msg = trimString(message);
|
||||
std::wstring msg = trimString(message);
|
||||
if (msg.length() > 0)
|
||||
{
|
||||
wstring trim = trimString(message);
|
||||
std::wstring trim = trimString(message);
|
||||
if (!minecraft->handleClientSideCommand(trim))
|
||||
{
|
||||
minecraft->player->chat(trim);
|
||||
|
||||
@@ -5,7 +5,7 @@ using namespace std;
|
||||
class ChatScreen : public Screen
|
||||
{
|
||||
protected:
|
||||
wstring message;
|
||||
std::wstring message;
|
||||
private:
|
||||
int frame;
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
virtual void removed();
|
||||
virtual void tick();
|
||||
private:
|
||||
static const wstring allowedChars;
|
||||
static const std::wstring allowedChars;
|
||||
protected:
|
||||
void keyPressed(wchar_t ch, int eventKey);
|
||||
public:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../SmallButton.h"
|
||||
#include "../../../Minecraft.World/Headers/net.minecraft.locale.h"
|
||||
|
||||
ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, int id)
|
||||
ConfirmScreen::ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, int id)
|
||||
{
|
||||
this->parent = parent;
|
||||
this->title1 = title1;
|
||||
@@ -15,7 +15,7 @@ ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstrin
|
||||
noButton = language->getElement(L"gui.no");
|
||||
}
|
||||
|
||||
ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, const wstring& yesButton, const wstring& noButton, int id)
|
||||
ConfirmScreen::ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, const std::wstring& yesButton, const std::wstring& noButton, int id)
|
||||
{
|
||||
this->parent = parent;
|
||||
this->title1 = title1;
|
||||
|
||||
@@ -6,15 +6,15 @@ class ConfirmScreen : public Screen
|
||||
{
|
||||
private:
|
||||
Screen *parent;
|
||||
wstring title1;
|
||||
wstring title2;
|
||||
wstring yesButton;
|
||||
wstring noButton;
|
||||
std::wstring title1;
|
||||
std::wstring title2;
|
||||
std::wstring yesButton;
|
||||
std::wstring noButton;
|
||||
int id;
|
||||
|
||||
public:
|
||||
ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, int id);
|
||||
ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, const wstring& yesButton, const wstring& noButton, int id);
|
||||
ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, int id);
|
||||
ConfirmScreen(Screen *parent, const std::wstring& title1, const std::wstring& title2, const std::wstring& yesButton, const std::wstring& noButton, int id);
|
||||
virtual void init();
|
||||
protected:
|
||||
virtual void buttonClicked(Button *button);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "../../../Minecraft.World/Headers/net.minecraft.locale.h"
|
||||
|
||||
|
||||
ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port)
|
||||
ConnectScreen::ConnectScreen(Minecraft *minecraft, const std::wstring& ip, int port)
|
||||
{
|
||||
aborted = false;
|
||||
// System.out.println("Connecting to " + ip + ", " + port);
|
||||
|
||||
@@ -11,7 +11,7 @@ private:
|
||||
ClientConnection *connection;
|
||||
bool aborted;
|
||||
public:
|
||||
ConnectScreen(Minecraft *minecraft, const wstring& ip, int port);
|
||||
ConnectScreen(Minecraft *minecraft, const std::wstring& ip, int port);
|
||||
virtual void tick();
|
||||
protected:
|
||||
virtual void keyPressed(char eventCharacter, int eventKey);
|
||||
|
||||
@@ -8,7 +8,7 @@ class ControlsScreen : public Screen
|
||||
private:
|
||||
Screen *lastScreen;
|
||||
protected:
|
||||
wstring title;
|
||||
std::wstring title;
|
||||
private:
|
||||
Options *options;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void CreateWorldScreen::updateResultFolder()
|
||||
for( int i = 0; i < SharedConstants::ILLEGAL_FILE_CHARACTERS_LENGTH; i++ )
|
||||
{
|
||||
size_t pos;
|
||||
while( (pos = resultFolder.find(SharedConstants::ILLEGAL_FILE_CHARACTERS[i])) != wstring::npos)
|
||||
while( (pos = resultFolder.find(SharedConstants::ILLEGAL_FILE_CHARACTERS[i])) != std::wstring::npos)
|
||||
{
|
||||
resultFolder[pos] = L'_';
|
||||
}
|
||||
@@ -65,9 +65,9 @@ void CreateWorldScreen::updateResultFolder()
|
||||
|
||||
}
|
||||
|
||||
wstring CreateWorldScreen::findAvailableFolderName(LevelStorageSource *levelSource, const wstring& folder)
|
||||
std::wstring CreateWorldScreen::findAvailableFolderName(LevelStorageSource *levelSource, const std::wstring& folder)
|
||||
{
|
||||
wstring folder2 = folder; // 4J - copy input as it is const
|
||||
std::wstring folder2 = folder; // 4J - copy input as it is const
|
||||
|
||||
#if 0
|
||||
while (levelSource->getDataTagFor(folder2) != NULL)
|
||||
@@ -98,7 +98,7 @@ void CreateWorldScreen::buttonClicked(Button *button)
|
||||
done = true;
|
||||
|
||||
__int64 seedValue = (new Random())->nextLong();
|
||||
wstring seedString = seedEdit->getValue();
|
||||
std::wstring seedString = seedEdit->getValue();
|
||||
|
||||
if (seedString.length() != 0)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ private:
|
||||
Screen *lastScreen;
|
||||
EditBox *nameEdit;
|
||||
EditBox *seedEdit;
|
||||
wstring resultFolder;
|
||||
std::wstring resultFolder;
|
||||
bool done;
|
||||
|
||||
public:
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
private:
|
||||
void updateResultFolder();
|
||||
public:
|
||||
static wstring findAvailableFolderName(LevelStorageSource *levelSource, const wstring& folder);
|
||||
static std::wstring findAvailableFolderName(LevelStorageSource *levelSource, const std::wstring& folder);
|
||||
virtual void removed();
|
||||
protected:
|
||||
virtual void buttonClicked(Button *button);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "../Button.h"
|
||||
#include "../../../Minecraft.World/Headers/net.minecraft.locale.h"
|
||||
|
||||
DisconnectedScreen::DisconnectedScreen(const wstring& title, const wstring reason, void *reasonObjects, ...)
|
||||
DisconnectedScreen::DisconnectedScreen(const std::wstring& title, const std::wstring reason, void *reasonObjects, ...)
|
||||
{
|
||||
Language *language = Language::getInstance();
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ using namespace std;
|
||||
class DisconnectedScreen : public Screen
|
||||
{
|
||||
private:
|
||||
wstring title, reason;
|
||||
std::wstring title, reason;
|
||||
|
||||
public:
|
||||
DisconnectedScreen(const wstring& title, const wstring reason, void *reasonObjects, ...);
|
||||
DisconnectedScreen(const std::wstring& title, const std::wstring reason, void *reasonObjects, ...);
|
||||
virtual void tick();
|
||||
protected:
|
||||
using Screen::keyPressed;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../../Build/stdafx.h"
|
||||
#include "ErrorScreen.h"
|
||||
|
||||
ErrorScreen::ErrorScreen(const wstring& title, const wstring& message)
|
||||
ErrorScreen::ErrorScreen(const std::wstring& title, const std::wstring& message)
|
||||
{
|
||||
this->title = title;
|
||||
this->message = message;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
class ErrorScreen : public Screen
|
||||
{
|
||||
private:
|
||||
wstring title, message;
|
||||
std::wstring title, message;
|
||||
public:
|
||||
ErrorScreen(const wstring& title, const wstring& message);
|
||||
ErrorScreen(const std::wstring& title, const std::wstring& message);
|
||||
virtual void init();
|
||||
virtual void render(int xm, int ym, float a);
|
||||
protected:
|
||||
|
||||
@@ -28,7 +28,7 @@ void InBedChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
}
|
||||
else if (eventKey == Keyboard::KEY_RETURN)
|
||||
{
|
||||
wstring msg = trimString(message);
|
||||
std::wstring msg = trimString(message);
|
||||
if (msg.length() > 0)
|
||||
{
|
||||
minecraft->player->chat(trimString(message));
|
||||
|
||||
@@ -24,7 +24,7 @@ void JoinMultiplayerScreen::init()
|
||||
buttons.clear();
|
||||
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + 12, language->getElement(L"multiplayer.connect")));
|
||||
buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + 12, language->getElement(L"gui.cancel")));
|
||||
wstring ip = replaceAll(minecraft->options->lastMpIp,L"_", L":");
|
||||
std::wstring ip = replaceAll(minecraft->options->lastMpIp,L"_", L":");
|
||||
buttons[0]->active = ip.length() > 0;
|
||||
|
||||
ipEdit = new EditBox(this, font, width / 2 - 100, height / 4 - 10 + 50 + 18, 200, 20, ip);
|
||||
@@ -47,19 +47,19 @@ void JoinMultiplayerScreen::buttonClicked(Button *button)
|
||||
}
|
||||
else if (button->id == 0)
|
||||
{
|
||||
wstring ip = trimString(ipEdit->getValue());
|
||||
std::wstring ip = trimString(ipEdit->getValue());
|
||||
|
||||
minecraft->options->lastMpIp = replaceAll(ip,L":", L"_");
|
||||
minecraft->options->save();
|
||||
|
||||
vector<wstring> parts = stringSplit(ip,L'L');
|
||||
vector<std::wstring> parts = stringSplit(ip,L'L');
|
||||
if (ip[0]==L'[')
|
||||
{
|
||||
int pos = (int)ip.find(L"]");
|
||||
if (pos != wstring::npos)
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
wstring path = ip.substr(1, pos);
|
||||
wstring port = trimString(ip.substr(pos + 1));
|
||||
std::wstring path = ip.substr(1, pos);
|
||||
std::wstring port = trimString(ip.substr(pos + 1));
|
||||
if (port[0]==L':' && port.length() > 0)
|
||||
{
|
||||
port = port.substr(1);
|
||||
@@ -86,7 +86,7 @@ void JoinMultiplayerScreen::buttonClicked(Button *button)
|
||||
}
|
||||
}
|
||||
|
||||
int JoinMultiplayerScreen::parseInt(const wstring& str, int def)
|
||||
int JoinMultiplayerScreen::parseInt(const std::wstring& str, int def)
|
||||
{
|
||||
return _fromString<int>(str);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
protected:
|
||||
virtual void buttonClicked(Button *button);
|
||||
private:
|
||||
virtual int parseInt(const wstring& str, int def);
|
||||
virtual int parseInt(const std::wstring& str, int def);
|
||||
protected:
|
||||
virtual void keyPressed(wchar_t ch, int eventKey);
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include "../Button.h"
|
||||
#include "../../../Minecraft.World/Util/StringHelpers.h"
|
||||
|
||||
const wstring NameEntryScreen::allowedChars = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\"#%/()=+?[]{}<>";
|
||||
const std::wstring NameEntryScreen::allowedChars = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\"#%/()=+?[]{}<>";
|
||||
|
||||
NameEntryScreen::NameEntryScreen(Screen *lastScreen, const wstring& oldName, int slot)
|
||||
NameEntryScreen::NameEntryScreen(Screen *lastScreen, const std::wstring& oldName, int slot)
|
||||
{
|
||||
frame = 0; // 4J added
|
||||
|
||||
@@ -53,7 +53,7 @@ void NameEntryScreen::buttonClicked(Button button)
|
||||
void NameEntryScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
{
|
||||
if (eventKey == Keyboard::KEY_BACK && name.length() > 0) name = name.substr(0, name.length() - 1);
|
||||
if (allowedChars.find(ch) != wstring::npos && name.length()<64)
|
||||
if (allowedChars.find(ch) != std::wstring::npos && name.length()<64)
|
||||
{
|
||||
name += ch;
|
||||
}
|
||||
|
||||
@@ -6,20 +6,20 @@ class NameEntryScreen : public Screen
|
||||
private:
|
||||
Screen *lastScreen;
|
||||
protected:
|
||||
wstring title;
|
||||
std::wstring title;
|
||||
private:
|
||||
int slot;
|
||||
wstring name;
|
||||
std::wstring name;
|
||||
int frame;
|
||||
public:
|
||||
NameEntryScreen(Screen *lastScreen, const wstring& oldName, int slot);
|
||||
NameEntryScreen(Screen *lastScreen, const std::wstring& oldName, int slot);
|
||||
virtual void init();
|
||||
virtual void removed();
|
||||
virtual void tick();
|
||||
protected:
|
||||
virtual void buttonClicked(Button button);
|
||||
private:
|
||||
static const wstring allowedChars;
|
||||
static const std::wstring allowedChars;
|
||||
protected:
|
||||
virtual void keyPressed(wchar_t ch, int eventKey);
|
||||
public:
|
||||
|
||||
@@ -10,7 +10,7 @@ private:
|
||||
static const int VIDEO_BUTTON_ID = 101;
|
||||
Screen *lastScreen;
|
||||
protected:
|
||||
wstring title;
|
||||
std::wstring title;
|
||||
private:
|
||||
Options *options;
|
||||
public:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.h"
|
||||
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.storage.h"
|
||||
|
||||
RenameWorldScreen::RenameWorldScreen(Screen *lastScreen, const wstring& levelId)
|
||||
RenameWorldScreen::RenameWorldScreen(Screen *lastScreen, const std::wstring& levelId)
|
||||
{
|
||||
nameEdit = NULL;
|
||||
this->lastScreen = lastScreen;
|
||||
@@ -31,7 +31,7 @@ void RenameWorldScreen::init()
|
||||
|
||||
LevelStorageSource *levelSource = minecraft->getLevelSource();
|
||||
LevelData *levelData = levelSource->getDataTagFor(levelId);
|
||||
wstring currentName = levelData->getLevelName();
|
||||
std::wstring currentName = levelData->getLevelName();
|
||||
|
||||
nameEdit = new EditBox(this, font, width / 2 - 100, 60, 200, 20, currentName);
|
||||
nameEdit->inFocus = true;
|
||||
|
||||
@@ -9,10 +9,10 @@ class RenameWorldScreen : public Screen
|
||||
private:
|
||||
Screen *lastScreen;
|
||||
EditBox *nameEdit;
|
||||
wstring levelId;
|
||||
std::wstring levelId;
|
||||
|
||||
public:
|
||||
RenameWorldScreen(Screen *lastScreen, const wstring& levelId);
|
||||
RenameWorldScreen(Screen *lastScreen, const std::wstring& levelId);
|
||||
virtual void tick();
|
||||
virtual void init() ;
|
||||
virtual void removed();
|
||||
|
||||
@@ -48,14 +48,14 @@ void SelectWorldScreen::loadLevelList()
|
||||
selectedWorld = -1;
|
||||
}
|
||||
|
||||
wstring SelectWorldScreen::getWorldId(int id)
|
||||
std::wstring SelectWorldScreen::getWorldId(int id)
|
||||
{
|
||||
return levelList->at(id)->getLevelId();
|
||||
}
|
||||
|
||||
wstring SelectWorldScreen::getWorldName(int id)
|
||||
std::wstring SelectWorldScreen::getWorldName(int id)
|
||||
{
|
||||
wstring levelName = levelList->at(id)->getLevelName();
|
||||
std::wstring levelName = levelList->at(id)->getLevelName();
|
||||
|
||||
if ( levelName.length() == 0 )
|
||||
{
|
||||
@@ -87,16 +87,16 @@ void SelectWorldScreen::buttonClicked(Button *button)
|
||||
if (!button->active) return;
|
||||
if (button->id == BUTTON_DELETE_ID)
|
||||
{
|
||||
wstring worldName = getWorldName(selectedWorld);
|
||||
std::wstring worldName = getWorldName(selectedWorld);
|
||||
if (worldName != L"")
|
||||
{
|
||||
isDeleting = true;
|
||||
|
||||
Language *language = Language::getInstance();
|
||||
wstring title = language->getElement(L"selectWorld.deleteQuestion");
|
||||
wstring warning = L"'" + worldName + L"' " + language->getElement(L"selectWorld.deleteWarning");
|
||||
wstring yes = language->getElement(L"selectWorld.deleteButton");
|
||||
wstring no = language->getElement(L"gui.cancel");
|
||||
std::wstring title = language->getElement(L"selectWorld.deleteQuestion");
|
||||
std::wstring warning = L"'" + worldName + L"' " + language->getElement(L"selectWorld.deleteWarning");
|
||||
std::wstring yes = language->getElement(L"selectWorld.deleteButton");
|
||||
std::wstring no = language->getElement(L"gui.cancel");
|
||||
|
||||
ConfirmScreen *confirmScreen = new ConfirmScreen(this, title, warning, yes, no, selectedWorld);
|
||||
minecraft->setScreen(confirmScreen);
|
||||
@@ -147,7 +147,7 @@ void SelectWorldScreen::worldSelected(int id)
|
||||
done = true;
|
||||
minecraft->gameMode = NULL; //new SurvivalMode(minecraft);
|
||||
|
||||
wstring worldFolderName = getWorldId(id);
|
||||
std::wstring worldFolderName = getWorldId(id);
|
||||
if (worldFolderName == L"") // 4J - was NULL comparison
|
||||
{
|
||||
worldFolderName = L"World" + _toString<int>(id);
|
||||
@@ -271,13 +271,13 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, int
|
||||
{
|
||||
LevelSummary *levelSummary = parent->levelList->at(i);
|
||||
|
||||
wstring name = levelSummary->getLevelName();
|
||||
std::wstring name = levelSummary->getLevelName();
|
||||
if (name.length()==0)
|
||||
{
|
||||
name = parent->worldLang + L" " + _toString<int>(i + 1);
|
||||
}
|
||||
|
||||
wstring id = levelSummary->getLevelId();
|
||||
std::wstring id = levelSummary->getLevelId();
|
||||
|
||||
ULARGE_INTEGER rawtime;
|
||||
rawtime.QuadPart = levelSummary->getLastPlayed() * 10000; // Convert it from milliseconds back to FileTime
|
||||
@@ -296,7 +296,7 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, int
|
||||
|
||||
__int64 size = levelSummary->getSizeOnDisk();
|
||||
id = id + L", " + _toString<float>(size / 1024 * 100 / 1024 / 100.0f) + L" MB)";
|
||||
wstring info;
|
||||
std::wstring info;
|
||||
|
||||
if (levelSummary->isRequiresConversion())
|
||||
{
|
||||
|
||||
@@ -25,14 +25,14 @@ private:
|
||||
|
||||
protected:
|
||||
Screen *lastScreen;
|
||||
wstring title;
|
||||
std::wstring title;
|
||||
private:
|
||||
bool done;
|
||||
int selectedWorld;
|
||||
vector<LevelSummary *> *levelList;
|
||||
WorldSelectionList *worldSelectionList;
|
||||
wstring worldLang;
|
||||
wstring conversionLang;
|
||||
std::wstring worldLang;
|
||||
std::wstring conversionLang;
|
||||
bool isDeleting;
|
||||
|
||||
Button *deleteButton;
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
private:
|
||||
void loadLevelList();
|
||||
protected:
|
||||
wstring getWorldId(int id);
|
||||
wstring getWorldName(int id);
|
||||
std::wstring getWorldId(int id);
|
||||
std::wstring getWorldName(int id);
|
||||
public:
|
||||
virtual void postInit();
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ void StatsScreen::GeneralStatisticsList::renderItem(int i, int x, int y, int h,
|
||||
{
|
||||
Stat *stat = Stats::generalStats->at(i);
|
||||
parent->drawString(parent->font, stat->name, x + 2, y + 1, i % 2 == 0 ? 0xffffff : 0x909090);
|
||||
wstring msg = stat->format(parent->stats->getTotalValue(stat));
|
||||
std::wstring msg = stat->format(parent->stats->getTotalValue(stat));
|
||||
parent->drawString(parent->font, msg, x + 2 + 213 - parent->font->width(msg), y + 1, i % 2 == 0 ? 0xffffff : 0x909090);
|
||||
}
|
||||
|
||||
@@ -305,12 +305,12 @@ void StatsScreen::StatisticsList::renderStat(ItemStat *stat, int x, int y, bool
|
||||
{
|
||||
if (stat != NULL)
|
||||
{
|
||||
wstring msg = stat->format(parent->stats->getTotalValue(stat));
|
||||
std::wstring msg = stat->format(parent->stats->getTotalValue(stat));
|
||||
parent->drawString(parent->font, msg, x - parent->font->width(msg), y + SLOT_TEXT_OFFSET, shaded ? 0xffffff : 0x909090);
|
||||
}
|
||||
else
|
||||
{
|
||||
wstring msg = L"-";
|
||||
std::wstring msg = L"-";
|
||||
parent->drawString(parent->font, msg, x - parent->font->width(msg), y + SLOT_TEXT_OFFSET, shaded ? 0xffffff : 0x909090);
|
||||
}
|
||||
}
|
||||
@@ -336,7 +336,7 @@ void StatsScreen::StatisticsList::renderDecorations(int mouseX, int mouseY)
|
||||
}
|
||||
else
|
||||
{
|
||||
wstring elementName;
|
||||
std::wstring elementName;
|
||||
if (mouseX >= (rowX + ROW_COL_1 - SLOT_BG_SIZE) && mouseX <= (rowX + ROW_COL_1))
|
||||
{
|
||||
elementName = getHeaderDescriptionId(0);
|
||||
@@ -380,7 +380,7 @@ void StatsScreen::StatisticsList::renderMousehoverTooltip(ItemStat *stat, int x,
|
||||
|
||||
Item *item = Item::items[stat->getItemId()];
|
||||
|
||||
wstring elementName = trimString(L"" + Language::getInstance()->getElementName(item->getDescriptionId()));
|
||||
std::wstring elementName = trimString(L"" + Language::getInstance()->getElementName(item->getDescriptionId()));
|
||||
|
||||
if (elementName.length() > 0)
|
||||
{
|
||||
@@ -526,7 +526,7 @@ void StatsScreen::ItemStatisticsList::renderItem(int i, int x, int y, int h, Tes
|
||||
renderStat((ItemStat *) stat, x + ROW_COL_3, y, i % 2 == 0);*/
|
||||
}
|
||||
|
||||
wstring StatsScreen::ItemStatisticsList::getHeaderDescriptionId(int column)
|
||||
std::wstring StatsScreen::ItemStatisticsList::getHeaderDescriptionId(int column)
|
||||
{
|
||||
if (column == COLUMN_CRAFTED)
|
||||
{
|
||||
@@ -653,7 +653,7 @@ void StatsScreen::BlockStatisticsList::renderItem(int i, int x, int y, int h, Te
|
||||
renderStat((ItemStat *) mineCount, x + ROW_COL_3, y, i % 2 == 0);*/
|
||||
}
|
||||
|
||||
wstring StatsScreen::BlockStatisticsList::getHeaderDescriptionId(int column)
|
||||
std::wstring StatsScreen::BlockStatisticsList::getHeaderDescriptionId(int column)
|
||||
{
|
||||
if (column == COLUMN_CRAFTED)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ protected:
|
||||
static const int BUTTON_ITEMSTATS_ID = 3;
|
||||
|
||||
Screen *lastScreen;
|
||||
wstring title;
|
||||
std::wstring title;
|
||||
public:
|
||||
class GeneralStatisticsList;
|
||||
class ItemStatisticsList;
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
virtual void clickedHeader(int headerMouseX, int headerMouseY);
|
||||
virtual int getNumberOfItems();
|
||||
ItemStat *getSlotStat(int slot);
|
||||
virtual wstring getHeaderDescriptionId(int column) = 0;
|
||||
virtual std::wstring getHeaderDescriptionId(int column) = 0;
|
||||
virtual void renderStat(ItemStat *stat, int x, int y, bool shaded);
|
||||
virtual void renderDecorations(int mouseX, int mouseY);
|
||||
virtual void renderMousehoverTooltip(ItemStat *stat, int x, int y);
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
ItemStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
|
||||
virtual void renderHeader(int x, int y, Tesselator *t);
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
|
||||
virtual wstring getHeaderDescriptionId(int column);
|
||||
virtual std::wstring getHeaderDescriptionId(int column);
|
||||
};
|
||||
|
||||
class BlockStatisticsList : public StatisticsList
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
BlockStatisticsList(StatsScreen *ss); // 4J - added parameter so we can access parent
|
||||
virtual void renderHeader(int x, int y, Tesselator *t);
|
||||
virtual void renderItem(int i, int x, int y, int h, Tesselator *t);
|
||||
virtual wstring getHeaderDescriptionId(int column);
|
||||
virtual std::wstring getHeaderDescriptionId(int column);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.h"
|
||||
|
||||
|
||||
const wstring TextEditScreen::allowedChars = SharedConstants::readAcceptableChars();
|
||||
const std::wstring TextEditScreen::allowedChars = SharedConstants::readAcceptableChars();
|
||||
|
||||
TextEditScreen::TextEditScreen(std::shared_ptr<SignTileEntity> sign)
|
||||
{
|
||||
@@ -61,12 +61,12 @@ void TextEditScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
if (eventKey == Keyboard::KEY_UP) line = (line - 1) & 3;
|
||||
if (eventKey == Keyboard::KEY_DOWN || eventKey == Keyboard::KEY_RETURN) line = (line + 1) & 3;
|
||||
|
||||
wstring temp=sign->GetMessage(line);
|
||||
std::wstring temp=sign->GetMessage(line);
|
||||
if (eventKey == Keyboard::KEY_BACK && temp.length() > 0)
|
||||
{
|
||||
temp = temp.substr(0, temp.length() - 1);
|
||||
}
|
||||
if (allowedChars.find(ch) != wstring::npos && temp.length() < 15)
|
||||
if (allowedChars.find(ch) != std::wstring::npos && temp.length() < 15)
|
||||
{
|
||||
temp += ch;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using namespace std;
|
||||
class TextEditScreen : public Screen
|
||||
{
|
||||
protected:
|
||||
wstring title;
|
||||
std::wstring title;
|
||||
private:
|
||||
std::shared_ptr<SignTileEntity> sign;
|
||||
int frame;
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
protected:
|
||||
virtual void buttonClicked(Button *button);
|
||||
private:
|
||||
static const wstring allowedChars;
|
||||
static const std::wstring allowedChars;
|
||||
protected:
|
||||
virtual void keyPressed(wchar_t ch, int eventKey);
|
||||
public:
|
||||
|
||||
@@ -22,12 +22,12 @@ TitleScreen::TitleScreen()
|
||||
|
||||
splash = L"missingno";
|
||||
// try { // 4J - removed try/catch
|
||||
vector<wstring> splashes;
|
||||
vector<std::wstring> splashes;
|
||||
|
||||
/*
|
||||
BufferedReader *br = new BufferedReader(new InputStreamReader(InputStream::getResourceAsStream(L"res\\title\\splashes.txt"))); //, Charset.forName("UTF-8")
|
||||
|
||||
wstring line = L"";
|
||||
std::wstring line = L"";
|
||||
while ( !(line = br->readLine()).empty() )
|
||||
{
|
||||
line = trimString( line );
|
||||
|
||||
@@ -11,7 +11,7 @@ private:
|
||||
|
||||
float vo;
|
||||
|
||||
wstring splash;
|
||||
std::wstring splash;
|
||||
Button *multiplayerButton;
|
||||
|
||||
public:
|
||||
|
||||
@@ -8,7 +8,7 @@ class VideoSettingsScreen : public Screen
|
||||
private:
|
||||
Screen *lastScreen;
|
||||
protected:
|
||||
wstring title;
|
||||
std::wstring title;
|
||||
private:
|
||||
Options *options;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../Build/stdafx.h"
|
||||
#include "SimpleIcon.h"
|
||||
|
||||
SimpleIcon::SimpleIcon(const wstring &name, float U0, float V0, float U1, float V1) : StitchedTexture(name)
|
||||
SimpleIcon::SimpleIcon(const std::wstring &name, float U0, float V0, float U1, float V1) : StitchedTexture(name)
|
||||
{
|
||||
u0 = U0;
|
||||
u1 = U1;
|
||||
|
||||
@@ -7,5 +7,5 @@ using namespace std;
|
||||
class SimpleIcon : public StitchedTexture
|
||||
{
|
||||
public:
|
||||
SimpleIcon(const wstring &name, float u0, float v0, float u1, float v1);
|
||||
SimpleIcon(const std::wstring &name, float u0, float v0, float u1, float v1);
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../Build/stdafx.h"
|
||||
#include "SlideButton.h"
|
||||
|
||||
SlideButton::SlideButton(int id, int x, int y, const Options::Option *option, const wstring& msg, float value) : Button(id, x, y, 150, 20, msg)
|
||||
SlideButton::SlideButton(int id, int x, int y, const Options::Option *option, const std::wstring& msg, float value) : Button(id, x, y, 150, 20, msg)
|
||||
{
|
||||
this->sliding = false; //4J added
|
||||
this->option = option;
|
||||
|
||||
@@ -12,7 +12,7 @@ private:
|
||||
const Options::Option *option;
|
||||
|
||||
public:
|
||||
SlideButton(int id, int x, int y, const Options::Option *option, const wstring& msg, float value);
|
||||
SlideButton(int id, int x, int y, const Options::Option *option, const std::wstring& msg, float value);
|
||||
protected:
|
||||
virtual int getYImage(bool hovered);
|
||||
virtual void renderBg(Minecraft *minecraft, int xm, int ym);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#include "../Build/stdafx.h"
|
||||
#include "SmallButton.h"
|
||||
|
||||
SmallButton::SmallButton(int id, int x, int y, const wstring& msg) : Button(id, x, y, 150, 20, msg)
|
||||
SmallButton::SmallButton(int id, int x, int y, const std::wstring& msg) : Button(id, x, y, 150, 20, msg)
|
||||
{
|
||||
this->option = NULL;
|
||||
}
|
||||
|
||||
SmallButton::SmallButton(int id, int x, int y, int width, int height, const wstring& msg) : Button(id, x, y, width, height, msg)
|
||||
SmallButton::SmallButton(int id, int x, int y, int width, int height, const std::wstring& msg) : Button(id, x, y, width, height, msg)
|
||||
{
|
||||
this->option = NULL;
|
||||
}
|
||||
|
||||
SmallButton::SmallButton(int id, int x, int y, const Options::Option *item, const wstring& msg) : Button(id, x, y, 150, 20, msg)
|
||||
SmallButton::SmallButton(int id, int x, int y, const Options::Option *item, const std::wstring& msg) : Button(id, x, y, 150, 20, msg)
|
||||
{
|
||||
this->option = item;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ private:
|
||||
const Options::Option *option;
|
||||
|
||||
public:
|
||||
SmallButton(int id, int x, int y, const wstring& msg);
|
||||
SmallButton(int id, int x, int y, int width, int height, const wstring& msg);
|
||||
SmallButton(int id, int x, int y, const Options::Option *item, const wstring& msg);
|
||||
SmallButton(int id, int x, int y, const std::wstring& msg);
|
||||
SmallButton(int id, int x, int y, int width, int height, const std::wstring& msg);
|
||||
SmallButton(int id, int x, int y, const Options::Option *item, const std::wstring& msg);
|
||||
const Options::Option *getOption();
|
||||
};
|
||||
Reference in New Issue
Block a user