Fixing more conflicts

This commit is contained in:
Chase Cooper 2026-03-07 16:20:44 -05:00
parent 8c79769645
commit 5acd0e1c9f
27 changed files with 204 additions and 517 deletions

View file

@ -858,27 +858,6 @@ void UIController::tickInput()
sceneMouseX = sceneMouseX * ((F32)pScene->getRenderWidth() / (F32)winW); sceneMouseX = sceneMouseX * ((F32)pScene->getRenderWidth() / (F32)winW);
sceneMouseY = sceneMouseY * ((F32)pScene->getRenderHeight() / (F32)winH); sceneMouseY = sceneMouseY * ((F32)pScene->getRenderHeight() / (F32)winH);
} }
<<<<<<< HEAD
if (hitObject != currentFocus)
{
IggyPlayerSetFocusRS(movie, hitObject, 0);
}
}
}
// Convert mouse to scene/movie coordinates for slider hit testing
F32 sceneMouseX = mouseX;
F32 sceneMouseY = mouseY;
{
S32 displayWidth = 0, displayHeight = 0;
pScene->GetParentLayer()->getRenderDimensions(displayWidth, displayHeight);
if (displayWidth > 0 && displayHeight > 0)
{
sceneMouseX = mouseX * (static_cast<F32>(pScene->getRenderWidth()) / static_cast<F32>(displayWidth));
sceneMouseY = mouseY * (static_cast<F32>(pScene->getRenderHeight()) / static_cast<F32>(displayHeight));
=======
>>>>>>> origin/main
} }
} }
@ -1052,14 +1031,10 @@ void UIController::tickInput()
if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible()) if (!ctrl || ctrl->getControlType() != UIControl::eSlider || !ctrl->getVisible())
continue; continue;
<<<<<<< HEAD
UIControl_Slider *pSlider = static_cast<UIControl_Slider *>(ctrl);
=======
if (pMainPanel && ctrl->getParentPanel() != pMainPanel) if (pMainPanel && ctrl->getParentPanel() != pMainPanel)
continue; continue;
UIControl_Slider *pSlider = (UIControl_Slider *)ctrl; UIControl_Slider *pSlider = static_cast<UIControl_Slider *>(ctrl);
>>>>>>> origin/main
pSlider->UpdateControl(); pSlider->UpdateControl();
S32 cx = pSlider->getXPos() + panelOffsetX; S32 cx = pSlider->getXPos() + panelOffsetX;
S32 cy = pSlider->getYPos() + panelOffsetY; S32 cy = pSlider->getYPos() + panelOffsetY;

View file

@ -334,12 +334,7 @@ void UIScene_AnvilMenu::onDirectEditFinished(UIControl_TextInput *input, UIContr
int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
{ {
<<<<<<< HEAD
// 4J HEG - No reason to set value if keyboard was cancelled
UIScene_AnvilMenu *pClass=static_cast<UIScene_AnvilMenu *>(lpParam); UIScene_AnvilMenu *pClass=static_cast<UIScene_AnvilMenu *>(lpParam);
=======
UIScene_AnvilMenu *pClass=(UIScene_AnvilMenu *)lpParam;
>>>>>>> origin/main
pClass->setIgnoreInput(false); pClass->setIgnoreInput(false);
if (bRes) if (bRes)
@ -348,8 +343,8 @@ int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes)
uint16_t pchText[128]; uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t)); ZeroMemory(pchText, 128 * sizeof(uint16_t));
Win64_GetKeyboardText(pchText, 128); Win64_GetKeyboardText(pchText, 128);
pClass->setEditNameValue((wchar_t *)pchText); pClass->setEditNameValue(reinterpret_cast<wchar_t *>(pchText));
pClass->m_itemName = (wchar_t *)pchText; pClass->m_itemName = reinterpret_cast<wchar_t *>(pchText);
pClass->updateItemName(); pClass->updateItemName();
#else #else
uint16_t pchText[128]; uint16_t pchText[128];

View file

@ -287,136 +287,68 @@ void UIScene_CreateWorldMenu::handleDestroy()
void UIScene_CreateWorldMenu::tick() void UIScene_CreateWorldMenu::tick()
{ {
UIScene::tick(); UIScene::tick();
#ifdef _WINDOWS64 if(m_iSetTexturePackDescription >= 0 )
// Cooldown timer to absorb ACTION_MENU_OK immediately after finishing text edit {
if (m_iDirectEditCooldown > 0) UpdateTexturePackDescription( m_iSetTexturePackDescription );
m_iDirectEditCooldown--; m_iSetTexturePackDescription = -1;
}
if(m_bShowTexturePackDescription)
{
slideLeft();
m_texturePackDescDisplayed = true;
// Direct world name keyboard editing m_bShowTexturePackDescription = false;
if (m_bDirectEditing) }
{
wchar_t ch;
bool changed = false;
// Consume UTF16 char input
while (g_KBMInput.ConsumeChar(ch))
{
if (ch == 0x08) // backspace
{
if (!m_worldName.empty())
{
m_worldName.pop_back();
changed = true;
}
}
else if (ch == 0x0D) // enter → confirm edit
{
m_bDirectEditing = false;
m_iDirectEditCooldown = 4; // absorb the matching ACTION_MENU_OK
m_editWorldName.setLabel(m_worldName.c_str());
}
else if (static_cast<int>(m_worldName.length()) < 25)
{
// Append typed character
m_worldName += ch;
changed = true;
}
}
// Escape = cancel & restore original name
if (m_bDirectEditing && g_KBMInput.IsKeyPressed(VK_ESCAPE))
{
m_worldName = m_worldNameBeforeEdit;
m_bDirectEditing = false;
m_iDirectEditCooldown = 4;
m_editWorldName.setLabel(m_worldName.c_str());
m_buttonCreateWorld.setEnable(!m_worldName.empty());
}
else if (changed)
{
// Update displayed label while typing
m_editWorldName.setLabel(m_worldName.c_str());
m_buttonCreateWorld.setEnable(!m_worldName.empty());
}
}
#endif // _WINDOWS64
// ---------------------------------------------------------
// origin/main logic begins
// ---------------------------------------------------------
if (m_iSetTexturePackDescription >= 0)
{
UpdateTexturePackDescription(m_iSetTexturePackDescription);
m_iSetTexturePackDescription = -1;
}
if (m_bShowTexturePackDescription)
{
slideLeft();
m_texturePackDescDisplayed = true;
m_bShowTexturePackDescription = false;
}
#ifdef __ORBIS__ #ifdef __ORBIS__
// check the status of the PSPlus common dialog // check the status of the PSPlus common dialog
switch (sceNpCommerceDialogUpdateStatus()) switch (sceNpCommerceDialogUpdateStatus())
{ {
case SCE_COMMON_DIALOG_STATUS_FINISHED: case SCE_COMMON_DIALOG_STATUS_FINISHED:
{ {
SceNpCommerceDialogResult Result; SceNpCommerceDialogResult Result;
sceNpCommerceDialogGetResult(&Result); sceNpCommerceDialogGetResult(&Result);
sceNpCommerceDialogTerminate(); sceNpCommerceDialogTerminate();
if (Result.authorized) if(Result.authorized)
{ {
ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result); ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result);
// they just became a PSPlus member // they just became a PSPlus member
checkStateAndStartGame(); checkStateAndStartGame();
} }
else else
{ {
// continue offline? // continue offline?
UINT uiIDA[1]; UINT uiIDA[1];
uiIDA[0] = IDS_PRO_NOTONLINE_DECLINE; uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE;
// warning about missing PSPlus // Give the player a warning about the texture pack missing
ui.RequestAlertMessage( ui.RequestAlertMessage(IDS_PLAY_OFFLINE,IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::ContinueOffline,dynamic_cast<UIScene_CreateWorldMenu*>(this));
IDS_PLAY_OFFLINE, }
IDS_NO_PLAYSTATIONPLUS, }
uiIDA, break;
1, default:
ProfileManager.GetPrimaryPad(), break;
&UIScene_CreateWorldMenu::ContinueOffline, }
dynamic_cast<UIScene_CreateWorldMenu*>(this)); #endif
}
}
break;
default:
break;
}
#endif // __ORBIS__
} }
#ifdef __ORBIS__ #ifdef __ORBIS__
int UIScene_CreateWorldMenu::ContinueOffline(void* pParam, int iPad, C4JStorage::EMessageResult result) int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::EMessageResult result)
{ {
UIScene_CreateWorldMenu* pClass = static_cast<UIScene_CreateWorldMenu*>(pParam); UIScene_CreateWorldMenu* pClass = (UIScene_CreateWorldMenu*)pParam;
// results switched for this dialog // results switched for this dialog
if (result == C4JStorage::EMessage_ResultAccept) if(result==C4JStorage::EMessage_ResultAccept)
{ {
pClass->m_MoreOptionsParams.bOnlineGame = false; pClass->m_MoreOptionsParams.bOnlineGame=false;
pClass->checkStateAndStartGame(); pClass->checkStateAndStartGame();
} }
return 0; return 0;
} }
#endif #endif
#ifdef _WINDOWS64 #ifdef _WINDOWS64
@ -1203,7 +1135,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
if (wSeed.length() != 0) if (wSeed.length() != 0)
{ {
int64_t value = 0; int64_t value = 0;
const unsigned int len = static_cast<unsigned int>(wSeed.length()); unsigned int len = static_cast<unsigned int>(wSeed.length());
//Check if the input string contains a numerical value //Check if the input string contains a numerical value
bool isNumber = true; bool isNumber = true;

View file

@ -68,7 +68,7 @@ DWORD XContentGetThumbnail(DWORD dwUserIndex, const XCONTENT_DATA* pContentData,
void XShowAchievementsUI(int i) {} void XShowAchievementsUI(int i) {}
DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; }
#ifndef _DURANGO #if !defined(_DURANGO) && !defined(_WIN64)
void PIXAddNamedCounter(int a, const char* b, ...) {} void PIXAddNamedCounter(int a, const char* b, ...) {}
//#define PS3_USE_PIX_EVENTS //#define PS3_USE_PIX_EVENTS
//#define PS4_USE_PIX_EVENTS //#define PS4_USE_PIX_EVENTS
@ -126,7 +126,9 @@ void PIXEndNamedEvent()
#endif #endif
} }
void PIXSetMarkerDeprecated(int a, const char* b, ...) {} void PIXSetMarkerDeprecated(int a, const char* b, ...) {}
#else #endif
#if 0//__PSVITA__
// 4J Stu - Removed this implementation in favour of a macro that will convert our string format // 4J Stu - Removed this implementation in favour of a macro that will convert our string format
// conversion at compile time rather than at runtime // conversion at compile time rather than at runtime
//void PIXBeginNamedEvent(int a, char *b, ...) //void PIXBeginNamedEvent(int a, char *b, ...)

