mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-25 07:13:00 +00:00
refactor: use std::endian directly, enum class EDefaultSkins, rename reserved-prefix helpers
This commit is contained in:
parent
3f33bf4817
commit
5105f89648
|
|
@ -377,7 +377,7 @@ void ColourTable::setColour(const std::wstring& colourName, int value) {
|
|||
|
||||
void ColourTable::setColour(const std::wstring& colourName,
|
||||
const std::wstring& value) {
|
||||
setColour(colourName, _fromHEXString<int>(value));
|
||||
setColour(colourName, fromHexWString<int>(value));
|
||||
}
|
||||
|
||||
unsigned int ColourTable::getColour(eMinecraftColour id) {
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type,
|
|||
ss >> param;
|
||||
} break;
|
||||
default:
|
||||
param = _fromString<unsigned int>(it->second);
|
||||
param = fromWString<unsigned int>(it->second);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,25 +41,25 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
|
||||
dos->writeUTF(m_schematicName);
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_location.x));
|
||||
dos->writeUTF(toWString(m_location.x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_location.y));
|
||||
dos->writeUTF(toWString(m_location.y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_location.z));
|
||||
dos->writeUTF(toWString(m_location.z));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
|
||||
|
||||
switch (m_rotation) {
|
||||
case ConsoleSchematicFile::eSchematicRot_0:
|
||||
dos->writeUTF(_toString(0));
|
||||
dos->writeUTF(toWString(0));
|
||||
break;
|
||||
case ConsoleSchematicFile::eSchematicRot_90:
|
||||
dos->writeUTF(_toString(90));
|
||||
dos->writeUTF(toWString(90));
|
||||
break;
|
||||
case ConsoleSchematicFile::eSchematicRot_180:
|
||||
dos->writeUTF(_toString(180));
|
||||
dos->writeUTF(toWString(180));
|
||||
break;
|
||||
case ConsoleSchematicFile::eSchematicRot_270:
|
||||
dos->writeUTF(_toString(270));
|
||||
dos->writeUTF(toWString(270));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -81,23 +81,23 @@ void ApplySchematicRuleDefinition::addAttribute(
|
|||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
}
|
||||
} else if (attributeName.compare(L"x") == 0) {
|
||||
m_location.x = _fromString<int>(attributeValue);
|
||||
m_location.x = fromWString<int>(attributeValue);
|
||||
if (((int)std::abs(m_location.x)) % 2 != 0) m_location.x -= 1;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// x=%f\n",m_location->x);
|
||||
} else if (attributeName.compare(L"y") == 0) {
|
||||
m_location.y = _fromString<int>(attributeValue);
|
||||
m_location.y = fromWString<int>(attributeValue);
|
||||
if (((int)std::abs(m_location.y)) % 2 != 0) m_location.y -= 1;
|
||||
if (m_location.y < 0) m_location.y = 0;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// y=%f\n",m_location->y);
|
||||
} else if (attributeName.compare(L"z") == 0) {
|
||||
m_location.z = _fromString<int>(attributeValue);
|
||||
m_location.z = fromWString<int>(attributeValue);
|
||||
if (((int)std::abs(m_location.z)) % 2 != 0) m_location.z -= 1;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// z=%f\n",m_location->z);
|
||||
} else if (attributeName.compare(L"rot") == 0) {
|
||||
int degrees = _fromString<int>(attributeValue);
|
||||
int degrees = fromWString<int>(attributeValue);
|
||||
|
||||
while (degrees < 0) degrees += 360;
|
||||
while (degrees >= 360) degrees -= 360;
|
||||
|
|
@ -123,7 +123,7 @@ void ApplySchematicRuleDefinition::addAttribute(
|
|||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// rot=%d\n",m_rotation);
|
||||
} else if (attributeName.compare(L"dim") == 0) {
|
||||
m_dimension = _fromString<int>(attributeValue);
|
||||
m_dimension = fromWString<int>(attributeValue);
|
||||
if (m_dimension > 1 || m_dimension < -1) m_dimension = 0;
|
||||
// app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter
|
||||
// dimension=%d\n",m_dimension);
|
||||
|
|
|
|||
|
|
@ -17,26 +17,26 @@ void BiomeOverride::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
|
||||
dos->writeUTF(_toString(m_biomeId));
|
||||
dos->writeUTF(toWString(m_biomeId));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
||||
dos->writeUTF(_toString(m_tile));
|
||||
dos->writeUTF(toWString(m_tile));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
|
||||
dos->writeUTF(_toString(m_topTile));
|
||||
dos->writeUTF(toWString(m_topTile));
|
||||
}
|
||||
|
||||
void BiomeOverride::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"tileId") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_tile = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter tileId=%d\n", m_tile);
|
||||
} else if (attributeName.compare(L"topTileId") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_topTile = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter topTileId=%d\n",
|
||||
m_topTile);
|
||||
} else if (attributeName.compare(L"biomeId") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_biomeId = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter biomeId=%d\n",
|
||||
m_biomeId);
|
||||
|
|
|
|||
|
|
@ -65,43 +65,43 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_x));
|
||||
dos->writeUTF(toWString(m_x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_y));
|
||||
dos->writeUTF(toWString(m_y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_z));
|
||||
dos->writeUTF(toWString(m_z));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
||||
dos->writeUTF(_toString(orientation));
|
||||
dos->writeUTF(toWString(orientation));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension);
|
||||
dos->writeUTF(_toString(m_dimension));
|
||||
dos->writeUTF(toWString(m_dimension));
|
||||
}
|
||||
|
||||
void ConsoleGenerateStructure::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"x") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_x = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter x=%d\n",
|
||||
m_x);
|
||||
} else if (attributeName.compare(L"y") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_y = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter y=%d\n",
|
||||
m_y);
|
||||
} else if (attributeName.compare(L"z") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_z = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter z=%d\n",
|
||||
m_z);
|
||||
} else if (attributeName.compare(L"orientation") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
orientation = value;
|
||||
app.DebugPrintf(
|
||||
"ConsoleGenerateStructure: Adding parameter orientation=%d\n",
|
||||
orientation);
|
||||
} else if (attributeName.compare(L"dim") == 0) {
|
||||
m_dimension = _fromString<int>(attributeValue);
|
||||
m_dimension = fromWString<int>(attributeValue);
|
||||
if (m_dimension > 1 || m_dimension < -1) m_dimension = 0;
|
||||
app.DebugPrintf(
|
||||
"ApplySchematicRuleDefinition: Adding parameter dimension=%d\n",
|
||||
|
|
|
|||
|
|
@ -131,16 +131,16 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
||||
dos->writeUTF(_toString(m_spawnPos->x));
|
||||
dos->writeUTF(toWString(m_spawnPos->x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
||||
dos->writeUTF(_toString(m_spawnPos->y));
|
||||
dos->writeUTF(toWString(m_spawnPos->y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
||||
dos->writeUTF(_toString(m_spawnPos->z));
|
||||
dos->writeUTF(toWString(m_spawnPos->z));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed);
|
||||
dos->writeUTF(_toString(m_seed));
|
||||
dos->writeUTF(toWString(m_seed));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld);
|
||||
dos->writeUTF(_toString(m_useFlatWorld));
|
||||
dos->writeUTF(toWString(m_useFlatWorld));
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::getChildren(
|
||||
|
|
@ -190,24 +190,24 @@ GameRuleDefinition* LevelGenerationOptions::addChild(
|
|||
void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"seed") == 0) {
|
||||
m_seed = _fromString<int64_t>(attributeValue);
|
||||
m_seed = fromWString<int64_t>(attributeValue);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter m_seed=%I64d\n", m_seed);
|
||||
} else if (attributeName.compare(L"spawnX") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->x = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",
|
||||
value);
|
||||
} else if (attributeName.compare(L"spawnY") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->y = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",
|
||||
value);
|
||||
} else if (attributeName.compare(L"spawnZ") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->z = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",
|
||||
value);
|
||||
|
|
@ -244,7 +244,7 @@ void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
|
|||
"LevelGenerationOptions: Adding parameter displayName=%ls\n",
|
||||
getDisplayName());
|
||||
} else if (attributeName.compare(L"texturePackId") == 0) {
|
||||
setRequiredTexturePackId(_fromString<unsigned int>(attributeValue));
|
||||
setRequiredTexturePackId(fromWString<unsigned int>(attributeValue));
|
||||
setRequiresTexturePack(true);
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter texturePackId=%0x\n",
|
||||
|
|
@ -260,7 +260,7 @@ void LevelGenerationOptions::addAttribute(const std::wstring& attributeName,
|
|||
"LevelGenerationOptions: Adding parameter baseSaveName=%ls\n",
|
||||
getBaseSavePath().c_str());
|
||||
} else if (attributeName.compare(L"hasBeenInCreative") == 0) {
|
||||
bool value = _fromString<bool>(attributeValue);
|
||||
bool value = fromWString<bool>(attributeValue);
|
||||
m_bHasBeenInCreative = value;
|
||||
app.DebugPrintf(
|
||||
"LevelGenerationOptions: Adding parameter gameMode=%d\n",
|
||||
|
|
|
|||
|
|
@ -18,32 +18,32 @@ void StartFeature::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
|
||||
dos->writeUTF(_toString(m_chunkX));
|
||||
dos->writeUTF(toWString(m_chunkX));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ);
|
||||
dos->writeUTF(_toString(m_chunkZ));
|
||||
dos->writeUTF(toWString(m_chunkZ));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature);
|
||||
dos->writeUTF(_toString((int)m_feature));
|
||||
dos->writeUTF(toWString((int)m_feature));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
||||
dos->writeUTF(_toString(m_orientation));
|
||||
dos->writeUTF(toWString(m_orientation));
|
||||
}
|
||||
|
||||
void StartFeature::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"chunkX") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_chunkX = value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter chunkX=%d\n", m_chunkX);
|
||||
} else if (attributeName.compare(L"chunkZ") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_chunkZ = value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter chunkZ=%d\n", m_chunkZ);
|
||||
} else if (attributeName.compare(L"orientation") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_orientation = value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter orientation=%d\n",
|
||||
m_orientation);
|
||||
} else if (attributeName.compare(L"feature") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_feature = (StructureFeature::EFeatureTypes)value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",
|
||||
m_feature);
|
||||
|
|
|
|||
|
|
@ -18,67 +18,67 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream* dos,
|
|||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
||||
dos->writeUTF(_toString(m_x0));
|
||||
dos->writeUTF(toWString(m_x0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
||||
dos->writeUTF(_toString(m_y0));
|
||||
dos->writeUTF(toWString(m_y0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
||||
dos->writeUTF(_toString(m_z0));
|
||||
dos->writeUTF(toWString(m_z0));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
||||
dos->writeUTF(_toString(m_x1));
|
||||
dos->writeUTF(toWString(m_x1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
||||
dos->writeUTF(_toString(m_y1));
|
||||
dos->writeUTF(toWString(m_y1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
||||
dos->writeUTF(_toString(m_z1));
|
||||
dos->writeUTF(toWString(m_z1));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
|
||||
dos->writeUTF(_toString(m_edgeTile));
|
||||
dos->writeUTF(toWString(m_edgeTile));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
|
||||
dos->writeUTF(_toString(m_fillTile));
|
||||
dos->writeUTF(toWString(m_fillTile));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir);
|
||||
dos->writeUTF(_toString(m_skipAir));
|
||||
dos->writeUTF(toWString(m_skipAir));
|
||||
}
|
||||
|
||||
void XboxStructureActionGenerateBox::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"x0") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_x0 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter x0=%d\n", m_x0);
|
||||
} else if (attributeName.compare(L"y0") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_y0 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter y0=%d\n", m_y0);
|
||||
} else if (attributeName.compare(L"z0") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_z0 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter z0=%d\n", m_z0);
|
||||
} else if (attributeName.compare(L"x1") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_x1 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter x1=%d\n", m_x1);
|
||||
} else if (attributeName.compare(L"y1") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_y1 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter y1=%d\n", m_y1);
|
||||
} else if (attributeName.compare(L"z1") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_z1 = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter z1=%d\n", m_z1);
|
||||
} else if (attributeName.compare(L"edgeTile") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_edgeTile = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter edgeTile=%d\n",
|
||||
m_edgeTile);
|
||||
} else if (attributeName.compare(L"fillTile") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_fillTile = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionGenerateBox: Adding parameter fillTile=%d\n",
|
||||
|
|
|
|||
|
|
@ -17,43 +17,43 @@ void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream* dos,
|
|||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_x));
|
||||
dos->writeUTF(toWString(m_x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_y));
|
||||
dos->writeUTF(toWString(m_y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_z));
|
||||
dos->writeUTF(toWString(m_z));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data);
|
||||
dos->writeUTF(_toString(m_data));
|
||||
dos->writeUTF(toWString(m_data));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block);
|
||||
dos->writeUTF(_toString(m_tile));
|
||||
dos->writeUTF(toWString(m_tile));
|
||||
}
|
||||
|
||||
void XboxStructureActionPlaceBlock::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"x") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_x = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionPlaceBlock: Adding parameter x=%d\n", m_x);
|
||||
} else if (attributeName.compare(L"y") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_y = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionPlaceBlock: Adding parameter y=%d\n", m_y);
|
||||
} else if (attributeName.compare(L"z") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_z = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionPlaceBlock: Adding parameter z=%d\n", m_z);
|
||||
} else if (attributeName.compare(L"block") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_tile = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionPlaceBlock: Adding parameter block=%d\n",
|
||||
m_tile);
|
||||
} else if (attributeName.compare(L"data") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_data = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionPlaceBlock: Adding parameter data=%d\n",
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ GameRuleDefinition* XboxStructureActionPlaceContainer::addChild(
|
|||
void XboxStructureActionPlaceContainer::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"facing") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_data = value;
|
||||
app.DebugPrintf(
|
||||
"XboxStructureActionPlaceContainer: Adding parameter facing=%d\n",
|
||||
|
|
|
|||
|
|
@ -24,17 +24,17 @@ void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
|
||||
dos->writeUTF(_toString(m_enchantmentId));
|
||||
dos->writeUTF(toWString(m_enchantmentId));
|
||||
|
||||
ConsoleGameRules::write(dos,
|
||||
ConsoleGameRules::eGameRuleAttr_enchantmentLevel);
|
||||
dos->writeUTF(_toString(m_enchantmentLevel));
|
||||
dos->writeUTF(toWString(m_enchantmentLevel));
|
||||
}
|
||||
|
||||
void AddEnchantmentRuleDefinition::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"enchantmentId") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
if (value < 0) value = 0;
|
||||
if (value >= 256) value = 255;
|
||||
m_enchantmentId = value;
|
||||
|
|
@ -42,7 +42,7 @@ void AddEnchantmentRuleDefinition::addAttribute(
|
|||
"AddEnchantmentRuleDefinition: Adding parameter enchantmentId=%d\n",
|
||||
m_enchantmentId);
|
||||
} else if (attributeName.compare(L"enchantmentLevel") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
if (value < 0) value = 0;
|
||||
m_enchantmentLevel = value;
|
||||
app.DebugPrintf(
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||
dos->writeUTF(_toString(m_itemId));
|
||||
dos->writeUTF(toWString(m_itemId));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||
dos->writeUTF(_toString(m_quantity));
|
||||
dos->writeUTF(toWString(m_quantity));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||
dos->writeUTF(_toString(m_auxValue));
|
||||
dos->writeUTF(toWString(m_auxValue));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||
dos->writeUTF(_toString(m_dataTag));
|
||||
dos->writeUTF(toWString(m_dataTag));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
|
||||
dos->writeUTF(_toString(m_slot));
|
||||
dos->writeUTF(toWString(m_slot));
|
||||
}
|
||||
|
||||
void AddItemRuleDefinition::getChildren(
|
||||
|
|
@ -58,27 +58,27 @@ GameRuleDefinition* AddItemRuleDefinition::addChild(
|
|||
void AddItemRuleDefinition::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"itemId") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_itemId = value;
|
||||
// app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter
|
||||
// itemId=%d\n",m_itemId);
|
||||
} else if (attributeName.compare(L"quantity") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_quantity = value;
|
||||
// app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter
|
||||
// quantity=%d\n",m_quantity);
|
||||
} else if (attributeName.compare(L"auxValue") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_auxValue = value;
|
||||
// app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter
|
||||
// auxValue=%d\n",m_auxValue);
|
||||
} else if (attributeName.compare(L"dataTag") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_dataTag = value;
|
||||
// app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter
|
||||
// dataTag=%d\n",m_dataTag);
|
||||
} else if (attributeName.compare(L"slot") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_slot = value;
|
||||
// app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter
|
||||
// slot=%d\n",m_slot);
|
||||
|
|
|
|||
|
|
@ -24,27 +24,27 @@ void CollectItemRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||
dos->writeUTF(_toString(m_itemId));
|
||||
dos->writeUTF(toWString(m_itemId));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||
dos->writeUTF(_toString(m_auxValue));
|
||||
dos->writeUTF(toWString(m_auxValue));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||
dos->writeUTF(_toString(m_quantity));
|
||||
dos->writeUTF(toWString(m_quantity));
|
||||
}
|
||||
|
||||
void CollectItemRuleDefinition::addAttribute(
|
||||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"itemId") == 0) {
|
||||
m_itemId = _fromString<int>(attributeValue);
|
||||
m_itemId = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("CollectItemRule: Adding parameter itemId=%d\n",
|
||||
m_itemId);
|
||||
} else if (attributeName.compare(L"auxValue") == 0) {
|
||||
m_auxValue = _fromString<int>(attributeValue);
|
||||
m_auxValue = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("CollectItemRule: Adding parameter m_auxValue=%d\n",
|
||||
m_auxValue);
|
||||
} else if (attributeName.compare(L"quantity") == 0) {
|
||||
m_quantity = _fromString<int>(attributeValue);
|
||||
m_quantity = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("CollectItemRule: Adding parameter m_quantity=%d\n",
|
||||
m_quantity);
|
||||
} else {
|
||||
|
|
@ -107,14 +107,14 @@ std::wstring CollectItemRuleDefinition::generateXml(
|
|||
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
||||
std::wstring xml = L"";
|
||||
if (item != nullptr) {
|
||||
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) +
|
||||
xml = L"<CollectItemRule itemId=\"" + toWString<int>(item->id) +
|
||||
L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" "
|
||||
L"promptName=\"OPTIONAL\"";
|
||||
if (item->getAuxValue() != 0)
|
||||
xml +=
|
||||
L" auxValue=\"" + _toString<int>(item->getAuxValue()) + L"\"";
|
||||
L" auxValue=\"" + toWString<int>(item->getAuxValue()) + L"\"";
|
||||
if (item->get4JData() != 0)
|
||||
xml += L" dataTag=\"" + _toString<int>(item->get4JData()) + L"\"";
|
||||
xml += L" dataTag=\"" + toWString<int>(item->get4JData()) + L"\"";
|
||||
xml += L"/>\n";
|
||||
}
|
||||
return xml;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ std::wstring CompleteAllRuleDefinition::generateDescriptionString(
|
|||
PacketData* values = (PacketData*)data;
|
||||
std::wstring newDesc = description;
|
||||
newDesc =
|
||||
replaceAll(newDesc, L"{*progress*}", _toString<int>(values->progress));
|
||||
newDesc = replaceAll(newDesc, L"{*goal*}", _toString<int>(values->goal));
|
||||
replaceAll(newDesc, L"{*progress*}", toWString<int>(values->progress));
|
||||
newDesc = replaceAll(newDesc, L"{*goal*}", toWString<int>(values->goal));
|
||||
return newDesc;
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ void CompoundGameRuleDefinition::populateGameRule(
|
|||
value.isPointer = true;
|
||||
|
||||
// Somehow add the newRule to the current rule
|
||||
rule->setParameter(L"rule" + _toString<int>(i), value);
|
||||
rule->setParameter(L"rule" + toWString<int>(i), value);
|
||||
++i;
|
||||
}
|
||||
GameRuleDefinition::populateGameRule(type, rule);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void GameRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
dos->writeUTF(m_promptId);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||
dos->writeUTF(_toString(m_4JDataValue));
|
||||
dos->writeUTF(toWString(m_4JDataValue));
|
||||
}
|
||||
|
||||
void GameRuleDefinition::getChildren(
|
||||
|
|
@ -86,7 +86,7 @@ void GameRuleDefinition::addAttribute(const std::wstring& attributeName,
|
|||
m_promptId.c_str());
|
||||
#endif
|
||||
} else if (attributeName.compare(L"dataTag") == 0) {
|
||||
m_4JDataValue = _fromString<int>(attributeValue);
|
||||
m_4JDataValue = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf(
|
||||
"GameRuleDefinition: Adding parameter m_4JDataValue=%d\n",
|
||||
m_4JDataValue);
|
||||
|
|
|
|||
|
|
@ -21,18 +21,18 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
dos->writeUTF(m_name);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
||||
dos->writeUTF(_toString(m_area.x0));
|
||||
dos->writeUTF(toWString(m_area.x0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
||||
dos->writeUTF(_toString(m_area.y0));
|
||||
dos->writeUTF(toWString(m_area.y0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
||||
dos->writeUTF(_toString(m_area.z0));
|
||||
dos->writeUTF(toWString(m_area.z0));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
||||
dos->writeUTF(_toString(m_area.x1));
|
||||
dos->writeUTF(toWString(m_area.x1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
||||
dos->writeUTF(_toString(m_area.y1));
|
||||
dos->writeUTF(toWString(m_area.y1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
||||
dos->writeUTF(_toString(m_area.z1));
|
||||
dos->writeUTF(toWString(m_area.z1));
|
||||
}
|
||||
|
||||
void NamedAreaRuleDefinition::addAttribute(const std::wstring& attributeName,
|
||||
|
|
@ -44,29 +44,29 @@ void NamedAreaRuleDefinition::addAttribute(const std::wstring& attributeName,
|
|||
m_name.c_str());
|
||||
#endif
|
||||
} else if (attributeName.compare(L"x0") == 0) {
|
||||
m_area.x0 = _fromString<int>(attributeValue);
|
||||
m_area.x0 = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x0=%f\n",
|
||||
m_area.x0);
|
||||
} else if (attributeName.compare(L"y0") == 0) {
|
||||
m_area.y0 = _fromString<int>(attributeValue);
|
||||
m_area.y0 = fromWString<int>(attributeValue);
|
||||
if (m_area.y0 < 0) m_area.y0 = 0;
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y0=%f\n",
|
||||
m_area.y0);
|
||||
} else if (attributeName.compare(L"z0") == 0) {
|
||||
m_area.z0 = _fromString<int>(attributeValue);
|
||||
m_area.z0 = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z0=%f\n",
|
||||
m_area.z0);
|
||||
} else if (attributeName.compare(L"x1") == 0) {
|
||||
m_area.x1 = _fromString<int>(attributeValue);
|
||||
m_area.x1 = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x1=%f\n",
|
||||
m_area.x1);
|
||||
} else if (attributeName.compare(L"y1") == 0) {
|
||||
m_area.y1 = _fromString<int>(attributeValue);
|
||||
m_area.y1 = fromWString<int>(attributeValue);
|
||||
if (m_area.y1 < 0) m_area.y1 = 0;
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter y1=%f\n",
|
||||
m_area.y1);
|
||||
} else if (attributeName.compare(L"z1") == 0) {
|
||||
m_area.z1 = _fromString<int>(attributeValue);
|
||||
m_area.z1 = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z1=%f\n",
|
||||
m_area.z1);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -39,23 +39,23 @@ void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
||||
dos->writeUTF(_toString(m_spawnPos->x));
|
||||
dos->writeUTF(toWString(m_spawnPos->x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
||||
dos->writeUTF(_toString(m_spawnPos->y));
|
||||
dos->writeUTF(toWString(m_spawnPos->y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
||||
dos->writeUTF(_toString(m_spawnPos->z));
|
||||
dos->writeUTF(toWString(m_spawnPos->z));
|
||||
|
||||
if (m_bUpdateYRot) {
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot);
|
||||
dos->writeUTF(_toString(m_yRot));
|
||||
dos->writeUTF(toWString(m_yRot));
|
||||
}
|
||||
if (m_bUpdateHealth) {
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food);
|
||||
dos->writeUTF(_toString(m_health));
|
||||
dos->writeUTF(toWString(m_health));
|
||||
}
|
||||
if (m_bUpdateFood) {
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health);
|
||||
dos->writeUTF(_toString(m_food));
|
||||
dos->writeUTF(toWString(m_food));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,36 +87,36 @@ void UpdatePlayerRuleDefinition::addAttribute(
|
|||
const std::wstring& attributeName, const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"spawnX") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->x = value;
|
||||
app.DebugPrintf(
|
||||
"UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n", value);
|
||||
} else if (attributeName.compare(L"spawnY") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->y = value;
|
||||
app.DebugPrintf(
|
||||
"UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n", value);
|
||||
} else if (attributeName.compare(L"spawnZ") == 0) {
|
||||
if (m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_spawnPos->z = value;
|
||||
app.DebugPrintf(
|
||||
"UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n", value);
|
||||
} else if (attributeName.compare(L"health") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_health = value;
|
||||
m_bUpdateHealth = true;
|
||||
app.DebugPrintf(
|
||||
"UpdatePlayerRuleDefinition: Adding parameter health=%d\n", value);
|
||||
} else if (attributeName.compare(L"food") == 0) {
|
||||
int value = _fromString<int>(attributeValue);
|
||||
int value = fromWString<int>(attributeValue);
|
||||
m_food = value;
|
||||
m_bUpdateFood = true;
|
||||
app.DebugPrintf(
|
||||
"UpdatePlayerRuleDefinition: Adding parameter health=%d\n", value);
|
||||
} else if (attributeName.compare(L"yRot") == 0) {
|
||||
float value = _fromString<float>(attributeValue);
|
||||
float value = fromWString<float>(attributeValue);
|
||||
m_yRot = value;
|
||||
m_bUpdateYRot = true;
|
||||
app.DebugPrintf(
|
||||
|
|
|
|||
|
|
@ -16,40 +16,40 @@ void UseTileRuleDefinition::writeAttributes(DataOutputStream* dos,
|
|||
GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
||||
dos->writeUTF(_toString(m_tileId));
|
||||
dos->writeUTF(toWString(m_tileId));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords);
|
||||
dos->writeUTF(_toString(m_useCoords));
|
||||
dos->writeUTF(toWString(m_useCoords));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_coordinates.x));
|
||||
dos->writeUTF(toWString(m_coordinates.x));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_coordinates.y));
|
||||
dos->writeUTF(toWString(m_coordinates.y));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_coordinates.z));
|
||||
dos->writeUTF(toWString(m_coordinates.z));
|
||||
}
|
||||
|
||||
void UseTileRuleDefinition::addAttribute(const std::wstring& attributeName,
|
||||
const std::wstring& attributeValue) {
|
||||
if (attributeName.compare(L"tileId") == 0) {
|
||||
m_tileId = _fromString<int>(attributeValue);
|
||||
m_tileId = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("UseTileRule: Adding parameter tileId=%d\n", m_tileId);
|
||||
} else if (attributeName.compare(L"useCoords") == 0) {
|
||||
m_useCoords = _fromString<bool>(attributeValue);
|
||||
m_useCoords = fromWString<bool>(attributeValue);
|
||||
app.DebugPrintf("UseTileRule: Adding parameter useCoords=%s\n",
|
||||
m_useCoords ? "true" : "false");
|
||||
} else if (attributeName.compare(L"x") == 0) {
|
||||
m_coordinates.x = _fromString<int>(attributeValue);
|
||||
m_coordinates.x = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("UseTileRule: Adding parameter x=%d\n",
|
||||
m_coordinates.x);
|
||||
} else if (attributeName.compare(L"y") == 0) {
|
||||
m_coordinates.y = _fromString<int>(attributeValue);
|
||||
m_coordinates.y = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("UseTileRule: Adding parameter y=%d\n",
|
||||
m_coordinates.y);
|
||||
} else if (attributeName.compare(L"z") == 0) {
|
||||
m_coordinates.z = _fromString<int>(attributeValue);
|
||||
m_coordinates.z = fromWString<int>(attributeValue);
|
||||
app.DebugPrintf("UseTileRule: Adding parameter z=%d\n",
|
||||
m_coordinates.z);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -274,10 +274,10 @@ std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal,
|
|||
|
||||
std::vector<std::wstring> idAndAux = stringSplit(id, L':');
|
||||
|
||||
int iconId = _fromString<int>(idAndAux[0]);
|
||||
int iconId = fromWString<int>(idAndAux[0]);
|
||||
|
||||
if (idAndAux.size() > 1) {
|
||||
iAuxVal = _fromString<int>(idAndAux[1]);
|
||||
iAuxVal = fromWString<int>(idAndAux[1]);
|
||||
} else {
|
||||
iAuxVal = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion* region) {
|
|||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.1f);
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
std::wstring line = _toString<int>(cost);
|
||||
std::wstring line = toWString<int>(cost);
|
||||
Font* font = pMinecraft->altFont;
|
||||
// int col = 0x685E4A;
|
||||
unsigned int col = m_textColour;
|
||||
|
|
@ -169,7 +169,7 @@ void UIControl_EnchantmentButton::updateState() {
|
|||
}
|
||||
|
||||
if (cost != m_lastCost) {
|
||||
setLabel(_toString<int>(cost));
|
||||
setLabel(toWString<int>(cost));
|
||||
m_lastCost = cost;
|
||||
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(void* lpParam,
|
|||
if (text[0] != '\0') {
|
||||
std::wstring value = convStringToWstring(text);
|
||||
int iVal = 0;
|
||||
if (!value.empty()) iVal = _fromString<int>(value);
|
||||
if (!value.empty()) iVal = fromWString<int>(value);
|
||||
switch (pClass->m_keyboardCallbackControl) {
|
||||
case eControl_Name:
|
||||
pClass->m_textInputName.setLabel(value);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void* initData,
|
|||
std::pair<int, int>(ench->id, level));
|
||||
m_buttonListEnchantments.addItem(
|
||||
app.GetString(ench->getDescriptionId()) +
|
||||
_toString<int>(level));
|
||||
toWString<int>(level));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ int UIScene_DebugSetCamera::KeyboardCompleteCallback(void* lpParam, bool bRes) {
|
|||
if (text[0] != '\0') {
|
||||
std::wstring value = convStringToWstring(text);
|
||||
double val = 0;
|
||||
if (!value.empty()) val = _fromString<double>(value);
|
||||
if (!value.empty()) val = fromWString<double>(value);
|
||||
switch (pClass->m_keyboardCallbackControl) {
|
||||
case eControl_CamX:
|
||||
pClass->m_textInputX.setLabel(value);
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass,
|
|||
}
|
||||
|
||||
// If the input string is a numerical value, convert it to a number
|
||||
if (isNumber) value = _fromString<int64_t>(wSeed);
|
||||
if (isNumber) value = fromWString<int64_t>(wSeed);
|
||||
|
||||
// If the value is not 0 use it, otherwise use the algorithm from the
|
||||
// java String.hashCode() function to hash it
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() {
|
|||
case SKIN_SELECT_PACK_DEFAULT:
|
||||
backupTexture = getTextureId(m_skinIndex);
|
||||
|
||||
if (m_skinIndex == eDefaultSkins_ServerSelected) {
|
||||
if (m_skinIndex == std::to_underlying(EDefaultSkins::ServerSelected)) {
|
||||
skinName = app.GetString(IDS_DEFAULT_SKINS);
|
||||
} else {
|
||||
skinName = wchDefaultNamesA[m_skinIndex];
|
||||
|
|
@ -860,30 +860,30 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() {
|
|||
|
||||
TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex) {
|
||||
TEXTURE_NAME texture = TN_MOB_CHAR;
|
||||
switch (skinIndex) {
|
||||
case eDefaultSkins_ServerSelected:
|
||||
case eDefaultSkins_Skin0:
|
||||
switch (static_cast<EDefaultSkins>(skinIndex)) {
|
||||
case EDefaultSkins::ServerSelected:
|
||||
case EDefaultSkins::Skin0:
|
||||
texture = TN_MOB_CHAR;
|
||||
break;
|
||||
case eDefaultSkins_Skin1:
|
||||
case EDefaultSkins::Skin1:
|
||||
texture = TN_MOB_CHAR1;
|
||||
break;
|
||||
case eDefaultSkins_Skin2:
|
||||
case EDefaultSkins::Skin2:
|
||||
texture = TN_MOB_CHAR2;
|
||||
break;
|
||||
case eDefaultSkins_Skin3:
|
||||
case EDefaultSkins::Skin3:
|
||||
texture = TN_MOB_CHAR3;
|
||||
break;
|
||||
case eDefaultSkins_Skin4:
|
||||
case EDefaultSkins::Skin4:
|
||||
texture = TN_MOB_CHAR4;
|
||||
break;
|
||||
case eDefaultSkins_Skin5:
|
||||
case EDefaultSkins::Skin5:
|
||||
texture = TN_MOB_CHAR5;
|
||||
break;
|
||||
case eDefaultSkins_Skin6:
|
||||
case EDefaultSkins::Skin6:
|
||||
texture = TN_MOB_CHAR6;
|
||||
break;
|
||||
case eDefaultSkins_Skin7:
|
||||
case EDefaultSkins::Skin7:
|
||||
texture = TN_MOB_CHAR7;
|
||||
break;
|
||||
};
|
||||
|
|
@ -907,8 +907,8 @@ int UIScene_SkinSelectMenu::getNextSkinIndex(int sourceIndex) {
|
|||
++nextSkin;
|
||||
|
||||
if (m_packIndex == SKIN_SELECT_PACK_DEFAULT &&
|
||||
nextSkin >= eDefaultSkins_Count) {
|
||||
nextSkin = eDefaultSkins_ServerSelected;
|
||||
nextSkin >= std::to_underlying(EDefaultSkins::Count)) {
|
||||
nextSkin = std::to_underlying(EDefaultSkins::ServerSelected);
|
||||
} else if (m_currentPack != nullptr &&
|
||||
nextSkin >= m_currentPack->getSkinCount()) {
|
||||
nextSkin = 0;
|
||||
|
|
@ -932,7 +932,7 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(int sourceIndex) {
|
|||
default:
|
||||
if (previousSkin == 0) {
|
||||
if (m_packIndex == SKIN_SELECT_PACK_DEFAULT) {
|
||||
previousSkin = eDefaultSkins_Count - 1;
|
||||
previousSkin = std::to_underlying(EDefaultSkins::Count) - 1;
|
||||
} else if (m_currentPack != nullptr) {
|
||||
previousSkin = m_currentPack->getSkinCount() - 1;
|
||||
}
|
||||
|
|
@ -967,7 +967,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() {
|
|||
std::uint32_t defaultSkinIndex =
|
||||
GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId);
|
||||
if (ugcSkinIndex == 0) {
|
||||
m_skinIndex = (EDefaultSkins)defaultSkinIndex;
|
||||
m_skinIndex = static_cast<int>(defaultSkinIndex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class UILayer;
|
|||
|
||||
class UIScene_SkinSelectMenu : public UIScene {
|
||||
private:
|
||||
static const wchar_t* wchDefaultNamesA[eDefaultSkins_Count];
|
||||
static const wchar_t* wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)];
|
||||
|
||||
// 4J Stu - How many to show on each side of the main control
|
||||
static const int sidePreviewControls = 4;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
// #include <system_service.h>
|
||||
#include <csignal>
|
||||
|
||||
#include "util/StringHelpers.h"
|
||||
|
||||
#if defined(__linux__) && defined(__GLIBC__)
|
||||
#include <execinfo.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ BufferedImage::BufferedImage(const std::wstring& File,
|
|||
|
||||
for (int l = 0; l < 10; l++) {
|
||||
std::wstring mipSuffix =
|
||||
(l != 0) ? L"MipMapLevel" + _toString<int>(l + 1) : L"";
|
||||
(l != 0) ? L"MipMapLevel" + toWString<int>(l + 1) : L"";
|
||||
std::wstring fileName = baseName + mipSuffix + L".png";
|
||||
std::wstring finalPath;
|
||||
bool foundOnDisk = false;
|
||||
|
|
@ -133,7 +133,7 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::wstring& File,
|
|||
for (int l = 0; l < 10; l++) {
|
||||
std::wstring name;
|
||||
std::wstring mipMapPath =
|
||||
(l != 0) ? L"MipMapLevel" + _toString<int>(l + 1) : L"";
|
||||
(l != 0) ? L"MipMapLevel" + toWString<int>(l + 1) : L"";
|
||||
name = L"res" + (filenameHasExtension
|
||||
? filePath
|
||||
: filePath.substr(0, filePath.length() - 4) +
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "util/Definitions.h" // 4jcraft TODO
|
||||
#include <bit>
|
||||
|
||||
class IntBuffer;
|
||||
class FloatBuffer;
|
||||
|
|
@ -12,7 +12,7 @@ class FloatBuffer;
|
|||
class ByteBuffer : public Buffer {
|
||||
protected:
|
||||
uint8_t* buffer;
|
||||
ByteOrder byteOrder;
|
||||
std::endian byteOrder;
|
||||
|
||||
public:
|
||||
ByteBuffer(unsigned int capacity);
|
||||
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
static ByteBuffer* wrap(std::vector<uint8_t>& b);
|
||||
static ByteBuffer* allocate(unsigned int capacity);
|
||||
void order(ByteOrder a);
|
||||
void order(std::endian a);
|
||||
ByteBuffer* flip();
|
||||
uint8_t* getBuffer();
|
||||
int getSize();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ ByteBuffer::ByteBuffer(unsigned int capacity) : Buffer(capacity) {
|
|||
hasBackingArray = false;
|
||||
buffer = new uint8_t[capacity];
|
||||
memset(buffer, 0, sizeof(uint8_t) * capacity);
|
||||
byteOrder = BIGENDIAN;
|
||||
byteOrder = std::endian::big;
|
||||
}
|
||||
|
||||
// Allocates a new direct byte buffer.
|
||||
|
|
@ -71,8 +71,8 @@ ByteBuffer* ByteBuffer::allocate(unsigned int capacity) {
|
|||
|
||||
// Modifies this buffer's byte order.
|
||||
// Parameters:
|
||||
// bo - The new byte order, either BIGENDIAN or LITTLEENDIAN
|
||||
void ByteBuffer::order(ByteOrder bo) { byteOrder = bo; }
|
||||
// bo - The new byte order, either std::endian::big or std::endian::little
|
||||
void ByteBuffer::order(std::endian bo) { byteOrder = bo; }
|
||||
|
||||
// Flips this buffer. The limit is set to the current position and then the
|
||||
// position is set to zero. If the mark is defined then it is discarded.
|
||||
|
|
@ -128,9 +128,9 @@ int ByteBuffer::getInt() {
|
|||
|
||||
m_position += 4;
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
value = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
value = b1 | (b2 << 8) | (b3 << 16) | (b4 << 24);
|
||||
}
|
||||
return value;
|
||||
|
|
@ -153,9 +153,9 @@ int ByteBuffer::getInt(unsigned int index) {
|
|||
int b3 = static_cast<int>(buffer[index + 2]);
|
||||
int b4 = static_cast<int>(buffer[index + 3]);
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
value = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
value = b1 | (b2 << 8) | (b3 << 16) | (b4 << 24);
|
||||
}
|
||||
return value;
|
||||
|
|
@ -184,10 +184,10 @@ int64_t ByteBuffer::getLong() {
|
|||
|
||||
m_position += 8;
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
value = (b1 << 56) | (b2 << 48) | (b3 << 40) | (b4 << 32) | (b5 << 24) |
|
||||
(b6 << 16) | (b7 << 8) | b8;
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
value = b1 | (b2 << 8) | (b3 << 16) | (b4 << 24) | (b5 << 32) |
|
||||
(b6 << 40) | (b7 << 48) | (b8 << 56);
|
||||
}
|
||||
|
|
@ -211,9 +211,9 @@ short ByteBuffer::getShort() {
|
|||
|
||||
m_position += 2;
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
value = (b1 << 8) | b2;
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
value = b1 | (b2 << 8);
|
||||
}
|
||||
return value;
|
||||
|
|
@ -259,12 +259,12 @@ ByteBuffer* ByteBuffer::put(int index, uint8_t b) {
|
|||
ByteBuffer* ByteBuffer::putInt(int value) {
|
||||
assert(m_position + 3 < m_limit);
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
buffer[m_position] = static_cast<uint8_t>((value >> 24) & 0xFF);
|
||||
buffer[m_position + 1] = static_cast<uint8_t>((value >> 16) & 0xFF);
|
||||
buffer[m_position + 2] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
buffer[m_position + 3] = static_cast<uint8_t>(value & 0xFF);
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
buffer[m_position] = static_cast<uint8_t>(value & 0xFF);
|
||||
buffer[m_position + 1] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
buffer[m_position + 2] = static_cast<uint8_t>((value >> 16) & 0xFF);
|
||||
|
|
@ -288,12 +288,12 @@ ByteBuffer* ByteBuffer::putInt(int value) {
|
|||
ByteBuffer* ByteBuffer::putInt(unsigned int index, int value) {
|
||||
assert(index + 3 < m_limit);
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
buffer[index] = static_cast<uint8_t>((value >> 24) & 0xFF);
|
||||
buffer[index + 1] = static_cast<uint8_t>((value >> 16) & 0xFF);
|
||||
buffer[index + 2] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
buffer[index + 3] = static_cast<uint8_t>(value & 0xFF);
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
buffer[index] = static_cast<uint8_t>(value & 0xFF);
|
||||
buffer[index + 1] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
buffer[index + 2] = static_cast<uint8_t>((value >> 16) & 0xFF);
|
||||
|
|
@ -315,10 +315,10 @@ ByteBuffer* ByteBuffer::putInt(unsigned int index, int value) {
|
|||
ByteBuffer* ByteBuffer::putShort(short value) {
|
||||
assert(m_position + 1 < m_limit);
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
buffer[m_position] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
buffer[m_position + 1] = static_cast<uint8_t>(value & 0xFF);
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
buffer[m_position] = static_cast<uint8_t>(value & 0xFF);
|
||||
buffer[m_position + 1] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
}
|
||||
|
|
@ -351,7 +351,7 @@ ByteBuffer* ByteBuffer::putShortArray(std::vector<short>& s) {
|
|||
ByteBuffer* ByteBuffer::putLong(int64_t value) {
|
||||
assert(m_position + 7 < m_limit);
|
||||
|
||||
if (byteOrder == BIGENDIAN) {
|
||||
if (byteOrder == std::endian::big) {
|
||||
buffer[m_position] = static_cast<uint8_t>((value >> 56) & 0xFF);
|
||||
buffer[m_position + 1] = static_cast<uint8_t>((value >> 48) & 0xFF);
|
||||
buffer[m_position + 2] = static_cast<uint8_t>((value >> 40) & 0xFF);
|
||||
|
|
@ -360,7 +360,7 @@ ByteBuffer* ByteBuffer::putLong(int64_t value) {
|
|||
buffer[m_position + 5] = static_cast<uint8_t>((value >> 16) & 0xFF);
|
||||
buffer[m_position + 6] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
buffer[m_position + 7] = static_cast<uint8_t>(value & 0xFF);
|
||||
} else if (byteOrder == LITTLEENDIAN) {
|
||||
} else if (byteOrder == std::endian::little) {
|
||||
buffer[m_position] = static_cast<uint8_t>((value & 0xFF));
|
||||
buffer[m_position + 1] = static_cast<uint8_t>((value >> 8) & 0xFF);
|
||||
buffer[m_position + 2] = static_cast<uint8_t>((value >> 16) & 0xFF);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void MemoryTracker::release() {
|
|||
}
|
||||
|
||||
ByteBuffer* MemoryTracker::createByteBuffer(int size) {
|
||||
// 4J - was ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder())
|
||||
// 4J - was ByteBuffer.allocateDirect(size).order(std::endian.nativeOrder())
|
||||
ByteBuffer* bb = ByteBuffer::allocate(size);
|
||||
return bb;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1772,8 +1772,8 @@ void Minecraft::run_middle() {
|
|||
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
while (System::nanoTime() >= lastTime + 1000000000) {
|
||||
fpsString = _toString<int>(frames) + L" fps, " +
|
||||
_toString<int>(Chunk::updates) +
|
||||
fpsString = toWString<int>(frames) + L" fps, " +
|
||||
toWString<int>(Chunk::updates) +
|
||||
L" chunk updates";
|
||||
Chunk::updates = 0;
|
||||
lastTime += 1000000000;
|
||||
|
|
@ -3959,7 +3959,7 @@ void Minecraft::fileDownloaded(const std::wstring& name, File* file) {
|
|||
std::wstring Minecraft::gatherStats1() {
|
||||
// return levelRenderer->gatherStats1();
|
||||
return L"Time to autosave: " +
|
||||
_toString<int64_t>(app.SecondsToAutosave()) + L"s";
|
||||
toWString<int64_t>(app.SecondsToAutosave()) + L"s";
|
||||
}
|
||||
|
||||
std::wstring Minecraft::gatherStats2() {
|
||||
|
|
@ -4135,7 +4135,7 @@ void Minecraft::startAndConnectTo(const std::wstring& name,
|
|||
minecraft->user = new User(userName, sid);
|
||||
} else {
|
||||
minecraft->user = new User(
|
||||
L"Player" + _toString<int>(System::currentTimeMillis() % 1000),
|
||||
L"Player" + toWString<int>(System::currentTimeMillis() % 1000),
|
||||
L"");
|
||||
}
|
||||
}
|
||||
|
|
@ -4206,7 +4206,7 @@ void Minecraft::main() {
|
|||
// 4J-PB - Can't call this for the first 5 seconds of a game - MS rule
|
||||
{
|
||||
name =
|
||||
L"Player" + _toString<int64_t>(System::currentTimeMillis() % 1000);
|
||||
L"Player" + toWString<int64_t>(System::currentTimeMillis() % 1000);
|
||||
sessionId = L"-";
|
||||
/* 4J - TODO - get a session ID from somewhere?
|
||||
if (args.size() > 0) name = args[0];
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ std::wstring Options::getMessage(const Options::Option* item) {
|
|||
return caption +
|
||||
language->getElement(L"options.sensitivity.max");
|
||||
}
|
||||
return caption + _toString<int>((int)(progressValue * 200)) + L"%";
|
||||
return caption + toWString<int>((int)(progressValue * 200)) + L"%";
|
||||
} else if (item == Option::FOV) {
|
||||
if (progressValue == 0) {
|
||||
return caption + language->getElement(L"options.fov.min");
|
||||
|
|
@ -320,7 +320,7 @@ std::wstring Options::getMessage(const Options::Option* item) {
|
|||
if (progressValue == 1) {
|
||||
return caption + language->getElement(L"options.fov.max");
|
||||
}
|
||||
return caption + _toString<int>((int)(70 + progressValue * 40));
|
||||
return caption + toWString<int>((int)(70 + progressValue * 40));
|
||||
} else if (item == Option::GAMMA) {
|
||||
if (progressValue == 0) {
|
||||
return caption + language->getElement(L"options.gamma.min");
|
||||
|
|
@ -328,13 +328,13 @@ std::wstring Options::getMessage(const Options::Option* item) {
|
|||
if (progressValue == 1) {
|
||||
return caption + language->getElement(L"options.gamma.max");
|
||||
}
|
||||
return caption + L"+" + _toString<int>((int)(progressValue * 100)) +
|
||||
return caption + L"+" + toWString<int>((int)(progressValue * 100)) +
|
||||
L"%";
|
||||
} else {
|
||||
if (progressValue == 0) {
|
||||
return caption + language->getElement(L"options.off");
|
||||
}
|
||||
return caption + _toString<int>((int)(progressValue * 100)) + L"%";
|
||||
return caption + toWString<int>((int)(progressValue * 100)) + L"%";
|
||||
}
|
||||
} else if (item->isBoolean()) {
|
||||
bool booleanValue = getBooleanValue(item);
|
||||
|
|
@ -395,14 +395,14 @@ void Options::load() {
|
|||
if (cmds[0] == L"gamma") gamma = readFloat(cmds[1]);
|
||||
if (cmds[0] == L"invertYMouse") invertYMouse = cmds[1] == L"true";
|
||||
if (cmds[0] == L"viewDistance")
|
||||
viewDistance = _fromString<int>(cmds[1]);
|
||||
if (cmds[0] == L"guiScale") guiScale = _fromString<int>(cmds[1]);
|
||||
if (cmds[0] == L"particles") particles = _fromString<int>(cmds[1]);
|
||||
viewDistance = fromWString<int>(cmds[1]);
|
||||
if (cmds[0] == L"guiScale") guiScale = fromWString<int>(cmds[1]);
|
||||
if (cmds[0] == L"particles") particles = fromWString<int>(cmds[1]);
|
||||
if (cmds[0] == L"bobView") bobView = cmds[1] == L"true";
|
||||
if (cmds[0] == L"anaglyph3d") anaglyph3d = cmds[1] == L"true";
|
||||
if (cmds[0] == L"advancedOpengl") advancedOpengl = cmds[1] == L"true";
|
||||
if (cmds[0] == L"fpsLimit") framerateLimit = _fromString<int>(cmds[1]);
|
||||
if (cmds[0] == L"difficulty") difficulty = _fromString<int>(cmds[1]);
|
||||
if (cmds[0] == L"fpsLimit") framerateLimit = fromWString<int>(cmds[1]);
|
||||
if (cmds[0] == L"difficulty") difficulty = fromWString<int>(cmds[1]);
|
||||
if (cmds[0] == L"fancyGraphics") fancyGraphics = cmds[1] == L"true";
|
||||
if (cmds[0] == L"ao") ambientOcclusion = cmds[1] == L"true";
|
||||
if (cmds[0] == L"clouds") renderClouds = cmds[1] == L"true";
|
||||
|
|
@ -411,7 +411,7 @@ void Options::load() {
|
|||
|
||||
for (int i = 0; i < keyMappings_length; i++) {
|
||||
if (cmds[0] == (L"key_" + keyMappings[i]->name)) {
|
||||
keyMappings[i]->key = _fromString<int>(cmds[1]);
|
||||
keyMappings[i]->key = fromWString<int>(cmds[1]);
|
||||
}
|
||||
}
|
||||
// } catch (Exception e) {
|
||||
|
|
@ -429,7 +429,7 @@ void Options::load() {
|
|||
float Options::readFloat(std::wstring string) {
|
||||
if (string == L"true") return 1;
|
||||
if (string == L"false") return 0;
|
||||
return _fromString<float>(string);
|
||||
return fromWString<float>(string);
|
||||
}
|
||||
|
||||
void Options::save() {
|
||||
|
|
@ -442,34 +442,34 @@ void Options::save() {
|
|||
DataOutputStream dos = DataOutputStream(&fos);
|
||||
// PrintWriter pw = new PrintWriter(new FileWriter(optionsFile));
|
||||
|
||||
dos.writeChars(L"music:" + _toString<float>(music) + L"\n");
|
||||
dos.writeChars(L"sound:" + _toString<float>(sound) + L"\n");
|
||||
dos.writeChars(L"music:" + toWString<float>(music) + L"\n");
|
||||
dos.writeChars(L"sound:" + toWString<float>(sound) + L"\n");
|
||||
dos.writeChars(L"invertYMouse:" +
|
||||
std::wstring(invertYMouse ? L"true" : L"false") + L"\n");
|
||||
dos.writeChars(L"mouseSensitivity:" + _toString<float>(sensitivity));
|
||||
dos.writeChars(L"fov:" + _toString<float>(fov));
|
||||
dos.writeChars(L"gamma:" + _toString<float>(gamma));
|
||||
dos.writeChars(L"viewDistance:" + _toString<int>(viewDistance));
|
||||
dos.writeChars(L"guiScale:" + _toString<int>(guiScale));
|
||||
dos.writeChars(L"particles:" + _toString<int>(particles));
|
||||
dos.writeChars(L"mouseSensitivity:" + toWString<float>(sensitivity));
|
||||
dos.writeChars(L"fov:" + toWString<float>(fov));
|
||||
dos.writeChars(L"gamma:" + toWString<float>(gamma));
|
||||
dos.writeChars(L"viewDistance:" + toWString<int>(viewDistance));
|
||||
dos.writeChars(L"guiScale:" + toWString<int>(guiScale));
|
||||
dos.writeChars(L"particles:" + toWString<int>(particles));
|
||||
dos.writeChars(L"bobView:" + std::wstring(bobView ? L"true" : L"false"));
|
||||
dos.writeChars(L"anaglyph3d:" +
|
||||
std::wstring(anaglyph3d ? L"true" : L"false"));
|
||||
dos.writeChars(L"advancedOpengl:" +
|
||||
std::wstring(advancedOpengl ? L"true" : L"false"));
|
||||
dos.writeChars(L"fpsLimit:" + _toString<int>(framerateLimit));
|
||||
dos.writeChars(L"difficulty:" + _toString<int>(difficulty));
|
||||
dos.writeChars(L"fpsLimit:" + toWString<int>(framerateLimit));
|
||||
dos.writeChars(L"difficulty:" + toWString<int>(difficulty));
|
||||
dos.writeChars(L"fancyGraphics:" +
|
||||
std::wstring(fancyGraphics ? L"true" : L"false"));
|
||||
dos.writeChars(L"ao:" +
|
||||
std::wstring(ambientOcclusion ? L"true" : L"false"));
|
||||
dos.writeChars(L"clouds:" + _toString<bool>(renderClouds));
|
||||
dos.writeChars(L"clouds:" + toWString<bool>(renderClouds));
|
||||
dos.writeChars(L"skin:" + skin);
|
||||
dos.writeChars(L"lastServer:" + lastMpIp);
|
||||
|
||||
for (int i = 0; i < keyMappings_length; i++) {
|
||||
dos.writeChars(L"key_" + keyMappings[i]->name + L":" +
|
||||
_toString<int>(keyMappings[i]->key));
|
||||
toWString<int>(keyMappings[i]->key));
|
||||
}
|
||||
|
||||
dos.close();
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ void CreateWorldScreen::buttonClicked(Button* button) {
|
|||
if (seedString.length() != 0) {
|
||||
// try to convert it to a long first
|
||||
// try { // 4J - removed try/catch
|
||||
int64_t value = _fromString<int64_t>(seedString);
|
||||
int64_t value = fromWString<int64_t>(seedString);
|
||||
|
||||
bool isNumber = true;
|
||||
for (unsigned int i = 0; i < seedString.length(); ++i) {
|
||||
|
|
@ -227,7 +227,7 @@ void CreateWorldScreen::buttonClicked(Button* button) {
|
|||
}
|
||||
}
|
||||
|
||||
if (isNumber) value = _fromString<int64_t>(seedString);
|
||||
if (isNumber) value = fromWString<int64_t>(seedString);
|
||||
|
||||
if (value != 0) {
|
||||
seedValue = value;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void DeathScreen::render(int xm, int ym, float a) {
|
|||
drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff);
|
||||
glPopMatrix();
|
||||
drawCenteredString(font,
|
||||
L"Score: &e" + _toString(minecraft->player->getScore()),
|
||||
L"Score: &e" + toWString(minecraft->player->getScore()),
|
||||
width / 2, 100, 0xffffff);
|
||||
|
||||
Screen::render(xm, ym, a);
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ void Font::loadUnicodePage(int page)
|
|||
//try
|
||||
//{
|
||||
// image =
|
||||
ImageIO.read(Textures.class.getResourceAsStream(fileName.toString()));
|
||||
ImageIO.read(Textures.class.getResourceAsStream(fileName.toWString()));
|
||||
//}
|
||||
//catch (IOException e)
|
||||
//{
|
||||
|
|
|
|||
|
|
@ -955,7 +955,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||
iSafezoneXHalf + 2, 20, 0xffffff);
|
||||
font->drawShadow(
|
||||
L"Seed: " +
|
||||
_toString<int64_t>(minecraft->level->getLevelData()->getSeed()),
|
||||
toWString<int64_t>(minecraft->level->getLevelData()->getSeed()),
|
||||
iSafezoneXHalf + 2, 32 + 00, 0xffffff);
|
||||
font->drawShadow(minecraft->gatherStats1(), iSafezoneXHalf + 2, 32 + 10,
|
||||
0xffffff);
|
||||
|
|
@ -981,8 +981,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||
FEATURE_DATA* pFeatureData = app.m_vTerrainFeatures[i];
|
||||
|
||||
std::wstring itemInfo =
|
||||
L"[" + _toString<int>(pFeatureData->x * 16) + L", " +
|
||||
_toString<int>(pFeatureData->z * 16) + L"] ";
|
||||
L"[" + toWString<int>(pFeatureData->x * 16) + L", " +
|
||||
toWString<int>(pFeatureData->z * 16) + L"] ";
|
||||
wfeature[pFeatureData->eTerrainFeature] += itemInfo;
|
||||
}
|
||||
|
||||
|
|
@ -1014,28 +1014,28 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
|
|||
double yBlockPos = floor(minecraft->player->y);
|
||||
double zBlockPos = floor(minecraft->player->z);
|
||||
drawString(font,
|
||||
L"x: " + _toString<double>(minecraft->player->x) +
|
||||
L"/ Head: " + _toString<double>(xBlockPos) +
|
||||
L"x: " + toWString<double>(minecraft->player->x) +
|
||||
L"/ Head: " + toWString<double>(xBlockPos) +
|
||||
L"/ Chunk: " +
|
||||
_toString<double>(minecraft->player->xChunk),
|
||||
toWString<double>(minecraft->player->xChunk),
|
||||
iSafezoneXHalf + 2, iYPos + 8 * 0, 0xe0e0e0);
|
||||
drawString(font,
|
||||
L"y: " + _toString<double>(minecraft->player->y) +
|
||||
L"/ Head: " + _toString<double>(yBlockPos),
|
||||
L"y: " + toWString<double>(minecraft->player->y) +
|
||||
L"/ Head: " + toWString<double>(yBlockPos),
|
||||
iSafezoneXHalf + 2, iYPos + 8 * 1, 0xe0e0e0);
|
||||
drawString(font,
|
||||
L"z: " + _toString<double>(minecraft->player->z) +
|
||||
L"/ Head: " + _toString<double>(zBlockPos) +
|
||||
L"z: " + toWString<double>(minecraft->player->z) +
|
||||
L"/ Head: " + toWString<double>(zBlockPos) +
|
||||
L"/ Chunk: " +
|
||||
_toString<double>(minecraft->player->zChunk),
|
||||
toWString<double>(minecraft->player->zChunk),
|
||||
iSafezoneXHalf + 2, iYPos + 8 * 2, 0xe0e0e0);
|
||||
drawString(
|
||||
font,
|
||||
L"f: " +
|
||||
_toString<double>(
|
||||
toWString<double>(
|
||||
Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) &
|
||||
0x3) +
|
||||
L"/ yRot: " + _toString<double>(minecraft->player->yRot),
|
||||
L"/ yRot: " + toWString<double>(minecraft->player->yRot),
|
||||
iSafezoneXHalf + 2, iYPos + 8 * 3, 0xe0e0e0);
|
||||
iYPos += 8 * 4;
|
||||
|
||||
|
|
@ -1049,7 +1049,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
|
|||
px & 15, pz & 15, minecraft->level->getBiomeSource());
|
||||
drawString(font,
|
||||
L"b: " + biome->m_name + L" (" +
|
||||
_toString<int>(biome->id) + L")",
|
||||
toWString<int>(biome->id) + L")",
|
||||
iSafezoneXHalf + 2, iYPos, 0xe0e0e0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void JoinMultiplayerScreen::buttonClicked(Button* button) {
|
|||
}
|
||||
|
||||
int JoinMultiplayerScreen::parseInt(const std::wstring& str, int def) {
|
||||
return _fromString<int>(str);
|
||||
return fromWString<int>(str);
|
||||
}
|
||||
|
||||
void JoinMultiplayerScreen::keyPressed(wchar_t ch, int eventKey) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ std::wstring SelectWorldScreen::getWorldName(int id) {
|
|||
if (levelName.length() == 0) {
|
||||
Language* language = Language::getInstance();
|
||||
levelName = language->getElement(L"selectWorld.world") + L" " +
|
||||
_toString<int>(id + 1);
|
||||
toWString<int>(id + 1);
|
||||
}
|
||||
|
||||
return levelName;
|
||||
|
|
@ -142,7 +142,7 @@ void SelectWorldScreen::worldSelected(int id) {
|
|||
std::wstring worldFolderName = getWorldId(id);
|
||||
if (worldFolderName == L"") // 4J - was nullptr comparison
|
||||
{
|
||||
worldFolderName = L"World" + _toString<int>(id);
|
||||
worldFolderName = L"World" + toWString<int>(id);
|
||||
}
|
||||
// 4J Stu - Not used, so commenting to stop the build failing
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y,
|
|||
|
||||
std::wstring name = levelSummary->getLevelName();
|
||||
if (name.length() == 0) {
|
||||
name = parent->worldLang + L" " + _toString<int>(i + 1);
|
||||
name = parent->worldLang + L" " + toWString<int>(i + 1);
|
||||
}
|
||||
|
||||
std::wstring id = levelSummary->getLevelId();
|
||||
|
|
@ -276,7 +276,7 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y,
|
|||
id = id + L" (" + buffer;
|
||||
|
||||
int64_t size = levelSummary->getSizeOnDisk();
|
||||
id = id + L", " + _toString<float>(size / 1024 * 100 / 1024 / 100.0f) +
|
||||
id = id + L", " + toWString<float>(size / 1024 * 100 / 1024 / 100.0f) +
|
||||
L" MB)";
|
||||
std::wstring info;
|
||||
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ std::wstring MultiPlayerChunkCache::gatherStats() {
|
|||
std::lock_guard<std::mutex> lock(m_csLoadCreate);
|
||||
size = (int)loadedChunkList.size();
|
||||
}
|
||||
return L"MultiplayerChunkCache: " + _toString<int>(size);
|
||||
return L"MultiplayerChunkCache: " + toWString<int>(size);
|
||||
}
|
||||
|
||||
void MultiPlayerChunkCache::dataReceived(int x, int z) {
|
||||
|
|
|
|||
|
|
@ -288,5 +288,5 @@ std::wstring ParticleEngine::countParticles() {
|
|||
total += particles[l][tt][list].size();
|
||||
}
|
||||
}
|
||||
return _toString<int>(total);
|
||||
return toWString<int>(total);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -674,18 +674,18 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) {
|
|||
}
|
||||
|
||||
std::wstring LevelRenderer::gatherStats1() {
|
||||
return L"C: " + _toString<int>(renderedChunks) + L"/" +
|
||||
_toString<int>(totalChunks) + L". F: " +
|
||||
_toString<int>(offscreenChunks) + L", O: " +
|
||||
_toString<int>(occludedChunks) + L", E: " +
|
||||
_toString<int>(emptyChunks);
|
||||
return L"C: " + toWString<int>(renderedChunks) + L"/" +
|
||||
toWString<int>(totalChunks) + L". F: " +
|
||||
toWString<int>(offscreenChunks) + L", O: " +
|
||||
toWString<int>(occludedChunks) + L", E: " +
|
||||
toWString<int>(emptyChunks);
|
||||
}
|
||||
|
||||
std::wstring LevelRenderer::gatherStats2() {
|
||||
return L"E: " + _toString<int>(renderedEntities) + L"/" +
|
||||
_toString<int>(totalEntities) + L". B: " +
|
||||
_toString<int>(culledEntities) + L", I: " +
|
||||
_toString<int>((totalEntities - culledEntities) - renderedEntities);
|
||||
return L"E: " + toWString<int>(renderedEntities) + L"/" +
|
||||
toWString<int>(totalEntities) + L". B: " +
|
||||
toWString<int>(culledEntities) + L", I: " +
|
||||
toWString<int>((totalEntities - culledEntities) - renderedEntities);
|
||||
}
|
||||
|
||||
void LevelRenderer::resortChunks(int xc, int yc, int zc) {
|
||||
|
|
@ -3618,7 +3618,7 @@ void LevelRenderer::registerTextures(IconRegister* iconRegister) {
|
|||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
breakingTextures[i] =
|
||||
iconRegister->registerIcon(L"destroy_" + _toString(i));
|
||||
iconRegister->registerIcon(L"destroy_" + toWString(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ ResourceLocation* HumanoidMobRenderer::getArmorLocation(ArmorItem* armorItem,
|
|||
std::wstring path =
|
||||
std::wstring(L"armor/" + MATERIAL_NAMES[armorItem->modelIndex])
|
||||
.append(L"_")
|
||||
.append(_toString<int>(layer == 2 ? 2 : 1))
|
||||
.append(toWString<int>(layer == 2 ? 2 : 1))
|
||||
.append((overlay ? L"_b" : L""))
|
||||
.append(L".png");
|
||||
|
||||
|
|
|
|||
|
|
@ -597,9 +597,9 @@ void ItemRenderer::renderGuiItemDecorations(Font* font, Textures* textures,
|
|||
if (amount.empty()) {
|
||||
int count = item->count;
|
||||
if (count > 64) {
|
||||
amount = _toString<int>(64) + L"+";
|
||||
amount = toWString<int>(64) + L"+";
|
||||
} else {
|
||||
amount = _toString<int>(item->count);
|
||||
amount = toWString<int>(item->count);
|
||||
}
|
||||
}
|
||||
glDisable(GL_LIGHTING);
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ void StitchSlot::collectAssignments(std::vector<StitchSlot*>* result) {
|
|||
|
||||
//@Override
|
||||
std::wstring StitchSlot::toString() {
|
||||
return L"Slot{originX=" + _toString(originX) + L", originY=" +
|
||||
_toString(originY) + L", width=" + _toString(width) + L", height=" +
|
||||
_toString(height) + L", texture=" + _toString(textureHolder) +
|
||||
L", subSlots=" + _toString(subSlots) + L'}';
|
||||
return L"Slot{originX=" + toWString(originX) + L", originY=" +
|
||||
toWString(originY) + L", width=" + toWString(width) + L", height=" +
|
||||
toWString(height) + L", texture=" + toWString(textureHolder) +
|
||||
L", subSlots=" + toWString(subSlots) + L'}';
|
||||
}
|
||||
|
|
@ -226,11 +226,11 @@ void StitchedTexture::loadAnimationFrames(BufferedReader* bufferedReader) {
|
|||
std::wstring token = *it;
|
||||
int multiPos = token.find_first_of('*');
|
||||
if (multiPos > 0) {
|
||||
int frame = _fromString<int>(token.substr(0, multiPos));
|
||||
int count = _fromString<int>(token.substr(multiPos + 1));
|
||||
int frame = fromWString<int>(token.substr(0, multiPos));
|
||||
int count = fromWString<int>(token.substr(multiPos + 1));
|
||||
results->push_back(intPairVector::value_type(frame, count));
|
||||
} else {
|
||||
int tokenVal = _fromString<int>(token);
|
||||
int tokenVal = fromWString<int>(token);
|
||||
results->push_back(intPairVector::value_type(tokenVal, 1));
|
||||
}
|
||||
}
|
||||
|
|
@ -266,11 +266,11 @@ void StitchedTexture::loadAnimationFrames(const std::wstring& string) {
|
|||
std::wstring token = trimString(*it);
|
||||
int multiPos = token.find_first_of('*');
|
||||
if (multiPos > 0) {
|
||||
int frame = _fromString<int>(token.substr(0, multiPos));
|
||||
int count = _fromString<int>(token.substr(multiPos + 1));
|
||||
int frame = fromWString<int>(token.substr(0, multiPos));
|
||||
int count = fromWString<int>(token.substr(multiPos + 1));
|
||||
results->push_back(intPairVector::value_type(frame, count));
|
||||
} else if (!token.empty()) {
|
||||
int tokenVal = _fromString<int>(token);
|
||||
int tokenVal = fromWString<int>(token);
|
||||
results->push_back(intPairVector::value_type(tokenVal, 1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ void TextureHolder::setForcedScale(int targetSize) {
|
|||
|
||||
//@Override
|
||||
std::wstring TextureHolder::toString() {
|
||||
return L"TextureHolder{width=" + _toString(width) + L", height=" +
|
||||
_toString(height) + L'}';
|
||||
return L"TextureHolder{width=" + toWString(width) + L", height=" +
|
||||
toWString(height) + L'}';
|
||||
}
|
||||
|
||||
int TextureHolder::compareTo(const TextureHolder* other) const {
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ bool Connection::readTick() {
|
|||
void handleException(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
close("disconnect.genericReason", "Internal exception: " + e.toString());
|
||||
close("disconnect.genericReason", "Internal exception: " + e.toWString());
|
||||
}*/
|
||||
|
||||
void Connection::close(DisconnectPacket::eDisconnectReason reason) {
|
||||
|
|
|
|||
|
|
@ -519,13 +519,13 @@ std::shared_ptr<Packet> Packet::readPacket(
|
|||
__debugbreak();
|
||||
assert(false);
|
||||
// throw new IOException(wstring(L"Bad packet id ") +
|
||||
// _toString<int>(id));
|
||||
// toWString<int>(id));
|
||||
}
|
||||
|
||||
packet = getPacket(id);
|
||||
if (packet == nullptr)
|
||||
assert(false); // throw new IOException(wstring(L"Bad packet id ") +
|
||||
// _toString<int>(id));
|
||||
// toWString<int>(id));
|
||||
|
||||
// app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client",
|
||||
// packet->getId());
|
||||
|
|
|
|||
|
|
@ -20,22 +20,22 @@ std::wstring Settings::getString(const std::wstring& key,
|
|||
|
||||
int Settings::getInt(const std::wstring& key, int defaultValue) {
|
||||
if (properties.find(key) == properties.end()) {
|
||||
properties[key] = _toString<int>(defaultValue);
|
||||
properties[key] = toWString<int>(defaultValue);
|
||||
saveProperties();
|
||||
}
|
||||
return _fromString<int>(properties[key]);
|
||||
return fromWString<int>(properties[key]);
|
||||
}
|
||||
|
||||
bool Settings::getBoolean(const std::wstring& key, bool defaultValue) {
|
||||
if (properties.find(key) == properties.end()) {
|
||||
properties[key] = _toString<bool>(defaultValue);
|
||||
properties[key] = toWString<bool>(defaultValue);
|
||||
saveProperties();
|
||||
}
|
||||
bool retval = _fromString<bool>(properties[key]);
|
||||
bool retval = fromWString<bool>(properties[key]);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Settings::setBooleanAndSave(const std::wstring& key, bool value) {
|
||||
properties[key] = _toString<bool>(value);
|
||||
properties[key] = toWString<bool>(value);
|
||||
saveProperties();
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ void DemoMode::tick() {
|
|||
if (day <= (DEMO_DAYS + 1))
|
||||
{
|
||||
minecraft->gui->displayClientMessage(L"demo.day." +
|
||||
_toString<int64_t>(day));
|
||||
toWString<int64_t>(day));
|
||||
}
|
||||
}
|
||||
else if (day == 1)
|
||||
|
|
|
|||
|
|
@ -821,8 +821,8 @@ bool ServerChunkCache::tick() {
|
|||
bool ServerChunkCache::shouldSave() { return !level->noSave; }
|
||||
|
||||
std::wstring ServerChunkCache::gatherStats() {
|
||||
return L"ServerChunkCache: "; // + _toString<int>(loadedChunks.size()) + L"
|
||||
// Drop: " + _toString<int>(toDrop.size());
|
||||
return L"ServerChunkCache: "; // + toWString<int>(loadedChunks.size()) + L"
|
||||
// Drop: " + toWString<int>(toDrop.size());
|
||||
}
|
||||
|
||||
std::vector<Biome::MobSpawnerData*>* ServerChunkCache::getMobsAt(
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ void ServerConnection::NewIncomingSocket(Socket* socket) {
|
|||
std::shared_ptr<PendingConnection> unconnectedClient =
|
||||
std::make_shared<PendingConnection>(
|
||||
server, socket,
|
||||
L"Connection #" + _toString<int>(connectionCounter++));
|
||||
L"Connection #" + toWString<int>(connectionCounter++));
|
||||
handleConnection(unconnectedClient);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ std::wstring Stat::TimeFormatter::format(int value) {
|
|||
return decimalFormat->format(minutes) + L" m";
|
||||
}
|
||||
|
||||
return _toString<double>(seconds) + L" s";
|
||||
return toWString<double>(seconds) + L" s";
|
||||
}
|
||||
|
||||
std::wstring Stat::DefaultFormat::format(int value) {
|
||||
|
|
@ -90,5 +90,5 @@ std::wstring Stat::DistanceFormatter::format(int cm) {
|
|||
} else if (meters > 0.5) {
|
||||
return decimalFormat->format(meters) + L" m";
|
||||
}
|
||||
return _toString<int>(cm) + L" cm";
|
||||
return toWString<int>(cm) + L" cm";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -624,7 +624,7 @@ void Stats::buildAdditionalStats() {
|
|||
rainbowCollection = std::vector<Stat*>(16);
|
||||
for (unsigned int i = 0; i < 16; i++) {
|
||||
generalStat = new GeneralStat(
|
||||
offset++, L"rainbowCollection." + _toString<unsigned int>(i));
|
||||
offset++, L"rainbowCollection." + toWString<unsigned int>(i));
|
||||
generalStats->push_back(generalStat);
|
||||
rainbowCollection[i] = generalStat;
|
||||
generalStat->postConstruct();
|
||||
|
|
@ -633,7 +633,7 @@ void Stats::buildAdditionalStats() {
|
|||
biomesVisisted = std::vector<Stat*>(23);
|
||||
for (unsigned int i = 0; i < 23; i++) {
|
||||
generalStat = new GeneralStat(
|
||||
offset++, L"biomesVisited." + _toString<unsigned int>(i));
|
||||
offset++, L"biomesVisited." + toWString<unsigned int>(i));
|
||||
generalStats->push_back(generalStat);
|
||||
biomesVisisted[i] = generalStat;
|
||||
generalStat->postConstruct();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ std::wstring Hasher::getHash(std::wstring& name) {
|
|||
// return new BigInteger(1, m.digest()).toString(16);
|
||||
|
||||
// TODO 4J Stu - Will this hash us with the same distribution as the MD5?
|
||||
return _toString(hash_value(s));
|
||||
return toString(hash_value(s));
|
||||
//}
|
||||
// catch (NoSuchAlgorithmException e)
|
||||
//{
|
||||
|
|
|
|||
|
|
@ -1737,7 +1737,7 @@ std::wstring Entity::getAName() {
|
|||
#ifdef _DEBUG
|
||||
std::wstring id = EntityIO::getEncodeId(shared_from_this());
|
||||
if (id.empty()) id = L"generic";
|
||||
return L"entity." + id + _toString(entityId);
|
||||
return L"entity." + id + toWString(entityId);
|
||||
#else
|
||||
return L"";
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ void Mob::addAdditonalSaveData(CompoundTag* entityTag) {
|
|||
|
||||
ListTag<FloatTag>* dropChanceList = new ListTag<FloatTag>();
|
||||
for (int i = 0; i < dropChances.size(); i++) {
|
||||
dropChanceList->add(new FloatTag(_toString(i), dropChances[i]));
|
||||
dropChanceList->add(new FloatTag(toWString(i), dropChances[i]));
|
||||
}
|
||||
entityTag->put(L"DropChances", dropChanceList);
|
||||
entityTag->putString(L"CustomName", getCustomName());
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ void EntityHorse::rebuildLayeredTextureInfo() {
|
|||
}
|
||||
} else {
|
||||
layerTextureLayers[0] = -1;
|
||||
layerTextureHashName += L"_" + _toString<int>(type) + L"_";
|
||||
layerTextureHashName += L"_" + toWString<int>(type) + L"_";
|
||||
armorIndex = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ Player::Player(Level* level, const std::wstring& name) : LivingEntity(level) {
|
|||
rotOffs = 180;
|
||||
flameTime = 20;
|
||||
|
||||
m_skinIndex = eDefaultSkins_Skin0;
|
||||
m_skinIndex = EDefaultSkins::Skin0;
|
||||
m_playerIndex = 0;
|
||||
m_dwSkinId = 0;
|
||||
m_dwCapeId = 0;
|
||||
|
|
@ -533,7 +533,7 @@ void Player::ride(std::shared_ptr<Entity> e) {
|
|||
|
||||
void Player::setPlayerDefaultSkin(EDefaultSkins skin) {
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
wprintf(L"Setting default skin to %d for player %ls\n", skin, name.c_str());
|
||||
wprintf(L"Setting default skin to %d for player %ls\n", std::to_underlying(skin), name.c_str());
|
||||
#endif
|
||||
m_skinIndex = skin;
|
||||
}
|
||||
|
|
@ -543,7 +543,7 @@ void Player::setCustomSkin(std::uint32_t skinId) {
|
|||
wprintf(L"Attempting to set skin to %08X for player %ls\n", skinId,
|
||||
name.c_str());
|
||||
#endif
|
||||
EDefaultSkins playerSkin = eDefaultSkins_ServerSelected;
|
||||
EDefaultSkins playerSkin = EDefaultSkins::ServerSelected;
|
||||
|
||||
// reset the idle
|
||||
setIsIdle(false);
|
||||
|
|
@ -556,12 +556,12 @@ void Player::setCustomSkin(std::uint32_t skinId) {
|
|||
std::uint32_t defaultSkinIndex =
|
||||
GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId);
|
||||
if (ugcSkinIndex == 0 && defaultSkinIndex > 0) {
|
||||
playerSkin = (EDefaultSkins)defaultSkinIndex;
|
||||
playerSkin = static_cast<EDefaultSkins>(defaultSkinIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (playerSkin == eDefaultSkins_ServerSelected) {
|
||||
playerSkin = (EDefaultSkins)(m_playerIndex + 1);
|
||||
if (playerSkin == EDefaultSkins::ServerSelected) {
|
||||
playerSkin = static_cast<EDefaultSkins>(m_playerIndex + 1);
|
||||
}
|
||||
|
||||
// We always set a default skin, since we may be waiting for the player's
|
||||
|
|
@ -2266,21 +2266,21 @@ float Player::getAbsorptionAmount() {
|
|||
|
||||
int Player::getTexture() {
|
||||
switch (m_skinIndex) {
|
||||
case eDefaultSkins_Skin0:
|
||||
case EDefaultSkins::Skin0:
|
||||
return TN_MOB_CHAR; // 4J - was L"/mob/char.png";
|
||||
case eDefaultSkins_Skin1:
|
||||
case EDefaultSkins::Skin1:
|
||||
return TN_MOB_CHAR1; // 4J - was L"/mob/char1.png";
|
||||
case eDefaultSkins_Skin2:
|
||||
case EDefaultSkins::Skin2:
|
||||
return TN_MOB_CHAR2; // 4J - was L"/mob/char2.png";
|
||||
case eDefaultSkins_Skin3:
|
||||
case EDefaultSkins::Skin3:
|
||||
return TN_MOB_CHAR3; // 4J - was L"/mob/char3.png";
|
||||
case eDefaultSkins_Skin4:
|
||||
case EDefaultSkins::Skin4:
|
||||
return TN_MOB_CHAR4; // 4J - was L"/mob/char4.png";
|
||||
case eDefaultSkins_Skin5:
|
||||
case EDefaultSkins::Skin5:
|
||||
return TN_MOB_CHAR5; // 4J - was L"/mob/char5.png";
|
||||
case eDefaultSkins_Skin6:
|
||||
case EDefaultSkins::Skin6:
|
||||
return TN_MOB_CHAR6; // 4J - was L"/mob/char6.png";
|
||||
case eDefaultSkins_Skin7:
|
||||
case EDefaultSkins::Skin7:
|
||||
return TN_MOB_CHAR7; // 4J - was L"/mob/char7.png";
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
enum EDefaultSkins {
|
||||
eDefaultSkins_ServerSelected,
|
||||
eDefaultSkins_Skin0,
|
||||
eDefaultSkins_Skin1,
|
||||
eDefaultSkins_Skin2,
|
||||
eDefaultSkins_Skin3,
|
||||
eDefaultSkins_Skin4,
|
||||
eDefaultSkins_Skin5,
|
||||
eDefaultSkins_Skin6,
|
||||
eDefaultSkins_Skin7,
|
||||
#include <cstdint>
|
||||
|
||||
eDefaultSkins_Count,
|
||||
enum class EDefaultSkins : std::uint8_t {
|
||||
ServerSelected,
|
||||
Skin0,
|
||||
Skin1,
|
||||
Skin2,
|
||||
Skin3,
|
||||
Skin4,
|
||||
Skin5,
|
||||
Skin6,
|
||||
Skin7,
|
||||
|
||||
Count,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void FireworksItem::appendHoverText(std::shared_ptr<ItemInstance> itemInstance,
|
|||
if (fireTag->contains(TAG_FLIGHT)) {
|
||||
lines->push_back(
|
||||
std::wstring(app.GetString(IDS_ITEM_FIREWORKS_FLIGHT)) + L" " +
|
||||
_toString<int>((fireTag->getByte(TAG_FLIGHT))));
|
||||
toWString<int>((fireTag->getByte(TAG_FLIGHT))));
|
||||
}
|
||||
|
||||
ListTag<CompoundTag>* explosions =
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
typedef Item::Tier _Tier;
|
||||
|
||||
// const UUID Item::BASE_ATTACK_DAMAGE_UUID =
|
||||
// UUID::fromString(L"CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
// UUID::fromWString(L"CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
|
||||
std::wstring Item::ICON_DESCRIPTION_PREFIX = L"item.";
|
||||
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ std::vector<std::wstring>* ItemInstance::getHoverText(
|
|||
//{
|
||||
// if (id == Item::map_Id)
|
||||
// {
|
||||
// title += L" #" + _toString(auxValue);
|
||||
// title += L" #" + toWString(auxValue);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
|
@ -579,7 +579,7 @@ std::vector<HtmlString>* ItemInstance::getHoverText(
|
|||
|
||||
/*if (!hasCustomHoverName() && id == Item::map_Id)
|
||||
{
|
||||
title.text += L" #" + _toString(auxValue);
|
||||
title.text += L" #" + toWString(auxValue);
|
||||
}*/
|
||||
|
||||
lines->push_back(title);
|
||||
|
|
@ -661,8 +661,8 @@ std::vector<HtmlString>* ItemInstance::getHoverText(
|
|||
if (isDamaged()) {
|
||||
std::wstring damageStr =
|
||||
L"Durability: LOCALISE " +
|
||||
_toString<int>((getMaxDamage()) - getDamageValue()) + L" / " +
|
||||
_toString<int>(getMaxDamage());
|
||||
toWString<int>((getMaxDamage()) - getDamageValue()) + L" / " +
|
||||
toWString<int>(getMaxDamage());
|
||||
lines->push_back(HtmlString(damageStr));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ MapItem::MapItem(int id) : ComplexItem(id) { setStackedByData(true); }
|
|||
|
||||
std::shared_ptr<MapItemSavedData> MapItem::getSavedData(short idNum,
|
||||
Level* level) {
|
||||
std::wstring id = std::wstring(L"map_") + _toString(idNum);
|
||||
std::wstring id = std::wstring(L"map_") + toWString(idNum);
|
||||
std::shared_ptr<MapItemSavedData> mapItemSavedData =
|
||||
std::dynamic_pointer_cast<MapItemSavedData>(
|
||||
level->getSavedData(typeid(MapItemSavedData), id));
|
||||
|
|
@ -45,7 +45,7 @@ std::shared_ptr<MapItemSavedData> MapItem::getSavedData(short idNum,
|
|||
// int aux = level->getFreeAuxValueFor(L"map");
|
||||
int aux = idNum;
|
||||
|
||||
id = std::wstring(L"map_") + _toString(aux);
|
||||
id = std::wstring(L"map_") + toWString(aux);
|
||||
mapItemSavedData = std::make_shared<MapItemSavedData>(id);
|
||||
|
||||
level->setSavedData(id, (std::shared_ptr<SavedData>)mapItemSavedData);
|
||||
|
|
@ -57,7 +57,7 @@ std::shared_ptr<MapItemSavedData> MapItem::getSavedData(short idNum,
|
|||
std::shared_ptr<MapItemSavedData> MapItem::getSavedData(
|
||||
std::shared_ptr<ItemInstance> itemInstance, Level* level) {
|
||||
std::wstring id =
|
||||
std::wstring(L"map_") + _toString(itemInstance->getAuxValue());
|
||||
std::wstring(L"map_") + toWString(itemInstance->getAuxValue());
|
||||
std::shared_ptr<MapItemSavedData> mapItemSavedData =
|
||||
std::dynamic_pointer_cast<MapItemSavedData>(
|
||||
level->getSavedData(typeid(MapItemSavedData), id));
|
||||
|
|
@ -69,7 +69,7 @@ std::shared_ptr<MapItemSavedData> MapItem::getSavedData(
|
|||
// map setup
|
||||
// itemInstance->setAuxValue(level->getFreeAuxValueFor(L"map"));
|
||||
|
||||
id = std::wstring(L"map_") + _toString(itemInstance->getAuxValue());
|
||||
id = std::wstring(L"map_") + toWString(itemInstance->getAuxValue());
|
||||
mapItemSavedData = std::make_shared<MapItemSavedData>(id);
|
||||
|
||||
newData = true;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ TilePos ChunkPos::getMiddleBlockPosition(int y) {
|
|||
}
|
||||
|
||||
std::wstring ChunkPos::toString() {
|
||||
return L"[" + _toString<int>(x) + L", " + _toString<int>(z) + L"]";
|
||||
return L"[" + toWString<int>(x) + L", " + toWString<int>(z) + L"]";
|
||||
}
|
||||
|
||||
int64_t ChunkPos::hash_fnct(const ChunkPos& k) { return k.hashCode(k.x, k.z); }
|
||||
|
|
|
|||
|
|
@ -167,9 +167,9 @@ GameRules::GameRule::GameRule(const std::wstring &startValue)
|
|||
void GameRules::GameRule::set(const std::wstring &newValue)
|
||||
{
|
||||
value = newValue;
|
||||
booleanValue = _fromString<bool>(newValue);
|
||||
intValue = _fromString<int>(newValue);
|
||||
doubleValue = _fromString<double>(newValue);
|
||||
booleanValue = fromWString<bool>(newValue);
|
||||
intValue = fromWString<int>(newValue);
|
||||
doubleValue = fromWString<double>(newValue);
|
||||
}
|
||||
|
||||
std::wstring GameRules::GameRule::get()
|
||||
|
|
|
|||
|
|
@ -1200,7 +1200,7 @@ int CompressedTileStorage::getHighestNonEmptyY() {
|
|||
void CompressedTileStorage::write(DataOutputStream* dos) {
|
||||
dos->writeInt(allocatedSize);
|
||||
if (indicesAndData) {
|
||||
if (LOCALSYSTEM_ENDIAN == BIGENDIAN) {
|
||||
if (std::endian::native == std::endian::big) {
|
||||
// The first 1024 bytes are an array of shorts, so we need to
|
||||
// reverse the endianness
|
||||
std::vector<uint8_t> indicesCopy(1024);
|
||||
|
|
@ -1236,7 +1236,7 @@ void CompressedTileStorage::read(DataInputStream* dis) {
|
|||
std::vector<uint8_t> wrapper(allocatedSize);
|
||||
dis->readFully(wrapper);
|
||||
memcpy(indicesAndData, wrapper.data(), allocatedSize);
|
||||
if (LOCALSYSTEM_ENDIAN == BIGENDIAN) {
|
||||
if (std::endian::native == std::endian::big) {
|
||||
reverseIndices(indicesAndData);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,15 +33,15 @@ RegionFile* RegionFileCache::_getRegionFile(
|
|||
|
||||
// File regionDir(basePath, L"region");
|
||||
|
||||
// File file(regionDir, wstring(L"r.") + _toString(chunkX>>5) + L"." +
|
||||
// _toString(chunkZ>>5) + L".mcr" );
|
||||
// File file(regionDir, wstring(L"r.") + toWString(chunkX>>5) + L"." +
|
||||
// toWString(chunkZ>>5) + L".mcr" );
|
||||
File file;
|
||||
if (useSplitSaves(saveFile->getSavePlatform())) {
|
||||
file = File(prefix + std::wstring(L"r.") + _toString(chunkX >> 4) +
|
||||
L"." + _toString(chunkZ >> 4) + L".mcr");
|
||||
file = File(prefix + std::wstring(L"r.") + toWString(chunkX >> 4) +
|
||||
L"." + toWString(chunkZ >> 4) + L".mcr");
|
||||
} else {
|
||||
file = File(prefix + std::wstring(L"r.") + _toString(chunkX >> 5) +
|
||||
L"." + _toString(chunkZ >> 5) + L".mcr");
|
||||
file = File(prefix + std::wstring(L"r.") + toWString(chunkX >> 5) +
|
||||
L"." + toWString(chunkZ >> 5) + L".mcr");
|
||||
}
|
||||
|
||||
RegionFile* ref = nullptr;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const int ZonedChunkStorage::CHUNK_SIZE_BYTES =
|
|||
ZonedChunkStorage::CHUNK_SIZE * ZonedChunkStorage::CHUNK_LAYERS +
|
||||
ZonedChunkStorage::CHUNK_HEADER_SIZE;
|
||||
|
||||
const ByteOrder ZonedChunkStorage::BYTEORDER = BIGENDIAN;
|
||||
const std::endian ZonedChunkStorage::BYTEORDER = std::endian::big;
|
||||
|
||||
ZonedChunkStorage::ZonedChunkStorage(File dir) {
|
||||
tickCount = 0;
|
||||
|
|
@ -62,8 +62,8 @@ ZoneFile* ZonedChunkStorage::getZoneFile(int x, int z, bool create) {
|
|||
wchar_t zRadix36[64];
|
||||
_itow(x, xRadix36, 36);
|
||||
_itow(z, zRadix36, 36);
|
||||
File file = File(dir, std::wstring(L"zone_") + _toString(xRadix36) +
|
||||
L"_" + _toString(zRadix36) + L".dat");
|
||||
File file = File(dir, std::wstring(L"zone_") + toString(xRadix36) +
|
||||
L"_" + toString(zRadix36) + L".dat");
|
||||
|
||||
if (!file.exists()) {
|
||||
if (!create) return nullptr;
|
||||
|
|
@ -74,8 +74,8 @@ ZoneFile* ZonedChunkStorage::getZoneFile(int x, int z, bool create) {
|
|||
}
|
||||
|
||||
File entityFile =
|
||||
File(dir, std::wstring(L"entities_") + _toString(xRadix36) + L"_" +
|
||||
_toString(zRadix36) + L".dat");
|
||||
File(dir, std::wstring(L"entities_") + toString(xRadix36) + L"_" +
|
||||
toString(zRadix36) + L".dat");
|
||||
|
||||
zoneFiles[key] = new ZoneFile(key, file, entityFile);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public:
|
|||
static const int CHUNK_LAYERS;
|
||||
static const int CHUNK_SIZE_BYTES;
|
||||
|
||||
static const ByteOrder BYTEORDER;
|
||||
static const std::endian BYTEORDER;
|
||||
|
||||
File dir;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ int FlatLayerInfo::getStart() { return start; }
|
|||
void FlatLayerInfo::setStart(int start) { this->start = start; }
|
||||
|
||||
std::wstring FlatLayerInfo::toString() {
|
||||
std::wstring result = _toString<int>(id);
|
||||
std::wstring result = toWString<int>(id);
|
||||
|
||||
if (height > 1) {
|
||||
result = _toString<int>(height) + L"x" + result;
|
||||
result = toWString<int>(height) + L"x" + result;
|
||||
}
|
||||
if (data > 0) {
|
||||
result += L":" + _toString<int>(data);
|
||||
result += L":" + toWString<int>(data);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -167,9 +167,9 @@ int BoundingBox::getYCenter() { return y0 + (y1 - y0 + 1) / 2; }
|
|||
int BoundingBox::getZCenter() { return z0 + (z1 - z0 + 1) / 2; }
|
||||
|
||||
std::wstring BoundingBox::toString() {
|
||||
return L"(" + _toString<int>(x0) + L", " + _toString<int>(y0) + L", " +
|
||||
_toString<int>(z0) + L"; " + _toString<int>(x1) + L", " +
|
||||
_toString<int>(y1) + L", " + _toString<int>(z1) + L")";
|
||||
return L"(" + toWString<int>(x0) + L", " + toWString<int>(y0) + L", " +
|
||||
toWString<int>(z0) + L"; " + toWString<int>(x1) + L", " +
|
||||
toWString<int>(y1) + L", " + toWString<int>(z1) + L")";
|
||||
}
|
||||
|
||||
IntArrayTag* BoundingBox::createTag(const std::wstring& name) {
|
||||
|
|
|
|||
|
|
@ -283,12 +283,12 @@ StrongholdPieces::StrongholdPiece::StrongholdPiece(int genDepth)
|
|||
}
|
||||
|
||||
void StrongholdPieces::StrongholdPiece::addAdditonalSaveData(CompoundTag* tag) {
|
||||
tag->putString(L"EntryDoor", _toString<int>(entryDoor));
|
||||
tag->putString(L"EntryDoor", toWString<int>(entryDoor));
|
||||
}
|
||||
|
||||
void StrongholdPieces::StrongholdPiece::readAdditonalSaveData(
|
||||
CompoundTag* tag) {
|
||||
entryDoor = (SmallDoorType)_fromString<int>(tag->getString(L"EntryDoor"));
|
||||
entryDoor = (SmallDoorType)fromWString<int>(tag->getString(L"EntryDoor"));
|
||||
}
|
||||
|
||||
void StrongholdPieces::StrongholdPiece::generateSmallDoor(
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void StructureFeatureSavedData::putFeatureTag(CompoundTag* tag, int chunkX,
|
|||
|
||||
std::wstring StructureFeatureSavedData::createFeatureTagId(int chunkX,
|
||||
int chunkZ) {
|
||||
return L"[" + _toString<int>(chunkX) + L"," + _toString<int>(chunkZ) + L"]";
|
||||
return L"[" + toWString<int>(chunkX) + L"," + toWString<int>(chunkZ) + L"]";
|
||||
}
|
||||
|
||||
CompoundTag* StructureFeatureSavedData::getFullTag() { return pieceTags; }
|
||||
|
|
@ -64,6 +64,6 @@ int Node::hashCode() { return hash; }
|
|||
bool Node::inOpenSet() { return heapIdx >= 0; }
|
||||
|
||||
std::wstring Node::toString() {
|
||||
return _toString<int>(x) + L", " + _toString<int>(y) + L", " +
|
||||
_toString<int>(z);
|
||||
return toWString<int>(x) + L", " + toWString<int>(y) + L", " +
|
||||
toWString<int>(z);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ public:
|
|||
virtual bool isSaveEndianDifferent() = 0;
|
||||
virtual void setLocalPlatform() = 0;
|
||||
virtual void setPlatform(ESavePlatform plat) = 0;
|
||||
virtual ByteOrder getSaveEndian() = 0;
|
||||
virtual ByteOrder getLocalEndian() = 0;
|
||||
virtual void setEndian(ByteOrder endian) = 0;
|
||||
virtual std::endian getSaveEndian() = 0;
|
||||
virtual std::endian getLocalEndian() = 0;
|
||||
virtual void setEndian(std::endian endian) = 0;
|
||||
|
||||
virtual void ConvertRegionFile(File sourceFile) = 0;
|
||||
virtual void ConvertToLocalPlatform() = 0;
|
||||
|
|
|
|||
|
|
@ -802,15 +802,15 @@ void ConsoleSaveFileOriginal::setPlatform(ESavePlatform plat) {
|
|||
header.setPlatform(plat);
|
||||
}
|
||||
|
||||
ByteOrder ConsoleSaveFileOriginal::getSaveEndian() {
|
||||
std::endian ConsoleSaveFileOriginal::getSaveEndian() {
|
||||
return header.getSaveEndian();
|
||||
}
|
||||
|
||||
ByteOrder ConsoleSaveFileOriginal::getLocalEndian() {
|
||||
std::endian ConsoleSaveFileOriginal::getLocalEndian() {
|
||||
return header.getLocalEndian();
|
||||
}
|
||||
|
||||
void ConsoleSaveFileOriginal::setEndian(ByteOrder endian) {
|
||||
void ConsoleSaveFileOriginal::setEndian(std::endian endian) {
|
||||
header.setEndian(endian);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,9 +89,9 @@ public:
|
|||
virtual bool isSaveEndianDifferent();
|
||||
virtual void setLocalPlatform();
|
||||
virtual void setPlatform(ESavePlatform plat);
|
||||
virtual ByteOrder getSaveEndian();
|
||||
virtual ByteOrder getLocalEndian();
|
||||
virtual void setEndian(ByteOrder endian);
|
||||
virtual std::endian getSaveEndian();
|
||||
virtual std::endian getLocalEndian();
|
||||
virtual void setEndian(std::endian endian);
|
||||
virtual bool isLocalEndianDifferent(ESavePlatform plat);
|
||||
|
||||
virtual void ConvertRegionFile(File sourceFile);
|
||||
|
|
|
|||
|
|
@ -1227,8 +1227,8 @@ std::wstring ConsoleSaveFileSplit::GetNameFromNumericIdentifier(
|
|||
}
|
||||
signed char regionX = (idIn >> 8) & 255;
|
||||
signed char regionZ = idIn & 255;
|
||||
std::wstring region = (prefix + std::wstring(L"r.") + _toString(regionX) +
|
||||
L"." + _toString(regionZ) + L".mcr");
|
||||
std::wstring region = (prefix + std::wstring(L"r.") + toWString(regionX) +
|
||||
L"." + toWString(regionZ) + L".mcr");
|
||||
|
||||
return region;
|
||||
}
|
||||
|
|
@ -1528,15 +1528,15 @@ void ConsoleSaveFileSplit::setPlatform(ESavePlatform plat) {
|
|||
header.setPlatform(plat);
|
||||
}
|
||||
|
||||
ByteOrder ConsoleSaveFileSplit::getSaveEndian() {
|
||||
std::endian ConsoleSaveFileSplit::getSaveEndian() {
|
||||
return header.getSaveEndian();
|
||||
}
|
||||
|
||||
ByteOrder ConsoleSaveFileSplit::getLocalEndian() {
|
||||
std::endian ConsoleSaveFileSplit::getLocalEndian() {
|
||||
return header.getLocalEndian();
|
||||
}
|
||||
|
||||
void ConsoleSaveFileSplit::setEndian(ByteOrder endian) {
|
||||
void ConsoleSaveFileSplit::setEndian(std::endian endian) {
|
||||
header.setEndian(endian);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,9 +163,9 @@ public:
|
|||
virtual bool isSaveEndianDifferent();
|
||||
virtual void setLocalPlatform();
|
||||
virtual void setPlatform(ESavePlatform plat);
|
||||
virtual ByteOrder getSaveEndian();
|
||||
virtual ByteOrder getLocalEndian();
|
||||
virtual void setEndian(ByteOrder endian);
|
||||
virtual std::endian getSaveEndian();
|
||||
virtual std::endian getLocalEndian();
|
||||
virtual void setEndian(std::endian endian);
|
||||
|
||||
virtual void ConvertRegionFile(File sourceFile);
|
||||
virtual void ConvertToLocalPlatform();
|
||||
|
|
|
|||
|
|
@ -141,13 +141,13 @@ void FileHeader::ReadHeader(
|
|||
switch (m_savePlatform) {
|
||||
case SAVE_FILE_PLATFORM_X360:
|
||||
case SAVE_FILE_PLATFORM_PS3:
|
||||
m_saveEndian = BIGENDIAN;
|
||||
m_saveEndian = std::endian::big;
|
||||
break;
|
||||
case SAVE_FILE_PLATFORM_XBONE:
|
||||
case SAVE_FILE_PLATFORM_WIN64:
|
||||
case SAVE_FILE_PLATFORM_PS4:
|
||||
case SAVE_FILE_PLATFORM_PSVITA:
|
||||
m_saveEndian = LITTLEENDIAN;
|
||||
m_saveEndian = std::endian::little;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
|
@ -354,12 +354,12 @@ std::vector<FileEntry*>* FileHeader::getFilesWithPrefix(
|
|||
return files;
|
||||
}
|
||||
|
||||
ByteOrder FileHeader::getEndian(ESavePlatform plat) {
|
||||
ByteOrder platEndian;
|
||||
std::endian FileHeader::getEndian(ESavePlatform plat) {
|
||||
std::endian platEndian;
|
||||
switch (plat) {
|
||||
case SAVE_FILE_PLATFORM_X360:
|
||||
case SAVE_FILE_PLATFORM_PS3:
|
||||
return BIGENDIAN;
|
||||
return std::endian::big;
|
||||
break;
|
||||
|
||||
case SAVE_FILE_PLATFORM_NONE:
|
||||
|
|
@ -367,11 +367,11 @@ ByteOrder FileHeader::getEndian(ESavePlatform plat) {
|
|||
case SAVE_FILE_PLATFORM_PS4:
|
||||
case SAVE_FILE_PLATFORM_PSVITA:
|
||||
case SAVE_FILE_PLATFORM_WIN64:
|
||||
return LITTLEENDIAN;
|
||||
return std::endian::little;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
return LITTLEENDIAN;
|
||||
return std::endian::little;
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "util/Definitions.h"
|
||||
#include <bit>
|
||||
|
||||
#define MAKE_FOURCC(ch0, ch1, ch2, ch3) \
|
||||
(static_cast<std::uint32_t>(static_cast<std::uint8_t>(ch0)) | \
|
||||
|
|
@ -164,8 +164,8 @@ class FileHeader {
|
|||
private:
|
||||
std::vector<FileEntry*> fileTable;
|
||||
ESavePlatform m_savePlatform;
|
||||
ByteOrder m_saveEndian;
|
||||
static const ByteOrder m_localEndian = LITTLEENDIAN;
|
||||
std::endian m_saveEndian;
|
||||
static const std::endian m_localEndian = std::endian::little;
|
||||
|
||||
short m_saveVersion;
|
||||
short m_originalSaveVersion;
|
||||
|
|
@ -210,10 +210,10 @@ protected:
|
|||
m_savePlatform = SAVE_FILE_PLATFORM_LOCAL;
|
||||
m_saveEndian = m_localEndian;
|
||||
}
|
||||
ByteOrder getSaveEndian() { return m_saveEndian; }
|
||||
static ByteOrder getLocalEndian() { return m_localEndian; }
|
||||
void setEndian(ByteOrder endian) { m_saveEndian = endian; }
|
||||
static ByteOrder getEndian(ESavePlatform plat);
|
||||
std::endian getSaveEndian() { return m_saveEndian; }
|
||||
static std::endian getLocalEndian() { return m_localEndian; }
|
||||
void setEndian(std::endian endian) { m_saveEndian = endian; }
|
||||
static std::endian getEndian(ESavePlatform plat);
|
||||
bool isLocalEndianDifferent(ESavePlatform plat) {
|
||||
return m_localEndian != getEndian(plat);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ LevelData* DirectoryLevelStorage::prepareLevel() {
|
|||
#if defined(__linux__)
|
||||
app.DebugPrintf(" -- %d\n", playerUid);
|
||||
#else
|
||||
app.DebugPrintf(" -- %ls\n", playerUid.toString().c_str());
|
||||
app.DebugPrintf(" -- %ls\n", playerUid.toWString().c_str());
|
||||
#endif
|
||||
#endif
|
||||
m_playerMappings[playerUid].readMappings(&dis);
|
||||
|
|
@ -390,7 +390,7 @@ void DirectoryLevelStorage::save(std::shared_ptr<Player> player) {
|
|||
CompoundTag* tag = new CompoundTag();
|
||||
player->saveWithoutId(tag);
|
||||
ConsoleSavePath realFile = ConsoleSavePath(
|
||||
playerDir.getName() + _toString(player->getXuid()) + L".dat");
|
||||
playerDir.getName() + toWString(player->getXuid()) + L".dat");
|
||||
// If saves are disabled (e.g. because we are writing the save buffer to
|
||||
// disk) then cache this player data
|
||||
if (PlatformStorage.GetSaveDisabled()) {
|
||||
|
|
@ -429,7 +429,7 @@ CompoundTag* DirectoryLevelStorage::load(std::shared_ptr<Player> player) {
|
|||
CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) {
|
||||
// 4J Jev, removed try/catch.
|
||||
ConsoleSavePath realFile =
|
||||
ConsoleSavePath(playerDir.getName() + _toString(xuid) + L".dat");
|
||||
ConsoleSavePath(playerDir.getName() + toWString(xuid) + L".dat");
|
||||
auto it = m_cachedSaveData.find(realFile.getName());
|
||||
if (it != m_cachedSaveData.end()) {
|
||||
ByteArrayOutputStream* bos = it->second;
|
||||
|
|
@ -464,7 +464,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() {
|
|||
std::wstring xuidStr = replaceAll(
|
||||
replaceAll(file->data.filename, playerDir.getName(), L""),
|
||||
L".dat", L"");
|
||||
PlayerUID xuid = _fromString<PlayerUID>(xuidStr);
|
||||
PlayerUID xuid = fromWString<PlayerUID>(xuidStr);
|
||||
deleteMapFilesForPlayer(xuid);
|
||||
m_saveFile->deleteFile(playerFiles->at(i));
|
||||
}
|
||||
|
|
@ -480,7 +480,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() {
|
|||
std::wstring xuidStr = replaceAll(
|
||||
replaceAll(file->data.filename, playerDir.getName(), L""),
|
||||
L".dat", L"");
|
||||
PlayerUID xuid = _fromString<PlayerUID>(xuidStr);
|
||||
PlayerUID xuid = fromWString<PlayerUID>(xuidStr);
|
||||
deleteMapFilesForPlayer(xuid);
|
||||
m_saveFile->deleteFile(playerFiles->at(i));
|
||||
}
|
||||
|
|
@ -602,7 +602,7 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension,
|
|||
|
||||
// If we had an old map file for a mapping that is no longer valid,
|
||||
// delete it
|
||||
std::wstring id = std::wstring(L"map_") + _toString(mapId);
|
||||
std::wstring id = std::wstring(L"map_") + toWString(mapId);
|
||||
ConsoleSavePath file = getDataFile(id);
|
||||
|
||||
if (m_saveFile->doesFileExist(file)) {
|
||||
|
|
@ -644,7 +644,7 @@ void DirectoryLevelStorage::saveMapIdLookup() {
|
|||
#if defined(__linux__)
|
||||
app.DebugPrintf(" -- %d\n", it->first);
|
||||
#else
|
||||
app.DebugPrintf(" -- %ls\n", it->first.toString().c_str());
|
||||
app.DebugPrintf(" -- %ls\n", it->first.toWString().c_str());
|
||||
#endif
|
||||
#endif
|
||||
dos.writePlayerUID(it->first);
|
||||
|
|
@ -701,7 +701,7 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) {
|
|||
if (it != m_playerMappings.end()) {
|
||||
for (auto itMap = it->second.m_mappings.begin();
|
||||
itMap != it->second.m_mappings.end(); ++itMap) {
|
||||
std::wstring id = std::wstring(L"map_") + _toString(itMap->second);
|
||||
std::wstring id = std::wstring(L"map_") + toWString(itMap->second);
|
||||
ConsoleSavePath file = getDataFile(id);
|
||||
|
||||
if (m_saveFile->doesFileExist(file)) {
|
||||
|
|
@ -725,7 +725,7 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) {
|
|||
if (m_mapDataMappings.xuids[i] == xuid) {
|
||||
changed = true;
|
||||
|
||||
std::wstring id = std::wstring(L"map_") + _toString(i);
|
||||
std::wstring id = std::wstring(L"map_") + toWString(i);
|
||||
ConsoleSavePath file = getDataFile(id);
|
||||
|
||||
if (m_saveFile->doesFileExist(file)) {
|
||||
|
|
@ -765,7 +765,7 @@ void DirectoryLevelStorage::saveAllCachedData() {
|
|||
|
||||
for (auto it = m_mapFilesToDelete.begin(); it != m_mapFilesToDelete.end();
|
||||
++it) {
|
||||
std::wstring id = std::wstring(L"map_") + _toString(*it);
|
||||
std::wstring id = std::wstring(L"map_") + toWString(*it);
|
||||
ConsoleSavePath file = getDataFile(id);
|
||||
if (m_saveFile->doesFileExist(file)) {
|
||||
m_saveFile->deleteFile(m_saveFile->createFile(file));
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ int CarrotTile::getBasePlantId() { return Item::carrots_Id; }
|
|||
void CarrotTile::registerIcons(IconRegister* iconRegister) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
icons[i] = iconRegister->registerIcon(getIconName() + L"_stage_" +
|
||||
_toString(i));
|
||||
toWString(i));
|
||||
}
|
||||
}
|
||||
|
|
@ -142,6 +142,6 @@ void CropTile::registerIcons(IconRegister* iconRegister) {
|
|||
icons = new Icon*[8];
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
icons[i] = iconRegister->registerIcon(L"crops_" + _toString(i));
|
||||
icons[i] = iconRegister->registerIcon(L"crops_" + toWString(i));
|
||||
}
|
||||
}
|
||||
|
|
@ -92,6 +92,6 @@ int NetherWartTile::cloneTileId(Level* level, int x, int y, int z) {
|
|||
void NetherWartTile::registerIcons(IconRegister* iconRegister) {
|
||||
for (int i = 0; i < NETHER_STALK_TEXTURE_COUNT; i++) {
|
||||
icons[i] = iconRegister->registerIcon(getIconName() + L"_stage_" +
|
||||
_toString<int>(i));
|
||||
toWString<int>(i));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,6 @@ void PotatoTile::spawnResources(Level* level, int x, int y, int z, int data,
|
|||
void PotatoTile::registerIcons(IconRegister* iconRegister) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
icons[i] = iconRegister->registerIcon(getIconName() + L"_stage_" +
|
||||
_toString<int>(i));
|
||||
toWString<int>(i));
|
||||
}
|
||||
}
|
||||
|
|
@ -2623,8 +2623,8 @@ Tile* Tile::setIconName(const std::wstring& iconName) {
|
|||
}
|
||||
|
||||
std::wstring Tile::getIconName() {
|
||||
return iconName.empty() ? L"MISSING_ICON_TILE_" + _toString<int>(id) +
|
||||
L"_" + _toString<int>(descriptionId)
|
||||
return iconName.empty() ? L"MISSING_ICON_TILE_" + toWString<int>(id) +
|
||||
L"_" + toWString<int>(descriptionId)
|
||||
: iconName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
platform_inc = include_directories('.')
|
||||
_threads = dependency('threads')
|
||||
|
||||
lib_platform_core = static_library('platform_core',
|
||||
files('C4JThread.cpp', 'ShutdownManager.cpp'),
|
||||
include_directories: [platform_inc, include_directories('..')],
|
||||
dependencies: [dependency('threads')],
|
||||
dependencies: [_threads],
|
||||
cpp_args: global_cpp_args + global_cpp_defs,
|
||||
)
|
||||
|
||||
|
|
@ -14,7 +15,6 @@ platform_dep = declare_dependency(
|
|||
|
||||
# SDL2-based platform implementations (formerly 4J.* modules)
|
||||
_sdl2 = dependency('sdl2')
|
||||
_threads = dependency('threads')
|
||||
_defs = []
|
||||
|
||||
if get_option('renderer') == 'gles'
|
||||
|
|
|
|||
|
|
@ -1,10 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define MAX_PATH_SIZE 256
|
||||
|
||||
enum ByteOrder {
|
||||
BIGENDIAN,
|
||||
LITTLEENDIAN,
|
||||
|
||||
LOCALSYSTEM_ENDIAN = LITTLEENDIAN,
|
||||
};
|
||||
inline constexpr int MAX_PATH_SIZE = 256;
|
||||
|
|
|
|||
|
|
@ -10,22 +10,21 @@ std::wstring replaceAll(const std::wstring& in, const std::wstring& replace,
|
|||
const std::wstring& with);
|
||||
|
||||
bool equalsIgnoreCase(const std::wstring& a, const std::wstring& b);
|
||||
// 4J-PB - for use in the ::toString
|
||||
template <class T>
|
||||
std::wstring _toString(T t) {
|
||||
std::wstring toWString(T t) {
|
||||
std::wostringstream oss;
|
||||
oss << std::dec << t;
|
||||
return oss.str();
|
||||
}
|
||||
template <class T>
|
||||
T _fromString(const std::wstring& s) {
|
||||
T fromWString(const std::wstring& s) {
|
||||
std::wistringstream stream(s);
|
||||
T t;
|
||||
stream >> t;
|
||||
return t;
|
||||
}
|
||||
template <class T>
|
||||
T _fromHEXString(const std::wstring& s) {
|
||||
T fromHexWString(const std::wstring& s) {
|
||||
std::wistringstream stream(s);
|
||||
T t;
|
||||
stream >> std::hex >> t;
|
||||
|
|
|
|||
Loading…
Reference in a new issue