From 5105f89648432b71db2a389219790e9d0895f696 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Fri, 3 Apr 2026 18:33:49 +1100 Subject: [PATCH] refactor: use std::endian directly, enum class EDefaultSkins, rename reserved-prefix helpers --- .../app/common/src/Colours/ColourTable.cpp | 2 +- targets/app/common/src/DLC/DLCPack.cpp | 2 +- .../ApplySchematicRuleDefinition.cpp | 24 +++++----- .../LevelGeneration/BiomeOverride.cpp | 12 ++--- .../ConsoleGenerateStructure.cpp | 20 ++++---- .../LevelGenerationOptions.cpp | 22 ++++----- .../LevelGeneration/StartFeature.cpp | 16 +++---- .../XboxStructureActionGenerateBox.cpp | 34 +++++++------- .../XboxStructureActionPlaceBlock.cpp | 20 ++++---- .../XboxStructureActionPlaceContainer.cpp | 2 +- .../AddEnchantmentRuleDefinition.cpp | 8 ++-- .../RuleDefinitions/AddItemRuleDefinition.cpp | 20 ++++---- .../CollectItemRuleDefinition.cpp | 18 ++++---- .../CompleteAllRuleDefinition.cpp | 4 +- .../CompoundGameRuleDefinition.cpp | 2 +- .../RuleDefinitions/GameRuleDefinition.cpp | 4 +- .../NamedAreaRuleDefinition.cpp | 24 +++++----- .../UpdatePlayerRuleDefinition.cpp | 24 +++++----- .../RuleDefinitions/UseTileRuleDefinition.cpp | 20 ++++---- .../Components/UIComponent_TutorialPopup.cpp | 4 +- .../Controls/UIControl_EnchantmentButton.cpp | 4 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 2 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 2 +- .../UIScene_CreateWorldMenu.cpp | 2 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 30 ++++++------ .../Help & Options/UIScene_SkinSelectMenu.h | 2 +- targets/app/linux/Linux_Minecraft.cpp | 2 + targets/app/src/BufferedImage.cpp | 4 +- targets/java/include/java/ByteBuffer.h | 6 +-- targets/java/src/ByteBuffer.cpp | 38 +++++++-------- targets/minecraft/client/MemoryTracker.cpp | 2 +- targets/minecraft/client/Minecraft.cpp | 10 ++-- targets/minecraft/client/Options.cpp | 46 +++++++++---------- .../client/gui/CreateWorldScreen.cpp | 4 +- targets/minecraft/client/gui/DeathScreen.cpp | 2 +- targets/minecraft/client/gui/Font.cpp | 2 +- targets/minecraft/client/gui/Gui.cpp | 28 +++++------ .../client/gui/JoinMultiplayerScreen.cpp | 2 +- .../client/gui/SelectWorldScreen.cpp | 8 ++-- .../multiplayer/MultiPlayerChunkCache.cpp | 2 +- .../client/particle/ParticleEngine.cpp | 2 +- .../client/renderer/LevelRenderer.cpp | 20 ++++---- .../renderer/entity/HumanoidMobRenderer.cpp | 2 +- .../client/renderer/entity/ItemRenderer.cpp | 4 +- .../client/renderer/texture/StitchSlot.cpp | 8 ++-- .../renderer/texture/StitchedTexture.cpp | 12 ++--- .../client/renderer/texture/TextureHolder.cpp | 4 +- targets/minecraft/network/Connection.cpp | 2 +- targets/minecraft/network/packet/Packet.cpp | 4 +- targets/minecraft/server/Settings.cpp | 10 ++-- targets/minecraft/server/level/DemoMode.cpp | 2 +- .../server/level/ServerChunkCache.cpp | 4 +- .../server/network/ServerConnection.cpp | 2 +- targets/minecraft/stats/Stat.cpp | 4 +- targets/minecraft/stats/Stats.cpp | 4 +- targets/minecraft/util/Hasher.cpp | 2 +- targets/minecraft/world/entity/Entity.cpp | 2 +- targets/minecraft/world/entity/Mob.cpp | 2 +- .../world/entity/animal/EntityHorse.cpp | 2 +- .../minecraft/world/entity/player/Player.cpp | 28 +++++------ .../minecraft/world/entity/player/SkinTypes.h | 24 +++++----- .../minecraft/world/item/FireworksItem.cpp | 2 +- targets/minecraft/world/item/Item.cpp | 2 +- targets/minecraft/world/item/ItemInstance.cpp | 8 ++-- targets/minecraft/world/item/MapItem.cpp | 8 ++-- targets/minecraft/world/level/ChunkPos.cpp | 2 +- targets/minecraft/world/level/GameRules.cpp | 6 +-- .../level/chunk/CompressedTileStorage.cpp | 4 +- .../level/chunk/storage/RegionFileCache.cpp | 12 ++--- .../level/chunk/storage/ZonedChunkStorage.cpp | 10 ++-- .../level/chunk/storage/ZonedChunkStorage.h | 2 +- .../level/levelgen/flat/FlatLayerInfo.cpp | 6 +-- .../level/levelgen/structure/BoundingBox.cpp | 6 +-- .../levelgen/structure/StrongholdPieces.cpp | 4 +- .../structure/StructureFeatureSavedData.cpp | 2 +- .../minecraft/world/level/pathfinder/Node.cpp | 4 +- .../ConsoleSaveFileIO/ConsoleSaveFile.h | 6 +-- .../ConsoleSaveFileOriginal.cpp | 6 +-- .../ConsoleSaveFileOriginal.h | 6 +-- .../ConsoleSaveFileSplit.cpp | 10 ++-- .../ConsoleSaveFileIO/ConsoleSaveFileSplit.h | 6 +-- .../storage/ConsoleSaveFileIO/FileHeader.cpp | 14 +++--- .../storage/ConsoleSaveFileIO/FileHeader.h | 14 +++--- .../level/storage/DirectoryLevelStorage.cpp | 20 ++++---- .../minecraft/world/level/tile/CarrotTile.cpp | 2 +- .../minecraft/world/level/tile/CropTile.cpp | 2 +- .../world/level/tile/NetherWartTile.cpp | 2 +- .../minecraft/world/level/tile/PotatoTile.cpp | 2 +- targets/minecraft/world/level/tile/Tile.cpp | 4 +- targets/platform/meson.build | 4 +- targets/util/include/util/Definitions.h | 9 +--- targets/util/include/util/StringHelpers.h | 7 ++- 93 files changed, 407 insertions(+), 411 deletions(-) diff --git a/targets/app/common/src/Colours/ColourTable.cpp b/targets/app/common/src/Colours/ColourTable.cpp index d665efcdf..c739b8e14 100644 --- a/targets/app/common/src/Colours/ColourTable.cpp +++ b/targets/app/common/src/Colours/ColourTable.cpp @@ -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(value)); + setColour(colourName, fromHexWString(value)); } unsigned int ColourTable::getColour(eMinecraftColour id) { diff --git a/targets/app/common/src/DLC/DLCPack.cpp b/targets/app/common/src/DLC/DLCPack.cpp index a4e35b11c..3efb14d73 100644 --- a/targets/app/common/src/DLC/DLCPack.cpp +++ b/targets/app/common/src/DLC/DLCPack.cpp @@ -145,7 +145,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, ss >> param; } break; default: - param = _fromString(it->second); + param = fromWString(it->second); } return true; } diff --git a/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index 8f14fdba9..fcd060b61 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -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(attributeValue); + m_location.x = fromWString(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(attributeValue); + m_location.y = fromWString(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(attributeValue); + m_location.z = fromWString(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(attributeValue); + int degrees = fromWString(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(attributeValue); + m_dimension = fromWString(attributeValue); if (m_dimension > 1 || m_dimension < -1) m_dimension = 0; // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter // dimension=%d\n",m_dimension); diff --git a/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.cpp index 89cf4303c..dd903a5ef 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/BiomeOverride.cpp @@ -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(attributeValue); + int value = fromWString(attributeValue); m_tile = value; app.DebugPrintf("BiomeOverride: Adding parameter tileId=%d\n", m_tile); } else if (attributeName.compare(L"topTileId") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_topTile = value; app.DebugPrintf("BiomeOverride: Adding parameter topTileId=%d\n", m_topTile); } else if (attributeName.compare(L"biomeId") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_biomeId = value; app.DebugPrintf("BiomeOverride: Adding parameter biomeId=%d\n", m_biomeId); diff --git a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index f2247c4a0..43c44eaa9 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -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(attributeValue); + int value = fromWString(attributeValue); m_x = value; app.DebugPrintf("ConsoleGenerateStructure: Adding parameter x=%d\n", m_x); } else if (attributeName.compare(L"y") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_y = value; app.DebugPrintf("ConsoleGenerateStructure: Adding parameter y=%d\n", m_y); } else if (attributeName.compare(L"z") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_z = value; app.DebugPrintf("ConsoleGenerateStructure: Adding parameter z=%d\n", m_z); } else if (attributeName.compare(L"orientation") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); orientation = value; app.DebugPrintf( "ConsoleGenerateStructure: Adding parameter orientation=%d\n", orientation); } else if (attributeName.compare(L"dim") == 0) { - m_dimension = _fromString(attributeValue); + m_dimension = fromWString(attributeValue); if (m_dimension > 1 || m_dimension < -1) m_dimension = 0; app.DebugPrintf( "ApplySchematicRuleDefinition: Adding parameter dimension=%d\n", diff --git a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 072922bcf..3c306897d 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -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(attributeValue); + m_seed = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue)); + setRequiredTexturePackId(fromWString(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(attributeValue); + bool value = fromWString(attributeValue); m_bHasBeenInCreative = value; app.DebugPrintf( "LevelGenerationOptions: Adding parameter gameMode=%d\n", diff --git a/targets/app/common/src/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/src/GameRules/LevelGeneration/StartFeature.cpp index 8755c704d..d146f924f 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/StartFeature.cpp @@ -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(attributeValue); + int value = fromWString(attributeValue); m_chunkX = value; app.DebugPrintf("StartFeature: Adding parameter chunkX=%d\n", m_chunkX); } else if (attributeName.compare(L"chunkZ") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_chunkZ = value; app.DebugPrintf("StartFeature: Adding parameter chunkZ=%d\n", m_chunkZ); } else if (attributeName.compare(L"orientation") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_orientation = value; app.DebugPrintf("StartFeature: Adding parameter orientation=%d\n", m_orientation); } else if (attributeName.compare(L"feature") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_feature = (StructureFeature::EFeatureTypes)value; app.DebugPrintf("StartFeature: Adding parameter feature=%d\n", m_feature); diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index 2f1877dbe..ef2b79cfb 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -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(attributeValue); + int value = fromWString(attributeValue); m_x0 = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter x0=%d\n", m_x0); } else if (attributeName.compare(L"y0") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_y0 = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter y0=%d\n", m_y0); } else if (attributeName.compare(L"z0") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_z0 = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter z0=%d\n", m_z0); } else if (attributeName.compare(L"x1") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_x1 = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter x1=%d\n", m_x1); } else if (attributeName.compare(L"y1") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_y1 = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter y1=%d\n", m_y1); } else if (attributeName.compare(L"z1") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_z1 = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter z1=%d\n", m_z1); } else if (attributeName.compare(L"edgeTile") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_edgeTile = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter edgeTile=%d\n", m_edgeTile); } else if (attributeName.compare(L"fillTile") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_fillTile = value; app.DebugPrintf( "XboxStructureActionGenerateBox: Adding parameter fillTile=%d\n", diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index 2919130d5..1a19f3c0a 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -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(attributeValue); + int value = fromWString(attributeValue); m_x = value; app.DebugPrintf( "XboxStructureActionPlaceBlock: Adding parameter x=%d\n", m_x); } else if (attributeName.compare(L"y") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_y = value; app.DebugPrintf( "XboxStructureActionPlaceBlock: Adding parameter y=%d\n", m_y); } else if (attributeName.compare(L"z") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_z = value; app.DebugPrintf( "XboxStructureActionPlaceBlock: Adding parameter z=%d\n", m_z); } else if (attributeName.compare(L"block") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_tile = value; app.DebugPrintf( "XboxStructureActionPlaceBlock: Adding parameter block=%d\n", m_tile); } else if (attributeName.compare(L"data") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(attributeValue); m_data = value; app.DebugPrintf( "XboxStructureActionPlaceBlock: Adding parameter data=%d\n", diff --git a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index e58bdce05..989a18c90 100644 --- a/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/src/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -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(attributeValue); + int value = fromWString(attributeValue); m_data = value; app.DebugPrintf( "XboxStructureActionPlaceContainer: Adding parameter facing=%d\n", diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 9fdfcf69f..74b19f992 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(attributeValue); if (value < 0) value = 0; m_enchantmentLevel = value; app.DebugPrintf( diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp index 36d819c62..0d541b7dc 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp @@ -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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(attributeValue); m_slot = value; // app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter // slot=%d\n",m_slot); diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index 95be010ba..39d99e5d0 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -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(attributeValue); + m_itemId = fromWString(attributeValue); app.DebugPrintf("CollectItemRule: Adding parameter itemId=%d\n", m_itemId); } else if (attributeName.compare(L"auxValue") == 0) { - m_auxValue = _fromString(attributeValue); + m_auxValue = fromWString(attributeValue); app.DebugPrintf("CollectItemRule: Adding parameter m_auxValue=%d\n", m_auxValue); } else if (attributeName.compare(L"quantity") == 0) { - m_quantity = _fromString(attributeValue); + m_quantity = fromWString(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"(item->id) + + xml = L"(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" " L"promptName=\"OPTIONAL\""; if (item->getAuxValue() != 0) xml += - L" auxValue=\"" + _toString(item->getAuxValue()) + L"\""; + L" auxValue=\"" + toWString(item->getAuxValue()) + L"\""; if (item->get4JData() != 0) - xml += L" dataTag=\"" + _toString(item->get4JData()) + L"\""; + xml += L" dataTag=\"" + toWString(item->get4JData()) + L"\""; xml += L"/>\n"; } return xml; diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index ed69bfb88..237b2a6e8 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -71,7 +71,7 @@ std::wstring CompleteAllRuleDefinition::generateDescriptionString( PacketData* values = (PacketData*)data; std::wstring newDesc = description; newDesc = - replaceAll(newDesc, L"{*progress*}", _toString(values->progress)); - newDesc = replaceAll(newDesc, L"{*goal*}", _toString(values->goal)); + replaceAll(newDesc, L"{*progress*}", toWString(values->progress)); + newDesc = replaceAll(newDesc, L"{*goal*}", toWString(values->goal)); return newDesc; } \ No newline at end of file diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp index a15522aa8..0d3907fa8 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp @@ -70,7 +70,7 @@ void CompoundGameRuleDefinition::populateGameRule( value.isPointer = true; // Somehow add the newRule to the current rule - rule->setParameter(L"rule" + _toString(i), value); + rule->setParameter(L"rule" + toWString(i), value); ++i; } GameRuleDefinition::populateGameRule(type, rule); diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index 8813cc4ef..1d6602717 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -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(attributeValue); + m_4JDataValue = fromWString(attributeValue); app.DebugPrintf( "GameRuleDefinition: Adding parameter m_4JDataValue=%d\n", m_4JDataValue); diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index 1b6f6dd81..7c00a1ccd 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -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(attributeValue); + m_area.x0 = fromWString(attributeValue); app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x0=%f\n", m_area.x0); } else if (attributeName.compare(L"y0") == 0) { - m_area.y0 = _fromString(attributeValue); + m_area.y0 = fromWString(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(attributeValue); + m_area.z0 = fromWString(attributeValue); app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z0=%f\n", m_area.z0); } else if (attributeName.compare(L"x1") == 0) { - m_area.x1 = _fromString(attributeValue); + m_area.x1 = fromWString(attributeValue); app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter x1=%f\n", m_area.x1); } else if (attributeName.compare(L"y1") == 0) { - m_area.y1 = _fromString(attributeValue); + m_area.y1 = fromWString(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(attributeValue); + m_area.z1 = fromWString(attributeValue); app.DebugPrintf("NamedAreaRuleDefinition: Adding parameter z1=%f\n", m_area.z1); } else { diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index ea32dbfa4..78b14dfb0 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(attributeValue); m_spawnPos->z = value; app.DebugPrintf( "UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n", value); } else if (attributeName.compare(L"health") == 0) { - int value = _fromString(attributeValue); + int value = fromWString(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(attributeValue); + int value = fromWString(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(attributeValue); + float value = fromWString(attributeValue); m_yRot = value; m_bUpdateYRot = true; app.DebugPrintf( diff --git a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index f3c2eb704..16413ceeb 100644 --- a/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/src/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -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(attributeValue); + m_tileId = fromWString(attributeValue); app.DebugPrintf("UseTileRule: Adding parameter tileId=%d\n", m_tileId); } else if (attributeName.compare(L"useCoords") == 0) { - m_useCoords = _fromString(attributeValue); + m_useCoords = fromWString(attributeValue); app.DebugPrintf("UseTileRule: Adding parameter useCoords=%s\n", m_useCoords ? "true" : "false"); } else if (attributeName.compare(L"x") == 0) { - m_coordinates.x = _fromString(attributeValue); + m_coordinates.x = fromWString(attributeValue); app.DebugPrintf("UseTileRule: Adding parameter x=%d\n", m_coordinates.x); } else if (attributeName.compare(L"y") == 0) { - m_coordinates.y = _fromString(attributeValue); + m_coordinates.y = fromWString(attributeValue); app.DebugPrintf("UseTileRule: Adding parameter y=%d\n", m_coordinates.y); } else if (attributeName.compare(L"z") == 0) { - m_coordinates.z = _fromString(attributeValue); + m_coordinates.z = fromWString(attributeValue); app.DebugPrintf("UseTileRule: Adding parameter z=%d\n", m_coordinates.z); } else { diff --git a/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.cpp index 6ba9667a9..afe7c1665 100644 --- a/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/src/UI/Components/UIComponent_TutorialPopup.cpp @@ -274,10 +274,10 @@ std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, std::vector idAndAux = stringSplit(id, L':'); - int iconId = _fromString(idAndAux[0]); + int iconId = fromWString(idAndAux[0]); if (idAndAux.size() > 1) { - iAuxVal = _fromString(idAndAux[1]); + iAuxVal = fromWString(idAndAux[1]); } else { iAuxVal = 0; } diff --git a/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.cpp index d2c87fd83..2bbbe5878 100644 --- a/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/src/UI/Controls/UIControl_EnchantmentButton.cpp @@ -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(cost); + std::wstring line = toWString(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(cost)); + setLabel(toWString(cost)); m_lastCost = cost; m_enchantmentString = EnchantmentNames::instance.getRandomName(); } diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index f827bc213..b0dd81b33 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -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(value); + if (!value.empty()) iVal = fromWString(value); switch (pClass->m_keyboardCallbackControl) { case eControl_Name: pClass->m_textInputName.setLabel(value); diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 5b8b41c69..852418444 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -93,7 +93,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void* initData, std::pair(ench->id, level)); m_buttonListEnchantments.addItem( app.GetString(ench->getDescriptionId()) + - _toString(level)); + toWString(level)); } } diff --git a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index aef46e535..b817e4c73 100644 --- a/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/src/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -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(value); + if (!value.empty()) val = fromWString(value); switch (pClass->m_keyboardCallbackControl) { case eControl_CamX: pClass->m_textInputX.setLabel(value); diff --git a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp b/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp index 85372b9db..2316b17d2 100644 --- a/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +++ b/targets/app/common/src/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp @@ -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(wSeed); + if (isNumber) value = fromWString(wSeed); // If the value is not 0 use it, otherwise use the algorithm from the // java String.hashCode() function to hash it diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp b/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp index 4d454fd1e..0c5968825 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -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(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(defaultSkinIndex); } } break; diff --git a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h b/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h index 2c04ebb5c..8801ba04c 100644 --- a/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/src/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -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; diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 29bb1d4db..cdb79f36f 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -4,6 +4,8 @@ // #include #include +#include "util/StringHelpers.h" + #if defined(__linux__) && defined(__GLIBC__) #include #include diff --git a/targets/app/src/BufferedImage.cpp b/targets/app/src/BufferedImage.cpp index 176a72cc6..8df5bcc18 100644 --- a/targets/app/src/BufferedImage.cpp +++ b/targets/app/src/BufferedImage.cpp @@ -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(l + 1) : L""; + (l != 0) ? L"MipMapLevel" + toWString(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(l + 1) : L""; + (l != 0) ? L"MipMapLevel" + toWString(l + 1) : L""; name = L"res" + (filenameHasExtension ? filePath : filePath.substr(0, filePath.length() - 4) + diff --git a/targets/java/include/java/ByteBuffer.h b/targets/java/include/java/ByteBuffer.h index 6982223ea..4213b3de1 100644 --- a/targets/java/include/java/ByteBuffer.h +++ b/targets/java/include/java/ByteBuffer.h @@ -4,7 +4,7 @@ #include #include "Buffer.h" -#include "util/Definitions.h" // 4jcraft TODO +#include 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& b); static ByteBuffer* allocate(unsigned int capacity); - void order(ByteOrder a); + void order(std::endian a); ByteBuffer* flip(); uint8_t* getBuffer(); int getSize(); diff --git a/targets/java/src/ByteBuffer.cpp b/targets/java/src/ByteBuffer.cpp index e9a61281b..fb33777c1 100644 --- a/targets/java/src/ByteBuffer.cpp +++ b/targets/java/src/ByteBuffer.cpp @@ -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(buffer[index + 2]); int b4 = static_cast(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((value >> 24) & 0xFF); buffer[m_position + 1] = static_cast((value >> 16) & 0xFF); buffer[m_position + 2] = static_cast((value >> 8) & 0xFF); buffer[m_position + 3] = static_cast(value & 0xFF); - } else if (byteOrder == LITTLEENDIAN) { + } else if (byteOrder == std::endian::little) { buffer[m_position] = static_cast(value & 0xFF); buffer[m_position + 1] = static_cast((value >> 8) & 0xFF); buffer[m_position + 2] = static_cast((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((value >> 24) & 0xFF); buffer[index + 1] = static_cast((value >> 16) & 0xFF); buffer[index + 2] = static_cast((value >> 8) & 0xFF); buffer[index + 3] = static_cast(value & 0xFF); - } else if (byteOrder == LITTLEENDIAN) { + } else if (byteOrder == std::endian::little) { buffer[index] = static_cast(value & 0xFF); buffer[index + 1] = static_cast((value >> 8) & 0xFF); buffer[index + 2] = static_cast((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((value >> 8) & 0xFF); buffer[m_position + 1] = static_cast(value & 0xFF); - } else if (byteOrder == LITTLEENDIAN) { + } else if (byteOrder == std::endian::little) { buffer[m_position] = static_cast(value & 0xFF); buffer[m_position + 1] = static_cast((value >> 8) & 0xFF); } @@ -351,7 +351,7 @@ ByteBuffer* ByteBuffer::putShortArray(std::vector& 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((value >> 56) & 0xFF); buffer[m_position + 1] = static_cast((value >> 48) & 0xFF); buffer[m_position + 2] = static_cast((value >> 40) & 0xFF); @@ -360,7 +360,7 @@ ByteBuffer* ByteBuffer::putLong(int64_t value) { buffer[m_position + 5] = static_cast((value >> 16) & 0xFF); buffer[m_position + 6] = static_cast((value >> 8) & 0xFF); buffer[m_position + 7] = static_cast(value & 0xFF); - } else if (byteOrder == LITTLEENDIAN) { + } else if (byteOrder == std::endian::little) { buffer[m_position] = static_cast((value & 0xFF)); buffer[m_position + 1] = static_cast((value >> 8) & 0xFF); buffer[m_position + 2] = static_cast((value >> 16) & 0xFF); diff --git a/targets/minecraft/client/MemoryTracker.cpp b/targets/minecraft/client/MemoryTracker.cpp index b44bc7aaa..c0a2b0bb7 100644 --- a/targets/minecraft/client/MemoryTracker.cpp +++ b/targets/minecraft/client/MemoryTracker.cpp @@ -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; } diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index f785fb015..ef473829c 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -1772,8 +1772,8 @@ void Minecraft::run_middle() { #if !defined(_CONTENT_PACKAGE) while (System::nanoTime() >= lastTime + 1000000000) { - fpsString = _toString(frames) + L" fps, " + - _toString(Chunk::updates) + + fpsString = toWString(frames) + L" fps, " + + toWString(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(app.SecondsToAutosave()) + L"s"; + toWString(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(System::currentTimeMillis() % 1000), + L"Player" + toWString(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(System::currentTimeMillis() % 1000); + L"Player" + toWString(System::currentTimeMillis() % 1000); sessionId = L"-"; /* 4J - TODO - get a session ID from somewhere? if (args.size() > 0) name = args[0]; diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index 0c8268291..2fca6d4d9 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -312,7 +312,7 @@ std::wstring Options::getMessage(const Options::Option* item) { return caption + language->getElement(L"options.sensitivity.max"); } - return caption + _toString((int)(progressValue * 200)) + L"%"; + return caption + toWString((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)(70 + progressValue * 40)); + return caption + toWString((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)(progressValue * 100)) + + return caption + L"+" + toWString((int)(progressValue * 100)) + L"%"; } else { if (progressValue == 0) { return caption + language->getElement(L"options.off"); } - return caption + _toString((int)(progressValue * 100)) + L"%"; + return caption + toWString((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(cmds[1]); - if (cmds[0] == L"guiScale") guiScale = _fromString(cmds[1]); - if (cmds[0] == L"particles") particles = _fromString(cmds[1]); + viewDistance = fromWString(cmds[1]); + if (cmds[0] == L"guiScale") guiScale = fromWString(cmds[1]); + if (cmds[0] == L"particles") particles = fromWString(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(cmds[1]); - if (cmds[0] == L"difficulty") difficulty = _fromString(cmds[1]); + if (cmds[0] == L"fpsLimit") framerateLimit = fromWString(cmds[1]); + if (cmds[0] == L"difficulty") difficulty = fromWString(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(cmds[1]); + keyMappings[i]->key = fromWString(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(string); + return fromWString(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(music) + L"\n"); - dos.writeChars(L"sound:" + _toString(sound) + L"\n"); + dos.writeChars(L"music:" + toWString(music) + L"\n"); + dos.writeChars(L"sound:" + toWString(sound) + L"\n"); dos.writeChars(L"invertYMouse:" + std::wstring(invertYMouse ? L"true" : L"false") + L"\n"); - dos.writeChars(L"mouseSensitivity:" + _toString(sensitivity)); - dos.writeChars(L"fov:" + _toString(fov)); - dos.writeChars(L"gamma:" + _toString(gamma)); - dos.writeChars(L"viewDistance:" + _toString(viewDistance)); - dos.writeChars(L"guiScale:" + _toString(guiScale)); - dos.writeChars(L"particles:" + _toString(particles)); + dos.writeChars(L"mouseSensitivity:" + toWString(sensitivity)); + dos.writeChars(L"fov:" + toWString(fov)); + dos.writeChars(L"gamma:" + toWString(gamma)); + dos.writeChars(L"viewDistance:" + toWString(viewDistance)); + dos.writeChars(L"guiScale:" + toWString(guiScale)); + dos.writeChars(L"particles:" + toWString(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(framerateLimit)); - dos.writeChars(L"difficulty:" + _toString(difficulty)); + dos.writeChars(L"fpsLimit:" + toWString(framerateLimit)); + dos.writeChars(L"difficulty:" + toWString(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(renderClouds)); + dos.writeChars(L"clouds:" + toWString(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(keyMappings[i]->key)); + toWString(keyMappings[i]->key)); } dos.close(); diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index 01ab7ea3c..a21336724 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -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(seedString); + int64_t value = fromWString(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(seedString); + if (isNumber) value = fromWString(seedString); if (value != 0) { seedValue = value; diff --git a/targets/minecraft/client/gui/DeathScreen.cpp b/targets/minecraft/client/gui/DeathScreen.cpp index 6a61079ae..550e5b15e 100644 --- a/targets/minecraft/client/gui/DeathScreen.cpp +++ b/targets/minecraft/client/gui/DeathScreen.cpp @@ -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); diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index e63d10303..ae8ac9a0a 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -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) //{ diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index 5540d81a8..05d23267d 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -955,7 +955,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { iSafezoneXHalf + 2, 20, 0xffffff); font->drawShadow( L"Seed: " + - _toString(minecraft->level->getLevelData()->getSeed()), + toWString(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(pFeatureData->x * 16) + L", " + - _toString(pFeatureData->z * 16) + L"] "; + L"[" + toWString(pFeatureData->x * 16) + L", " + + toWString(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(minecraft->player->x) + - L"/ Head: " + _toString(xBlockPos) + + L"x: " + toWString(minecraft->player->x) + + L"/ Head: " + toWString(xBlockPos) + L"/ Chunk: " + - _toString(minecraft->player->xChunk), + toWString(minecraft->player->xChunk), iSafezoneXHalf + 2, iYPos + 8 * 0, 0xe0e0e0); drawString(font, - L"y: " + _toString(minecraft->player->y) + - L"/ Head: " + _toString(yBlockPos), + L"y: " + toWString(minecraft->player->y) + + L"/ Head: " + toWString(yBlockPos), iSafezoneXHalf + 2, iYPos + 8 * 1, 0xe0e0e0); drawString(font, - L"z: " + _toString(minecraft->player->z) + - L"/ Head: " + _toString(zBlockPos) + + L"z: " + toWString(minecraft->player->z) + + L"/ Head: " + toWString(zBlockPos) + L"/ Chunk: " + - _toString(minecraft->player->zChunk), + toWString(minecraft->player->zChunk), iSafezoneXHalf + 2, iYPos + 8 * 2, 0xe0e0e0); drawString( font, L"f: " + - _toString( + toWString( Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3) + - L"/ yRot: " + _toString(minecraft->player->yRot), + L"/ yRot: " + toWString(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(biome->id) + L")", + toWString(biome->id) + L")", iSafezoneXHalf + 2, iYPos, 0xe0e0e0); } diff --git a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp index 8e8b4d904..3f49e52fc 100644 --- a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp +++ b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp @@ -77,7 +77,7 @@ void JoinMultiplayerScreen::buttonClicked(Button* button) { } int JoinMultiplayerScreen::parseInt(const std::wstring& str, int def) { - return _fromString(str); + return fromWString(str); } void JoinMultiplayerScreen::keyPressed(wchar_t ch, int eventKey) { diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index 8b2cfea85..2ad4534d7 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -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(id + 1); + toWString(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(id); + worldFolderName = L"World" + toWString(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(i + 1); + name = parent->worldLang + L" " + toWString(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(size / 1024 * 100 / 1024 / 100.0f) + + id = id + L", " + toWString(size / 1024 * 100 / 1024 / 100.0f) + L" MB)"; std::wstring info; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index c7f5eff8f..cb6d44fa5 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -295,7 +295,7 @@ std::wstring MultiPlayerChunkCache::gatherStats() { std::lock_guard lock(m_csLoadCreate); size = (int)loadedChunkList.size(); } - return L"MultiplayerChunkCache: " + _toString(size); + return L"MultiplayerChunkCache: " + toWString(size); } void MultiPlayerChunkCache::dataReceived(int x, int z) { diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index 3b628fa38..0ec0743af 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -288,5 +288,5 @@ std::wstring ParticleEngine::countParticles() { total += particles[l][tt][list].size(); } } - return _toString(total); + return toWString(total); } diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index e9e4ef27c..0893cde46 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -674,18 +674,18 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { } std::wstring LevelRenderer::gatherStats1() { - return L"C: " + _toString(renderedChunks) + L"/" + - _toString(totalChunks) + L". F: " + - _toString(offscreenChunks) + L", O: " + - _toString(occludedChunks) + L", E: " + - _toString(emptyChunks); + return L"C: " + toWString(renderedChunks) + L"/" + + toWString(totalChunks) + L". F: " + + toWString(offscreenChunks) + L", O: " + + toWString(occludedChunks) + L", E: " + + toWString(emptyChunks); } std::wstring LevelRenderer::gatherStats2() { - return L"E: " + _toString(renderedEntities) + L"/" + - _toString(totalEntities) + L". B: " + - _toString(culledEntities) + L", I: " + - _toString((totalEntities - culledEntities) - renderedEntities); + return L"E: " + toWString(renderedEntities) + L"/" + + toWString(totalEntities) + L". B: " + + toWString(culledEntities) + L", I: " + + toWString((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)); } } diff --git a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp index b73c0a143..bc89e5ac8 100644 --- a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp @@ -73,7 +73,7 @@ ResourceLocation* HumanoidMobRenderer::getArmorLocation(ArmorItem* armorItem, std::wstring path = std::wstring(L"armor/" + MATERIAL_NAMES[armorItem->modelIndex]) .append(L"_") - .append(_toString(layer == 2 ? 2 : 1)) + .append(toWString(layer == 2 ? 2 : 1)) .append((overlay ? L"_b" : L"")) .append(L".png"); diff --git a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp index 7598a9de1..2375f82eb 100644 --- a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -597,9 +597,9 @@ void ItemRenderer::renderGuiItemDecorations(Font* font, Textures* textures, if (amount.empty()) { int count = item->count; if (count > 64) { - amount = _toString(64) + L"+"; + amount = toWString(64) + L"+"; } else { - amount = _toString(item->count); + amount = toWString(item->count); } } glDisable(GL_LIGHTING); diff --git a/targets/minecraft/client/renderer/texture/StitchSlot.cpp b/targets/minecraft/client/renderer/texture/StitchSlot.cpp index d4b5e57e3..81839ed28 100644 --- a/targets/minecraft/client/renderer/texture/StitchSlot.cpp +++ b/targets/minecraft/client/renderer/texture/StitchSlot.cpp @@ -137,8 +137,8 @@ void StitchSlot::collectAssignments(std::vector* 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'}'; } \ No newline at end of file diff --git a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp index 1bf676764..53e66eb95 100644 --- a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp +++ b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp @@ -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(token.substr(0, multiPos)); - int count = _fromString(token.substr(multiPos + 1)); + int frame = fromWString(token.substr(0, multiPos)); + int count = fromWString(token.substr(multiPos + 1)); results->push_back(intPairVector::value_type(frame, count)); } else { - int tokenVal = _fromString(token); + int tokenVal = fromWString(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(token.substr(0, multiPos)); - int count = _fromString(token.substr(multiPos + 1)); + int frame = fromWString(token.substr(0, multiPos)); + int count = fromWString(token.substr(multiPos + 1)); results->push_back(intPairVector::value_type(frame, count)); } else if (!token.empty()) { - int tokenVal = _fromString(token); + int tokenVal = fromWString(token); results->push_back(intPairVector::value_type(tokenVal, 1)); } } diff --git a/targets/minecraft/client/renderer/texture/TextureHolder.cpp b/targets/minecraft/client/renderer/texture/TextureHolder.cpp index ee0989111..1893b9337 100644 --- a/targets/minecraft/client/renderer/texture/TextureHolder.cpp +++ b/targets/minecraft/client/renderer/texture/TextureHolder.cpp @@ -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 { diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index b63df4411..2f32f6aa1 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -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) { diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index 43e7c310c..bf3b33ddb 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -519,13 +519,13 @@ std::shared_ptr Packet::readPacket( __debugbreak(); assert(false); // throw new IOException(wstring(L"Bad packet id ") + - // _toString(id)); + // toWString(id)); } packet = getPacket(id); if (packet == nullptr) assert(false); // throw new IOException(wstring(L"Bad packet id ") + - // _toString(id)); + // toWString(id)); // app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client", // packet->getId()); diff --git a/targets/minecraft/server/Settings.cpp b/targets/minecraft/server/Settings.cpp index 21f5edec7..d23221cf4 100644 --- a/targets/minecraft/server/Settings.cpp +++ b/targets/minecraft/server/Settings.cpp @@ -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(defaultValue); + properties[key] = toWString(defaultValue); saveProperties(); } - return _fromString(properties[key]); + return fromWString(properties[key]); } bool Settings::getBoolean(const std::wstring& key, bool defaultValue) { if (properties.find(key) == properties.end()) { - properties[key] = _toString(defaultValue); + properties[key] = toWString(defaultValue); saveProperties(); } - bool retval = _fromString(properties[key]); + bool retval = fromWString(properties[key]); return retval; } void Settings::setBooleanAndSave(const std::wstring& key, bool value) { - properties[key] = _toString(value); + properties[key] = toWString(value); saveProperties(); } \ No newline at end of file diff --git a/targets/minecraft/server/level/DemoMode.cpp b/targets/minecraft/server/level/DemoMode.cpp index a7a75767f..b9519ee8b 100644 --- a/targets/minecraft/server/level/DemoMode.cpp +++ b/targets/minecraft/server/level/DemoMode.cpp @@ -26,7 +26,7 @@ void DemoMode::tick() { if (day <= (DEMO_DAYS + 1)) { minecraft->gui->displayClientMessage(L"demo.day." + - _toString(day)); + toWString(day)); } } else if (day == 1) diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index fc6dcf23d..af2bcc849 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -821,8 +821,8 @@ bool ServerChunkCache::tick() { bool ServerChunkCache::shouldSave() { return !level->noSave; } std::wstring ServerChunkCache::gatherStats() { - return L"ServerChunkCache: "; // + _toString(loadedChunks.size()) + L" - // Drop: " + _toString(toDrop.size()); + return L"ServerChunkCache: "; // + toWString(loadedChunks.size()) + L" + // Drop: " + toWString(toDrop.size()); } std::vector* ServerChunkCache::getMobsAt( diff --git a/targets/minecraft/server/network/ServerConnection.cpp b/targets/minecraft/server/network/ServerConnection.cpp index 700290fff..e8494c554 100644 --- a/targets/minecraft/server/network/ServerConnection.cpp +++ b/targets/minecraft/server/network/ServerConnection.cpp @@ -28,7 +28,7 @@ void ServerConnection::NewIncomingSocket(Socket* socket) { std::shared_ptr unconnectedClient = std::make_shared( server, socket, - L"Connection #" + _toString(connectionCounter++)); + L"Connection #" + toWString(connectionCounter++)); handleConnection(unconnectedClient); } diff --git a/targets/minecraft/stats/Stat.cpp b/targets/minecraft/stats/Stat.cpp index 2ed5957c4..0df732e05 100644 --- a/targets/minecraft/stats/Stat.cpp +++ b/targets/minecraft/stats/Stat.cpp @@ -73,7 +73,7 @@ std::wstring Stat::TimeFormatter::format(int value) { return decimalFormat->format(minutes) + L" m"; } - return _toString(seconds) + L" s"; + return toWString(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(cm) + L" cm"; + return toWString(cm) + L" cm"; } diff --git a/targets/minecraft/stats/Stats.cpp b/targets/minecraft/stats/Stats.cpp index 5f0a022ef..b2edc48ac 100644 --- a/targets/minecraft/stats/Stats.cpp +++ b/targets/minecraft/stats/Stats.cpp @@ -624,7 +624,7 @@ void Stats::buildAdditionalStats() { rainbowCollection = std::vector(16); for (unsigned int i = 0; i < 16; i++) { generalStat = new GeneralStat( - offset++, L"rainbowCollection." + _toString(i)); + offset++, L"rainbowCollection." + toWString(i)); generalStats->push_back(generalStat); rainbowCollection[i] = generalStat; generalStat->postConstruct(); @@ -633,7 +633,7 @@ void Stats::buildAdditionalStats() { biomesVisisted = std::vector(23); for (unsigned int i = 0; i < 23; i++) { generalStat = new GeneralStat( - offset++, L"biomesVisited." + _toString(i)); + offset++, L"biomesVisited." + toWString(i)); generalStats->push_back(generalStat); biomesVisisted[i] = generalStat; generalStat->postConstruct(); diff --git a/targets/minecraft/util/Hasher.cpp b/targets/minecraft/util/Hasher.cpp index 6dfdd383b..c88ed7cd5 100644 --- a/targets/minecraft/util/Hasher.cpp +++ b/targets/minecraft/util/Hasher.cpp @@ -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) //{ diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index a285748ee..3017bd39e 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -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 diff --git a/targets/minecraft/world/entity/Mob.cpp b/targets/minecraft/world/entity/Mob.cpp index 0b1d9cccf..9fe0a5f95 100644 --- a/targets/minecraft/world/entity/Mob.cpp +++ b/targets/minecraft/world/entity/Mob.cpp @@ -244,7 +244,7 @@ void Mob::addAdditonalSaveData(CompoundTag* entityTag) { ListTag* dropChanceList = new ListTag(); 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()); diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index af42a882e..110cd5857 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -650,7 +650,7 @@ void EntityHorse::rebuildLayeredTextureInfo() { } } else { layerTextureLayers[0] = -1; - layerTextureHashName += L"_" + _toString(type) + L"_"; + layerTextureHashName += L"_" + toWString(type) + L"_"; armorIndex = 1; } diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 543e47229..4e28ba603 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -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 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(defaultSkinIndex); } } - if (playerSkin == eDefaultSkins_ServerSelected) { - playerSkin = (EDefaultSkins)(m_playerIndex + 1); + if (playerSkin == EDefaultSkins::ServerSelected) { + playerSkin = static_cast(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: diff --git a/targets/minecraft/world/entity/player/SkinTypes.h b/targets/minecraft/world/entity/player/SkinTypes.h index a8db7583d..67cbce0fe 100644 --- a/targets/minecraft/world/entity/player/SkinTypes.h +++ b/targets/minecraft/world/entity/player/SkinTypes.h @@ -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 - eDefaultSkins_Count, +enum class EDefaultSkins : std::uint8_t { + ServerSelected, + Skin0, + Skin1, + Skin2, + Skin3, + Skin4, + Skin5, + Skin6, + Skin7, + + Count, }; diff --git a/targets/minecraft/world/item/FireworksItem.cpp b/targets/minecraft/world/item/FireworksItem.cpp index 16a5f7808..ad8c68363 100644 --- a/targets/minecraft/world/item/FireworksItem.cpp +++ b/targets/minecraft/world/item/FireworksItem.cpp @@ -66,7 +66,7 @@ void FireworksItem::appendHoverText(std::shared_ptr itemInstance, if (fireTag->contains(TAG_FLIGHT)) { lines->push_back( std::wstring(app.GetString(IDS_ITEM_FIREWORKS_FLIGHT)) + L" " + - _toString((fireTag->getByte(TAG_FLIGHT)))); + toWString((fireTag->getByte(TAG_FLIGHT)))); } ListTag* explosions = diff --git a/targets/minecraft/world/item/Item.cpp b/targets/minecraft/world/item/Item.cpp index f6461fd99..b70630013 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -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."; diff --git a/targets/minecraft/world/item/ItemInstance.cpp b/targets/minecraft/world/item/ItemInstance.cpp index 28b5c8bc1..6704b19a8 100644 --- a/targets/minecraft/world/item/ItemInstance.cpp +++ b/targets/minecraft/world/item/ItemInstance.cpp @@ -514,7 +514,7 @@ std::vector* ItemInstance::getHoverText( //{ // if (id == Item::map_Id) // { - // title += L" #" + _toString(auxValue); + // title += L" #" + toWString(auxValue); // } //} @@ -579,7 +579,7 @@ std::vector* 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* ItemInstance::getHoverText( if (isDamaged()) { std::wstring damageStr = L"Durability: LOCALISE " + - _toString((getMaxDamage()) - getDamageValue()) + L" / " + - _toString(getMaxDamage()); + toWString((getMaxDamage()) - getDamageValue()) + L" / " + + toWString(getMaxDamage()); lines->push_back(HtmlString(damageStr)); } } diff --git a/targets/minecraft/world/item/MapItem.cpp b/targets/minecraft/world/item/MapItem.cpp index faffce44f..b9ddadcb4 100644 --- a/targets/minecraft/world/item/MapItem.cpp +++ b/targets/minecraft/world/item/MapItem.cpp @@ -33,7 +33,7 @@ MapItem::MapItem(int id) : ComplexItem(id) { setStackedByData(true); } std::shared_ptr 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 = std::dynamic_pointer_cast( level->getSavedData(typeid(MapItemSavedData), id)); @@ -45,7 +45,7 @@ std::shared_ptr 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(id); level->setSavedData(id, (std::shared_ptr)mapItemSavedData); @@ -57,7 +57,7 @@ std::shared_ptr MapItem::getSavedData(short idNum, std::shared_ptr MapItem::getSavedData( std::shared_ptr itemInstance, Level* level) { std::wstring id = - std::wstring(L"map_") + _toString(itemInstance->getAuxValue()); + std::wstring(L"map_") + toWString(itemInstance->getAuxValue()); std::shared_ptr mapItemSavedData = std::dynamic_pointer_cast( level->getSavedData(typeid(MapItemSavedData), id)); @@ -69,7 +69,7 @@ std::shared_ptr 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(id); newData = true; diff --git a/targets/minecraft/world/level/ChunkPos.cpp b/targets/minecraft/world/level/ChunkPos.cpp index 023ce6739..f5523128d 100644 --- a/targets/minecraft/world/level/ChunkPos.cpp +++ b/targets/minecraft/world/level/ChunkPos.cpp @@ -52,7 +52,7 @@ TilePos ChunkPos::getMiddleBlockPosition(int y) { } std::wstring ChunkPos::toString() { - return L"[" + _toString(x) + L", " + _toString(z) + L"]"; + return L"[" + toWString(x) + L", " + toWString(z) + L"]"; } int64_t ChunkPos::hash_fnct(const ChunkPos& k) { return k.hashCode(k.x, k.z); } diff --git a/targets/minecraft/world/level/GameRules.cpp b/targets/minecraft/world/level/GameRules.cpp index 9788c7141..8f4d32bce 100644 --- a/targets/minecraft/world/level/GameRules.cpp +++ b/targets/minecraft/world/level/GameRules.cpp @@ -167,9 +167,9 @@ GameRules::GameRule::GameRule(const std::wstring &startValue) void GameRules::GameRule::set(const std::wstring &newValue) { value = newValue; - booleanValue = _fromString(newValue); - intValue = _fromString(newValue); - doubleValue = _fromString(newValue); + booleanValue = fromWString(newValue); + intValue = fromWString(newValue); + doubleValue = fromWString(newValue); } std::wstring GameRules::GameRule::get() diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index c95285847..422b6b1ed 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -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 indicesCopy(1024); @@ -1236,7 +1236,7 @@ void CompressedTileStorage::read(DataInputStream* dis) { std::vector wrapper(allocatedSize); dis->readFully(wrapper); memcpy(indicesAndData, wrapper.data(), allocatedSize); - if (LOCALSYSTEM_ENDIAN == BIGENDIAN) { + if (std::endian::native == std::endian::big) { reverseIndices(indicesAndData); } diff --git a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp index 33bcff68a..ac6abe580 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp @@ -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; diff --git a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp index e96629b09..86421596f 100644 --- a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp @@ -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); } diff --git a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.h b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.h index c068bc648..67ba31063 100644 --- a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.h +++ b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.h @@ -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; diff --git a/targets/minecraft/world/level/levelgen/flat/FlatLayerInfo.cpp b/targets/minecraft/world/level/levelgen/flat/FlatLayerInfo.cpp index e462ef551..4389e81d6 100644 --- a/targets/minecraft/world/level/levelgen/flat/FlatLayerInfo.cpp +++ b/targets/minecraft/world/level/levelgen/flat/FlatLayerInfo.cpp @@ -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(id); + std::wstring result = toWString(id); if (height > 1) { - result = _toString(height) + L"x" + result; + result = toWString(height) + L"x" + result; } if (data > 0) { - result += L":" + _toString(data); + result += L":" + toWString(data); } return result; diff --git a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp index 3572b0ae3..0755f03e3 100644 --- a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp +++ b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp @@ -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(x0) + L", " + _toString(y0) + L", " + - _toString(z0) + L"; " + _toString(x1) + L", " + - _toString(y1) + L", " + _toString(z1) + L")"; + return L"(" + toWString(x0) + L", " + toWString(y0) + L", " + + toWString(z0) + L"; " + toWString(x1) + L", " + + toWString(y1) + L", " + toWString(z1) + L")"; } IntArrayTag* BoundingBox::createTag(const std::wstring& name) { diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp index 647f8b3ea..039df4998 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp @@ -283,12 +283,12 @@ StrongholdPieces::StrongholdPiece::StrongholdPiece(int genDepth) } void StrongholdPieces::StrongholdPiece::addAdditonalSaveData(CompoundTag* tag) { - tag->putString(L"EntryDoor", _toString(entryDoor)); + tag->putString(L"EntryDoor", toWString(entryDoor)); } void StrongholdPieces::StrongholdPiece::readAdditonalSaveData( CompoundTag* tag) { - entryDoor = (SmallDoorType)_fromString(tag->getString(L"EntryDoor")); + entryDoor = (SmallDoorType)fromWString(tag->getString(L"EntryDoor")); } void StrongholdPieces::StrongholdPiece::generateSmallDoor( diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp index ae9a68421..dd9cfd2f2 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp @@ -36,7 +36,7 @@ void StructureFeatureSavedData::putFeatureTag(CompoundTag* tag, int chunkX, std::wstring StructureFeatureSavedData::createFeatureTagId(int chunkX, int chunkZ) { - return L"[" + _toString(chunkX) + L"," + _toString(chunkZ) + L"]"; + return L"[" + toWString(chunkX) + L"," + toWString(chunkZ) + L"]"; } CompoundTag* StructureFeatureSavedData::getFullTag() { return pieceTags; } \ No newline at end of file diff --git a/targets/minecraft/world/level/pathfinder/Node.cpp b/targets/minecraft/world/level/pathfinder/Node.cpp index aa5e792e3..6112dfb37 100644 --- a/targets/minecraft/world/level/pathfinder/Node.cpp +++ b/targets/minecraft/world/level/pathfinder/Node.cpp @@ -64,6 +64,6 @@ int Node::hashCode() { return hash; } bool Node::inOpenSet() { return heapIdx >= 0; } std::wstring Node::toString() { - return _toString(x) + L", " + _toString(y) + L", " + - _toString(z); + return toWString(x) + L", " + toWString(y) + L", " + + toWString(z); } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h index 61bbd4924..29ca0ac9e 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h @@ -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; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index 2d5d2cf33..e5f302819 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -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); } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h index 6db4e52c5..d0193e7b0 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h @@ -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); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 70534965c..bb225db4c 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -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); } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h index 44bc76632..0ec06afac 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h @@ -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(); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index 4271ca3e2..9fea1b59a 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -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* 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; } \ No newline at end of file diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h index 66bb7953b..ba63ee694 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h @@ -6,7 +6,7 @@ #include #include -#include "util/Definitions.h" +#include #define MAKE_FOURCC(ch0, ch1, ch2, ch3) \ (static_cast(static_cast(ch0)) | \ @@ -164,8 +164,8 @@ class FileHeader { private: std::vector 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); } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index e7d77bb93..f8fb4b181 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -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) { 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) { 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(xuidStr); + PlayerUID xuid = fromWString(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(xuidStr); + PlayerUID xuid = fromWString(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)); diff --git a/targets/minecraft/world/level/tile/CarrotTile.cpp b/targets/minecraft/world/level/tile/CarrotTile.cpp index 5a49b2de1..0efc57d2d 100644 --- a/targets/minecraft/world/level/tile/CarrotTile.cpp +++ b/targets/minecraft/world/level/tile/CarrotTile.cpp @@ -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)); } } \ No newline at end of file diff --git a/targets/minecraft/world/level/tile/CropTile.cpp b/targets/minecraft/world/level/tile/CropTile.cpp index 59e640901..28d4be5dc 100644 --- a/targets/minecraft/world/level/tile/CropTile.cpp +++ b/targets/minecraft/world/level/tile/CropTile.cpp @@ -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)); } } \ No newline at end of file diff --git a/targets/minecraft/world/level/tile/NetherWartTile.cpp b/targets/minecraft/world/level/tile/NetherWartTile.cpp index adbc414e4..3b6a2c7e4 100644 --- a/targets/minecraft/world/level/tile/NetherWartTile.cpp +++ b/targets/minecraft/world/level/tile/NetherWartTile.cpp @@ -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(i)); + toWString(i)); } } diff --git a/targets/minecraft/world/level/tile/PotatoTile.cpp b/targets/minecraft/world/level/tile/PotatoTile.cpp index 601f675fb..51a7d9c5b 100644 --- a/targets/minecraft/world/level/tile/PotatoTile.cpp +++ b/targets/minecraft/world/level/tile/PotatoTile.cpp @@ -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(i)); + toWString(i)); } } \ No newline at end of file diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index 6b5dfb1b6..fe3819555 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -2623,8 +2623,8 @@ Tile* Tile::setIconName(const std::wstring& iconName) { } std::wstring Tile::getIconName() { - return iconName.empty() ? L"MISSING_ICON_TILE_" + _toString(id) + - L"_" + _toString(descriptionId) + return iconName.empty() ? L"MISSING_ICON_TILE_" + toWString(id) + + L"_" + toWString(descriptionId) : iconName; } diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 02c33afe1..893bcf60c 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -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' diff --git a/targets/util/include/util/Definitions.h b/targets/util/include/util/Definitions.h index db512e514..b02596765 100644 --- a/targets/util/include/util/Definitions.h +++ b/targets/util/include/util/Definitions.h @@ -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; diff --git a/targets/util/include/util/StringHelpers.h b/targets/util/include/util/StringHelpers.h index b9a110de6..590ce8d37 100644 --- a/targets/util/include/util/StringHelpers.h +++ b/targets/util/include/util/StringHelpers.h @@ -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 -std::wstring _toString(T t) { +std::wstring toWString(T t) { std::wostringstream oss; oss << std::dec << t; return oss.str(); } template -T _fromString(const std::wstring& s) { +T fromWString(const std::wstring& s) { std::wistringstream stream(s); T t; stream >> t; return t; } template -T _fromHEXString(const std::wstring& s) { +T fromHexWString(const std::wstring& s) { std::wistringstream stream(s); T t; stream >> std::hex >> t;