View file

@ -137,11 +137,6 @@ int NetworkPlayerXbox::GetTimeSinceLastChunkPacket_ms()
return INT_MAX; return INT_MAX;
} }
<<<<<<< HEAD const int64_t currentTime = System::currentTimeMillis();
__int64 currentTime = System::currentTimeMillis();
return static_cast<int>(currentTime - m_lastChunkPacketTime); return static_cast<int>(currentTime - m_lastChunkPacketTime);
=======
int64_t currentTime = System::currentTimeMillis();
return (int)( currentTime - m_lastChunkPacketTime );
>>>>>>> origin/main
} }

View file

@ -158,13 +158,8 @@ public:
int64_t getLong(const wstring &name) int64_t getLong(const wstring &name)
{ {
<<<<<<< HEAD
if (tags.find(name) == tags.end()) return (__int64)0;
return static_cast<LongTag *>(tags[name])->data;
=======
if (tags.find(name) == tags.end()) return (int64_t)0; if (tags.find(name) == tags.end()) return (int64_t)0;
return ((LongTag *) tags[name])->data; return ((LongTag *) tags[name])->data;
>>>>>>> origin/main
} }
float getFloat(const wstring &name) float getFloat(const wstring &name)

View file

@ -213,13 +213,8 @@ ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal()
VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT ); VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT );
pagesCommitted = 0; pagesCommitted = 0;
// Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway // Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway
<<<<<<< HEAD
#if defined _XBOX
app.GetSaveThumbnail(nullptr,nullptr);
=======
#if defined _XBOX #if defined _XBOX
app.GetSaveThumbnail(NULL,NULL); app.GetSaveThumbnail(NULL,NULL);
>>>>>>> origin/main
#elif defined __PS3__ #elif defined __PS3__
app.GetSaveThumbnail(nullptr,nullptr, nullptr,nullptr); app.GetSaveThumbnail(nullptr,nullptr, nullptr,nullptr);
#endif #endif

View file

@ -110,11 +110,7 @@ wchar_t DataInputStream::readChar()
{ {
int a = stream->read(); int a = stream->read();
int b = stream->read(); int b = stream->read();
<<<<<<< HEAD return static_cast<wchar_t>((a << 8) | (b & 0xff));
return static_cast<wchar_t>((a << 8) | (b & 0xff));
=======
return (wchar_t)((a << 8) | (b & 0xff));
>>>>>>> origin/main
} }
//Reads some bytes from an input stream and stores them into the buffer array b. The number of bytes read is equal to the length of b. //Reads some bytes from an input stream and stores them into the buffer array b. The number of bytes read is equal to the length of b.

View file

@ -227,13 +227,8 @@ void DataOutputStream::writeUTF(const wstring& str)
byteArray bytearr(utflen+2); byteArray bytearr(utflen+2);
<<<<<<< HEAD
bytearr[count++] = static_cast<byte>((utflen >> 8) & 0xFF); bytearr[count++] = static_cast<byte>((utflen >> 8) & 0xFF);
bytearr[count++] = static_cast<byte>((utflen >> 0) & 0xFF); bytearr[count++] = static_cast<byte>((utflen >> 0) & 0xFF);
=======
bytearr[count++] = (byte) ((utflen >> 8) & 0xFF);
bytearr[count++] = (byte) ((utflen >> 0) & 0xFF);
>>>>>>> origin/main
int i=0; int i=0;
for (i=0; i<strlen; i++) for (i=0; i<strlen; i++)

View file

@ -24,8 +24,8 @@ _MapDataMappings::_MapDataMappings()
int _MapDataMappings::getDimension(int id) int _MapDataMappings::getDimension(int id)
{ {
int offset = (2*(id%4)); const int offset = (2*(id%4));
int val = (dimensions[id>>2] & (3 << offset))>>offset; const int val = (dimensions[id>>2] & (3 << offset))>>offset;
int returnVal=0; int returnVal=0;
@ -54,7 +54,7 @@ void _MapDataMappings::setMapping(int id, PlayerUID xuid, int dimension)
{ {
xuids[id] = xuid; xuids[id] = xuid;
int offset = (2*(id%4)); const int offset = (2*(id%4));
// Reset it first // Reset it first
dimensions[id>>2] &= ~( 2 << offset ); dimensions[id>>2] &= ~( 2 << offset );
@ -108,11 +108,7 @@ void _MapDataMappings_old::setMapping(int id, PlayerUID xuid, int dimension)
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
void DirectoryLevelStorage::PlayerMappings::addMapping(int id, int centreX, int centreZ, int dimension, int scale) void DirectoryLevelStorage::PlayerMappings::addMapping(int id, int centreX, int centreZ, int dimension, int scale)
{ {
<<<<<<< HEAD const int64_t index = ( static_cast<int64_t>(centreZ & 0x1FFFFFFF) << 34) | ( static_cast<int64_t>(centreX & 0x1FFFFFFF) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
__int64 index = ( static_cast<__int64>(centreZ & 0x1FFFFFFF) << 34) | ( static_cast<__int64>(centreX & 0x1FFFFFFF) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
=======
int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
>>>>>>> origin/main
m_mappings[index] = id; m_mappings[index] = id;
//app.DebugPrintf("Adding mapping: %d - (%d,%d)/%d/%d [%I64d - 0x%016llx]\n", id, centreX, centreZ, dimension, scale, index, index); //app.DebugPrintf("Adding mapping: %d - (%d,%d)/%d/%d [%I64d - 0x%016llx]\n", id, centreX, centreZ, dimension, scale, index, index);
} }
@ -124,12 +120,8 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int &id, int centreX, int
//int64_t zShifted = zMasked << 34; //int64_t zShifted = zMasked << 34;
//int64_t xShifted = xMasked << 5; //int64_t xShifted = xMasked << 5;
//app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted); //app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted);
<<<<<<< HEAD const int64_t index = ( static_cast<int64_t>(centreZ & 0x1FFFFFFF) << 34) | ( static_cast<int64_t>(centreX & 0x1FFFFFFF) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
__int64 index = ( static_cast<__int64>(centreZ & 0x1FFFFFFF) << 34) | ( static_cast<__int64>(centreX & 0x1FFFFFFF) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3); const auto it = m_mappings.find(index);
=======
int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
>>>>>>> origin/main
auto it = m_mappings.find(index);
if(it != m_mappings.end()) if(it != m_mappings.end())
{ {
id = it->second; id = it->second;
@ -146,7 +138,7 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int &id, int centreX, int
void DirectoryLevelStorage::PlayerMappings::writeMappings(DataOutputStream *dos) void DirectoryLevelStorage::PlayerMappings::writeMappings(DataOutputStream *dos)
{ {
dos->writeInt(m_mappings.size()); dos->writeInt(m_mappings.size());
for ( auto& it : m_mappings ) for (const auto& it : m_mappings )
{ {
app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", it.first, it.first, it.second); app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", it.first, it.first, it.second);
dos->writeLong(it.first); dos->writeLong(it.first);
@ -156,11 +148,11 @@ void DirectoryLevelStorage::PlayerMappings::writeMappings(DataOutputStream *dos)
void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream *dis) void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream *dis)
{ {
int count = dis->readInt(); const int count = dis->readInt();
for(unsigned int i = 0; i < count; ++i) for(unsigned int i = 0; i < count; ++i)
{ {
int64_t index = dis->readLong(); int64_t index = dis->readLong();
int id = dis->readInt(); const int id = dis->readInt();
m_mappings[index] = id; m_mappings[index] = id;
app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", index, index, id); app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", index, index, id);
} }
@ -182,7 +174,7 @@ DirectoryLevelStorage::~DirectoryLevelStorage()
{ {
delete m_saveFile; delete m_saveFile;
for( auto& it : m_cachedSaveData ) for(const auto& it : m_cachedSaveData )
{ {
delete it.second; delete it.second;
} }
@ -196,7 +188,7 @@ void DirectoryLevelStorage::initiateSession()
{ {
// 4J Jev, removed try/catch. // 4J Jev, removed try/catch.
File dataFile = File( dir, wstring(L"session.lock") ); const File dataFile = File( dir, wstring(L"session.lock") );
FileOutputStream fos = FileOutputStream(dataFile); FileOutputStream fos = FileOutputStream(dataFile);
DataOutputStream dos = DataOutputStream(&fos); DataOutputStream dos = DataOutputStream(&fos);
dos.writeLong(sessionId); dos.writeLong(sessionId);
@ -227,13 +219,13 @@ ChunkStorage *DirectoryLevelStorage::createChunkStorage(Dimension *dimension)
if (dynamic_cast<HellDimension *>(dimension) != nullptr) if (dynamic_cast<HellDimension *>(dimension) != nullptr)
{ {
File dir2 = File(dir, LevelStorage::NETHER_FOLDER); const File dir2 = File(dir, LevelStorage::NETHER_FOLDER);
//dir2.mkdirs(); // 4J Removed //dir2.mkdirs(); // 4J Removed
return new OldChunkStorage(dir2, true); return new OldChunkStorage(dir2, true);
} }
if (dynamic_cast<TheEndDimension *>(dimension) != nullptr) if (dynamic_cast<TheEndDimension *>(dimension) != nullptr)
{ {
File dir2 = File(dir, LevelStorage::ENDER_FOLDER); const File dir2 = File(dir, LevelStorage::ENDER_FOLDER);
//dir2.mkdirs(); // 4J Removed //dir2.mkdirs(); // 4J Removed
return new OldChunkStorage(dir2, true); return new OldChunkStorage(dir2, true);
} }
@ -245,7 +237,7 @@ LevelData *DirectoryLevelStorage::prepareLevel()
{ {
// 4J Stu Added // 4J Stu Added
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
ConsoleSavePath mapFile = getDataFile(L"largeMapDataMappings"); const ConsoleSavePath mapFile = getDataFile(L"largeMapDataMappings");
#else #else
ConsoleSavePath mapFile = getDataFile(L"mapDataMappings"); ConsoleSavePath mapFile = getDataFile(L"mapDataMappings");
#endif #endif
@ -281,13 +273,13 @@ LevelData *DirectoryLevelStorage::prepareLevel()
getSaveFile()->setFilePointer(fileEntry,0,nullptr, FILE_BEGIN); getSaveFile()->setFilePointer(fileEntry,0,nullptr, FILE_BEGIN);
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
byteArray data(fileEntry->getFileSize()); const byteArray data(fileEntry->getFileSize());
getSaveFile()->readFile( fileEntry, data.data, fileEntry->getFileSize(), &NumberOfBytesRead); getSaveFile()->readFile( fileEntry, data.data, fileEntry->getFileSize(), &NumberOfBytesRead);
assert( NumberOfBytesRead == fileEntry->getFileSize() ); assert( NumberOfBytesRead == fileEntry->getFileSize() );
ByteArrayInputStream bais(data); ByteArrayInputStream bais(data);
DataInputStream dis(&bais); DataInputStream dis(&bais);
int count = dis.readInt(); const int count = dis.readInt();
app.DebugPrintf("Loading %d mappings\n", count); app.DebugPrintf("Loading %d mappings\n", count);
for(unsigned int i = 0; i < count; ++i) for(unsigned int i = 0; i < count; ++i)
{ {
@ -340,7 +332,7 @@ LevelData *DirectoryLevelStorage::prepareLevel()
// 4J Jev, removed try/catch // 4J Jev, removed try/catch
ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) ); const ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) );
if ( m_saveFile->doesFileExist( dataFile ) ) if ( m_saveFile->doesFileExist( dataFile ) )
{ {
@ -364,7 +356,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vector<shared_pt
CompoundTag *root = new CompoundTag(); CompoundTag *root = new CompoundTag();
root->put(L"Data", dataTag); root->put(L"Data", dataTag);
ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); const ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) );
ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile ); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile );
NbtIo::writeCompressed(root, &fos); NbtIo::writeCompressed(root, &fos);
@ -381,7 +373,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData *levelData)
CompoundTag *root = new CompoundTag(); CompoundTag *root = new CompoundTag();
root->put(L"Data", dataTag); root->put(L"Data", dataTag);
ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) ); const ConsoleSavePath currentFile = ConsoleSavePath( wstring( L"level.dat" ) );
ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile ); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream( m_saveFile, currentFile );
NbtIo::writeCompressed(root, &fos); NbtIo::writeCompressed(root, &fos);
@ -406,7 +398,7 @@ void DirectoryLevelStorage::save(shared_ptr<Player> player)
#elif defined(_DURANGO) #elif defined(_DURANGO)
ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + player->getXuid().toString() + L".dat" ); ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + player->getXuid().toString() + L".dat" );
#else #else
ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( player->getXuid() ) + L".dat" ); const ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( player->getXuid() ) + L".dat" );
#endif #endif
// If saves are disabled (e.g. because we are writing the save buffer to disk) then cache this player data // If saves are disabled (e.g. because we are writing the save buffer to disk) then cache this player data
if(StorageManager.GetSaveDisabled()) if(StorageManager.GetSaveDisabled())
@ -414,7 +406,7 @@ void DirectoryLevelStorage::save(shared_ptr<Player> player)
ByteArrayOutputStream *bos = new ByteArrayOutputStream(); ByteArrayOutputStream *bos = new ByteArrayOutputStream();
NbtIo::writeCompressed(tag,bos); NbtIo::writeCompressed(tag,bos);
auto it = m_cachedSaveData.find(realFile.getName()); const auto it = m_cachedSaveData.find(realFile.getName());
if(it != m_cachedSaveData.end() ) if(it != m_cachedSaveData.end() )
{ {
delete it->second; delete it->second;
@ -455,9 +447,9 @@ CompoundTag *DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid)
#elif defined(_DURANGO) #elif defined(_DURANGO)
ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + xuid.toString() + L".dat" ); ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + xuid.toString() + L".dat" );
#else #else
ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( xuid ) + L".dat" ); const ConsoleSavePath realFile = ConsoleSavePath( playerDir.getName() + std::to_wstring( xuid ) + L".dat" );
#endif #endif
auto it = m_cachedSaveData.find(realFile.getName()); const auto it = m_cachedSaveData.find(realFile.getName());
if(it != m_cachedSaveData.end() ) if(it != m_cachedSaveData.end() )
{ {
ByteArrayOutputStream *bos = it->second; ByteArrayOutputStream *bos = it->second;
@ -493,12 +485,12 @@ void DirectoryLevelStorage::clearOldPlayerFiles()
{ {
for(unsigned int i = 0; i < playerFiles->size(); ++i ) for(unsigned int i = 0; i < playerFiles->size(); ++i )
{ {
FileEntry *file = playerFiles->at(i); const FileEntry *file = playerFiles->at(i);
wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L"");
#if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO) #if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO)
PlayerUID xuid(xuidStr); PlayerUID xuid(xuidStr);
#else #else
PlayerUID xuid = _fromString<PlayerUID>(xuidStr); const PlayerUID xuid = _fromString<PlayerUID>(xuidStr);
#endif #endif
deleteMapFilesForPlayer(xuid); deleteMapFilesForPlayer(xuid);
m_saveFile->deleteFile( playerFiles->at(i) ); m_saveFile->deleteFile( playerFiles->at(i) );
@ -512,12 +504,12 @@ void DirectoryLevelStorage::clearOldPlayerFiles()
for(unsigned int i = MAX_PLAYER_DATA_SAVES; i < playerFiles->size(); ++i ) for(unsigned int i = MAX_PLAYER_DATA_SAVES; i < playerFiles->size(); ++i )
{ {
FileEntry *file = playerFiles->at(i); const FileEntry *file = playerFiles->at(i);
wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L""); wstring xuidStr = replaceAll( replaceAll(file->data.filename,playerDir.getName(),L""),L".dat",L"");
#if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO) #if defined(__PS3__) || defined(__ORBIS__) || defined(_DURANGO)
PlayerUID xuid(xuidStr); PlayerUID xuid(xuidStr);
#else #else
PlayerUID xuid = _fromString<PlayerUID>(xuidStr); const PlayerUID xuid = _fromString<PlayerUID>(xuidStr);
#endif #endif
deleteMapFilesForPlayer(xuid); deleteMapFilesForPlayer(xuid);
m_saveFile->deleteFile( playerFiles->at(i) ); m_saveFile->deleteFile( playerFiles->at(i) );
@ -553,7 +545,7 @@ void DirectoryLevelStorage::flushSaveFile(bool autosave)
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_DistributableSave)) if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_DistributableSave))
{ {
// Delete gamerules files if it exists // Delete gamerules files if it exists
ConsoleSavePath gameRulesFiles(GAME_RULE_SAVENAME); const ConsoleSavePath gameRulesFiles(GAME_RULE_SAVENAME);
if(m_saveFile->doesFileExist(gameRulesFiles)) if(m_saveFile->doesFileExist(gameRulesFiles))
{ {
FileEntry *fe = m_saveFile->createFile(gameRulesFiles); FileEntry *fe = m_saveFile->createFile(gameRulesFiles);
@ -572,7 +564,7 @@ void DirectoryLevelStorage::resetNetherPlayerPositions()
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
vector<FileEntry *> *playerFiles = m_saveFile->getValidPlayerDatFiles(); vector<FileEntry *> *playerFiles = m_saveFile->getValidPlayerDatFiles();
#else #else
vector<FileEntry *> *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() ); const vector<FileEntry *> *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() );
#endif #endif
if ( playerFiles ) if ( playerFiles )
@ -607,7 +599,7 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension, int
bool foundMapping = false; bool foundMapping = false;
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
auto it = m_playerMappings.find(xuid); const auto it = m_playerMappings.find(xuid);
if(it != m_playerMappings.end()) if(it != m_playerMappings.end())
{ {
foundMapping = it->second.getMapping(mapId, centreXC, centreZC, dimension, scale); foundMapping = it->second.getMapping(mapId, centreXC, centreZC, dimension, scale);
@ -674,7 +666,7 @@ void DirectoryLevelStorage::saveMapIdLookup()
if(StorageManager.GetSaveDisabled() ) return; if(StorageManager.GetSaveDisabled() ) return;
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
ConsoleSavePath file = getDataFile(L"largeMapDataMappings"); const ConsoleSavePath file = getDataFile(L"largeMapDataMappings");
#else #else
ConsoleSavePath file = getDataFile(L"mapDataMappings"); ConsoleSavePath file = getDataFile(L"mapDataMappings");
#endif #endif
@ -720,13 +712,13 @@ void DirectoryLevelStorage::saveMapIdLookup()
void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid) void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid)
{ {
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
auto it = m_playerMappings.find(xuid); const auto it = m_playerMappings.find(xuid);
if(it != m_playerMappings.end()) if(it != m_playerMappings.end())
{ {
for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap) for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap)
{ {
int index = itMap->second / 8; const int index = itMap->second / 8;
int offset = itMap->second % 8; const int offset = itMap->second % 8;
m_usedMappings[index] &= ~(1<<offset); m_usedMappings[index] &= ~(1<<offset);
} }
m_playerMappings.erase(it); m_playerMappings.erase(it);
@ -744,14 +736,14 @@ void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid)
void DirectoryLevelStorage::deleteMapFilesForPlayer(shared_ptr<Player> player) void DirectoryLevelStorage::deleteMapFilesForPlayer(shared_ptr<Player> player)
{ {
PlayerUID playerXuid = player->getXuid(); const PlayerUID playerXuid = player->getXuid();
if(playerXuid != INVALID_XUID) deleteMapFilesForPlayer(playerXuid); if(playerXuid != INVALID_XUID) deleteMapFilesForPlayer(playerXuid);
} }
void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid)
{ {
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
auto it = m_playerMappings.find(xuid); const auto it = m_playerMappings.find(xuid);
if(it != m_playerMappings.end()) if(it != m_playerMappings.end())
{ {
for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap) for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap)
@ -766,8 +758,8 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid)
else m_saveFile->deleteFile( m_saveFile->createFile(file) ); else m_saveFile->deleteFile( m_saveFile->createFile(file) );
} }
int index = itMap->second / 8; const int index = itMap->second / 8;
int offset = itMap->second % 8; const int offset = itMap->second % 8;
m_usedMappings[index] &= ~(1<<offset); m_usedMappings[index] &= ~(1<<offset);
} }
m_playerMappings.erase(it); m_playerMappings.erase(it);
@ -815,7 +807,7 @@ void DirectoryLevelStorage::saveAllCachedData()
} }
m_cachedSaveData.clear(); m_cachedSaveData.clear();
for (auto& it : m_mapFilesToDelete ) for (const auto& it : m_mapFilesToDelete )
{ {
std::wstring id = wstring( L"map_" ) + std::to_wstring(it); std::wstring id = wstring( L"map_" ) + std::to_wstring(it);
ConsoleSavePath file = getDataFile(id); ConsoleSavePath file = getDataFile(id);

View file

@ -140,12 +140,8 @@ wstring FlatLevelSource::gatherStats()
vector<Biome::MobSpawnerData *> *FlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) vector<Biome::MobSpawnerData *> *FlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
{ {
Biome *biome = level->getBiome(x, z); Biome *biome = level->getBiome(x, z);
<<<<<<< HEAD
if (biome == nullptr)
=======
if (biome == NULL) if (biome == NULL)
>>>>>>> origin/main {
{
return nullptr; return nullptr;
} }
return biome->getMobs(mobCategory); return biome->getMobs(mobCategory);

View file

@ -211,11 +211,7 @@ wstring HellFlatLevelSource::gatherStats()
vector<Biome::MobSpawnerData *> *HellFlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) vector<Biome::MobSpawnerData *> *HellFlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
{ {
Biome *biome = level->getBiome(x, z); Biome *biome = level->getBiome(x, z);
<<<<<<< HEAD if (biome == nullptr)
if (biome == nullptr)
=======
if (biome == NULL)
>>>>>>> origin/main
{ {
return nullptr; return nullptr;
} }

View file

@ -36,11 +36,7 @@ double Math::random()
//the value of the argument rounded to the nearest long value. //the value of the argument rounded to the nearest long value.
int64_t Math::round( double d ) int64_t Math::round( double d )
{ {
<<<<<<< HEAD return static_cast<int64_t>(floor(d + 0.5));
return static_cast<__int64>(floor(d + 0.5));
=======
return (int64_t)floor( d + 0.5 );
>>>>>>> origin/main
} }
int Math::_max(int a, int b) int Math::_max(int a, int b)

View file

@ -57,13 +57,8 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType)
{ {
biomeLayer = std::make_shared<ZoomLayer>(1000 + i, biomeLayer); biomeLayer = std::make_shared<ZoomLayer>(1000 + i, biomeLayer);
<<<<<<< HEAD if (i == 0) biomeLayer = std::make_shared<AddIslandLayer>(3, biomeLayer);
if (i == 0) biomeLayer = std::make_shared<AddIslandLayer>(3, biomeLayer);
=======
if (i == 0) biomeLayer = shared_ptr<Layer>(new AddIslandLayer(3, biomeLayer));
>>>>>>> origin/main
if (i == 0) if (i == 0)
{ {
// 4J - moved mushroom islands to here. This skips 3 zooms that the old location of the add was, making them about 1/8 of the original size. Adding // 4J - moved mushroom islands to here. This skips 3 zooms that the old location of the add was, making them about 1/8 of the original size. Adding
@ -77,15 +72,9 @@ LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType)
// 4J - now expand mushroom islands up again. This does a simple region grow to add a new mushroom island element when any of the neighbours are also mushroom islands. // 4J - now expand mushroom islands up again. This does a simple region grow to add a new mushroom island element when any of the neighbours are also mushroom islands.
// This helps make the islands into nice compact shapes of the type that are actually likely to be able to make an island out of the sea in a small space. Also // This helps make the islands into nice compact shapes of the type that are actually likely to be able to make an island out of the sea in a small space. Also
// helps the shore layer from doing too much damage in shrinking the islands we are making // helps the shore layer from doing too much damage in shrinking the islands we are making
<<<<<<< HEAD biomeLayer = std::make_shared<GrowMushroomIslandLayer>(5, biomeLayer);
biomeLayer = std::make_shared<GrowMushroomIslandLayer>(5, biomeLayer);
// Note - this reduces the size of mushroom islands by turning their edges into shores. We are doing this at i == 1 rather than i == 0 as the original does // Note - this reduces the size of mushroom islands by turning their edges into shores. We are doing this at i == 1 rather than i == 0 as the original does
biomeLayer = std::make_shared<ShoreLayer>(1000, biomeLayer); biomeLayer = std::make_shared<ShoreLayer>(1000, biomeLayer);
=======
biomeLayer = shared_ptr<Layer>(new GrowMushroomIslandLayer(5, biomeLayer));
// Note - this reduces the size of mushroom islands by turning their edges into shores. We are doing this at i == 1 rather than i == 0 as the original does
biomeLayer = shared_ptr<Layer>(new ShoreLayer(1000, biomeLayer));
>>>>>>> origin/main
biomeLayer = std::make_shared<SwampRiversLayer>(1000, biomeLayer); biomeLayer = std::make_shared<SwampRiversLayer>(1000, biomeLayer);
} }

View file

@ -195,13 +195,8 @@ void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse,
( ( z & 0x3f0 ) >> 4 ); ( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
// Add in the higher bits for x and z // Add in the higher bits for x and z
<<<<<<< HEAD posbits |= ( ( static_cast<uint64_t>(x) & 0x3FFFC00L) << 38) |
posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00L) << 38) | ( ( static_cast<uint64_t>(z) & 0x3FFFC00L) << 22);
( ( static_cast<__uint64>(z) & 0x3FFFC00L) << 22);
=======
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
>>>>>>> origin/main
#endif #endif
lightCache_t cacheValue = cache[idx]; lightCache_t cacheValue = cache[idx];
@ -258,14 +253,8 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l
( ( y & 0x0f0 ) << 2 ) | ( ( y & 0x0f0 ) << 2 ) |
( ( z & 0x3f0 ) >> 4 ); ( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
// Add in the higher bits for x and z posbits |= ( ( static_cast<uint64_t>(x) & 0x3FFFC00L) << 38) |
<<<<<<< HEAD ( ( static_cast<uint64_t>(z) & 0x3FFFC00L) << 22);
posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00L) << 38) |
( ( static_cast<__uint64>(z) & 0x3FFFC00L) << 22);
=======
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
>>>>>>> origin/main
#endif #endif
lightCache_t cacheValue = cache[idx]; lightCache_t cacheValue = cache[idx];
@ -331,13 +320,8 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i
( ( z & 0x3f0 ) >> 4 ); ( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
// Add in the higher bits for x and z // Add in the higher bits for x and z
<<<<<<< HEAD posbits |= ( ( static_cast<uint64_t>(x) & 0x3FFFC00) << 38) |
posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00) << 38) | ( ( static_cast<uint64_t>(z) & 0x3FFFC00) << 22);
( ( static_cast<__uint64>(z) & 0x3FFFC00) << 22);
=======
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00) << 22);
>>>>>>> origin/main
#endif #endif
lightCache_t cacheValue = cache[idx]; lightCache_t cacheValue = cache[idx];
@ -412,13 +396,8 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay
( ( z & 0x3f0 ) >> 4 ); ( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
// Add in the higher bits for x and z // Add in the higher bits for x and z
<<<<<<< HEAD posbits |= ( ( static_cast<uint64_t>(x) & 0x3FFFC00L) << 38) |
posbits |= ( ( static_cast<__uint64>(x) & 0x3FFFC00L) << 38) | ( ( static_cast<uint64_t>(z) & 0x3FFFC00L) << 22);
( ( static_cast<__uint64>(z) & 0x3FFFC00L) << 22);
=======
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
>>>>>>> origin/main
#endif #endif
lightCache_t cacheValue = cache[idx]; lightCache_t cacheValue = cache[idx];
@ -3457,13 +3436,8 @@ int Level::getExpectedLight(lightCache_t *cache, int x, int y, int z, LightLayer
// 4J - Made changes here so that lighting goes through a cache, if enabled for this thread // 4J - Made changes here so that lighting goes through a cache, if enabled for this thread
void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool force, bool rootOnlyEmissive) void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool force, bool rootOnlyEmissive)
{ {
<<<<<<< HEAD
lightCache_t *cache = static_cast<lightCache_t *>(TlsGetValue(tlsIdxLightCache)); lightCache_t *cache = static_cast<lightCache_t *>(TlsGetValue(tlsIdxLightCache));
__uint64 cacheUse = 0;
=======
lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache);
uint64_t cacheUse = 0; uint64_t cacheUse = 0;
>>>>>>> origin/main
if( force ) if( force )
{ {
@ -3502,7 +3476,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
} }
else else
{ {
toCheck = (int *)(cache + (16*16*16)); toCheck = reinterpret_cast<int *>(cache + (16 * 16 * 16));
} }
int checkedPosition = 0; int checkedPosition = 0;

View file

@ -18,11 +18,7 @@ LevelData::LevelData(CompoundTag *tag)
{ {
wstring generatorName = tag->getString(L"generatorName"); wstring generatorName = tag->getString(L"generatorName");
m_pGenerator = LevelType::getLevelType(generatorName); m_pGenerator = LevelType::getLevelType(generatorName);
<<<<<<< HEAD if (m_pGenerator == nullptr)
if (m_pGenerator == nullptr)
=======
if (m_pGenerator == NULL)
>>>>>>> origin/main
{ {
m_pGenerator = LevelType::lvl_normal; m_pGenerator = LevelType::lvl_normal;
} }

View file

@ -100,11 +100,7 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException
userName = readUtf(dis, Player::MAX_NAME_LENGTH); userName = readUtf(dis, Player::MAX_NAME_LENGTH);
wstring typeName = readUtf(dis, 16); wstring typeName = readUtf(dis, 16);
m_pLevelType = LevelType::getLevelType(typeName); m_pLevelType = LevelType::getLevelType(typeName);
<<<<<<< HEAD if (m_pLevelType == nullptr)
if (m_pLevelType == nullptr)
=======
if (m_pLevelType == NULL)
>>>>>>> origin/main
{ {
m_pLevelType = LevelType::lvl_normal; m_pLevelType = LevelType::lvl_normal;
} }
@ -139,11 +135,7 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException
{ {
dos->writeInt(clientVersion); dos->writeInt(clientVersion);
writeUtf(userName, dos); writeUtf(userName, dos);
<<<<<<< HEAD if (m_pLevelType == nullptr)
if (m_pLevelType == nullptr)
=======
if (m_pLevelType == NULL)
>>>>>>> origin/main
{ {
writeUtf(L"", dos); writeUtf(L"", dos);
} }
@ -182,18 +174,10 @@ void LoginPacket::handle(PacketListener *listener)
int LoginPacket::getEstimatedSize() int LoginPacket::getEstimatedSize()
{ {
int length=0; int length=0;
<<<<<<< HEAD if (m_pLevelType != nullptr)
if (m_pLevelType != nullptr)
=======
if (m_pLevelType != NULL)
>>>>>>> origin/main
{ {
length = static_cast<int>(m_pLevelType->getGeneratorName().length()); length = static_cast<int>(m_pLevelType->getGeneratorName().length());
} }
<<<<<<< HEAD return static_cast<int>(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2 * sizeof(PlayerUID)) + 1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int));
return static_cast<int>(sizeof(int) + userName.length() + 4 + 6 + sizeof(__int64) + sizeof(char) + sizeof(int) + (2 * sizeof(PlayerUID)) + 1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int));
=======
return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int));
>>>>>>> origin/main
} }

View file

@ -53,11 +53,7 @@ int Mth::floor(float v)
int64_t Mth::lfloor(double v) int64_t Mth::lfloor(double v)
{ {
<<<<<<< HEAD int64_t i = static_cast<int64_t>(v);
__int64 i = static_cast<__int64>(v);
=======
int64_t i = (int64_t) v;
>>>>>>> origin/main
return v < i ? i - 1 : i; return v < i ? i - 1 : i;
} }

View file

@ -41,13 +41,8 @@ void Random::nextBytes(byte *bytes, unsigned int count)
double Random::nextDouble() double Random::nextDouble()
{ {
<<<<<<< HEAD return ((static_cast<int64_t>(next(26)) << 27) + next(27))
return ((static_cast<__int64>(next(26)) << 27) + next(27))
/ static_cast<double>(1LL << 53); / static_cast<double>(1LL << 53);
=======
return (((int64_t)next(26) << 27) + next(27))
/ (double)(1LL << 53);
>>>>>>> origin/main
} }
double Random::nextGaussian() double Random::nextGaussian()
@ -84,11 +79,7 @@ int Random::nextInt(int n)
if ((n & -n) == n) // i.e., n is a power of 2 if ((n & -n) == n) // i.e., n is a power of 2
<<<<<<< HEAD return static_cast<int>((static_cast<int64_t>(next(31)) * n) >> 31); // 4J Stu - Made int64_t instead of long
return static_cast<int>(((__int64)next(31) * n) >> 31); // 4J Stu - Made __int64 instead of long
=======
return (int)(((int64_t)next(31) * n) >> 31); // 4J Stu - Made int64_t instead of long
>>>>>>> origin/main
int bits, val; int bits, val;
do do
@ -106,11 +97,7 @@ float Random::nextFloat()
int64_t Random::nextLong() int64_t Random::nextLong()
{ {
<<<<<<< HEAD return (static_cast<int64_t>(next(32)) << 32) + next(32);
return (static_cast<__int64>(next(32)) << 32) + next(32);
=======
return ((int64_t)next(32) << 32) + next(32);
>>>>>>> origin/main
} }
bool Random::nextBoolean() bool Random::nextBoolean()

View file

@ -198,15 +198,9 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
m_saveFile->LockSaveAccess(); m_saveFile->LockSaveAccess();
<<<<<<< HEAD
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN);
=======
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN);
>>>>>>> origin/main
unsigned int length; unsigned int length;
unsigned int decompLength; unsigned int decompLength;
unsigned int readDecompLength; unsigned int readDecompLength;
@ -378,13 +372,8 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync
* file * file
*/ */
// debug("SAVE", x, z, length, "grow"); // debug("SAVE", x, z, length, "grow");
<<<<<<< HEAD
//SetFilePointer(file,0,0,FILE_END);
m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_END );
=======
//SetFilePointer(file,0,0,FILE_END); //SetFilePointer(file,0,0,FILE_END);
m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_END );
>>>>>>> origin/main
sectorNumber = static_cast<int>(sectorFree->size()); sectorNumber = static_cast<int>(sectorFree->size());
#ifndef _CONTENT_PACAKGE #ifndef _CONTENT_PACAKGE
@ -417,13 +406,8 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync
void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int compLength) void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int compLength)
{ {
DWORD numberOfBytesWritten = 0; DWORD numberOfBytesWritten = 0;
<<<<<<< HEAD
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN );
=======
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN );
>>>>>>> origin/main
// 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data
// We store length and decompression length as ints, then length bytes of xbox LZX compressed data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data
@ -441,13 +425,8 @@ void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int co
void RegionFile::zero(int sectorNumber, int length) void RegionFile::zero(int sectorNumber, int length)
{ {
DWORD numberOfBytesWritten = 0; DWORD numberOfBytesWritten = 0;
<<<<<<< HEAD
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN );
=======
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN );
>>>>>>> origin/main
m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten ); m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten );
} }
@ -493,13 +472,9 @@ void RegionFile::setOffset(int x, int z, int offset)
DWORD numberOfBytesWritten = 0; DWORD numberOfBytesWritten = 0;
offsets[x + z * 32] = offset; offsets[x + z * 32] = offset;
<<<<<<< HEAD
m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, nullptr, FILE_BEGIN );
=======
m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, NULL, FILE_BEGIN );
>>>>>>> origin/main m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, nullptr, FILE_BEGIN );
m_saveFile->writeFile(fileEntry,&offset,4,&numberOfBytesWritten); m_saveFile->writeFile(fileEntry,&offset,4,&numberOfBytesWritten);
} }
@ -512,13 +487,8 @@ void RegionFile::setTimestamp(int x, int z, int value)
DWORD numberOfBytesWritten = 0; DWORD numberOfBytesWritten = 0;
chunkTimestamps[x + z * 32] = value; chunkTimestamps[x + z * 32] = value;
<<<<<<< HEAD
m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, nullptr, FILE_BEGIN ); m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, nullptr, FILE_BEGIN );
=======
m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, NULL, FILE_BEGIN );
>>>>>>> origin/main
m_saveFile->writeFile(fileEntry,&value,4,&numberOfBytesWritten); m_saveFile->writeFile(fileEntry,&value,4,&numberOfBytesWritten);
} }

View file

@ -47,11 +47,7 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException
mapHeight = dis->readShort(); mapHeight = dis->readShort();
wstring typeName = readUtf(dis, 16); wstring typeName = readUtf(dis, 16);
m_pLevelType = LevelType::getLevelType(typeName); m_pLevelType = LevelType::getLevelType(typeName);
<<<<<<< HEAD if (m_pLevelType == nullptr)
if (m_pLevelType == nullptr)
=======
if (m_pLevelType == NULL)
>>>>>>> origin/main
{ {
m_pLevelType = LevelType::lvl_normal; m_pLevelType = LevelType::lvl_normal;
} }
@ -72,11 +68,7 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException
dos->writeByte(dimension); dos->writeByte(dimension);
dos->writeByte(playerGameType->getId()); dos->writeByte(playerGameType->getId());
dos->writeShort(mapHeight); dos->writeShort(mapHeight);
<<<<<<< HEAD if (m_pLevelType == nullptr)
if (m_pLevelType == nullptr)
=======
if (m_pLevelType == NULL)
>>>>>>> origin/main
{ {
writeUtf(L"", dos); writeUtf(L"", dos);
} }
@ -97,11 +89,7 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException
int RespawnPacket::getEstimatedSize() int RespawnPacket::getEstimatedSize()
{ {
int length=0; int length=0;
<<<<<<< HEAD if (m_pLevelType != nullptr)
if (m_pLevelType != nullptr)
=======
if (m_pLevelType != NULL)
>>>>>>> origin/main
{ {
length = static_cast<int>(m_pLevelType->getGeneratorName().length()); length = static_cast<int>(m_pLevelType->getGeneratorName().length());
} }

View file

@ -87,8 +87,8 @@ SparseDataStorage::~SparseDataStorage()
SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom) SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom)
{ {
// Extra details of source storage // Extra details of source storage
int64_t sourceDataAndCount = copyFrom->dataAndCount; const int64_t sourceDataAndCount = copyFrom->dataAndCount;
unsigned char *sourceIndicesAndData = (unsigned char *)(sourceDataAndCount & 0x0000ffffffffffff); const unsigned char *sourceIndicesAndData = (unsigned char *)(sourceDataAndCount & 0x0000ffffffffffff);
int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff; int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff;
// Allocate & copy indices ( 128 bytes ) and any allocated planes (128 * count) // Allocate & copy indices ( 128 bytes ) and any allocated planes (128 * count)
@ -129,10 +129,10 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
for( int xz = 0; xz < 256; xz++ ) // 256 in loop as 16 x 16 separate bytes need checked for( int xz = 0; xz < 256; xz++ ) // 256 in loop as 16 x 16 separate bytes need checked
{ {
int pos = ( xz << 7 ) | y; const int pos = ( xz << 7 ) | y;
int slot = pos >> 1; const int slot = pos >> 1;
int part = pos & 1; const int part = pos & 1;
unsigned char value = ( dataIn[slot + inOffset] >> (part * 4) ) & 15; const unsigned char value = ( dataIn[slot + inOffset] >> (part * 4) ) & 15;
if( value != 0 ) all0 = false; if( value != 0 ) all0 = false;
} }
if( all0 ) if( all0 )
@ -158,9 +158,9 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
// we know they were sequentially allocated above. // we know they were sequentially allocated above.
if( planeIndices[y] < 128 ) if( planeIndices[y] < 128 )
{ {
int part = y & 1; const int part = y & 1;
//int shift = 4 * part; //int shift = 4 * part;
unsigned char *pucIn = &dataIn[ (y >> 1) + inOffset]; const unsigned char *pucIn = &dataIn[ (y >> 1) + inOffset];
for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination byte for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination byte
{ {
@ -176,13 +176,9 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
// Get new data and count packed info // Get new data and count packed info
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) planeIndices) & 0x0000ffffffffffffL; int64_t newDataAndCount = reinterpret_cast<int64_t>(planeIndices) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(allocatedPlaneCount) << 48;
newDataAndCount |= static_cast<__int64>(allocatedPlaneCount) << 48;
=======
newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48;
>>>>>>> origin/main
updateDataAndCount( newDataAndCount ); updateDataAndCount( newDataAndCount );
} }
@ -209,10 +205,10 @@ void SparseDataStorage::getData(byteArray retArray, unsigned int retOffset)
} }
else else
{ {
int part = y & 1; const int part = y & 1;
int shift = 4 * part; const int shift = 4 * part;
unsigned char *pucOut = &retArray.data[ (y >> 1) + + retOffset]; unsigned char *pucOut = &retArray.data[ (y >> 1) + + retOffset];
unsigned char *pucIn = &data[ planeIndices[ y ] * 128 ]; const unsigned char *pucIn = &data[ planeIndices[ y ] * 128 ];
for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same byte for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same byte
{ {
unsigned char value = (*pucIn) & 15; unsigned char value = (*pucIn) & 15;
@ -241,10 +237,10 @@ int SparseDataStorage::get(int x, int y, int z)
} }
else else
{ {
int planeIndex = x * 16 + z; // Index within this xz plane const int planeIndex = x * 16 + z; // Index within this xz plane
int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte)
int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte
int retval = ( data[ planeIndices[y] * 128 + byteIndex ] >> shift ) & 15; const int retval = ( data[ planeIndices[y] * 128 + byteIndex ] >> shift ) & 15;
return retval; return retval;
} }
@ -274,12 +270,12 @@ void SparseDataStorage::set(int x, int y, int z, int val)
// Either data was already allocated, or we've just done that. Now store our value into the right place. // Either data was already allocated, or we've just done that. Now store our value into the right place.
int planeIndex = x * 16 + z; // Index within this xz plane const int planeIndex = x * 16 + z; // Index within this xz plane
int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte)
int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte
int mask = 0xf0 >> shift; const int mask = 0xf0 >> shift;
int idx = planeIndices[y] * 128 + byteIndex; const int idx = planeIndices[y] * 128 + byteIndex;
data[idx] = ( data[idx] & mask ) | ( val << shift ); data[idx] = ( data[idx] & mask ) | ( val << shift );
} }
@ -292,7 +288,7 @@ void SparseDataStorage::set(int x, int y, int z, int val)
int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, int x1, int y1, int z1, int offset, tileUpdatedCallback callback, void *param, int yparam) int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, int x1, int y1, int z1, int offset, tileUpdatedCallback callback, void *param, int yparam)
{ {
// Actual setting of data happens when calling set method so no need to lock here // Actual setting of data happens when calling set method so no need to lock here
unsigned char *pucIn = &dataIn.data[offset]; const unsigned char *pucIn = &dataIn.data[offset];
if( callback ) if( callback )
{ {
for( int x = x0; x < x1; x++ ) for( int x = x0; x < x1; x++ )
@ -300,11 +296,11 @@ int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, i
for( int z = z0; z < z1; z++ ) for( int z = z0; z < z1; z++ )
{ {
// Emulate how data was extracted from DataLayer... see comment above // Emulate how data was extracted from DataLayer... see comment above
int yy0 = y0 & 0xfffffffe; const int yy0 = y0 & 0xfffffffe;
int len = ( y1 - y0 ) / 2; const int len = ( y1 - y0 ) / 2;
for( int i = 0; i < len; i++ ) for( int i = 0; i < len; i++ )
{ {
int y = yy0 + ( i * 2 ); const int y = yy0 + ( i * 2 );
int toSet = (*pucIn) & 15; int toSet = (*pucIn) & 15;
if( get(x, y, z) != toSet ) if( get(x, y, z) != toSet )
@ -330,11 +326,11 @@ int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, i
for( int z = z0; z < z1; z++ ) for( int z = z0; z < z1; z++ )
{ {
// Emulate how data was extracted from DataLayer... see comment above // Emulate how data was extracted from DataLayer... see comment above
int yy0 = y0 & 0xfffffffe; const int yy0 = y0 & 0xfffffffe;
int len = ( y1 - y0 ) / 2; const int len = ( y1 - y0 ) / 2;
for( int i = 0; i < len; i++ ) for( int i = 0; i < len; i++ )
{ {
int y = yy0 + ( i * 2 ); const int y = yy0 + ( i * 2 );
set(x, y, z, (*pucIn) & 15 ); set(x, y, z, (*pucIn) & 15 );
set(x, y + 1, z, ((*pucIn) >> 4 ) & 15 ); set(x, y + 1, z, ((*pucIn) >> 4 ) & 15 );
@ -343,7 +339,7 @@ int SparseDataStorage::setDataRegion(byteArray dataIn, int x0, int y0, int z0, i
} }
} }
} }
ptrdiff_t count = pucIn - &dataIn.data[offset]; const ptrdiff_t count = pucIn - &dataIn.data[offset];
return static_cast<int>(count); return static_cast<int>(count);
} }
@ -361,11 +357,11 @@ int SparseDataStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z0
for( int z = z0; z < z1; z++ ) for( int z = z0; z < z1; z++ )
{ {
// Emulate how data was extracted from DataLayer... see comment above // Emulate how data was extracted from DataLayer... see comment above
int yy0 = y0 & 0xfffffffe; const int yy0 = y0 & 0xfffffffe;
int len = ( y1 - y0 ) / 2; const int len = ( y1 - y0 ) / 2;
for( int i = 0; i < len; i++ ) for( int i = 0; i < len; i++ )
{ {
int y = yy0 + ( i * 2 ); const int y = yy0 + ( i * 2 );
*pucOut = get( x, y, z); *pucOut = get( x, y, z);
*pucOut |= get( x, y + 1, z) << 4; *pucOut |= get( x, y + 1, z) << 4;
@ -373,14 +369,9 @@ int SparseDataStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z0
} }
} }
} }
ptrdiff_t count = pucOut - &dataInOut.data[offset]; const ptrdiff_t count = pucOut - &dataInOut.data[offset];
<<<<<<< HEAD
return static_cast<int>(count);
=======
return (int)count; return static_cast<int>(count);
>>>>>>> origin/main
} }
void SparseDataStorage::addNewPlane(int y) void SparseDataStorage::addNewPlane(int y)
@ -389,38 +380,34 @@ void SparseDataStorage::addNewPlane(int y)
do do
{ {
// Get last packed data pointer & count // Get last packed data pointer & count
int64_t lastDataAndCount = dataAndCount; const int64_t lastDataAndCount = dataAndCount;
// Unpack count & data pointer // Unpack count & data pointer
int lastLinesUsed = static_cast<int>((lastDataAndCount >> 48) & 0xffff); const int lastLinesUsed = static_cast<int>((lastDataAndCount >> 48) & 0xffff);
unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff);
// Find out what to prefill the newly allocated line with // Find out what to prefill the newly allocated line with
unsigned char planeIndex = lastDataPointer[y]; const unsigned char planeIndex = lastDataPointer[y];
if( planeIndex < ALL_0_INDEX ) return; // Something has already allocated this line - we're done if( planeIndex < ALL_0_INDEX ) return; // Something has already allocated this line - we're done
int linesUsed = lastLinesUsed + 1; int linesUsed = lastLinesUsed + 1;
// Allocate new memory storage, copy over anything from old storage, and initialise remainder // Allocate new memory storage, copy over anything from old storage, and initialise remainder
unsigned char *dataPointer = static_cast<unsigned char *>(malloc(linesUsed * 128 + 128)); auto dataPointer = static_cast<unsigned char *>(malloc(linesUsed * 128 + 128));
XMemCpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128); XMemCpy( dataPointer, lastDataPointer, 128 * lastLinesUsed + 128);
XMemSet( dataPointer + ( 128 * lastLinesUsed ) + 128, 0, 128 ); XMemSet( dataPointer + ( 128 * lastLinesUsed ) + 128, 0, 128 );
dataPointer[y] = lastLinesUsed; dataPointer[y] = lastLinesUsed;
// Get new data and count packed info // Get new data and count packed info
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; int64_t newDataAndCount = reinterpret_cast<int64_t>(dataPointer) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(linesUsed) << 48;
newDataAndCount |= static_cast<__int64>(linesUsed) << 48;
=======
newDataAndCount |= ((int64_t)linesUsed) << 48;
>>>>>>> origin/main
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at // Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); const int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
if( lastDataAndCount2 == lastDataAndCount ) if( lastDataAndCount2 == lastDataAndCount )
{ {
@ -443,7 +430,7 @@ void SparseDataStorage::addNewPlane(int y)
void SparseDataStorage::getPlaneIndicesAndData(unsigned char **planeIndices, unsigned char **data) void SparseDataStorage::getPlaneIndicesAndData(unsigned char **planeIndices, unsigned char **data)
{ {
unsigned char *indicesAndData = (unsigned char *)(dataAndCount & 0x0000ffffffffffff); unsigned char *indicesAndData = reinterpret_cast<unsigned char *>(dataAndCount & 0x0000ffffffffffff);
*planeIndices = indicesAndData; *planeIndices = indicesAndData;
*data = indicesAndData + 128; *data = indicesAndData + 128;
@ -461,7 +448,7 @@ void SparseDataStorage::tick()
{ {
// We have 3 queues for deleting. Always delete from the next one after where we are writing to, so it should take 2 ticks // We have 3 queues for deleting. Always delete from the next one after where we are writing to, so it should take 2 ticks
// before we ever delete something, from when the request to delete it came in // before we ever delete something, from when the request to delete it came in
int freeIndex = ( deleteQueueIndex + 1 ) % 3; const int freeIndex = ( deleteQueueIndex + 1 ) % 3;
// printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); // printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated());
unsigned char *toFree = nullptr; unsigned char *toFree = nullptr;
@ -493,12 +480,12 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount)
bool success = false; bool success = false;
do do
{ {
int64_t lastDataAndCount = dataAndCount; const int64_t lastDataAndCount = dataAndCount;
unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); unsigned char *lastDataPointer = reinterpret_cast<unsigned char *>(lastDataAndCount & 0x0000ffffffffffff);
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at // Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); const int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
if( lastDataAndCount2 == lastDataAndCount ) if( lastDataAndCount2 == lastDataAndCount )
{ {
@ -521,7 +508,7 @@ int SparseDataStorage::compress()
unsigned char _planeIndices[128]; unsigned char _planeIndices[128];
bool needsCompressed = false; bool needsCompressed = false;
int64_t lastDataAndCount = dataAndCount; const int64_t lastDataAndCount = dataAndCount;
unsigned char *planeIndices = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff); unsigned char *planeIndices = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff);
unsigned char *data = planeIndices + 128; unsigned char *data = planeIndices + 128;
@ -535,7 +522,7 @@ int SparseDataStorage::compress()
} }
else else
{ {
unsigned char *pucData = &data[ 128 * planeIndices[i] ]; const unsigned char *pucData = &data[ 128 * planeIndices[i] ];
bool all0 = true; bool all0 = true;
for( int j = 0; j < 128; j++ ) // 16 x 16 x 4-bits for( int j = 0; j < 128; j++ ) // 16 x 16 x 4-bits
{ {
@ -573,15 +560,11 @@ int SparseDataStorage::compress()
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL; int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(planesToAlloc) << 48;
newDataAndCount |= static_cast<__int64>(planesToAlloc) << 48;
=======
newDataAndCount |= ((int64_t)planesToAlloc) << 48;
>>>>>>> origin/main
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at // Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount ); const int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
if( lastDataAndCount2 != lastDataAndCount ) if( lastDataAndCount2 != lastDataAndCount )
{ {
@ -611,7 +594,7 @@ int SparseDataStorage::compress()
bool SparseDataStorage::isCompressed() bool SparseDataStorage::isCompressed()
{ {
int count = ( dataAndCount >> 48 ) & 0xffff; const int count = ( dataAndCount >> 48 ) & 0xffff;
return (count < 127); return (count < 127);
@ -619,28 +602,24 @@ bool SparseDataStorage::isCompressed()
void SparseDataStorage::write(DataOutputStream *dos) void SparseDataStorage::write(DataOutputStream *dos)
{ {
int count = ( dataAndCount >> 48 ) & 0xffff; const int count = ( dataAndCount >> 48 ) & 0xffff;
dos->writeInt(count); dos->writeInt(count);
unsigned char *dataPointer = (unsigned char *)(dataAndCount & 0x0000ffffffffffff); unsigned char *dataPointer = (unsigned char *)(dataAndCount & 0x0000ffffffffffff);
byteArray wrapper(dataPointer, count * 128 + 128); const byteArray wrapper(dataPointer, count * 128 + 128);
dos->write(wrapper); dos->write(wrapper);
} }
void SparseDataStorage::read(DataInputStream *dis) void SparseDataStorage::read(DataInputStream *dis)
{ {
int count = dis->readInt(); const int count = dis->readInt();
unsigned char *dataPointer = static_cast<unsigned char *>(malloc(count * 128 + 128)); unsigned char *dataPointer = static_cast<unsigned char *>(malloc(count * 128 + 128));
byteArray wrapper(dataPointer, count * 128 + 128); const byteArray wrapper(dataPointer, count * 128 + 128);
dis->readFully(wrapper); dis->readFully(wrapper);
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; int64_t newDataAndCount = reinterpret_cast<int64_t>(dataPointer) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(count) << 48;
newDataAndCount |= static_cast<__int64>(count) << 48;
=======
newDataAndCount |= ((int64_t)count) << 48;
>>>>>>> origin/main
updateDataAndCount(newDataAndCount); updateDataAndCount(newDataAndCount);
} }

View file

@ -180,13 +180,9 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset)
// Get new data and count packed info // Get new data and count packed info
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) planeIndices) & 0x0000ffffffffffffL; int64_t newDataAndCount = reinterpret_cast<int64_t>(planeIndices) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(allocatedPlaneCount) << 48;
newDataAndCount |= static_cast<__int64>(allocatedPlaneCount) << 48;
=======
newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48;
>>>>>>> origin/main
updateDataAndCount( newDataAndCount ); updateDataAndCount( newDataAndCount );
} }
@ -379,13 +375,8 @@ int SparseLightStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z
} }
} }
ptrdiff_t count = pucOut - &dataInOut.data[offset]; ptrdiff_t count = pucOut - &dataInOut.data[offset];
<<<<<<< HEAD
return static_cast<int>(count);
=======
return (int)count; return static_cast<int>(count);
>>>>>>> origin/main
} }
void SparseLightStorage::addNewPlane(int y) void SparseLightStorage::addNewPlane(int y)
@ -418,11 +409,7 @@ void SparseLightStorage::addNewPlane(int y)
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(linesUsed) << 48;
newDataAndCount |= static_cast<__int64>(linesUsed) << 48;
=======
newDataAndCount |= ((int64_t)linesUsed) << 48;
>>>>>>> origin/main
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at // Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
@ -590,11 +577,7 @@ int SparseLightStorage::compress()
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL; int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(planesToAlloc) << 48;
newDataAndCount |= static_cast<__int64>(planesToAlloc) << 48;
=======
newDataAndCount |= ((int64_t)planesToAlloc) << 48;
>>>>>>> origin/main
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at // Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place // dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
@ -653,11 +636,7 @@ void SparseLightStorage::read(DataInputStream *dis)
#pragma warning ( disable : 4826 ) #pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL; int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 ) #pragma warning ( default : 4826 )
<<<<<<< HEAD newDataAndCount |= static_cast<int64_t>(count) << 48;
newDataAndCount |= static_cast<__int64>(count) << 48;
=======
newDataAndCount |= ((int64_t)count) << 48;
>>>>>>> origin/main
updateDataAndCount( newDataAndCount ); updateDataAndCount( newDataAndCount );
} }

View file

@ -187,17 +187,10 @@ void StemTile::spawnResources(Level *level, int x, int y, int z, int data, float
Item *seed = nullptr; Item *seed = nullptr;
if (fruit == Tile::pumpkin) seed = Item::seeds_pumpkin; if (fruit == Tile::pumpkin) seed = Item::seeds_pumpkin;
if (fruit == Tile::melon) seed = Item::seeds_melon; if (fruit == Tile::melon) seed = Item::seeds_melon;
<<<<<<< HEAD if (seed != nullptr)
for (int i = 0; i < 3; i++)
{
popResource(level, x, y, z, std::make_shared<ItemInstance>(seed));
}
=======
if (seed != NULL)
{ {
popResource(level, x, y, z, shared_ptr<ItemInstance>(new ItemInstance(seed))); popResource(level, x, y, z, std::make_shared<ItemInstance>(seed));
} }
>>>>>>> origin/main
} }
int StemTile::getResource(int data, Random *random, int playerBonusLevel) int StemTile::getResource(int data, Random *random, int playerBonusLevel)

View file

@ -92,12 +92,8 @@ bool Zombie::isBaby()
void Zombie::setBaby(bool baby) void Zombie::setBaby(bool baby)
{ {
<<<<<<< HEAD
getEntityData()->set(DATA_BABY_ID, static_cast<byte>(baby ? 1 : 0));
=======
getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0)); getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0));
updateSize(baby); updateSize(baby);
>>>>>>> origin/main
if (level != nullptr && !level->isClientSide) if (level != nullptr && !level->isClientSide)
{ {

View file

@ -64,11 +64,7 @@ int64_t System::nanoTime()
// Using double to avoid 64-bit overflow during multiplication for long uptime // Using double to avoid 64-bit overflow during multiplication for long uptime
// Precision is sufficient for ~100 days of uptime. // Precision is sufficient for ~100 days of uptime.
<<<<<<< HEAD return static_cast<int64_t>(static_cast<double>(counter.QuadPart) * 1000000000.0 / static_cast<double>(s_frequency.QuadPart));
return static_cast<__int64>((double)counter.QuadPart * 1000000000.0 / (double)s_frequency.QuadPart);
=======
return (int64_t)((double)counter.QuadPart * 1000000000.0 / (double)s_frequency.QuadPart);
>>>>>>> origin/main
#else #else
return GetTickCount() * 1000000LL; return GetTickCount() * 1000000LL;
#endif #endif

View file

@ -332,10 +332,10 @@ public:
#define PIXSetMarkerDeprecated(a, b, ...) PIXSetMarker(a, L ## b, __VA_ARGS__) #define PIXSetMarkerDeprecated(a, b, ...) PIXSetMarker(a, L ## b, __VA_ARGS__)
#define PIXAddNamedCounter(a, b) PIXReportCounter( L ## b, a) #define PIXAddNamedCounter(a, b) PIXReportCounter( L ## b, a)
#else #else
void PIXAddNamedCounter(int a, const char *b, ...); inline void PIXAddNamedCounter(int, const char*, ...) {}
void PIXBeginNamedEvent(int a, const char *b, ...); inline void PIXBeginNamedEvent(int, const char*, ...) {}
void PIXEndNamedEvent(); inline void PIXEndNamedEvent() {}
void PIXSetMarkerDeprecated(int a, const char *b, ...); inline void PIXSetMarkerDeprecated(int, const char*, ...) {}
#endif #endif
void XSetThreadProcessor(HANDLE a, int b); void XSetThreadProcessor(HANDLE a, int b);