Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
This commit is contained in:
@@ -51,7 +51,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||
glColor4f(1, 1, 1, 1);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
|
||||
Slot *hoveredSlot = nullptr;
|
||||
Slot *hoveredSlot = NULL;
|
||||
|
||||
for ( Slot *slot : *menu->slots )
|
||||
{
|
||||
@@ -73,7 +73,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||
}
|
||||
|
||||
shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
||||
if (inventory->getCarried() != nullptr)
|
||||
if (inventory->getCarried() != NULL)
|
||||
{
|
||||
glTranslatef(0, 0, 32);
|
||||
// Slot old = carriedSlot;
|
||||
@@ -90,7 +90,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||
|
||||
renderLabels();
|
||||
|
||||
if (inventory->getCarried() == nullptr && hoveredSlot != nullptr && hoveredSlot->hasItem())
|
||||
if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem())
|
||||
{
|
||||
|
||||
wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
||||
@@ -127,7 +127,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
|
||||
int y = slot->y;
|
||||
shared_ptr<ItemInstance> item = slot->getItem();
|
||||
|
||||
if (item == nullptr)
|
||||
if (item == NULL)
|
||||
{
|
||||
int icon = slot->getNoItemIcon();
|
||||
if (icon >= 0)
|
||||
@@ -151,7 +151,7 @@ Slot *AbstractContainerScreen::findSlot(int x, int y)
|
||||
{
|
||||
if (isHovering(slot, x, y)) return slot;
|
||||
}
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool AbstractContainerScreen::isHovering(Slot *slot, int xm, int ym)
|
||||
@@ -177,7 +177,7 @@ void AbstractContainerScreen::mouseClicked(int x, int y, int buttonNum)
|
||||
bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight);
|
||||
|
||||
int slotId = -1;
|
||||
if (slot != nullptr) slotId = slot->index;
|
||||
if (slot != NULL) slotId = slot->index;
|
||||
|
||||
if (clickedOutside)
|
||||
{
|
||||
@@ -210,7 +210,7 @@ void AbstractContainerScreen::keyPressed(wchar_t eventCharacter, int eventKey)
|
||||
|
||||
void AbstractContainerScreen::removed()
|
||||
{
|
||||
if (minecraft->player == nullptr) return;
|
||||
if (minecraft->player == NULL) return;
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
|
||||
|
||||
@@ -3,22 +3,21 @@
|
||||
#include "AbstractTexturePack.h"
|
||||
#include "..\Minecraft.World\InputOutputStream.h"
|
||||
#include "..\Minecraft.World\StringHelpers.h"
|
||||
#include "Common/UI/UI.h"
|
||||
|
||||
AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
|
||||
{
|
||||
// 4J init
|
||||
textureId = -1;
|
||||
m_colourTable = nullptr;
|
||||
m_colourTable = NULL;
|
||||
|
||||
|
||||
this->file = file;
|
||||
this->fallback = fallback;
|
||||
|
||||
m_iconData = nullptr;
|
||||
m_iconData = NULL;
|
||||
m_iconSize = 0;
|
||||
|
||||
m_comparisonData = nullptr;
|
||||
m_comparisonData = NULL;
|
||||
m_comparisonSize = 0;
|
||||
|
||||
// 4J Stu - These calls need to be in the most derived version of the class
|
||||
@@ -42,7 +41,7 @@ void AbstractTexturePack::loadIcon()
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png");
|
||||
|
||||
UINT size = 0;
|
||||
@@ -58,7 +57,7 @@ void AbstractTexturePack::loadComparison()
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png");
|
||||
|
||||
UINT size = 0;
|
||||
@@ -71,8 +70,8 @@ void AbstractTexturePack::loadDescription()
|
||||
{
|
||||
// 4J Unused currently
|
||||
#if 0
|
||||
InputStream *inputStream = nullptr;
|
||||
BufferedReader *br = nullptr;
|
||||
InputStream *inputStream = NULL;
|
||||
BufferedReader *br = NULL;
|
||||
//try {
|
||||
inputStream = getResourceImplementation(L"/pack.txt");
|
||||
br = new BufferedReader(new InputStreamReader(inputStream));
|
||||
@@ -82,12 +81,12 @@ void AbstractTexturePack::loadDescription()
|
||||
//} finally {
|
||||
// TODO [EB]: use IOUtils.closeSilently()
|
||||
// try {
|
||||
if (br != nullptr)
|
||||
if (br != NULL)
|
||||
{
|
||||
br->close();
|
||||
delete br;
|
||||
}
|
||||
if (inputStream != nullptr)
|
||||
if (inputStream != NULL)
|
||||
{
|
||||
inputStream->close();
|
||||
delete inputStream;
|
||||
@@ -106,7 +105,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
|
||||
{
|
||||
app.DebugPrintf("texture - %ls\n",name.c_str());
|
||||
InputStream *is = getResourceImplementation(name);
|
||||
if (is == nullptr && fallback != nullptr && allowFallback)
|
||||
if (is == NULL && fallback != NULL && allowFallback)
|
||||
{
|
||||
is = fallback->getResource(name, true);
|
||||
}
|
||||
@@ -122,7 +121,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
|
||||
|
||||
void AbstractTexturePack::unload(Textures *textures)
|
||||
{
|
||||
if (iconImage != nullptr && textureId != -1)
|
||||
if (iconImage != NULL && textureId != -1)
|
||||
{
|
||||
textures->releaseTexture(textureId);
|
||||
}
|
||||
@@ -130,7 +129,7 @@ void AbstractTexturePack::unload(Textures *textures)
|
||||
|
||||
void AbstractTexturePack::load(Textures *textures)
|
||||
{
|
||||
if (iconImage != nullptr)
|
||||
if (iconImage != NULL)
|
||||
{
|
||||
if (textureId == -1)
|
||||
{
|
||||
@@ -150,7 +149,7 @@ bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback)
|
||||
{
|
||||
bool hasFile = this->hasFile(name);
|
||||
|
||||
return !hasFile && (allowFallback && fallback != nullptr) ? fallback->hasFile(name, allowFallback) : hasFile;
|
||||
return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile;
|
||||
}
|
||||
|
||||
DWORD AbstractTexturePack::getId()
|
||||
@@ -232,7 +231,7 @@ void AbstractTexturePack::loadDefaultUI()
|
||||
{
|
||||
#ifdef _XBOX
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
@@ -241,7 +240,7 @@ void AbstractTexturePack::loadDefaultUI()
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");
|
||||
|
||||
XuiFreeVisuals(L"");
|
||||
app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack");
|
||||
app.LoadSkin(szResourceLocator,NULL);//L"TexturePack");
|
||||
//CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
||||
#else
|
||||
@@ -260,7 +259,7 @@ void AbstractTexturePack::loadDefaultColourTable()
|
||||
// Load the file
|
||||
#ifdef __PS3__
|
||||
// need to check if it's a BD build, so pass in the name
|
||||
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":nullptr).append(L"res/colours.col"));
|
||||
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col"));
|
||||
|
||||
#else
|
||||
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
|
||||
@@ -270,12 +269,12 @@ void AbstractTexturePack::loadDefaultColourTable()
|
||||
if(coloursFile.exists())
|
||||
{
|
||||
DWORD dwLength = coloursFile.length();
|
||||
byteArray data(static_cast<unsigned int>(dwLength));
|
||||
byteArray data(dwLength);
|
||||
|
||||
FileInputStream fis(coloursFile);
|
||||
fis.read(data,0,dwLength);
|
||||
fis.close();
|
||||
if(m_colourTable != nullptr) delete m_colourTable;
|
||||
if(m_colourTable != NULL) delete m_colourTable;
|
||||
m_colourTable = new ColourTable(data.data, dwLength);
|
||||
|
||||
delete [] data.data;
|
||||
@@ -291,7 +290,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
|
||||
{
|
||||
#ifdef _XBOX
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
@@ -310,7 +309,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
|
||||
{
|
||||
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/");
|
||||
HXUIOBJ hScene;
|
||||
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", nullptr, &hScene);
|
||||
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene);
|
||||
|
||||
if(HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
@@ -334,7 +333,7 @@ void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj)
|
||||
HXUIOBJ child;
|
||||
HRESULT hr = XuiElementGetFirstChild(hObj, &child);
|
||||
|
||||
while(HRESULT_SUCCEEDED(hr) && child != nullptr)
|
||||
while(HRESULT_SUCCEEDED(hr) && child != NULL)
|
||||
{
|
||||
LPCWSTR childName;
|
||||
XuiElementGetId(child,&childName);
|
||||
@@ -375,7 +374,7 @@ void AbstractTexturePack::unloadUI()
|
||||
|
||||
wstring AbstractTexturePack::getXuiRootPath()
|
||||
{
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
@@ -387,14 +386,14 @@ wstring AbstractTexturePack::getXuiRootPath()
|
||||
|
||||
PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes)
|
||||
{
|
||||
if(m_iconSize == 0 || m_iconData == nullptr) loadIcon();
|
||||
if(m_iconSize == 0 || m_iconData == NULL) loadIcon();
|
||||
dwImageBytes = m_iconSize;
|
||||
return m_iconData;
|
||||
}
|
||||
|
||||
PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes)
|
||||
{
|
||||
if(m_comparisonSize == 0 || m_comparisonData == nullptr) loadComparison();
|
||||
if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison();
|
||||
|
||||
dwImageBytes = m_comparisonSize;
|
||||
return m_comparisonData;
|
||||
|
||||
@@ -89,5 +89,5 @@ public:
|
||||
virtual unsigned int getDLCParentPackId();
|
||||
virtual unsigned char getDLCSubPackId();
|
||||
virtual ColourTable *getColourTable() { return m_colourTable; }
|
||||
virtual ArchiveFile *getArchiveFile() { return nullptr; }
|
||||
virtual ArchiveFile *getArchiveFile() { return NULL; }
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ AchievementPopup::AchievementPopup(Minecraft *mc)
|
||||
// 4J - added initialisers
|
||||
width = 0;
|
||||
height = 0;
|
||||
ach = nullptr;
|
||||
ach = NULL;
|
||||
startTime = 0;
|
||||
isHelper = false;
|
||||
|
||||
@@ -59,7 +59,7 @@ void AchievementPopup::prepareWindow()
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, static_cast<float>(width), static_cast<float>(height), 0, 1000, 3000);
|
||||
glOrtho(0, (float)width, (float)height, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
@@ -88,7 +88,7 @@ void AchievementPopup::render()
|
||||
glDepthMask(true);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
if (ach == nullptr || startTime == 0) return;
|
||||
if (ach == NULL || startTime == 0) return;
|
||||
|
||||
double time = (System::currentTimeMillis() - startTime) / 3000.0;
|
||||
if (isHelper)
|
||||
|
||||
@@ -52,7 +52,7 @@ void AchievementScreen::buttonClicked(Button *button)
|
||||
{
|
||||
if (button->id == 1)
|
||||
{
|
||||
minecraft->setScreen(nullptr);
|
||||
minecraft->setScreen(NULL);
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
}
|
||||
Screen::buttonClicked(button);
|
||||
@@ -62,7 +62,7 @@ void AchievementScreen::keyPressed(char eventCharacter, int eventKey)
|
||||
{
|
||||
if (eventKey == minecraft->options->keyBuild->key)
|
||||
{
|
||||
minecraft->setScreen(nullptr);
|
||||
minecraft->setScreen(NULL);
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
}
|
||||
else
|
||||
@@ -286,7 +286,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||
vLine(x2, y1, y2, color);
|
||||
}
|
||||
|
||||
Achievement *hoveredAchievement = nullptr;
|
||||
Achievement *hoveredAchievement = NULL;
|
||||
ItemRenderer *ir = new ItemRenderer();
|
||||
|
||||
glPushMatrix();
|
||||
@@ -372,7 +372,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
Screen::render(xm, ym, a);
|
||||
|
||||
if (hoveredAchievement != nullptr)
|
||||
if (hoveredAchievement != NULL)
|
||||
{
|
||||
Achievement *ach = hoveredAchievement;
|
||||
wstring name = ach->name;
|
||||
|
||||
@@ -30,7 +30,7 @@ void ArchiveFile::_readHeader(DataInputStream *dis)
|
||||
|
||||
ArchiveFile::ArchiveFile(File file)
|
||||
{
|
||||
m_cachedData = nullptr;
|
||||
m_cachedData = NULL;
|
||||
m_sourcefile = file;
|
||||
app.DebugPrintf("Loading archive file...\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
@@ -48,7 +48,7 @@ ArchiveFile::ArchiveFile(File file)
|
||||
FileInputStream fis(file);
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
byteArray readArray(static_cast<unsigned int>(file.length()));
|
||||
byteArray readArray(file.length());
|
||||
fis.read(readArray,0,file.length());
|
||||
|
||||
ByteArrayInputStream bais(readArray);
|
||||
@@ -122,20 +122,20 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||
HANDLE hfile = CreateFile( m_sourcefile.getPath().c_str(),
|
||||
GENERIC_READ,
|
||||
0,
|
||||
nullptr,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr
|
||||
NULL
|
||||
);
|
||||
#else
|
||||
app.DebugPrintf("Createfile archive\n");
|
||||
HANDLE hfile = CreateFile( wstringtofilename(m_sourcefile.getPath()),
|
||||
GENERIC_READ,
|
||||
0,
|
||||
nullptr,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
nullptr
|
||||
NULL
|
||||
);
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||
app.DebugPrintf("hfile ok\n");
|
||||
DWORD ok = SetFilePointer( hfile,
|
||||
data->ptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
FILE_BEGIN
|
||||
);
|
||||
|
||||
@@ -157,7 +157,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||
(LPVOID) pbData,
|
||||
data->filesize,
|
||||
&bytesRead,
|
||||
nullptr
|
||||
NULL
|
||||
);
|
||||
|
||||
if(bSuccess==FALSE)
|
||||
@@ -182,7 +182,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||
#endif
|
||||
|
||||
// Compressed filenames are preceeded with an asterisk.
|
||||
if ( data->isCompressed && out.data != nullptr )
|
||||
if ( data->isCompressed && out.data != NULL )
|
||||
{
|
||||
/* 4J-JEV:
|
||||
* If a compressed file is accessed before compression object is
|
||||
@@ -204,7 +204,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||
out.length = decompressedSize;
|
||||
}
|
||||
|
||||
assert(out.data != nullptr); // THERE IS NO FILE WITH THIS NAME!
|
||||
assert(out.data != NULL); // THERE IS NO FILE WITH THIS NAME!
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double
|
||||
if( ( xRot - xRotO ) > 180.0f ) xRot -= 360.0f;
|
||||
else if( ( xRot - xRotO ) < -180.0f ) xRot += 360.0f;
|
||||
|
||||
glTranslatef(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z));
|
||||
glTranslatef((float)x, (float)y, (float)z);
|
||||
glRotatef(yRotO + (yRot - yRotO) * a - 90, 0, 1, 0);
|
||||
glRotatef(xRotO + (xRot - xRotO) * a, 0, 0, 1);
|
||||
|
||||
@@ -55,19 +55,19 @@ void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double
|
||||
// glNormal3f(ss, 0, 0); // 4J - changed to use tesselator
|
||||
t->begin();
|
||||
t->normal(1,0,0);
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(-2), static_cast<float>(-2), (float)( u02), (float)( v02));
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(-2), static_cast<float>(+2), (float)( u12), (float)( v02));
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(+2), static_cast<float>(+2), (float)( u12), (float)( v12));
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(+2), static_cast<float>(-2), (float)( u02), (float)( v12));
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( -2), (float)( u02), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( +2), (float)( u12), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( +2), (float)( u12), (float)( v12));
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( -2), (float)( u02), (float)( v12));
|
||||
t->end();
|
||||
|
||||
// glNormal3f(-ss, 0, 0); // 4J - changed to use tesselator
|
||||
t->begin();
|
||||
t->normal(-1,0,0);
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(+2), static_cast<float>(-2), (float)( u02), (float)( v02));
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(+2), static_cast<float>(+2), (float)( u12), (float)( v02));
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(-2), static_cast<float>(+2), (float)( u12), (float)( v12));
|
||||
t->vertexUV(static_cast<float>(-7), static_cast<float>(-2), static_cast<float>(-2), (float)( u02), (float)( v12));
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( -2), (float)( u02), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( +2), (float)( u12), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( +2), (float)( u12), (float)( v12));
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( -2), (float)( u02), (float)( v12));
|
||||
t->end();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
@@ -77,10 +77,10 @@ void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double
|
||||
// glNormal3f(0, 0, ss); // 4J - changed to use tesselator
|
||||
t->begin();
|
||||
t->normal(0,0,1);
|
||||
t->vertexUV(static_cast<float>(-8), static_cast<float>(-2), static_cast<float>(0), (float)( u0), (float)( v0));
|
||||
t->vertexUV(static_cast<float>(+8), static_cast<float>(-2), static_cast<float>(0), (float)( u1), (float)( v0));
|
||||
t->vertexUV(static_cast<float>(+8), static_cast<float>(+2), static_cast<float>(0), (float)( u1), (float)( v1));
|
||||
t->vertexUV(static_cast<float>(-8), static_cast<float>(+2), static_cast<float>(0), (float)( u0), (float)( v1));
|
||||
t->vertexUV((float)(-8), (float)( -2), (float)( 0), (float)( u0), (float)( v0));
|
||||
t->vertexUV((float)(+8), (float)( -2), (float)( 0), (float)( u1), (float)( v0));
|
||||
t->vertexUV((float)(+8), (float)( +2), (float)( 0), (float)( u1), (float)( v1));
|
||||
t->vertexUV((float)(-8), (float)( +2), (float)( 0), (float)( u0), (float)( v1));
|
||||
t->end();
|
||||
}
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
@@ -7,7 +7,7 @@ ResourceLocation BatRenderer::BAT_LOCATION = ResourceLocation(TN_MOB_BAT);
|
||||
|
||||
BatRenderer::BatRenderer() : MobRenderer(new BatModel(), 0.25f)
|
||||
{
|
||||
modelVersion = static_cast<BatModel *>(model)->modelVersion();
|
||||
modelVersion = ((BatModel *)model)->modelVersion();
|
||||
}
|
||||
|
||||
void BatRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
|
||||
@@ -7,7 +7,7 @@ ResourceLocation BlazeRenderer::BLAZE_LOCATION = ResourceLocation(TN_MOB_BLAZE);
|
||||
|
||||
BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f)
|
||||
{
|
||||
modelVersion = static_cast<BlazeModel *>(model)->modelVersion();
|
||||
modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||
}
|
||||
|
||||
void BlazeRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
@@ -16,7 +16,7 @@ void BlazeRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z
|
||||
// do some casting around instead
|
||||
shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob);
|
||||
|
||||
int modelVersion = static_cast<BlazeModel *>(model)->modelVersion();
|
||||
int modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||
if (modelVersion != this->modelVersion)
|
||||
{
|
||||
this->modelVersion = modelVersion;
|
||||
|
||||
@@ -14,20 +14,20 @@ BoatModel::BoatModel() : Model()
|
||||
int h = 20;
|
||||
int yOff = 4;
|
||||
|
||||
cubes[0]->addBox(static_cast<float>(-w / 2), static_cast<float>(-h / 2 + 2), -3, w, h - 4, 4, 0);
|
||||
cubes[0]->setPos(0, static_cast<float>(0 + yOff), 0);
|
||||
cubes[0]->addBox((float)(-w / 2), (float)(-h / 2 + 2), -3, w, h - 4, 4, 0);
|
||||
cubes[0]->setPos(0, (float)(0 + yOff), 0);
|
||||
|
||||
cubes[1]->addBox(static_cast<float>(-w / 2 + 2), static_cast<float>(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[1]->setPos(static_cast<float>(-w / 2 + 1), static_cast<float>(0 + yOff), 0);
|
||||
cubes[1]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[1]->setPos((float)(-w / 2 + 1), (float)(0 + yOff), 0);
|
||||
|
||||
cubes[2]->addBox(static_cast<float>(-w / 2 + 2), static_cast<float>(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[2]->setPos(static_cast<float>(+w / 2 - 1), static_cast<float>(0 + yOff), 0);
|
||||
cubes[2]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[2]->setPos((float)(+w / 2 - 1), (float)(0 + yOff), 0);
|
||||
|
||||
cubes[3]->addBox(static_cast<float>(-w / 2 + 2), static_cast<float>(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[3]->setPos(0, static_cast<float>(0 + yOff), static_cast<float>(-h / 2 + 1));
|
||||
cubes[3]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[3]->setPos(0, (float)(0 + yOff), (float)(-h / 2 + 1));
|
||||
|
||||
cubes[4]->addBox(static_cast<float>(-w / 2 + 2), static_cast<float>(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[4]->setPos(0, static_cast<float>(0 + yOff), static_cast<float>(+h / 2 - 1));
|
||||
cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1));
|
||||
|
||||
cubes[0]->xRot = PI / 2;
|
||||
cubes[1]->yRot = PI / 2 * 3;
|
||||
|
||||
@@ -20,7 +20,7 @@ void BoatRenderer::render(shared_ptr<Entity> _boat, double x, double y, double z
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
glTranslatef(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z));
|
||||
glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
glRotatef(180-rot, 0, 1, 0);
|
||||
float hurt = boat->getHurtTime() - a;
|
||||
|
||||
@@ -42,7 +42,7 @@ void BreakingItemParticle::render(Tesselator *t, float a, float xa, float ya, fl
|
||||
float v1 = v0 + 0.999f / 16.0f / 4;
|
||||
float r = 0.1f * size;
|
||||
|
||||
if (tex != nullptr)
|
||||
if (tex != NULL)
|
||||
{
|
||||
u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||
u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||
@@ -50,9 +50,9 @@ void BreakingItemParticle::render(Tesselator *t, float a, float xa, float ya, fl
|
||||
v1 = tex->getV(((vo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||
}
|
||||
|
||||
float x = static_cast<float>(xo + (this->x - xo) * a - xOff);
|
||||
float y = static_cast<float>(yo + (this->y - yo) * a - yOff);
|
||||
float z = static_cast<float>(zo + (this->z - zo) * a - zOff);
|
||||
float x = (float) (xo + (this->x - xo) * a - xOff);
|
||||
float y = (float) (yo + (this->y - yo) * a - yOff);
|
||||
float z = (float) (zo + (this->z - zo) * a - zOff);
|
||||
float br = SharedConstants::TEXTURE_LIGHTING ? 1 : getBrightness(a); // 4J - change brought forward from 1.8.2
|
||||
t->color(br * rCol, br * gCol, br * bCol);
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ BubbleParticle::BubbleParticle(Level *level, double x, double y, double z, doubl
|
||||
|
||||
size = size*(random->nextFloat()*0.6f+0.2f);
|
||||
|
||||
xd = xa*0.2f+static_cast<float>(Math::random() * 2 - 1)*0.02f;
|
||||
yd = ya*0.2f+static_cast<float>(Math::random() * 2 - 1)*0.02f;
|
||||
zd = za*0.2f+static_cast<float>(Math::random() * 2 - 1)*0.02f;
|
||||
xd = xa*0.2f+(float)(Math::random()*2-1)*0.02f;
|
||||
yd = ya*0.2f+(float)(Math::random()*2-1)*0.02f;
|
||||
zd = za*0.2f+(float)(Math::random()*2-1)*0.02f;
|
||||
|
||||
lifetime = static_cast<int>(8 / (Math::random() * 0.8 + 0.2));
|
||||
lifetime = (int) (8 / (Math::random() * 0.8 + 0.2));
|
||||
}
|
||||
|
||||
void BubbleParticle::tick()
|
||||
|
||||
@@ -31,7 +31,7 @@ BufferedImage::BufferedImage(int width,int height,int type)
|
||||
|
||||
for( int i = 1 ; i < 10; i++ )
|
||||
{
|
||||
data[i] = nullptr;
|
||||
data[i] = NULL;
|
||||
}
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
@@ -140,7 +140,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
|
||||
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
{
|
||||
data[l] = nullptr;
|
||||
data[l] = NULL;
|
||||
}
|
||||
|
||||
for( int l = 0; l < 10; l++ )
|
||||
@@ -193,12 +193,12 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
||||
{
|
||||
HRESULT hr;
|
||||
wstring filePath = File;
|
||||
BYTE *pbData = nullptr;
|
||||
BYTE *pbData = NULL;
|
||||
DWORD dwBytes = 0;
|
||||
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
{
|
||||
data[l] = nullptr;
|
||||
data[l] = NULL;
|
||||
}
|
||||
|
||||
for( int l = 0; l < 10; l++ )
|
||||
@@ -230,7 +230,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
||||
|
||||
DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
|
||||
pbData = dlcFile->getData(dwBytes);
|
||||
if(pbData == nullptr || dwBytes == 0)
|
||||
if(pbData == NULL || dwBytes == 0)
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
@@ -269,7 +269,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes)
|
||||
int iCurrentByte=0;
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
{
|
||||
data[l] = nullptr;
|
||||
data[l] = NULL;
|
||||
}
|
||||
|
||||
D3DXIMAGE_INFO ImageInfo;
|
||||
@@ -329,7 +329,7 @@ int *BufferedImage::getData(int level)
|
||||
|
||||
Graphics *BufferedImage::getGraphics()
|
||||
{
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Returns the transparency. Returns either OPAQUE, BITMASK, or TRANSLUCENT.
|
||||
@@ -359,7 +359,7 @@ BufferedImage *BufferedImage::getSubimage(int x ,int y, int w, int h)
|
||||
this->getRGB(x, y, w, h, arrayWrapper,0,w);
|
||||
|
||||
int level = 1;
|
||||
while(getData(level) != nullptr)
|
||||
while(getData(level) != NULL)
|
||||
{
|
||||
int ww = w >> level;
|
||||
int hh = h >> level;
|
||||
@@ -391,9 +391,9 @@ void BufferedImage::preMultiplyAlpha()
|
||||
{
|
||||
cur = curData[i];
|
||||
alpha = (cur >> 24) & 0xff;
|
||||
r = ((cur >> 16) & 0xff) * static_cast<float>(alpha)/255;
|
||||
g = ((cur >> 8) & 0xff) * static_cast<float>(alpha)/255;
|
||||
b = (cur & 0xff) * static_cast<float>(alpha)/255;
|
||||
r = ((cur >> 16) & 0xff) * (float)alpha/255;
|
||||
g = ((cur >> 8) & 0xff) * (float)alpha/255;
|
||||
b = (cur & 0xff) * (float)alpha/255;
|
||||
|
||||
curData[i] = (r << 16) | (g << 8) | (b ) | (alpha << 24);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class DLCPack;
|
||||
class BufferedImage
|
||||
{
|
||||
private:
|
||||
int *data[10]; // Arrays for mipmaps - nullptr if not used
|
||||
int *data[10]; // Arrays for mipmaps - NULL if not used
|
||||
int width;
|
||||
int height;
|
||||
void ByteFlip4(unsigned int &data); // 4J added
|
||||
|
||||
@@ -87,7 +87,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
{
|
||||
if (eventKey == Keyboard::KEY_ESCAPE)
|
||||
{
|
||||
minecraft->setScreen(nullptr);
|
||||
minecraft->setScreen(NULL);
|
||||
return;
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_RETURN)
|
||||
@@ -108,7 +108,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
s_chatHistory.erase(s_chatHistory.begin());
|
||||
}
|
||||
}
|
||||
minecraft->setScreen(nullptr);
|
||||
minecraft->setScreen(NULL);
|
||||
return;
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_UP) { handleHistoryUp(); return; }
|
||||
@@ -160,7 +160,7 @@ void ChatScreen::mouseClicked(int x, int y, int buttonNum)
|
||||
{
|
||||
if (buttonNum == 0)
|
||||
{
|
||||
if (minecraft->gui->selectedName != L"") // 4J - was nullptr comparison
|
||||
if (minecraft->gui->selectedName != L"") // 4J - was NULL comparison
|
||||
{
|
||||
if (message.length() > 0 && message[message.length()-1]!=L' ')
|
||||
{
|
||||
|
||||
@@ -52,19 +52,19 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
|
||||
Tile *tile = chest->getTile();
|
||||
data = chest->getData();
|
||||
|
||||
if (dynamic_cast<ChestTile*>(tile) != nullptr && data == 0)
|
||||
if (dynamic_cast<ChestTile*>(tile) != NULL && data == 0)
|
||||
{
|
||||
static_cast<ChestTile *>(tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z);
|
||||
((ChestTile *) tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z);
|
||||
data = chest->getData();
|
||||
}
|
||||
|
||||
chest->checkNeighbors();
|
||||
}
|
||||
if (chest->n.lock() != nullptr || chest->w.lock() != nullptr) return;
|
||||
if (chest->n.lock() != NULL || chest->w.lock() != NULL) return;
|
||||
|
||||
|
||||
ChestModel *model;
|
||||
if (chest->e.lock() != nullptr || chest->s.lock() != nullptr)
|
||||
if (chest->e.lock() != NULL || chest->s.lock() != NULL)
|
||||
{
|
||||
model = largeChestModel;
|
||||
|
||||
@@ -102,7 +102,7 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
//if( setColor ) glColor4f(1, 1, 1, 1);
|
||||
if( setColor ) glColor4f(1, 1, 1, alpha);
|
||||
glTranslatef(static_cast<float>(x), static_cast<float>(y) + 1, static_cast<float>(z) + 1);
|
||||
glTranslatef((float) x, (float) y + 1, (float) z + 1);
|
||||
glScalef(1, -1, -1);
|
||||
|
||||
glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
@@ -112,11 +112,11 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
|
||||
if (data == 4) rot = 90;
|
||||
if (data == 5) rot = -90;
|
||||
|
||||
if (data == 2 && chest->e.lock() != nullptr)
|
||||
if (data == 2 && chest->e.lock() != NULL)
|
||||
{
|
||||
glTranslatef(1, 0, 0);
|
||||
}
|
||||
if (data == 5 && chest->s.lock() != nullptr)
|
||||
if (data == 5 && chest->s.lock() != NULL)
|
||||
{
|
||||
glTranslatef(0, 0, -1);
|
||||
}
|
||||
@@ -124,12 +124,12 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
|
||||
glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
float open = chest->oOpenness + (chest->openness - chest->oOpenness) * a;
|
||||
if (chest->n.lock() != nullptr)
|
||||
if (chest->n.lock() != NULL)
|
||||
{
|
||||
float open2 = chest->n.lock()->oOpenness + (chest->n.lock()->openness - chest->n.lock()->oOpenness) * a;
|
||||
if (open2 > open) open = open2;
|
||||
}
|
||||
if (chest->w.lock() != nullptr)
|
||||
if (chest->w.lock() != NULL)
|
||||
{
|
||||
float open2 = chest->w.lock()->oOpenness + (chest->w.lock()->openness - chest->w.lock()->oOpenness) * a;
|
||||
if (open2 > open) open = open2;
|
||||
|
||||
@@ -8,35 +8,35 @@ ChickenModel::ChickenModel() : Model()
|
||||
int yo = 16;
|
||||
head = new ModelPart(this, 0, 0);
|
||||
head->addBox(-2.0f, -6.0f, -2.0f, 4, 6, 3, 0.0f); // Head
|
||||
head->setPos(0, static_cast<float>(-1 + yo), -4);
|
||||
head->setPos(0, (float)(-1 + yo), -4);
|
||||
|
||||
beak = new ModelPart(this, 14, 0);
|
||||
beak->addBox(-2.0f, -4.0f, -4.0f, 4, 2, 2, 0.0f); // Beak
|
||||
beak->setPos(0, static_cast<float>(-1 + yo), -4);
|
||||
beak->setPos(0, (float)(-1 + yo), -4);
|
||||
|
||||
redThing = new ModelPart(this, 14, 4);
|
||||
redThing->addBox(-1.0f, -2.0f, -3.0f, 2, 2, 2, 0.0f); // Beak
|
||||
redThing->setPos(0, static_cast<float>(-1 + yo), -4);
|
||||
redThing->setPos(0, (float)(-1 + yo), -4);
|
||||
|
||||
body = new ModelPart(this, 0, 9);
|
||||
body->addBox(-3.0f, -4.0f, -3.0f, 6, 8, 6, 0.0f); // Body
|
||||
body->setPos(0, static_cast<float>(0 + yo), 0);
|
||||
body->setPos(0, (float)(0 + yo), 0);
|
||||
|
||||
leg0 = new ModelPart(this, 26, 0);
|
||||
leg0->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg0
|
||||
leg0->setPos(-2, static_cast<float>(3 + yo), 1);
|
||||
leg0->setPos(-2, (float)(3 + yo), 1);
|
||||
|
||||
leg1 = new ModelPart(this, 26, 0);
|
||||
leg1->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg1
|
||||
leg1->setPos(1, static_cast<float>(3 + yo), 1);
|
||||
leg1->setPos(1, (float)(3 + yo), 1);
|
||||
|
||||
wing0 = new ModelPart(this, 24, 13);
|
||||
wing0->addBox(0.0f, 0.0f, -3.0f, 1, 4, 6); // Wing0
|
||||
wing0->setPos(-4, static_cast<float>(-3 + yo), 0);
|
||||
wing0->setPos(-4, (float)(-3 + yo), 0);
|
||||
|
||||
wing1 = new ModelPart(this, 24, 13);
|
||||
wing1->addBox(-1.0f, 0.0f, -3.0f, 1, 4, 6); // Wing1
|
||||
wing1->setPos(4, static_cast<float>(-3 + yo), 0);
|
||||
wing1->setPos(4, (float)(-3 + yo), 0);
|
||||
|
||||
// 4J added - compile now to avoid random performance hit first time cubes are rendered
|
||||
head->compile(1.0f/16.0f);
|
||||
|
||||
@@ -32,13 +32,13 @@ void Chunk::CreateNewThreadStorage()
|
||||
|
||||
void Chunk::ReleaseThreadStorage()
|
||||
{
|
||||
unsigned char *tileIds = static_cast<unsigned char *>(TlsGetValue(tlsIdx));
|
||||
unsigned char *tileIds = (unsigned char *)TlsGetValue(tlsIdx);
|
||||
delete tileIds;
|
||||
}
|
||||
|
||||
unsigned char *Chunk::GetTileIdsStorage()
|
||||
{
|
||||
unsigned char *tileIds = static_cast<unsigned char *>(TlsGetValue(tlsIdx));
|
||||
unsigned char *tileIds = (unsigned char *)TlsGetValue(tlsIdx);
|
||||
return tileIds;
|
||||
}
|
||||
#else
|
||||
@@ -148,7 +148,7 @@ void Chunk::setPos(int x, int y, int z)
|
||||
|
||||
void Chunk::translateToPos()
|
||||
{
|
||||
glTranslatef(static_cast<float>(xRenderOffs), static_cast<float>(yRenderOffs), static_cast<float>(zRenderOffs));
|
||||
glTranslatef((float)xRenderOffs, (float)yRenderOffs, (float)zRenderOffs);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ void Chunk::makeCopyForRebuild(Chunk *source)
|
||||
this->ym = source->ym;
|
||||
this->zm = source->zm;
|
||||
this->bb = source->bb;
|
||||
this->clipChunk = nullptr;
|
||||
this->clipChunk = NULL;
|
||||
this->id = source->id;
|
||||
this->globalRenderableTileEntities = source->globalRenderableTileEntities;
|
||||
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
||||
@@ -399,7 +399,7 @@ void Chunk::rebuild()
|
||||
glTranslatef(zs / 2.0f, ys / 2.0f, zs / 2.0f);
|
||||
#endif
|
||||
t->begin();
|
||||
t->offset(static_cast<float>(-this->x), static_cast<float>(-this->y), static_cast<float>(-this->z));
|
||||
t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
|
||||
}
|
||||
|
||||
Tile *tile = Tile::tiles[tileId];
|
||||
@@ -521,7 +521,7 @@ void Chunk::rebuild()
|
||||
else
|
||||
{
|
||||
// Easy case - nothing already existing for this chunk. Add them all in.
|
||||
for( size_t i = 0; i < renderableTileEntities.size(); i++ )
|
||||
for( int i = 0; i < renderableTileEntities.size(); i++ )
|
||||
{
|
||||
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
|
||||
}
|
||||
@@ -680,7 +680,7 @@ void Chunk::rebuild_SPU()
|
||||
// render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently
|
||||
// it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into
|
||||
// the cache anyway.
|
||||
ChunkRebuildData* pOutData = nullptr;
|
||||
ChunkRebuildData* pOutData = NULL;
|
||||
g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0);
|
||||
|
||||
Tesselator::Bounds bounds;
|
||||
@@ -826,7 +826,7 @@ void Chunk::rebuild_SPU()
|
||||
}
|
||||
|
||||
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
|
||||
for( size_t i = 0; i < renderableTileEntities.size(); i++ )
|
||||
for( int i = 0; i < renderableTileEntities.size(); i++ )
|
||||
{
|
||||
auto it2 = find( it->second.begin(), it->second.end(), renderableTileEntities[i] );
|
||||
if( it2 == it->second.end() )
|
||||
@@ -842,7 +842,7 @@ void Chunk::rebuild_SPU()
|
||||
else
|
||||
{
|
||||
// Easy case - nothing already existing for this chunk. Add them all in.
|
||||
for( size_t i = 0; i < renderableTileEntities.size(); i++ )
|
||||
for( int i = 0; i < renderableTileEntities.size(); i++ )
|
||||
{
|
||||
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
|
||||
}
|
||||
@@ -936,17 +936,17 @@ void Chunk::rebuild_SPU()
|
||||
|
||||
float Chunk::distanceToSqr(shared_ptr<Entity> player) const
|
||||
{
|
||||
float xd = static_cast<float>(player->x - xm);
|
||||
float yd = static_cast<float>(player->y - ym);
|
||||
float zd = static_cast<float>(player->z - zm);
|
||||
float xd = (float) (player->x - xm);
|
||||
float yd = (float) (player->y - ym);
|
||||
float zd = (float) (player->z - zm);
|
||||
return xd * xd + yd * yd + zd * zd;
|
||||
}
|
||||
|
||||
float Chunk::squishedDistanceToSqr(shared_ptr<Entity> player)
|
||||
{
|
||||
float xd = static_cast<float>(player->x - xm);
|
||||
float yd = static_cast<float>(player->y - ym) * 2;
|
||||
float zd = static_cast<float>(player->z - zm);
|
||||
float xd = (float) (player->x - xm);
|
||||
float yd = (float) (player->y - ym) * 2;
|
||||
float zd = (float) (player->z - zm);
|
||||
return xd * xd + yd * yd + zd * zd;
|
||||
}
|
||||
|
||||
@@ -981,7 +981,7 @@ void Chunk::reset()
|
||||
void Chunk::_delete()
|
||||
{
|
||||
reset();
|
||||
level = nullptr;
|
||||
level = NULL;
|
||||
}
|
||||
|
||||
int Chunk::getList(int layer)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
ClockTexture::ClockTexture() : StitchedTexture(L"clock", L"clock")
|
||||
{
|
||||
rot = rota = 0.0;
|
||||
m_dataTexture = nullptr;
|
||||
m_dataTexture = NULL;
|
||||
m_iPad = XUSER_INDEX_ANY;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ void ClockTexture::cycleFrames()
|
||||
Minecraft *mc = Minecraft::GetInstance();
|
||||
|
||||
double rott = 0;
|
||||
if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr)
|
||||
if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL)
|
||||
{
|
||||
float time = mc->localplayers[m_iPad]->level->getTimeOfDay(1);
|
||||
rott = time;
|
||||
@@ -55,9 +55,9 @@ void ClockTexture::cycleFrames()
|
||||
rot += rota;
|
||||
|
||||
// 4J Stu - We share data with another texture
|
||||
if(m_dataTexture != nullptr)
|
||||
if(m_dataTexture != NULL)
|
||||
{
|
||||
int newFrame = static_cast<int>((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size();
|
||||
int newFrame = (int) ((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size();
|
||||
while (newFrame < 0)
|
||||
{
|
||||
newFrame = (newFrame + m_dataTexture->frames->size()) % m_dataTexture->frames->size();
|
||||
@@ -70,7 +70,7 @@ void ClockTexture::cycleFrames()
|
||||
}
|
||||
else
|
||||
{
|
||||
int newFrame = static_cast<int>((rot + 1.0) * frames->size()) % frames->size();
|
||||
int newFrame = (int) ((rot + 1.0) * frames->size()) % frames->size();
|
||||
while (newFrame < 0)
|
||||
{
|
||||
newFrame = (newFrame + frames->size()) % frames->size();
|
||||
@@ -95,7 +95,7 @@ int ClockTexture::getSourceHeight() const
|
||||
|
||||
int ClockTexture::getFrames()
|
||||
{
|
||||
if(m_dataTexture == nullptr)
|
||||
if(m_dataTexture == NULL)
|
||||
{
|
||||
return StitchedTexture::getFrames();
|
||||
}
|
||||
@@ -107,7 +107,7 @@ int ClockTexture::getFrames()
|
||||
|
||||
void ClockTexture::freeFrameTextures()
|
||||
{
|
||||
if(m_dataTexture == nullptr)
|
||||
if(m_dataTexture == NULL)
|
||||
{
|
||||
StitchedTexture::freeFrameTextures();
|
||||
}
|
||||
@@ -115,5 +115,5 @@ void ClockTexture::freeFrameTextures()
|
||||
|
||||
bool ClockTexture::hasOwnData()
|
||||
{
|
||||
return m_dataTexture == nullptr;
|
||||
return m_dataTexture == NULL;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ void SoundEngine::updateSoundEffectVolume(float fVal) {}
|
||||
void SoundEngine::add(const wstring& name, File *file) {}
|
||||
void SoundEngine::addMusic(const wstring& name, File *file) {}
|
||||
void SoundEngine::addStreaming(const wstring& name, File *file) {}
|
||||
char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return nullptr; }
|
||||
char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return NULL; }
|
||||
bool SoundEngine::isStreamingWavebankReady() { return true; }
|
||||
void SoundEngine::playMusicTick() {};
|
||||
|
||||
@@ -334,7 +334,7 @@ void SoundEngine::tick(shared_ptr<Mob> *players, float a)
|
||||
bool bListenerPostionSet = false;
|
||||
for( size_t i = 0; i < MAX_LOCAL_PLAYERS; i++ )
|
||||
{
|
||||
if( players[i] != nullptr )
|
||||
if( players[i] != NULL )
|
||||
{
|
||||
m_ListenerA[i].bValid=true;
|
||||
F32 x,y,z;
|
||||
@@ -401,7 +401,7 @@ SoundEngine::SoundEngine()
|
||||
m_iMusicDelay=0;
|
||||
m_validListenerCount=0;
|
||||
|
||||
m_bHeardTrackA=nullptr;
|
||||
m_bHeardTrackA=NULL;
|
||||
|
||||
// Start the streaming music playing some music from the overworld
|
||||
SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
||||
@@ -547,8 +547,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||
&m_engine,
|
||||
finalPath,
|
||||
MA_SOUND_FLAG_ASYNC,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
&s->sound) != MA_SUCCESS)
|
||||
{
|
||||
app.DebugPrintf("Failed to initialize sound from file: %s\n", finalPath);
|
||||
@@ -631,8 +631,8 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
|
||||
&m_engine,
|
||||
finalPath,
|
||||
MA_SOUND_FLAG_ASYNC,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
&s->sound) != MA_SUCCESS)
|
||||
{
|
||||
delete s;
|
||||
@@ -700,7 +700,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y , float z,
|
||||
|
||||
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
|
||||
{
|
||||
if(pMinecraft->localplayers[i]!=nullptr)
|
||||
if(pMinecraft->localplayers[i]!=NULL)
|
||||
{
|
||||
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
||||
{
|
||||
@@ -794,7 +794,7 @@ int SoundEngine::getMusicID(int iDomain)
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
// Before the game has started?
|
||||
if(pMinecraft==nullptr)
|
||||
if(pMinecraft==NULL)
|
||||
{
|
||||
// any track from the overworld
|
||||
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
|
||||
@@ -927,8 +927,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter)
|
||||
&soundEngine->m_engine,
|
||||
soundEngine->m_szStreamName,
|
||||
MA_SOUND_FLAG_STREAM,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
&soundEngine->m_musicStream);
|
||||
|
||||
if (result != MA_SUCCESS)
|
||||
@@ -1186,7 +1186,7 @@ void SoundEngine::playMusicUpdate()
|
||||
if( !m_openStreamThread->isRunning() )
|
||||
{
|
||||
delete m_openStreamThread;
|
||||
m_openStreamThread = nullptr;
|
||||
m_openStreamThread = NULL;
|
||||
|
||||
app.DebugPrintf("OpenStreamThreadProc finished. m_musicStreamActive=%d\n", m_musicStreamActive);
|
||||
|
||||
@@ -1243,7 +1243,7 @@ void SoundEngine::playMusicUpdate()
|
||||
if( !m_openStreamThread->isRunning() )
|
||||
{
|
||||
delete m_openStreamThread;
|
||||
m_openStreamThread = nullptr;
|
||||
m_openStreamThread = NULL;
|
||||
m_StreamState = eMusicStreamState_Stop;
|
||||
}
|
||||
break;
|
||||
@@ -1279,14 +1279,14 @@ void SoundEngine::playMusicUpdate()
|
||||
}
|
||||
if(GetIsPlayingStreamingGameMusic())
|
||||
{
|
||||
//if(m_MusicInfo.pCue!=nullptr)
|
||||
//if(m_MusicInfo.pCue!=NULL)
|
||||
{
|
||||
bool playerInEnd = false;
|
||||
bool playerInNether=false;
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
for(unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i)
|
||||
{
|
||||
if(pMinecraft->localplayers[i]!=nullptr)
|
||||
if(pMinecraft->localplayers[i]!=NULL)
|
||||
{
|
||||
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
||||
{
|
||||
@@ -1417,7 +1417,7 @@ void SoundEngine::playMusicUpdate()
|
||||
|
||||
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
|
||||
{
|
||||
if(pMinecraft->localplayers[i]!=nullptr)
|
||||
if(pMinecraft->localplayers[i]!=NULL)
|
||||
{
|
||||
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
||||
{
|
||||
|
||||
@@ -108,23 +108,23 @@ class SoundEngine : public ConsoleSoundEngine
|
||||
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
|
||||
public:
|
||||
SoundEngine();
|
||||
void destroy() override;
|
||||
virtual void destroy();
|
||||
#ifdef _DEBUG
|
||||
void GetSoundName(char *szSoundName,int iSound);
|
||||
#endif
|
||||
void play(int iSound, float x, float y, float z, float volume, float pitch) override;
|
||||
void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) override;
|
||||
void playUI(int iSound, float volume, float pitch) override;
|
||||
void playMusicTick() override;
|
||||
void updateMusicVolume(float fVal) override;
|
||||
void updateSystemMusicPlaying(bool isPlaying) override;
|
||||
void updateSoundEffectVolume(float fVal) override;
|
||||
void init(Options *) override;
|
||||
void tick(shared_ptr<Mob> *players, float a) override; // 4J - updated to take array of local players rather than single one
|
||||
void add(const wstring& name, File *file) override;
|
||||
void addMusic(const wstring& name, File *file) override;
|
||||
void addStreaming(const wstring& name, File *file) override;
|
||||
char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false) override;
|
||||
virtual void play(int iSound, float x, float y, float z, float volume, float pitch);
|
||||
virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true);
|
||||
virtual void playUI(int iSound, float volume, float pitch);
|
||||
virtual void playMusicTick();
|
||||
virtual void updateMusicVolume(float fVal);
|
||||
virtual void updateSystemMusicPlaying(bool isPlaying);
|
||||
virtual void updateSoundEffectVolume(float fVal);
|
||||
virtual void init(Options *);
|
||||
virtual void tick(shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one
|
||||
virtual void add(const wstring& name, File *file);
|
||||
virtual void addMusic(const wstring& name, File *file);
|
||||
virtual void addStreaming(const wstring& name, File *file);
|
||||
virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false);
|
||||
bool isStreamingWavebankReady(); // 4J Added
|
||||
int getMusicID(int iDomain);
|
||||
int getMusicID(const wstring& name);
|
||||
@@ -138,8 +138,7 @@ private:
|
||||
#ifdef __PS3__
|
||||
int initAudioHardware(int iMinSpeakers);
|
||||
#else
|
||||
int initAudioHardware(int iMinSpeakers) override
|
||||
{ return iMinSpeakers;}
|
||||
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;}
|
||||
#endif
|
||||
|
||||
int GetRandomishTrack(int iStart,int iEnd);
|
||||
|
||||
@@ -112,8 +112,8 @@ extern "C" {
|
||||
// query get_info to find the exact amount required. yes I know
|
||||
// this is lame).
|
||||
//
|
||||
// If you pass in a non-nullptr buffer of the type below, allocation
|
||||
// will occur from it as described above. Otherwise just pass nullptr
|
||||
// If you pass in a non-NULL buffer of the type below, allocation
|
||||
// will occur from it as described above. Otherwise just pass NULL
|
||||
// to use malloc()/alloca()
|
||||
|
||||
typedef struct
|
||||
@@ -191,8 +191,8 @@ extern stb_vorbis *stb_vorbis_open_pushdata(
|
||||
// the first N bytes of the file--you're told if it's not enough, see below)
|
||||
// on success, returns an stb_vorbis *, does not set error, returns the amount of
|
||||
// data parsed/consumed on this call in *datablock_memory_consumed_in_bytes;
|
||||
// on failure, returns nullptr on error and sets *error, does not change *datablock_memory_consumed
|
||||
// if returns nullptr and *error is VORBIS_need_more_data, then the input block was
|
||||
// on failure, returns NULL on error and sets *error, does not change *datablock_memory_consumed
|
||||
// if returns NULL and *error is VORBIS_need_more_data, then the input block was
|
||||
// incomplete and you need to pass in a larger block from the start of the file
|
||||
|
||||
extern int stb_vorbis_decode_frame_pushdata(
|
||||
@@ -219,7 +219,7 @@ extern int stb_vorbis_decode_frame_pushdata(
|
||||
// without writing state-machiney code to record a partial detection.
|
||||
//
|
||||
// The number of channels returned are stored in *channels (which can be
|
||||
// nullptr--it is always the same as the number of channels reported by
|
||||
// NULL--it is always the same as the number of channels reported by
|
||||
// get_info). *output will contain an array of float* buffers, one per
|
||||
// channel. In other words, (*output)[0][0] contains the first sample from
|
||||
// the first channel, and (*output)[1][0] contains the first sample from
|
||||
@@ -269,18 +269,18 @@ extern int stb_vorbis_decode_memory(const unsigned char *mem, int len, int *chan
|
||||
extern stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len,
|
||||
int *error, const stb_vorbis_alloc *alloc_buffer);
|
||||
// create an ogg vorbis decoder from an ogg vorbis stream in memory (note
|
||||
// this must be the entire stream!). on failure, returns nullptr and sets *error
|
||||
// this must be the entire stream!). on failure, returns NULL and sets *error
|
||||
|
||||
#ifndef STB_VORBIS_NO_STDIO
|
||||
extern stb_vorbis * stb_vorbis_open_filename(const char *filename,
|
||||
int *error, const stb_vorbis_alloc *alloc_buffer);
|
||||
// create an ogg vorbis decoder from a filename via fopen(). on failure,
|
||||
// returns nullptr and sets *error (possibly to VORBIS_file_open_failure).
|
||||
// returns NULL and sets *error (possibly to VORBIS_file_open_failure).
|
||||
|
||||
extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close,
|
||||
int *error, const stb_vorbis_alloc *alloc_buffer);
|
||||
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
||||
// the _current_ seek point (ftell). on failure, returns nullptr and sets *error.
|
||||
// the _current_ seek point (ftell). on failure, returns NULL and sets *error.
|
||||
// note that stb_vorbis must "own" this stream; if you seek it in between
|
||||
// calls to stb_vorbis, it will become confused. Moreover, if you attempt to
|
||||
// perform stb_vorbis_seek_*() operations on this file, it will assume it
|
||||
@@ -291,7 +291,7 @@ extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_cl
|
||||
int *error, const stb_vorbis_alloc *alloc_buffer, unsigned int len);
|
||||
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
||||
// the _current_ seek point (ftell); the stream will be of length 'len' bytes.
|
||||
// on failure, returns nullptr and sets *error. note that stb_vorbis must "own"
|
||||
// on failure, returns NULL and sets *error. note that stb_vorbis must "own"
|
||||
// this stream; if you seek it in between calls to stb_vorbis, it will become
|
||||
// confused.
|
||||
#endif
|
||||
@@ -314,7 +314,7 @@ extern float stb_vorbis_stream_length_in_seconds(stb_vorbis *f);
|
||||
|
||||
extern int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***output);
|
||||
// decode the next frame and return the number of samples. the number of
|
||||
// channels returned are stored in *channels (which can be nullptr--it is always
|
||||
// channels returned are stored in *channels (which can be NULL--it is always
|
||||
// the same as the number of channels reported by get_info). *output will
|
||||
// contain an array of float* buffers, one per channel. These outputs will
|
||||
// be overwritten on the next call to stb_vorbis_get_frame_*.
|
||||
@@ -588,7 +588,7 @@ enum STBVorbisError
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#else // STB_VORBIS_NO_CRT
|
||||
#define nullptr 0
|
||||
#define NULL 0
|
||||
#define malloc(s) 0
|
||||
#define free(s) ((void) 0)
|
||||
#define realloc(s) 0
|
||||
@@ -949,11 +949,11 @@ static void *setup_malloc(vorb *f, int sz)
|
||||
f->setup_memory_required += sz;
|
||||
if (f->alloc.alloc_buffer) {
|
||||
void *p = (char *) f->alloc.alloc_buffer + f->setup_offset;
|
||||
if (f->setup_offset + sz > f->temp_offset) return nullptr;
|
||||
if (f->setup_offset + sz > f->temp_offset) return NULL;
|
||||
f->setup_offset += sz;
|
||||
return p;
|
||||
}
|
||||
return sz ? malloc(sz) : nullptr;
|
||||
return sz ? malloc(sz) : NULL;
|
||||
}
|
||||
|
||||
static void setup_free(vorb *f, void *p)
|
||||
@@ -966,7 +966,7 @@ static void *setup_temp_malloc(vorb *f, int sz)
|
||||
{
|
||||
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs.
|
||||
if (f->alloc.alloc_buffer) {
|
||||
if (f->temp_offset - sz < f->setup_offset) return nullptr;
|
||||
if (f->temp_offset - sz < f->setup_offset) return NULL;
|
||||
f->temp_offset -= sz;
|
||||
return (char *) f->alloc.alloc_buffer + f->temp_offset;
|
||||
}
|
||||
@@ -1654,12 +1654,12 @@ static int codebook_decode_scalar_raw(vorb *f, Codebook *c)
|
||||
int i;
|
||||
prep_huffman(f);
|
||||
|
||||
if (c->codewords == nullptr && c->sorted_codewords == nullptr)
|
||||
if (c->codewords == NULL && c->sorted_codewords == NULL)
|
||||
return -1;
|
||||
|
||||
// cases to use binary search: sorted_codewords && !c->codewords
|
||||
// sorted_codewords && c->entries > 8
|
||||
if (c->entries > 8 ? c->sorted_codewords!=nullptr : !c->codewords) {
|
||||
if (c->entries > 8 ? c->sorted_codewords!=NULL : !c->codewords) {
|
||||
// binary search
|
||||
uint32 code = bit_reverse(f->acc);
|
||||
int x=0, n=c->sorted_entries, len;
|
||||
@@ -2629,7 +2629,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
|
||||
// @OPTIMIZE: reduce register pressure by using fewer variables?
|
||||
int save_point = temp_alloc_save(f);
|
||||
float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2));
|
||||
float *u=nullptr,*v=nullptr;
|
||||
float *u=NULL,*v=NULL;
|
||||
// twiddle factors
|
||||
float *A = f->A[blocktype];
|
||||
|
||||
@@ -3057,7 +3057,7 @@ static float *get_window(vorb *f, int len)
|
||||
len <<= 1;
|
||||
if (len == f->blocksize_0) return f->window[0];
|
||||
if (len == f->blocksize_1) return f->window[1];
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef STB_VORBIS_NO_DEFER_FLOOR
|
||||
@@ -3306,7 +3306,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start,
|
||||
if (map->chan[j].mux == i) {
|
||||
if (zero_channel[j]) {
|
||||
do_not_decode[ch] = TRUE;
|
||||
residue_buffers[ch] = nullptr;
|
||||
residue_buffers[ch] = NULL;
|
||||
} else {
|
||||
do_not_decode[ch] = FALSE;
|
||||
residue_buffers[ch] = f->channel_buffers[j];
|
||||
@@ -3351,7 +3351,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start,
|
||||
if (really_zero_channel[i]) {
|
||||
memset(f->channel_buffers[i], 0, sizeof(*f->channel_buffers[i]) * n2);
|
||||
} else {
|
||||
do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], nullptr);
|
||||
do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], NULL);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -3464,7 +3464,7 @@ static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)
|
||||
if (f->previous_length) {
|
||||
int i,j, n = f->previous_length;
|
||||
float *w = get_window(f, n);
|
||||
if (w == nullptr) return 0;
|
||||
if (w == NULL) return 0;
|
||||
for (i=0; i < f->channels; ++i) {
|
||||
for (j=0; j < n; ++j)
|
||||
f->channel_buffers[i][left+j] =
|
||||
@@ -3647,24 +3647,24 @@ static int start_decoder(vorb *f)
|
||||
//file vendor
|
||||
len = get32_packet(f);
|
||||
f->vendor = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
||||
if (f->vendor == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->vendor == NULL) return error(f, VORBIS_outofmem);
|
||||
for(i=0; i < len; ++i) {
|
||||
f->vendor[i] = get8_packet(f);
|
||||
}
|
||||
f->vendor[len] = (char)'\0';
|
||||
//user comments
|
||||
f->comment_list_length = get32_packet(f);
|
||||
f->comment_list = nullptr;
|
||||
f->comment_list = NULL;
|
||||
if (f->comment_list_length > 0)
|
||||
{
|
||||
f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length));
|
||||
if (f->comment_list == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->comment_list == NULL) return error(f, VORBIS_outofmem);
|
||||
}
|
||||
|
||||
for(i=0; i < f->comment_list_length; ++i) {
|
||||
len = get32_packet(f);
|
||||
f->comment_list[i] = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
||||
if (f->comment_list[i] == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->comment_list[i] == NULL) return error(f, VORBIS_outofmem);
|
||||
|
||||
for(j=0; j < len; ++j) {
|
||||
f->comment_list[i][j] = get8_packet(f);
|
||||
@@ -3710,7 +3710,7 @@ static int start_decoder(vorb *f)
|
||||
|
||||
f->codebook_count = get_bits(f,8) + 1;
|
||||
f->codebooks = (Codebook *) setup_malloc(f, sizeof(*f->codebooks) * f->codebook_count);
|
||||
if (f->codebooks == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->codebooks == NULL) return error(f, VORBIS_outofmem);
|
||||
memset(f->codebooks, 0, sizeof(*f->codebooks) * f->codebook_count);
|
||||
for (i=0; i < f->codebook_count; ++i) {
|
||||
uint32 *values;
|
||||
@@ -3771,7 +3771,7 @@ static int start_decoder(vorb *f)
|
||||
f->setup_temp_memory_required = c->entries;
|
||||
|
||||
c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries);
|
||||
if (c->codeword_lengths == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (c->codeword_lengths == NULL) return error(f, VORBIS_outofmem);
|
||||
memcpy(c->codeword_lengths, lengths, c->entries);
|
||||
setup_temp_free(f, lengths, c->entries); // note this is only safe if there have been no intervening temp mallocs!
|
||||
lengths = c->codeword_lengths;
|
||||
@@ -3791,7 +3791,7 @@ static int start_decoder(vorb *f)
|
||||
}
|
||||
|
||||
c->sorted_entries = sorted_count;
|
||||
values = nullptr;
|
||||
values = NULL;
|
||||
|
||||
CHECK(f);
|
||||
if (!c->sparse) {
|
||||
@@ -3820,11 +3820,11 @@ static int start_decoder(vorb *f)
|
||||
if (c->sorted_entries) {
|
||||
// allocate an extra slot for sentinels
|
||||
c->sorted_codewords = (uint32 *) setup_malloc(f, sizeof(*c->sorted_codewords) * (c->sorted_entries+1));
|
||||
if (c->sorted_codewords == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (c->sorted_codewords == NULL) return error(f, VORBIS_outofmem);
|
||||
// allocate an extra slot at the front so that c->sorted_values[-1] is defined
|
||||
// so that we can catch that case without an extra if
|
||||
c->sorted_values = ( int *) setup_malloc(f, sizeof(*c->sorted_values ) * (c->sorted_entries+1));
|
||||
if (c->sorted_values == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (c->sorted_values == NULL) return error(f, VORBIS_outofmem);
|
||||
++c->sorted_values;
|
||||
c->sorted_values[-1] = -1;
|
||||
compute_sorted_huffman(c, lengths, values);
|
||||
@@ -3834,7 +3834,7 @@ static int start_decoder(vorb *f)
|
||||
setup_temp_free(f, values, sizeof(*values)*c->sorted_entries);
|
||||
setup_temp_free(f, c->codewords, sizeof(*c->codewords)*c->sorted_entries);
|
||||
setup_temp_free(f, lengths, c->entries);
|
||||
c->codewords = nullptr;
|
||||
c->codewords = NULL;
|
||||
}
|
||||
|
||||
compute_accelerated_huffman(c);
|
||||
@@ -3857,7 +3857,7 @@ static int start_decoder(vorb *f)
|
||||
}
|
||||
if (c->lookup_values == 0) return error(f, VORBIS_invalid_setup);
|
||||
mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values);
|
||||
if (mults == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (mults == NULL) return error(f, VORBIS_outofmem);
|
||||
for (j=0; j < (int) c->lookup_values; ++j) {
|
||||
int q = get_bits(f, c->value_bits);
|
||||
if (q == EOP) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_invalid_setup); }
|
||||
@@ -3874,7 +3874,7 @@ static int start_decoder(vorb *f)
|
||||
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->sorted_entries * c->dimensions);
|
||||
} else
|
||||
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->entries * c->dimensions);
|
||||
if (c->multiplicands == nullptr) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); }
|
||||
if (c->multiplicands == NULL) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); }
|
||||
len = sparse ? c->sorted_entries : c->entries;
|
||||
for (j=0; j < len; ++j) {
|
||||
unsigned int z = sparse ? c->sorted_values[j] : j;
|
||||
@@ -3902,7 +3902,7 @@ static int start_decoder(vorb *f)
|
||||
float last=0;
|
||||
CHECK(f);
|
||||
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->lookup_values);
|
||||
if (c->multiplicands == nullptr) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); }
|
||||
if (c->multiplicands == NULL) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); }
|
||||
for (j=0; j < (int) c->lookup_values; ++j) {
|
||||
float val = mults[j] * c->delta_value + c->minimum_value + last;
|
||||
c->multiplicands[j] = val;
|
||||
@@ -3931,7 +3931,7 @@ static int start_decoder(vorb *f)
|
||||
// Floors
|
||||
f->floor_count = get_bits(f, 6)+1;
|
||||
f->floor_config = (Floor *) setup_malloc(f, f->floor_count * sizeof(*f->floor_config));
|
||||
if (f->floor_config == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->floor_config == NULL) return error(f, VORBIS_outofmem);
|
||||
for (i=0; i < f->floor_count; ++i) {
|
||||
f->floor_types[i] = get_bits(f, 16);
|
||||
if (f->floor_types[i] > 1) return error(f, VORBIS_invalid_setup);
|
||||
@@ -4007,7 +4007,7 @@ static int start_decoder(vorb *f)
|
||||
// Residue
|
||||
f->residue_count = get_bits(f, 6)+1;
|
||||
f->residue_config = (Residue *) setup_malloc(f, f->residue_count * sizeof(f->residue_config[0]));
|
||||
if (f->residue_config == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->residue_config == NULL) return error(f, VORBIS_outofmem);
|
||||
memset(f->residue_config, 0, f->residue_count * sizeof(f->residue_config[0]));
|
||||
for (i=0; i < f->residue_count; ++i) {
|
||||
uint8 residue_cascade[64];
|
||||
@@ -4029,7 +4029,7 @@ static int start_decoder(vorb *f)
|
||||
residue_cascade[j] = high_bits*8 + low_bits;
|
||||
}
|
||||
r->residue_books = (short (*)[8]) setup_malloc(f, sizeof(r->residue_books[0]) * r->classifications);
|
||||
if (r->residue_books == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (r->residue_books == NULL) return error(f, VORBIS_outofmem);
|
||||
for (j=0; j < r->classifications; ++j) {
|
||||
for (k=0; k < 8; ++k) {
|
||||
if (residue_cascade[j] & (1 << k)) {
|
||||
@@ -4049,7 +4049,7 @@ static int start_decoder(vorb *f)
|
||||
int classwords = f->codebooks[r->classbook].dimensions;
|
||||
int temp = j;
|
||||
r->classdata[j] = (uint8 *) setup_malloc(f, sizeof(r->classdata[j][0]) * classwords);
|
||||
if (r->classdata[j] == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (r->classdata[j] == NULL) return error(f, VORBIS_outofmem);
|
||||
for (k=classwords-1; k >= 0; --k) {
|
||||
r->classdata[j][k] = temp % r->classifications;
|
||||
temp /= r->classifications;
|
||||
@@ -4059,14 +4059,14 @@ static int start_decoder(vorb *f)
|
||||
|
||||
f->mapping_count = get_bits(f,6)+1;
|
||||
f->mapping = (Mapping *) setup_malloc(f, f->mapping_count * sizeof(*f->mapping));
|
||||
if (f->mapping == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->mapping == NULL) return error(f, VORBIS_outofmem);
|
||||
memset(f->mapping, 0, f->mapping_count * sizeof(*f->mapping));
|
||||
for (i=0; i < f->mapping_count; ++i) {
|
||||
Mapping *m = f->mapping + i;
|
||||
int mapping_type = get_bits(f,16);
|
||||
if (mapping_type != 0) return error(f, VORBIS_invalid_setup);
|
||||
m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan));
|
||||
if (m->chan == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (m->chan == NULL) return error(f, VORBIS_outofmem);
|
||||
if (get_bits(f,1))
|
||||
m->submaps = get_bits(f,4)+1;
|
||||
else
|
||||
@@ -4128,11 +4128,11 @@ static int start_decoder(vorb *f)
|
||||
f->channel_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1);
|
||||
f->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
|
||||
f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist);
|
||||
if (f->channel_buffers[i] == nullptr || f->previous_window[i] == nullptr || f->finalY[i] == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->channel_buffers[i] == NULL || f->previous_window[i] == NULL || f->finalY[i] == NULL) return error(f, VORBIS_outofmem);
|
||||
memset(f->channel_buffers[i], 0, sizeof(float) * f->blocksize_1);
|
||||
#ifdef STB_VORBIS_NO_DEFER_FLOOR
|
||||
f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
|
||||
if (f->floor_buffers[i] == nullptr) return error(f, VORBIS_outofmem);
|
||||
if (f->floor_buffers[i] == NULL) return error(f, VORBIS_outofmem);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -4232,7 +4232,7 @@ static void vorbis_deinit(stb_vorbis *p)
|
||||
setup_free(p, c->codewords);
|
||||
setup_free(p, c->sorted_codewords);
|
||||
// c->sorted_values[-1] is the first entry in the array
|
||||
setup_free(p, c->sorted_values ? c->sorted_values-1 : nullptr);
|
||||
setup_free(p, c->sorted_values ? c->sorted_values-1 : NULL);
|
||||
}
|
||||
setup_free(p, p->codebooks);
|
||||
}
|
||||
@@ -4266,14 +4266,14 @@ static void vorbis_deinit(stb_vorbis *p)
|
||||
|
||||
void stb_vorbis_close(stb_vorbis *p)
|
||||
{
|
||||
if (p == nullptr) return;
|
||||
if (p == NULL) return;
|
||||
vorbis_deinit(p);
|
||||
setup_free(p,p);
|
||||
}
|
||||
|
||||
static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
|
||||
{
|
||||
memset(p, 0, sizeof(*p)); // nullptr out all malloc'd pointers to start
|
||||
memset(p, 0, sizeof(*p)); // NULL out all malloc'd pointers to start
|
||||
if (z) {
|
||||
p->alloc = *z;
|
||||
p->alloc.alloc_buffer_length_in_bytes &= ~7;
|
||||
@@ -4281,12 +4281,12 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
|
||||
}
|
||||
p->eof = 0;
|
||||
p->error = VORBIS__no_error;
|
||||
p->stream = nullptr;
|
||||
p->codebooks = nullptr;
|
||||
p->stream = NULL;
|
||||
p->codebooks = NULL;
|
||||
p->page_crc_tests = -1;
|
||||
#ifndef STB_VORBIS_NO_STDIO
|
||||
p->close_on_free = FALSE;
|
||||
p->f = nullptr;
|
||||
p->f = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -4509,7 +4509,7 @@ int stb_vorbis_decode_frame_pushdata(
|
||||
|
||||
stb_vorbis *stb_vorbis_open_pushdata(
|
||||
const unsigned char *data, int data_len, // the memory available for decoding
|
||||
int *data_used, // only defined if result is not nullptr
|
||||
int *data_used, // only defined if result is not NULL
|
||||
int *error, const stb_vorbis_alloc *alloc)
|
||||
{
|
||||
stb_vorbis *f, p;
|
||||
@@ -4523,7 +4523,7 @@ stb_vorbis *stb_vorbis_open_pushdata(
|
||||
else
|
||||
*error = p.error;
|
||||
vorbis_deinit(&p);
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
f = vorbis_alloc(&p);
|
||||
if (f) {
|
||||
@@ -4533,7 +4533,7 @@ stb_vorbis *stb_vorbis_open_pushdata(
|
||||
return f;
|
||||
} else {
|
||||
vorbis_deinit(&p);
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif // STB_VORBIS_NO_PUSHDATA_API
|
||||
@@ -4680,7 +4680,7 @@ static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset)
|
||||
|
||||
set_file_offset(f, previous_safe);
|
||||
|
||||
while (vorbis_find_page(f, &end, nullptr)) {
|
||||
while (vorbis_find_page(f, &end, NULL)) {
|
||||
if (end >= limit_offset && stb_vorbis_get_file_offset(f) < limit_offset)
|
||||
return 1;
|
||||
set_file_offset(f, end);
|
||||
@@ -4770,7 +4770,7 @@ static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number)
|
||||
set_file_offset(f, left.page_end + (delta / 2) - 32768);
|
||||
}
|
||||
|
||||
if (!vorbis_find_page(f, nullptr, nullptr)) goto error;
|
||||
if (!vorbis_find_page(f, NULL, NULL)) goto error;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@@ -4920,7 +4920,7 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number)
|
||||
if (sample_number != f->current_loc) {
|
||||
int n;
|
||||
uint32 frame_start = f->current_loc;
|
||||
stb_vorbis_get_frame_float(f, &n, nullptr);
|
||||
stb_vorbis_get_frame_float(f, &n, NULL);
|
||||
assert(sample_number > frame_start);
|
||||
assert(f->channel_buffer_start + (int) (sample_number-frame_start) <= f->channel_buffer_end);
|
||||
f->channel_buffer_start += (sample_number - frame_start);
|
||||
@@ -5063,7 +5063,7 @@ stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free, int *er
|
||||
}
|
||||
if (error) *error = p.error;
|
||||
vorbis_deinit(&p);
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, const stb_vorbis_alloc *alloc)
|
||||
@@ -5081,14 +5081,14 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st
|
||||
FILE *f;
|
||||
#if defined(_WIN32) && defined(__STDC_WANT_SECURE_LIB__)
|
||||
if (0 != fopen_s(&f, filename, "rb"))
|
||||
f = nullptr;
|
||||
f = NULL;
|
||||
#else
|
||||
f = fopen(filename, "rb");
|
||||
#endif
|
||||
if (f)
|
||||
return stb_vorbis_open_file(f, TRUE, error, alloc);
|
||||
if (error) *error = VORBIS_file_open_failure;
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
#endif // STB_VORBIS_NO_STDIO
|
||||
|
||||
@@ -5097,7 +5097,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err
|
||||
stb_vorbis *f, p;
|
||||
if (!data) {
|
||||
if (error) *error = VORBIS_unexpected_eof;
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
vorbis_init(&p, alloc);
|
||||
p.stream = (uint8 *) data;
|
||||
@@ -5116,7 +5116,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err
|
||||
}
|
||||
if (error) *error = p.error;
|
||||
vorbis_deinit(&p);
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef STB_VORBIS_NO_INTEGER_CONVERSION
|
||||
@@ -5255,8 +5255,8 @@ static void convert_samples_short(int buf_c, short **buffer, int b_offset, int d
|
||||
|
||||
int stb_vorbis_get_frame_short(stb_vorbis *f, int num_c, short **buffer, int num_samples)
|
||||
{
|
||||
float **output = nullptr;
|
||||
int len = stb_vorbis_get_frame_float(f, nullptr, &output);
|
||||
float **output = NULL;
|
||||
int len = stb_vorbis_get_frame_float(f, NULL, &output);
|
||||
if (len > num_samples) len = num_samples;
|
||||
if (len)
|
||||
convert_samples_short(num_c, buffer, 0, f->channels, output, 0, len);
|
||||
@@ -5294,7 +5294,7 @@ int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, short *buff
|
||||
float **output;
|
||||
int len;
|
||||
if (num_c == 1) return stb_vorbis_get_frame_short(f,num_c,&buffer, num_shorts);
|
||||
len = stb_vorbis_get_frame_float(f, nullptr, &output);
|
||||
len = stb_vorbis_get_frame_float(f, NULL, &output);
|
||||
if (len) {
|
||||
if (len*num_c > num_shorts) len = num_shorts / num_c;
|
||||
convert_channels_short_interleaved(num_c, buffer, f->channels, output, 0, len);
|
||||
@@ -5316,7 +5316,7 @@ int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short
|
||||
n += k;
|
||||
f->channel_buffer_start += k;
|
||||
if (n == len) break;
|
||||
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break;
|
||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@@ -5333,7 +5333,7 @@ int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, in
|
||||
n += k;
|
||||
f->channel_buffer_start += k;
|
||||
if (n == len) break;
|
||||
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break;
|
||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@@ -5343,8 +5343,8 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_
|
||||
{
|
||||
int data_len, offset, total, limit, error;
|
||||
short *data;
|
||||
stb_vorbis *v = stb_vorbis_open_filename(filename, &error, nullptr);
|
||||
if (v == nullptr) return -1;
|
||||
stb_vorbis *v = stb_vorbis_open_filename(filename, &error, NULL);
|
||||
if (v == NULL) return -1;
|
||||
limit = v->channels * 4096;
|
||||
*channels = v->channels;
|
||||
if (sample_rate)
|
||||
@@ -5352,7 +5352,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_
|
||||
offset = data_len = 0;
|
||||
total = limit;
|
||||
data = (short *) malloc(total * sizeof(*data));
|
||||
if (data == nullptr) {
|
||||
if (data == NULL) {
|
||||
stb_vorbis_close(v);
|
||||
return -2;
|
||||
}
|
||||
@@ -5365,7 +5365,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_
|
||||
short *data2;
|
||||
total *= 2;
|
||||
data2 = (short *) realloc(data, total * sizeof(*data));
|
||||
if (data2 == nullptr) {
|
||||
if (data2 == NULL) {
|
||||
free(data);
|
||||
stb_vorbis_close(v);
|
||||
return -2;
|
||||
@@ -5383,8 +5383,8 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp
|
||||
{
|
||||
int data_len, offset, total, limit, error;
|
||||
short *data;
|
||||
stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, nullptr);
|
||||
if (v == nullptr) return -1;
|
||||
stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, NULL);
|
||||
if (v == NULL) return -1;
|
||||
limit = v->channels * 4096;
|
||||
*channels = v->channels;
|
||||
if (sample_rate)
|
||||
@@ -5392,7 +5392,7 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp
|
||||
offset = data_len = 0;
|
||||
total = limit;
|
||||
data = (short *) malloc(total * sizeof(*data));
|
||||
if (data == nullptr) {
|
||||
if (data == NULL) {
|
||||
stb_vorbis_close(v);
|
||||
return -2;
|
||||
}
|
||||
@@ -5405,7 +5405,7 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp
|
||||
short *data2;
|
||||
total *= 2;
|
||||
data2 = (short *) realloc(data, total * sizeof(*data));
|
||||
if (data2 == nullptr) {
|
||||
if (data2 == NULL) {
|
||||
free(data);
|
||||
stb_vorbis_close(v);
|
||||
return -2;
|
||||
@@ -5440,7 +5440,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float
|
||||
f->channel_buffer_start += k;
|
||||
if (n == len)
|
||||
break;
|
||||
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs))
|
||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs))
|
||||
break;
|
||||
}
|
||||
return n;
|
||||
@@ -5466,7 +5466,7 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
|
||||
f->channel_buffer_start += k;
|
||||
if (n == num_samples)
|
||||
break;
|
||||
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs))
|
||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs))
|
||||
break;
|
||||
}
|
||||
return n;
|
||||
|
||||
@@ -325,7 +325,7 @@ void ColourTable::staticCtor()
|
||||
{
|
||||
for(unsigned int i = eMinecraftColour_NOT_SET; i < eMinecraftColour_COUNT; ++i)
|
||||
{
|
||||
s_colourNamesMap.insert( unordered_map<wstring,eMinecraftColour>::value_type( ColourTableElements[i], static_cast<eMinecraftColour>(i)) );
|
||||
s_colourNamesMap.insert( unordered_map<wstring,eMinecraftColour>::value_type( ColourTableElements[i], (eMinecraftColour)i) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ void ColourTable::setColour(const wstring &colourName, int value)
|
||||
auto it = s_colourNamesMap.find(colourName);
|
||||
if(it != s_colourNamesMap.end())
|
||||
{
|
||||
m_colourValues[static_cast<int>(it->second)] = value;
|
||||
m_colourValues[(int)it->second] = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,5 +377,5 @@ void ColourTable::setColour(const wstring &colourName, const wstring &value)
|
||||
|
||||
unsigned int ColourTable::getColour(eMinecraftColour id)
|
||||
{
|
||||
return m_colourValues[static_cast<int>(id)];
|
||||
return m_colourValues[(int)id];
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -163,12 +163,12 @@ public:
|
||||
eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;}
|
||||
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
|
||||
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
|
||||
void SetAction(int iPad, eXuiAction action, LPVOID param = nullptr);
|
||||
void SetTMSAction(int iPad, eTMSAction action) { m_eTMSAction[iPad] = action; }
|
||||
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
|
||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
|
||||
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
|
||||
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
||||
void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = nullptr) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
||||
void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = NULL) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
||||
eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;}
|
||||
void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;}
|
||||
|
||||
@@ -625,7 +625,7 @@ public:
|
||||
virtual void ReleaseSaveThumbnail()=0;
|
||||
virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)=0;
|
||||
|
||||
virtual void ReadBannedList(int iPad, eTMSAction action=static_cast<eTMSAction>(0), bool bCallback=false)=0;
|
||||
virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0;
|
||||
|
||||
private:
|
||||
|
||||
@@ -862,12 +862,12 @@ public:
|
||||
|
||||
bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];}
|
||||
void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
|
||||
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=nullptr;BannedListA[iPad].dwBytes=0;}
|
||||
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;}
|
||||
|
||||
DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;}
|
||||
void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;}
|
||||
|
||||
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = nullptr; *pdwBytes = 0;}
|
||||
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
|
||||
|
||||
//XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path)
|
||||
{
|
||||
m_pbData = nullptr;
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring &
|
||||
{
|
||||
if(paramName.compare(wchTypeNamesA[i]) == 0)
|
||||
{
|
||||
type = static_cast<EAudioParameterType>(i);
|
||||
type = (EAudioParameterType)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
|
||||
{
|
||||
i++;
|
||||
}
|
||||
size_t iLast=creditValue.find_last_of(L" ", i);
|
||||
int iLast=(int)creditValue.find_last_of(L" ",i);
|
||||
switch(XGetLanguage())
|
||||
{
|
||||
case XC_LANGUAGE_JAPANESE:
|
||||
@@ -96,7 +96,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
|
||||
iLast = maximumChars;
|
||||
break;
|
||||
default:
|
||||
iLast=creditValue.find_last_of(L" ", i);
|
||||
iLast=(int)creditValue.find_last_of(L" ",i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||
|
||||
if(uiVersion < CURRENT_AUDIO_VERSION_NUM)
|
||||
{
|
||||
if(pbData!=nullptr) delete [] pbData;
|
||||
if(pbData!=NULL) delete [] pbData;
|
||||
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||
return false;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||
for(unsigned int i=0;i<uiParameterTypeCount;i++)
|
||||
{
|
||||
// Map DLC strings to application strings, then store the DLC index mapping to application index
|
||||
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
|
||||
wstring parameterName((WCHAR *)pParams->wchData);
|
||||
EAudioParameterType type = getParameterType(parameterName);
|
||||
if( type != e_AudioParamType_Invalid )
|
||||
{
|
||||
@@ -169,7 +169,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
EAudioType type = static_cast<EAudioType>(pFile->dwType);
|
||||
EAudioType type = (EAudioType)pFile->dwType;
|
||||
// Params
|
||||
unsigned int uiParameterCount=*(unsigned int *)pbTemp;
|
||||
pbTemp+=sizeof(int);
|
||||
@@ -182,7 +182,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||
|
||||
if(it != parameterMapping.end() )
|
||||
{
|
||||
addParameter(type,static_cast<EAudioParameterType>(pParams->dwType),(WCHAR *)pParams->wchData);
|
||||
addParameter(type,(EAudioParameterType)pParams->dwType,(WCHAR *)pParams->wchData);
|
||||
}
|
||||
pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount);
|
||||
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
|
||||
@@ -198,7 +198,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||
return true;
|
||||
}
|
||||
|
||||
int DLCAudioFile::GetCountofType(EAudioType eType)
|
||||
int DLCAudioFile::GetCountofType(DLCAudioFile::EAudioType eType)
|
||||
{
|
||||
return m_parameters[eType].size();
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ public:
|
||||
|
||||
DLCAudioFile(const wstring &path);
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
PBYTE getData(DWORD &dwBytes) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
|
||||
bool processDLCDataFile(PBYTE pbData, DWORD dwLength);
|
||||
int GetCountofType(EAudioType ptype);
|
||||
int GetCountofType(DLCAudioFile::EAudioType ptype);
|
||||
wstring &GetSoundName(int iIndex);
|
||||
|
||||
private:
|
||||
@@ -49,6 +49,6 @@ private:
|
||||
vector<wstring> m_parameters[e_AudioType_Max];
|
||||
|
||||
// use the EAudioType to order these
|
||||
void addParameter(EAudioType type, EAudioParameterType ptype, const wstring &value);
|
||||
EAudioParameterType getParameterType(const wstring ¶mName);
|
||||
void addParameter(DLCAudioFile::EAudioType type, DLCAudioFile::EAudioParameterType ptype, const wstring &value);
|
||||
DLCAudioFile::EAudioParameterType getParameterType(const wstring ¶mName);
|
||||
};
|
||||
|
||||
@@ -6,5 +6,5 @@ class DLCCapeFile : public DLCFile
|
||||
public:
|
||||
DLCCapeFile(const wstring &path);
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
};
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
DLCColourTableFile::DLCColourTableFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path)
|
||||
{
|
||||
m_colourTable = nullptr;
|
||||
m_colourTable = NULL;
|
||||
}
|
||||
|
||||
DLCColourTableFile::~DLCColourTableFile()
|
||||
{
|
||||
if(m_colourTable != nullptr)
|
||||
if(m_colourTable != NULL)
|
||||
{
|
||||
app.DebugPrintf("Deleting DLCColourTableFile data\n");
|
||||
delete m_colourTable;
|
||||
|
||||
@@ -10,9 +10,9 @@ private:
|
||||
|
||||
public:
|
||||
DLCColourTableFile(const wstring &path);
|
||||
~DLCColourTableFile() override;
|
||||
~DLCColourTableFile();
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
|
||||
ColourTable *getColourTable() const { return m_colourTable; }
|
||||
ColourTable *getColourTable() { return m_colourTable; }
|
||||
};
|
||||
@@ -12,12 +12,12 @@ public:
|
||||
DLCFile(DLCManager::EDLCType type, const wstring &path);
|
||||
virtual ~DLCFile() {}
|
||||
|
||||
DLCManager::EDLCType getType() const { return m_type; }
|
||||
DLCManager::EDLCType getType() { return m_type; }
|
||||
wstring getPath() { return m_path; }
|
||||
DWORD getSkinID() const { return m_dwSkinId; }
|
||||
DWORD getSkinID() { return m_dwSkinId; }
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes) {}
|
||||
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return nullptr; }
|
||||
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; }
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value) {}
|
||||
|
||||
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
DLCGameRulesFile::DLCGameRulesFile(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path)
|
||||
{
|
||||
m_pbData = nullptr;
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@ private:
|
||||
public:
|
||||
DLCGameRulesFile(const wstring &path);
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
PBYTE getData(DWORD &dwBytes) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
};
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path)
|
||||
{
|
||||
m_pbData = nullptr;
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
|
||||
m_hasData = false;
|
||||
|
||||
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
|
||||
|
||||
lgo = nullptr;
|
||||
lgo = NULL;
|
||||
}
|
||||
|
||||
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
|
||||
|
||||
@@ -14,52 +14,29 @@ private:
|
||||
bool m_hasData;
|
||||
|
||||
public:
|
||||
bool requiresTexturePack() override
|
||||
{return m_bRequiresTexturePack;}
|
||||
virtual bool requiresTexturePack() {return m_bRequiresTexturePack;}
|
||||
virtual UINT getRequiredTexturePackId() {return m_requiredTexturePackId;}
|
||||
virtual wstring getDefaultSaveName() {return m_defaultSaveName;}
|
||||
virtual LPCWSTR getWorldName() {return m_worldName.c_str();}
|
||||
virtual LPCWSTR getDisplayName() {return m_displayName.c_str();}
|
||||
virtual wstring getGrfPath() {return L"GameRules.grf";}
|
||||
|
||||
UINT getRequiredTexturePackId() override
|
||||
{return m_requiredTexturePackId;}
|
||||
|
||||
wstring getDefaultSaveName() override
|
||||
{return m_defaultSaveName;}
|
||||
|
||||
LPCWSTR getWorldName() override
|
||||
{return m_worldName.c_str();}
|
||||
|
||||
LPCWSTR getDisplayName() override
|
||||
{return m_displayName.c_str();}
|
||||
|
||||
wstring getGrfPath() override
|
||||
{return L"GameRules.grf";}
|
||||
|
||||
void setRequiresTexturePack(bool x) override
|
||||
{m_bRequiresTexturePack = x;}
|
||||
|
||||
void setRequiredTexturePackId(UINT x) override
|
||||
{m_requiredTexturePackId = x;}
|
||||
|
||||
void setDefaultSaveName(const wstring &x) override
|
||||
{m_defaultSaveName = x;}
|
||||
|
||||
void setWorldName(const wstring & x) override
|
||||
{m_worldName = x;}
|
||||
|
||||
void setDisplayName(const wstring & x) override
|
||||
{m_displayName = x;}
|
||||
|
||||
void setGrfPath(const wstring & x) override
|
||||
{m_grfPath = x;}
|
||||
virtual void setRequiresTexturePack(bool x) {m_bRequiresTexturePack = x;}
|
||||
virtual void setRequiredTexturePackId(UINT x) {m_requiredTexturePackId = x;}
|
||||
virtual void setDefaultSaveName(const wstring &x) {m_defaultSaveName = x;}
|
||||
virtual void setWorldName(const wstring & x) {m_worldName = x;}
|
||||
virtual void setDisplayName(const wstring & x) {m_displayName = x;}
|
||||
virtual void setGrfPath(const wstring & x) {m_grfPath = x;}
|
||||
|
||||
LevelGenerationOptions *lgo;
|
||||
|
||||
public:
|
||||
DLCGameRulesHeader(const wstring &path);
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
PBYTE getData(DWORD &dwBytes) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
|
||||
void setGrfData(PBYTE fData, DWORD fSize, StringTable *);
|
||||
|
||||
bool ready() override
|
||||
{ return m_hasData; }
|
||||
virtual bool ready() { return m_hasData; }
|
||||
};
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
DLCLocalisationFile::DLCLocalisationFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path)
|
||||
{
|
||||
m_strings = nullptr;
|
||||
m_strings = NULL;
|
||||
}
|
||||
|
||||
void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
DLCLocalisationFile(const wstring &path);
|
||||
DLCLocalisationFile(PBYTE pbData, DWORD dwBytes); // when we load in a texture pack details file from TMS++
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
|
||||
StringTable *getStringTable() { return m_strings; }
|
||||
};
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\TexturePackRepository.h"
|
||||
#include "Common/UI/UI.h"
|
||||
|
||||
const WCHAR *DLCManager::wchTypeNamesA[]=
|
||||
{
|
||||
@@ -48,7 +47,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType(const wstring ¶mN
|
||||
{
|
||||
if(paramName.compare(wchTypeNamesA[i]) == 0)
|
||||
{
|
||||
type = static_cast<EDLCParameterType>(i);
|
||||
type = (EDLCParameterType)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +70,7 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
|
||||
}
|
||||
else
|
||||
{
|
||||
packCount = static_cast<DWORD>(m_packs.size());
|
||||
packCount = (DWORD)m_packs.size();
|
||||
}
|
||||
return packCount;
|
||||
}
|
||||
@@ -83,7 +82,7 @@ void DLCManager::addPack(DLCPack *pack)
|
||||
|
||||
void DLCManager::removePack(DLCPack *pack)
|
||||
{
|
||||
if(pack != nullptr)
|
||||
if(pack != NULL)
|
||||
{
|
||||
auto it = find(m_packs.begin(), m_packs.end(), pack);
|
||||
if(it != m_packs.end() ) m_packs.erase(it);
|
||||
@@ -113,7 +112,7 @@ void DLCManager::LanguageChanged(void)
|
||||
|
||||
DLCPack *DLCManager::getPack(const wstring &name)
|
||||
{
|
||||
DLCPack *pack = nullptr;
|
||||
DLCPack *pack = NULL;
|
||||
//DWORD currentIndex = 0;
|
||||
for( DLCPack * currentPack : m_packs )
|
||||
{
|
||||
@@ -131,7 +130,7 @@ DLCPack *DLCManager::getPack(const wstring &name)
|
||||
#ifdef _XBOX_ONE
|
||||
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
||||
{
|
||||
DLCPack *pack = nullptr;
|
||||
DLCPack *pack = NULL;
|
||||
for( DLCPack *currentPack : m_packs )
|
||||
{
|
||||
wstring wsName=currentPack->getPurchaseOfferId();
|
||||
@@ -148,7 +147,7 @@ DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
||||
|
||||
DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
|
||||
{
|
||||
DLCPack *pack = nullptr;
|
||||
DLCPack *pack = NULL;
|
||||
if( type != e_DLCType_All )
|
||||
{
|
||||
DWORD currentIndex = 0;
|
||||
@@ -182,9 +181,9 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
||||
{
|
||||
DWORD foundIndex = 0;
|
||||
found = false;
|
||||
if(pack == nullptr)
|
||||
if(pack == NULL)
|
||||
{
|
||||
app.DebugPrintf("DLCManager: Attempting to find the index for a nullptr pack\n");
|
||||
app.DebugPrintf("DLCManager: Attempting to find the index for a NULL pack\n");
|
||||
//__debugbreak();
|
||||
return foundIndex;
|
||||
}
|
||||
@@ -245,7 +244,7 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
|
||||
|
||||
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||
{
|
||||
DLCPack *foundPack = nullptr;
|
||||
DLCPack *foundPack = NULL;
|
||||
for( DLCPack *pack : m_packs )
|
||||
{
|
||||
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
||||
@@ -262,11 +261,11 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||
|
||||
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||
{
|
||||
DLCSkinFile *foundSkinfile = nullptr;
|
||||
DLCSkinFile *foundSkinfile = NULL;
|
||||
for( DLCPack *pack : m_packs )
|
||||
{
|
||||
foundSkinfile=pack->getSkinFile(path);
|
||||
if(foundSkinfile!=nullptr)
|
||||
if(foundSkinfile!=NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -277,14 +276,14 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||
{
|
||||
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
||||
DLCPack *firstCorruptPack = nullptr;
|
||||
DLCPack *firstCorruptPack = NULL;
|
||||
|
||||
for( DLCPack *pack : m_packs )
|
||||
{
|
||||
if( pack->IsCorrupt() )
|
||||
{
|
||||
++corruptDLCCount;
|
||||
if(firstCorruptPack == nullptr) firstCorruptPack = pack;
|
||||
if(firstCorruptPack == NULL) firstCorruptPack = pack;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,13 +291,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
if(corruptDLCCount == 1 && firstCorruptPack != nullptr)
|
||||
if(corruptDLCCount == 1 && firstCorruptPack != NULL)
|
||||
{
|
||||
// pass in the pack format string
|
||||
WCHAR wchFormat[132];
|
||||
swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str());
|
||||
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,wchFormat);
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,wchFormat);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -331,13 +330,13 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||
#ifdef _WINDOWS64
|
||||
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if(finalPath.size() == 0) finalPath = path;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#elif defined(_DURANGO)
|
||||
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||
if(finalPath.size() == 0) finalPath = wPath;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
@@ -348,9 +347,9 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||
@@ -373,7 +372,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||
|
||||
bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
{
|
||||
unordered_map<int, EDLCParameterType> parameterMapping;
|
||||
unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte=0;
|
||||
|
||||
// File format defined in the DLC_Creator
|
||||
@@ -392,7 +391,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
|
||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
if(pbData!=nullptr) delete [] pbData;
|
||||
if(pbData!=NULL) delete [] pbData;
|
||||
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||
return false;
|
||||
}
|
||||
@@ -404,9 +403,9 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
for(unsigned int i=0;i<uiParameterCount;i++)
|
||||
{
|
||||
// Map DLC strings to application strings, then store the DLC index mapping to application index
|
||||
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
|
||||
EDLCParameterType type = getParameterType(parameterName);
|
||||
if( type != e_DLCParamType_Invalid )
|
||||
wstring parameterName((WCHAR *)pParams->wchData);
|
||||
DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
|
||||
if( type != DLCManager::e_DLCParamType_Invalid )
|
||||
{
|
||||
parameterMapping[pParams->dwType] = type;
|
||||
}
|
||||
@@ -430,10 +429,10 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
EDLCType type = static_cast<EDLCType>(pFile->dwType);
|
||||
DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType;
|
||||
|
||||
DLCFile *dlcFile = nullptr;
|
||||
DLCPack *dlcTexturePack = nullptr;
|
||||
DLCFile *dlcFile = NULL;
|
||||
DLCPack *dlcTexturePack = NULL;
|
||||
|
||||
if(type == e_DLCType_TexturePack)
|
||||
{
|
||||
@@ -462,8 +461,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dlcFile != nullptr) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData);
|
||||
else if(dlcTexturePack != nullptr) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData);
|
||||
if(dlcFile != NULL) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData);
|
||||
else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData);
|
||||
}
|
||||
}
|
||||
pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount);
|
||||
@@ -471,28 +470,28 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
}
|
||||
//pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
||||
|
||||
if(dlcTexturePack != nullptr)
|
||||
if(dlcTexturePack != NULL)
|
||||
{
|
||||
DWORD texturePackFilesProcessed = 0;
|
||||
bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,pFile->uiFileSize,dlcTexturePack);
|
||||
pack->SetDataPointer(nullptr); // If it's a child pack, it doesn't own the data
|
||||
pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data
|
||||
if(!validPack || texturePackFilesProcessed == 0)
|
||||
{
|
||||
delete dlcTexturePack;
|
||||
dlcTexturePack = nullptr;
|
||||
dlcTexturePack = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pack->addChildPack(dlcTexturePack);
|
||||
|
||||
if(dlcTexturePack->getDLCItemsCount(e_DLCType_Texture) > 0)
|
||||
if(dlcTexturePack->getDLCItemsCount(DLCManager::e_DLCType_Texture) > 0)
|
||||
{
|
||||
Minecraft::GetInstance()->skins->addTexturePackFromDLC(dlcTexturePack, dlcTexturePack->GetPackId() );
|
||||
}
|
||||
}
|
||||
++dwFilesProcessed;
|
||||
}
|
||||
else if(dlcFile != nullptr)
|
||||
else if(dlcFile != NULL)
|
||||
{
|
||||
// Data
|
||||
dlcFile->addData(pbTemp,pFile->uiFileSize);
|
||||
@@ -500,7 +499,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
// TODO - 4J Stu Remove the need for this vSkinNames vector, or manage it differently
|
||||
switch(pFile->dwType)
|
||||
{
|
||||
case e_DLCType_Skin:
|
||||
case DLCManager::e_DLCType_Skin:
|
||||
app.vSkinNames.push_back((WCHAR *)pFile->wchFile);
|
||||
break;
|
||||
}
|
||||
@@ -515,13 +514,13 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte];
|
||||
}
|
||||
|
||||
if( pack->getDLCItemsCount(e_DLCType_GameRules) > 0
|
||||
|| pack->getDLCItemsCount(e_DLCType_GameRulesHeader) > 0)
|
||||
if( pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules) > 0
|
||||
|| pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) > 0)
|
||||
{
|
||||
app.m_gameRules.loadGameRules(pack);
|
||||
}
|
||||
|
||||
if(pack->getDLCItemsCount(e_DLCType_Audio) > 0)
|
||||
if(pack->getDLCItemsCount(DLCManager::e_DLCType_Audio) > 0)
|
||||
{
|
||||
//app.m_Audio.loadAudioDetails(pack);
|
||||
}
|
||||
@@ -538,22 +537,22 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const string &path, DLCPack *pac
|
||||
#ifdef _WINDOWS64
|
||||
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||
if(finalPath.size() == 0) finalPath = path;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#elif defined(_DURANGO)
|
||||
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||
if(finalPath.size() == 0) finalPath = wPath;
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#else
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||
@@ -580,7 +579,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
{
|
||||
DWORD packId=0;
|
||||
bool bPackIDSet=false;
|
||||
unordered_map<int, EDLCParameterType> parameterMapping;
|
||||
unordered_map<int, DLCManager::EDLCParameterType> parameterMapping;
|
||||
unsigned int uiCurrentByte=0;
|
||||
|
||||
// File format defined in the DLC_Creator
|
||||
@@ -609,9 +608,9 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
for(unsigned int i=0;i<uiParameterCount;i++)
|
||||
{
|
||||
// Map DLC strings to application strings, then store the DLC index mapping to application index
|
||||
wstring parameterName(static_cast<WCHAR *>(pParams->wchData));
|
||||
EDLCParameterType type = getParameterType(parameterName);
|
||||
if( type != e_DLCParamType_Invalid )
|
||||
wstring parameterName((WCHAR *)pParams->wchData);
|
||||
DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName);
|
||||
if( type != DLCManager::e_DLCParamType_Invalid )
|
||||
{
|
||||
parameterMapping[pParams->dwType] = type;
|
||||
}
|
||||
@@ -634,7 +633,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
|
||||
for(unsigned int i=0;i<uiFileCount;i++)
|
||||
{
|
||||
EDLCType type = static_cast<EDLCType>(pFile->dwType);
|
||||
DLCManager::EDLCType type = (DLCManager::EDLCType)pFile->dwType;
|
||||
|
||||
// Params
|
||||
uiParameterCount=*(unsigned int *)pbTemp;
|
||||
@@ -650,7 +649,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
{
|
||||
if(it->second==e_DLCParamType_PackId)
|
||||
{
|
||||
wstring wsTemp=static_cast<WCHAR *>(pParams->wchData);
|
||||
wstring wsTemp=(WCHAR *)pParams->wchData;
|
||||
std::wstringstream ss;
|
||||
// 4J Stu - numbered using decimal to make it easier for artists/people to number manually
|
||||
ss << std::dec << wsTemp.c_str();
|
||||
|
||||
@@ -24,14 +24,14 @@ DLCPack::DLCPack(const wstring &name,DWORD dwLicenseMask)
|
||||
m_isCorrupt = false;
|
||||
m_packId = 0;
|
||||
m_packVersion = 0;
|
||||
m_parentPack = nullptr;
|
||||
m_parentPack = NULL;
|
||||
m_dlcMountIndex = -1;
|
||||
#ifdef _XBOX
|
||||
m_dlcDeviceID = XCONTENTDEVICE_ANY;
|
||||
#endif
|
||||
|
||||
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
||||
m_data = nullptr;
|
||||
m_data = NULL;
|
||||
}
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
@@ -44,11 +44,11 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas
|
||||
m_isCorrupt = false;
|
||||
m_packId = 0;
|
||||
m_packVersion = 0;
|
||||
m_parentPack = nullptr;
|
||||
m_parentPack = NULL;
|
||||
m_dlcMountIndex = -1;
|
||||
|
||||
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
||||
m_data = nullptr;
|
||||
m_data = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -76,7 +76,7 @@ DLCPack::~DLCPack()
|
||||
wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str());
|
||||
#endif
|
||||
// For the same reason, don't delete data pointer for any child pack as it just points to a region within the parent pack that has already been freed
|
||||
if( m_parentPack == nullptr )
|
||||
if( m_parentPack == NULL )
|
||||
{
|
||||
delete [] m_data;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ DLCPack::~DLCPack()
|
||||
|
||||
DWORD DLCPack::GetDLCMountIndex()
|
||||
{
|
||||
if(m_parentPack != nullptr)
|
||||
if(m_parentPack != NULL)
|
||||
{
|
||||
return m_parentPack->GetDLCMountIndex();
|
||||
}
|
||||
@@ -94,7 +94,7 @@ DWORD DLCPack::GetDLCMountIndex()
|
||||
|
||||
XCONTENTDEVICEID DLCPack::GetDLCDeviceID()
|
||||
{
|
||||
if(m_parentPack != nullptr )
|
||||
if(m_parentPack != NULL )
|
||||
{
|
||||
return m_parentPack->GetDLCDeviceID();
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &va
|
||||
m_dataPath = value;
|
||||
break;
|
||||
default:
|
||||
m_parameters[static_cast<int>(type)] = value;
|
||||
m_parameters[(int)type] = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned in
|
||||
|
||||
DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
|
||||
{
|
||||
DLCFile *newFile = nullptr;
|
||||
DLCFile *newFile = NULL;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
|
||||
break;
|
||||
};
|
||||
|
||||
if( newFile != nullptr )
|
||||
if( newFile != NULL )
|
||||
{
|
||||
m_files[newFile->getType()].push_back(newFile);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
|
||||
}
|
||||
|
||||
// MGH - added this comp func, as the embedded func in find_if was confusing the PS3 compiler
|
||||
static const wstring *g_pathCmpString = nullptr;
|
||||
static const wstring *g_pathCmpString = NULL;
|
||||
static bool pathCmp(DLCFile *val)
|
||||
{
|
||||
return (g_pathCmpString->compare(val->getPath()) == 0);
|
||||
@@ -263,7 +263,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
|
||||
bool hasFile = false;
|
||||
if(type == DLCManager::e_DLCType_All)
|
||||
{
|
||||
for(DLCManager::EDLCType currentType = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
|
||||
for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1))
|
||||
{
|
||||
hasFile = doesPackContainFile(currentType,path);
|
||||
if(hasFile) break;
|
||||
@@ -284,13 +284,13 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
|
||||
|
||||
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
|
||||
{
|
||||
DLCFile *file = nullptr;
|
||||
DLCFile *file = NULL;
|
||||
if(type == DLCManager::e_DLCType_All)
|
||||
{
|
||||
for(DLCManager::EDLCType currentType = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
|
||||
for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1))
|
||||
{
|
||||
file = getFile(currentType,index);
|
||||
if(file != nullptr) break;
|
||||
if(file != NULL) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -306,13 +306,13 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
|
||||
|
||||
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
|
||||
{
|
||||
DLCFile *file = nullptr;
|
||||
DLCFile *file = NULL;
|
||||
if(type == DLCManager::e_DLCType_All)
|
||||
{
|
||||
for(DLCManager::EDLCType currentType = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
|
||||
for(DLCManager::EDLCType currentType = (DLCManager::EDLCType)0; currentType < DLCManager::e_DLCType_Max; currentType = (DLCManager::EDLCType)(currentType + 1))
|
||||
{
|
||||
file = getFile(currentType,path);
|
||||
if(file != nullptr) break;
|
||||
if(file != NULL) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -323,7 +323,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
|
||||
if(it == m_files[type].end())
|
||||
{
|
||||
// Not found
|
||||
file = nullptr;
|
||||
file = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -346,11 +346,11 @@ DWORD DLCPack::getDLCItemsCount(DLCManager::EDLCType type /*= DLCManager::e_DLCT
|
||||
case DLCManager::e_DLCType_All:
|
||||
for(int i = 0; i < DLCManager::e_DLCType_Max; ++i)
|
||||
{
|
||||
count += getDLCItemsCount(static_cast<DLCManager::EDLCType>(i));
|
||||
count += getDLCItemsCount((DLCManager::EDLCType)i);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
count = static_cast<DWORD>(m_files[(int)type].size());
|
||||
count = (DWORD)m_files[(int)type].size();
|
||||
break;
|
||||
};
|
||||
return count;
|
||||
@@ -420,12 +420,12 @@ void DLCPack::UpdateLanguage()
|
||||
{
|
||||
// find the language file
|
||||
DLCManager::e_DLCType_LocalisationData;
|
||||
DLCFile *file = nullptr;
|
||||
DLCFile *file = NULL;
|
||||
|
||||
if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0)
|
||||
{
|
||||
file = m_files[DLCManager::e_DLCType_LocalisationData][0];
|
||||
DLCLocalisationFile *localisationFile = static_cast<DLCLocalisationFile *>(getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"));
|
||||
DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc");
|
||||
StringTable *strTable = localisationFile->getStringTable();
|
||||
strTable->ReloadStringTable();
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ public:
|
||||
|
||||
DWORD getSkinCount() { return getDLCItemsCount(DLCManager::e_DLCType_Skin); }
|
||||
DWORD getSkinIndexAt(const wstring &path, bool &found) { return getFileIndexAt(DLCManager::e_DLCType_Skin, path, found); }
|
||||
DLCSkinFile *getSkinFile(const wstring &path) { return static_cast<DLCSkinFile *>(getFile(DLCManager::e_DLCType_Skin, path)); }
|
||||
DLCSkinFile *getSkinFile(DWORD index) { return static_cast<DLCSkinFile *>(getFile(DLCManager::e_DLCType_Skin, index)); }
|
||||
DLCSkinFile *getSkinFile(const wstring &path) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, path); }
|
||||
DLCSkinFile *getSkinFile(DWORD index) { return (DLCSkinFile *)getFile(DLCManager::e_DLCType_Skin, index); }
|
||||
bool doesPackContainSkin(const wstring &path) { return doesPackContainFile(DLCManager::e_DLCType_Skin, path); }
|
||||
|
||||
bool hasPurchasedFile(DLCManager::EDLCType type, const wstring &path);
|
||||
|
||||
@@ -79,7 +79,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
|
||||
{
|
||||
i++;
|
||||
}
|
||||
size_t iLast=creditValue.find_last_of(L" ", i);
|
||||
int iLast=(int)creditValue.find_last_of(L" ",i);
|
||||
switch(XGetLanguage())
|
||||
{
|
||||
case XC_LANGUAGE_JAPANESE:
|
||||
@@ -88,7 +88,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
|
||||
iLast = maximumChars;
|
||||
break;
|
||||
default:
|
||||
iLast=creditValue.find_last_of(L" ", i);
|
||||
iLast=(int)creditValue.find_last_of(L" ",i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
|
||||
|
||||
int DLCSkinFile::getAdditionalBoxesCount()
|
||||
{
|
||||
return static_cast<int>(m_AdditionalBoxes.size());
|
||||
return (int)m_AdditionalBoxes.size();
|
||||
}
|
||||
vector<SKIN_BOX *> *DLCSkinFile::getAdditionalBoxes()
|
||||
{
|
||||
|
||||
@@ -17,11 +17,11 @@ public:
|
||||
|
||||
DLCSkinFile(const wstring &path);
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value);
|
||||
|
||||
wstring getParameterAsString(DLCManager::EDLCParameterType type) override;
|
||||
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
|
||||
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type);
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
|
||||
vector<SKIN_BOX *> *getAdditionalBoxes();
|
||||
int getAdditionalBoxesCount();
|
||||
unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;}
|
||||
|
||||
@@ -7,7 +7,7 @@ DLCTextureFile::DLCTextureFile(const wstring &path) : DLCFile(DLCManager::e_DLCT
|
||||
m_bIsAnim = false;
|
||||
m_animString = L"";
|
||||
|
||||
m_pbData = nullptr;
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ private:
|
||||
public:
|
||||
DLCTextureFile(const wstring &path);
|
||||
|
||||
void addData(PBYTE pbData, DWORD dwBytes) override;
|
||||
PBYTE getData(DWORD &dwBytes) override;
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes);
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
|
||||
void addParameter(DLCManager::EDLCParameterType type, const wstring &value) override;
|
||||
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value);
|
||||
|
||||
wstring getParameterAsString(DLCManager::EDLCParameterType type) override;
|
||||
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
|
||||
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type);
|
||||
virtual bool getParameterAsBool(DLCManager::EDLCParameterType type);
|
||||
};
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
DLCUIDataFile::DLCUIDataFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path)
|
||||
{
|
||||
m_pbData = nullptr;
|
||||
m_pbData = NULL;
|
||||
m_dwBytes = 0;
|
||||
m_canDeleteData = false;
|
||||
}
|
||||
|
||||
DLCUIDataFile::~DLCUIDataFile()
|
||||
{
|
||||
if(m_canDeleteData && m_pbData != nullptr)
|
||||
if(m_canDeleteData && m_pbData != NULL)
|
||||
{
|
||||
app.DebugPrintf("Deleting DLCUIDataFile data\n");
|
||||
delete [] m_pbData;
|
||||
|
||||
@@ -10,11 +10,11 @@ private:
|
||||
|
||||
public:
|
||||
DLCUIDataFile(const wstring &path);
|
||||
~DLCUIDataFile() override;
|
||||
~DLCUIDataFile();
|
||||
|
||||
using DLCFile::addData;
|
||||
using DLCFile::addParameter;
|
||||
|
||||
virtual void addData(PBYTE pbData, DWORD dwBytes,bool canDeleteData = false);
|
||||
PBYTE getData(DWORD &dwBytes) override;
|
||||
virtual PBYTE getData(DWORD &dwBytes);
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool enchanted = false;
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
// 4J-JEV: Ripped code from enchantmenthelpers
|
||||
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
||||
@@ -58,7 +58,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
Enchantment *e = Enchantment::enchantments[m_enchantmentId];
|
||||
|
||||
if(e != nullptr && e->category->canEnchant(item->getItem()))
|
||||
if(e != NULL && e->category->canEnchant(item->getItem()))
|
||||
{
|
||||
int level = min(e->getMaxLevel(), m_enchantmentLevel);
|
||||
item->enchant(e, m_enchantmentLevel);
|
||||
|
||||
@@ -41,11 +41,11 @@ void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
|
||||
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment)
|
||||
{
|
||||
rule = new AddEnchantmentRuleDefinition();
|
||||
m_enchantments.push_back(static_cast<AddEnchantmentRuleDefinition *>(rule));
|
||||
m_enchantments.push_back((AddEnchantmentRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -97,10 +97,10 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst
|
||||
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId)
|
||||
{
|
||||
bool added = false;
|
||||
if(Item::items[m_itemId] != nullptr)
|
||||
if(Item::items[m_itemId] != NULL)
|
||||
{
|
||||
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||
shared_ptr<ItemInstance> newItem = std::make_shared<ItemInstance>(m_itemId, quantity, m_auxValue);
|
||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
||||
newItem->set4JData(m_dataTag);
|
||||
|
||||
for( auto& it : m_enchantments )
|
||||
@@ -118,7 +118,7 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
|
||||
container->setItem( slotId, newItem );
|
||||
added = true;
|
||||
}
|
||||
else if(dynamic_pointer_cast<Inventory>(container) != nullptr)
|
||||
else if(dynamic_pointer_cast<Inventory>(container) != NULL)
|
||||
{
|
||||
added = dynamic_pointer_cast<Inventory>(container)->add(newItem);
|
||||
}
|
||||
|
||||
@@ -13,20 +13,20 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOption
|
||||
{
|
||||
m_levelGenOptions = levelGenOptions;
|
||||
m_location = Vec3::newPermanent(0,0,0);
|
||||
m_locationBox = nullptr;
|
||||
m_locationBox = NULL;
|
||||
m_totalBlocksChanged = 0;
|
||||
m_totalBlocksChangedLighting = 0;
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||
m_completed = false;
|
||||
m_dimension = 0;
|
||||
m_schematic = nullptr;
|
||||
m_schematic = NULL;
|
||||
}
|
||||
|
||||
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
|
||||
{
|
||||
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
|
||||
if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||
m_schematic = nullptr;
|
||||
m_schematic = NULL;
|
||||
delete m_location;
|
||||
}
|
||||
|
||||
@@ -72,20 +72,20 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||
else if(attributeName.compare(L"x") == 0)
|
||||
{
|
||||
m_location->x = _fromString<int>(attributeValue);
|
||||
if( static_cast<int>(abs(m_location->x))%2 != 0) m_location->x -=1;
|
||||
if( ((int)abs(m_location->x))%2 != 0) m_location->x -=1;
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter x=%f\n",m_location->x);
|
||||
}
|
||||
else if(attributeName.compare(L"y") == 0)
|
||||
{
|
||||
m_location->y = _fromString<int>(attributeValue);
|
||||
if( static_cast<int>(abs(m_location->y))%2 != 0) m_location->y -= 1;
|
||||
if( ((int)abs(m_location->y))%2 != 0) m_location->y -= 1;
|
||||
if(m_location->y < 0) m_location->y = 0;
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter y=%f\n",m_location->y);
|
||||
}
|
||||
else if(attributeName.compare(L"z") == 0)
|
||||
{
|
||||
m_location->z = _fromString<int>(attributeValue);
|
||||
if(static_cast<int>(abs(m_location->z))%2 != 0) m_location->z -= 1;
|
||||
if(((int)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)
|
||||
@@ -95,7 +95,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||
while(degrees < 0) degrees += 360;
|
||||
while(degrees >= 360) degrees -= 360;
|
||||
float quad = degrees/90;
|
||||
degrees = static_cast<int>(quad + 0.5f);
|
||||
degrees = (int)(quad + 0.5f);
|
||||
switch(degrees)
|
||||
{
|
||||
case 1:
|
||||
@@ -130,7 +130,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||
|
||||
void ApplySchematicRuleDefinition::updateLocationBox()
|
||||
{
|
||||
if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
m_locationBox = AABB::newPermanent(0,0,0,0,0,0);
|
||||
|
||||
@@ -162,9 +162,9 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
||||
if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if(m_locationBox == nullptr) updateLocationBox();
|
||||
if(m_locationBox == NULL) updateLocationBox();
|
||||
if(chunkBox->intersects( m_locationBox ))
|
||||
{
|
||||
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
||||
@@ -189,7 +189,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
|
||||
{
|
||||
m_completed = true;
|
||||
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||
//m_schematic = nullptr;
|
||||
//m_schematic = NULL;
|
||||
}
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
@@ -201,9 +201,9 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
||||
if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if(m_locationBox == nullptr) updateLocationBox();
|
||||
if(m_locationBox == NULL) updateLocationBox();
|
||||
if(chunkBox->intersects( m_locationBox ))
|
||||
{
|
||||
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
||||
@@ -223,7 +223,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
||||
{
|
||||
m_completed = true;
|
||||
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||
//m_schematic = nullptr;
|
||||
//m_schematic = NULL;
|
||||
}
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
@@ -231,13 +231,13 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
||||
|
||||
bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1)
|
||||
{
|
||||
if( m_locationBox == nullptr ) updateLocationBox();
|
||||
if( m_locationBox == NULL ) updateLocationBox();
|
||||
return m_locationBox->intersects(x0,y0,z0,x1,y1,z1);
|
||||
}
|
||||
|
||||
int ApplySchematicRuleDefinition::getMinY()
|
||||
{
|
||||
if( m_locationBox == nullptr ) updateLocationBox();
|
||||
if( m_locationBox == NULL ) updateLocationBox();
|
||||
return m_locationBox->y0;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn
|
||||
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
if(item != nullptr && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||
{
|
||||
if(!getComplete(rule))
|
||||
{
|
||||
@@ -90,21 +90,13 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
|
||||
if(quantityCollected >= m_quantity)
|
||||
{
|
||||
setComplete(rule, true);
|
||||
app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId, m_auxValue, m_quantity, m_4JDataValue);
|
||||
app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId,m_auxValue,m_quantity,m_4JDataValue);
|
||||
|
||||
if (rule->getConnection() != nullptr)
|
||||
{
|
||||
rule->getConnection()->send(std::make_shared<UpdateGameRuleProgressPacket>(
|
||||
getActionType(),
|
||||
this->m_descriptionId,
|
||||
m_itemId,
|
||||
m_auxValue,
|
||||
this->m_4JDataValue,
|
||||
nullptr,
|
||||
static_cast<DWORD>(0)
|
||||
));
|
||||
}
|
||||
}
|
||||
if(rule->getConnection() != NULL)
|
||||
{
|
||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return statusChanged;
|
||||
@@ -114,7 +106,7 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
||||
wstring xml = L"";
|
||||
if(item != nullptr)
|
||||
if(item != NULL)
|
||||
{
|
||||
xml = L"<CollectItemRule itemId=\"" + std::to_wstring(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
|
||||
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\"";
|
||||
|
||||
@@ -36,7 +36,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
|
||||
}
|
||||
}
|
||||
if(rule->getConnection() != nullptr)
|
||||
if(rule->getConnection() != NULL)
|
||||
{
|
||||
PacketData data;
|
||||
data.goal = goal;
|
||||
@@ -45,20 +45,20 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||
int icon = -1;
|
||||
int auxValue = 0;
|
||||
|
||||
if(m_lastRuleStatusChanged != nullptr)
|
||||
if(m_lastRuleStatusChanged != NULL)
|
||||
{
|
||||
icon = m_lastRuleStatusChanged->getIcon();
|
||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||
m_lastRuleStatusChanged = nullptr;
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
}
|
||||
rule->getConnection()->send(std::make_shared<UpdateGameRuleProgressPacket>(getActionType(), this->m_descriptionId, icon, auxValue, 0, &data, sizeof(PacketData)));
|
||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
|
||||
}
|
||||
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
|
||||
}
|
||||
|
||||
wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &description, void *data, int dataLength)
|
||||
{
|
||||
PacketData *values = static_cast<PacketData *>(data);
|
||||
PacketData *values = (PacketData *)data;
|
||||
wstring newDesc = description;
|
||||
newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress));
|
||||
newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
CompoundGameRuleDefinition::CompoundGameRuleDefinition()
|
||||
{
|
||||
m_lastRuleStatusChanged = nullptr;
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
}
|
||||
|
||||
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
||||
@@ -26,7 +26,7 @@ void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
|
||||
|
||||
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule)
|
||||
{
|
||||
rule = new CompleteAllRuleDefinition();
|
||||
@@ -49,13 +49,13 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
|
||||
wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
||||
#endif
|
||||
}
|
||||
if(rule != nullptr) m_children.push_back(rule);
|
||||
if(rule != NULL) m_children.push_back(rule);
|
||||
return rule;
|
||||
}
|
||||
|
||||
void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
|
||||
{
|
||||
GameRule *newRule = nullptr;
|
||||
GameRule *newRule = NULL;
|
||||
int i = 0;
|
||||
for (auto& it : m_children )
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
||||
{
|
||||
m_x = m_y = m_z = 0;
|
||||
boundingBox = nullptr;
|
||||
boundingBox = NULL;
|
||||
orientation = Direction::NORTH;
|
||||
m_dimension = 0;
|
||||
}
|
||||
@@ -25,26 +25,26 @@ void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *childre
|
||||
|
||||
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox)
|
||||
{
|
||||
rule = new XboxStructureActionGenerateBox();
|
||||
m_actions.push_back(static_cast<XboxStructureActionGenerateBox *>(rule));
|
||||
m_actions.push_back((XboxStructureActionGenerateBox *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceBlock();
|
||||
m_actions.push_back(static_cast<XboxStructureActionPlaceBlock *>(rule));
|
||||
m_actions.push_back((XboxStructureActionPlaceBlock *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceContainer();
|
||||
m_actions.push_back(static_cast<XboxStructureActionPlaceContainer *>(rule));
|
||||
m_actions.push_back((XboxStructureActionPlaceContainer *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceSpawner();
|
||||
m_actions.push_back(static_cast<XboxStructureActionPlaceSpawner *>(rule));
|
||||
m_actions.push_back((XboxStructureActionPlaceSpawner *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,7 +112,7 @@ void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const
|
||||
|
||||
BoundingBox* ConsoleGenerateStructure::getBoundingBox()
|
||||
{
|
||||
if(boundingBox == nullptr)
|
||||
if(boundingBox == NULL)
|
||||
{
|
||||
// Find the max bounds
|
||||
int maxX, maxY, maxZ;
|
||||
@@ -139,25 +139,25 @@ bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, Boundin
|
||||
{
|
||||
case ConsoleGameRules::eGameRuleType_GenerateBox:
|
||||
{
|
||||
XboxStructureActionGenerateBox *genBox = static_cast<XboxStructureActionGenerateBox *>(action);
|
||||
XboxStructureActionGenerateBox *genBox = (XboxStructureActionGenerateBox *)action;
|
||||
genBox->generateBoxInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceBlock:
|
||||
{
|
||||
XboxStructureActionPlaceBlock *pPlaceBlock = static_cast<XboxStructureActionPlaceBlock *>(action);
|
||||
XboxStructureActionPlaceBlock *pPlaceBlock = (XboxStructureActionPlaceBlock *)action;
|
||||
pPlaceBlock->placeBlockInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceContainer:
|
||||
{
|
||||
XboxStructureActionPlaceContainer *pPlaceContainer = static_cast<XboxStructureActionPlaceContainer *>(action);
|
||||
XboxStructureActionPlaceContainer *pPlaceContainer = (XboxStructureActionPlaceContainer *)action;
|
||||
pPlaceContainer->placeContainerInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceSpawner:
|
||||
{
|
||||
XboxStructureActionPlaceSpawner *pPlaceSpawner = static_cast<XboxStructureActionPlaceSpawner *>(action);
|
||||
XboxStructureActionPlaceSpawner *pPlaceSpawner = (XboxStructureActionPlaceSpawner *)action;
|
||||
pPlaceSpawner->placeSpawnerInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
virtual int getMinY();
|
||||
|
||||
EStructurePiece GetType() { return static_cast<EStructurePiece>(0); }
|
||||
EStructurePiece GetType() { return (EStructurePiece)0; }
|
||||
void addAdditonalSaveData(CompoundTag *tag) {}
|
||||
void readAdditonalSaveData(CompoundTag *tag) {}
|
||||
};
|
||||
@@ -16,18 +16,18 @@ ConsoleSchematicFile::ConsoleSchematicFile()
|
||||
{
|
||||
m_xSize = m_ySize = m_zSize = 0;
|
||||
m_refCount = 1;
|
||||
m_data.data = nullptr;
|
||||
m_data.data = NULL;
|
||||
}
|
||||
|
||||
ConsoleSchematicFile::~ConsoleSchematicFile()
|
||||
{
|
||||
app.DebugPrintf("Deleting schematic file\n");
|
||||
if(m_data.data != nullptr) delete [] m_data.data;
|
||||
if(m_data.data != NULL) delete [] m_data.data;
|
||||
}
|
||||
|
||||
void ConsoleSchematicFile::save(DataOutputStream *dos)
|
||||
{
|
||||
if(dos != nullptr)
|
||||
if(dos != NULL)
|
||||
{
|
||||
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||
|
||||
@@ -52,7 +52,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
|
||||
|
||||
void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||
{
|
||||
if(dis != nullptr)
|
||||
if(dis != NULL)
|
||||
{
|
||||
// VERSION CHECK //
|
||||
int version = dis->readInt();
|
||||
@@ -61,7 +61,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||
|
||||
if (version > XBOX_SCHEMATIC_ORIGINAL_VERSION) // Or later versions
|
||||
{
|
||||
compressionType = static_cast<Compression::ECompressionTypes>(dis->readByte());
|
||||
compressionType = (Compression::ECompressionTypes)dis->readByte();
|
||||
}
|
||||
|
||||
if (version > XBOX_SCHEMATIC_CURRENT_VERSION)
|
||||
@@ -75,10 +75,10 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||
byteArray compressedBuffer(compressedSize);
|
||||
dis->readFully(compressedBuffer);
|
||||
|
||||
if(m_data.data != nullptr)
|
||||
if(m_data.data != NULL)
|
||||
{
|
||||
delete [] m_data.data;
|
||||
m_data.data = nullptr;
|
||||
delete [] m_data.data;
|
||||
m_data.data = NULL;
|
||||
}
|
||||
|
||||
if(compressionType == Compression::eCompressionType_None)
|
||||
@@ -111,17 +111,17 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||
// READ TAGS //
|
||||
CompoundTag *tag = NbtIo::read(dis);
|
||||
ListTag<CompoundTag> *tileEntityTags = (ListTag<CompoundTag> *) tag->getList(L"TileEntities");
|
||||
if (tileEntityTags != nullptr)
|
||||
if (tileEntityTags != NULL)
|
||||
{
|
||||
for (int i = 0; i < tileEntityTags->size(); i++)
|
||||
{
|
||||
CompoundTag *teTag = tileEntityTags->get(i);
|
||||
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
||||
|
||||
if(te == nullptr)
|
||||
if(te == NULL)
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
app.DebugPrintf("ConsoleSchematicFile has read a nullptr tile entity\n");
|
||||
app.DebugPrintf("ConsoleSchematicFile has read a NULL tile entity\n");
|
||||
__debugbreak();
|
||||
#endif
|
||||
}
|
||||
@@ -132,7 +132,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||
}
|
||||
}
|
||||
ListTag<CompoundTag> *entityTags = (ListTag<CompoundTag> *) tag->getList(L"Entities");
|
||||
if (entityTags != nullptr)
|
||||
if (entityTags != NULL)
|
||||
{
|
||||
for (int i = 0; i < entityTags->size(); i++)
|
||||
{
|
||||
@@ -145,15 +145,15 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||
double z = pos->get(2)->data;
|
||||
|
||||
if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME )
|
||||
{
|
||||
x = static_cast<IntTag *>(eTag->get(L"TileX"))->data;
|
||||
y = static_cast<IntTag *>(eTag->get(L"TileY"))->data;
|
||||
z = static_cast<IntTag *>(eTag->get(L"TileZ"))->data;
|
||||
}
|
||||
{
|
||||
x = ((IntTag *) eTag->get(L"TileX") )->data;
|
||||
y = ((IntTag *) eTag->get(L"TileY") )->data;
|
||||
z = ((IntTag *) eTag->get(L"TileZ") )->data;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
//app.DebugPrintf(1,"Loaded entity type %d at (%f,%f,%f)\n",(int)type,x,y,z);
|
||||
#endif
|
||||
m_entities.push_back( pair<Vec3 *, CompoundTag *>(Vec3::newPermanent(x,y,z),static_cast<CompoundTag *>(eTag->copy())));
|
||||
m_entities.push_back( pair<Vec3 *, CompoundTag *>(Vec3::newPermanent(x,y,z),(CompoundTag *)eTag->copy()));
|
||||
}
|
||||
}
|
||||
delete tag;
|
||||
@@ -178,7 +178,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
||||
tag->put(L"Entities", entityTags);
|
||||
|
||||
for (auto& it : m_entities )
|
||||
entityTags->add( static_cast<CompoundTag *>((it).second->copy()) );
|
||||
entityTags->add( (CompoundTag *)(it).second->copy() );
|
||||
|
||||
NbtIo::write(tag,dos);
|
||||
delete tag;
|
||||
@@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
||||
|
||||
int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
{
|
||||
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, static_cast<double>(chunk->x)*16));
|
||||
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, static_cast<double>((xStart >> 4) << 4) + 16));
|
||||
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
|
||||
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
|
||||
|
||||
int yStart = destinationBox->y0;
|
||||
int yEnd = destinationBox->y1;
|
||||
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
|
||||
|
||||
int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, static_cast<double>(chunk->z) * 16));
|
||||
int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, static_cast<double>((zStart >> 4) << 4) + 16));
|
||||
int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, (double)chunk->z * 16));
|
||||
int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, (double)((zStart >> 4) << 4) + 16));
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1);
|
||||
@@ -442,10 +442,10 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
||||
Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ);
|
||||
if( chunkBox->containsIncludingLowerBound(pos) )
|
||||
{
|
||||
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( static_cast<int>(targetX) & 15, static_cast<int>(targetY) & 15, static_cast<int>(targetZ) & 15 );
|
||||
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
|
||||
|
||||
if ( teCopy != nullptr )
|
||||
{
|
||||
if ( teCopy != NULL )
|
||||
{
|
||||
CompoundTag *teData = new CompoundTag();
|
||||
te->save(teData);
|
||||
|
||||
@@ -493,7 +493,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
||||
}
|
||||
|
||||
CompoundTag *eTag = it->second;
|
||||
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, nullptr);
|
||||
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
|
||||
|
||||
if( e->GetType() == eTYPE_PAINTING )
|
||||
{
|
||||
@@ -582,18 +582,18 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||
|
||||
app.DebugPrintf("Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), %dx%dx%d\n",xStart,yStart,zStart,xEnd,yEnd,zEnd,xSize,ySize,zSize);
|
||||
|
||||
if(dos != nullptr) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||
if(dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||
|
||||
if(dos != nullptr) dos->writeByte(compressionType);
|
||||
if(dos != NULL) dos->writeByte(compressionType);
|
||||
|
||||
//Write xSize
|
||||
if(dos != nullptr) dos->writeInt(xSize);
|
||||
if(dos != NULL) dos->writeInt(xSize);
|
||||
|
||||
//Write ySize
|
||||
if(dos != nullptr) dos->writeInt(ySize);
|
||||
if(dos != NULL) dos->writeInt(ySize);
|
||||
|
||||
//Write zSize
|
||||
if(dos != nullptr) dos->writeInt(zSize);
|
||||
if(dos != NULL) dos->writeInt(zSize);
|
||||
|
||||
//byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, xSize, ySize, zSize, false);
|
||||
int xRowSize = ySize * zSize;
|
||||
@@ -660,8 +660,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||
delete [] result.data;
|
||||
byteArray buffer = byteArray(ucTemp,inputSize);
|
||||
|
||||
if(dos != nullptr) dos->writeInt(inputSize);
|
||||
if(dos != nullptr) dos->write(buffer);
|
||||
if(dos != NULL) dos->writeInt(inputSize);
|
||||
if(dos != NULL) dos->write(buffer);
|
||||
delete [] buffer.data;
|
||||
|
||||
CompoundTag tag;
|
||||
@@ -725,10 +725,10 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||
pos->get(2)->data -= zStart;
|
||||
|
||||
if( e->instanceof(eTYPE_HANGING_ENTITY) )
|
||||
{
|
||||
static_cast<IntTag *>(eTag->get(L"TileX"))->data -= xStart;
|
||||
static_cast<IntTag *>(eTag->get(L"TileY"))->data -= yStart;
|
||||
static_cast<IntTag *>(eTag->get(L"TileZ"))->data -= zStart;
|
||||
{
|
||||
((IntTag *) eTag->get(L"TileX") )->data -= xStart;
|
||||
((IntTag *) eTag->get(L"TileY") )->data -= yStart;
|
||||
((IntTag *) eTag->get(L"TileZ") )->data -= zStart;
|
||||
}
|
||||
|
||||
entitiesTag->add(eTag);
|
||||
@@ -738,7 +738,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||
|
||||
tag.put(L"Entities", entitiesTag);
|
||||
|
||||
if(dos != nullptr) NbtIo::write(&tag,dos);
|
||||
if(dos != NULL) NbtIo::write(&tag,dos);
|
||||
}
|
||||
|
||||
void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP)
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
stringValueMapType m_parameters; // These are the members of this rule that maintain it's state
|
||||
|
||||
public:
|
||||
GameRule(GameRuleDefinition *definition, Connection *connection = nullptr);
|
||||
GameRule(GameRuleDefinition *definition, Connection *connection = NULL);
|
||||
virtual ~GameRule();
|
||||
|
||||
Connection *getConnection() { return m_connection; }
|
||||
|
||||
@@ -50,7 +50,7 @@ GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
||||
#endif
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
|
||||
@@ -61,6 +61,6 @@ public:
|
||||
|
||||
// Static functions
|
||||
static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection);
|
||||
static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = nullptr, int dataLength = 0);
|
||||
static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0);
|
||||
|
||||
};
|
||||
@@ -85,24 +85,24 @@ const WCHAR *GameRuleManager::wchAttrNameA[] =
|
||||
|
||||
GameRuleManager::GameRuleManager()
|
||||
{
|
||||
m_currentGameRuleDefinitions = nullptr;
|
||||
m_currentLevelGenerationOptions = nullptr;
|
||||
m_currentGameRuleDefinitions = NULL;
|
||||
m_currentLevelGenerationOptions = NULL;
|
||||
}
|
||||
|
||||
void GameRuleManager::loadGameRules(DLCPack *pack)
|
||||
{
|
||||
StringTable *strings = nullptr;
|
||||
StringTable *strings = NULL;
|
||||
|
||||
if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc"))
|
||||
{
|
||||
DLCLocalisationFile *localisationFile = static_cast<DLCLocalisationFile *>(pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"));
|
||||
DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc");
|
||||
strings = localisationFile->getStringTable();
|
||||
}
|
||||
|
||||
int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader);
|
||||
for(int i = 0; i < gameRulesCount; ++i)
|
||||
{
|
||||
DLCGameRulesHeader *dlcHeader = static_cast<DLCGameRulesHeader *>(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
|
||||
DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
|
||||
DWORD dSize;
|
||||
byte *dData = dlcHeader->getData(dSize);
|
||||
|
||||
@@ -120,7 +120,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
||||
gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules);
|
||||
for (int i = 0; i < gameRulesCount; ++i)
|
||||
{
|
||||
DLCGameRulesFile *dlcFile = static_cast<DLCGameRulesFile *>(pack->getFile(DLCManager::e_DLCType_GameRules, i));
|
||||
DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i);
|
||||
|
||||
DWORD dSize;
|
||||
byte *dData = dlcFile->getData(dSize);
|
||||
@@ -182,7 +182,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
compr_content(new BYTE[compr_len], compr_len);
|
||||
dis.read(compr_content);
|
||||
|
||||
Compression::getCompression()->SetDecompressionType( static_cast<Compression::ECompressionTypes>(compression_type) );
|
||||
Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type );
|
||||
Compression::getCompression()->DecompressLZXRLE( content.data, &content.length,
|
||||
compr_content.data, compr_content.length);
|
||||
Compression::getCompression()->SetDecompressionType( SAVE_FILE_PLATFORM_LOCAL );
|
||||
@@ -237,11 +237,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
// 4J-JEV: Reverse of loadGameRules.
|
||||
void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
{
|
||||
if (m_currentGameRuleDefinitions == nullptr &&
|
||||
m_currentLevelGenerationOptions == nullptr)
|
||||
if (m_currentGameRuleDefinitions == NULL &&
|
||||
m_currentLevelGenerationOptions == NULL)
|
||||
{
|
||||
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
|
||||
*dOut = nullptr;
|
||||
*dOut = NULL;
|
||||
*dSize = 0;
|
||||
return;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
ByteArrayOutputStream compr_baos;
|
||||
DataOutputStream compr_dos(&compr_baos);
|
||||
|
||||
if (m_currentGameRuleDefinitions == nullptr)
|
||||
if (m_currentGameRuleDefinitions == NULL)
|
||||
{
|
||||
compr_dos.writeInt( 0 ); // numStrings for StringTable
|
||||
compr_dos.writeInt( version_number );
|
||||
@@ -282,9 +282,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
{
|
||||
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
||||
|
||||
if (st == nullptr)
|
||||
if (st == NULL)
|
||||
{
|
||||
app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == nullptr!");
|
||||
app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
*dSize = baos.buf.length;
|
||||
*dOut = baos.buf.data;
|
||||
|
||||
baos.buf.data = nullptr;
|
||||
baos.buf.data = NULL;
|
||||
|
||||
dos.close(); baos.close();
|
||||
}
|
||||
@@ -399,8 +399,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
for(int i = 0; i < 8; ++i) dis.readBoolean();
|
||||
}
|
||||
|
||||
ByteArrayInputStream *contentBais = nullptr;
|
||||
DataInputStream *contentDis = nullptr;
|
||||
ByteArrayInputStream *contentBais = NULL;
|
||||
DataInputStream *contentDis = NULL;
|
||||
|
||||
if(compressionType == Compression::eCompressionType_None)
|
||||
{
|
||||
@@ -469,13 +469,13 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
tagsAndAtts.push_back( contentDis->readUTF() );
|
||||
|
||||
unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap;
|
||||
for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < static_cast<int>(ConsoleGameRules::eGameRuleType_Count); ++type)
|
||||
for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type)
|
||||
{
|
||||
for(UINT i = 0; i < numStrings; ++i)
|
||||
{
|
||||
if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0)
|
||||
{
|
||||
tagIdMap.insert( unordered_map<int, ConsoleGameRules::EGameRuleType>::value_type(i, static_cast<ConsoleGameRules::EGameRuleType>(type)) );
|
||||
tagIdMap.insert( unordered_map<int, ConsoleGameRules::EGameRuleType>::value_type(i, (ConsoleGameRules::EGameRuleType)type) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -521,7 +521,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
auto it = tagIdMap.find(tagId);
|
||||
if(it != tagIdMap.end()) tagVal = it->second;
|
||||
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
|
||||
if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions)
|
||||
{
|
||||
@@ -548,14 +548,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
{
|
||||
// Not default
|
||||
contentDis->close();
|
||||
if(contentBais != nullptr) delete contentBais;
|
||||
if(contentBais != NULL) delete contentBais;
|
||||
delete contentDis;
|
||||
}
|
||||
|
||||
dis.close();
|
||||
bais.reset();
|
||||
|
||||
//if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; }
|
||||
//if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; }
|
||||
if(!gameRulesAdded) delete gameRules;
|
||||
|
||||
return true;
|
||||
@@ -583,7 +583,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, vector<wstring> *tags
|
||||
int attID = dis->readInt();
|
||||
wstring value = dis->readUTF();
|
||||
|
||||
if(rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID),value);
|
||||
if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,8 +597,8 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
|
||||
auto it = tagIdMap->find(tagId);
|
||||
if(it != tagIdMap->end()) tagVal = it->second;
|
||||
|
||||
GameRuleDefinition *childRule = nullptr;
|
||||
if(rule != nullptr) childRule = rule->addChild(tagVal);
|
||||
GameRuleDefinition *childRule = NULL;
|
||||
if(rule != NULL) childRule = rule->addChild(tagVal);
|
||||
|
||||
readAttributes(dis,tagsAndAtts,childRule);
|
||||
readChildren(dis,tagsAndAtts,tagIdMap,childRule);
|
||||
@@ -607,7 +607,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
|
||||
|
||||
void GameRuleManager::processSchematics(LevelChunk *levelChunk)
|
||||
{
|
||||
if(getLevelGenerationOptions() != nullptr)
|
||||
if(getLevelGenerationOptions() != NULL)
|
||||
{
|
||||
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
||||
levelGenOptions->processSchematics(levelChunk);
|
||||
@@ -616,7 +616,7 @@ void GameRuleManager::processSchematics(LevelChunk *levelChunk)
|
||||
|
||||
void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk)
|
||||
{
|
||||
if(getLevelGenerationOptions() != nullptr)
|
||||
if(getLevelGenerationOptions() != NULL)
|
||||
{
|
||||
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
||||
levelGenOptions->processSchematicsLighting(levelChunk);
|
||||
@@ -701,21 +701,21 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen
|
||||
{
|
||||
unloadCurrentGameRules();
|
||||
|
||||
m_currentGameRuleDefinitions = nullptr;
|
||||
m_currentGameRuleDefinitions = NULL;
|
||||
m_currentLevelGenerationOptions = levelGen;
|
||||
|
||||
if(m_currentLevelGenerationOptions != nullptr && m_currentLevelGenerationOptions->requiresGameRules() )
|
||||
if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() )
|
||||
{
|
||||
m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules();
|
||||
}
|
||||
|
||||
if(m_currentLevelGenerationOptions != nullptr)
|
||||
if(m_currentLevelGenerationOptions != NULL)
|
||||
m_currentLevelGenerationOptions->reset_start();
|
||||
}
|
||||
|
||||
LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
||||
{
|
||||
if(m_currentGameRuleDefinitions != nullptr && !key.empty() )
|
||||
if(m_currentGameRuleDefinitions != NULL && !key.empty() )
|
||||
{
|
||||
return m_currentGameRuleDefinitions->getString(key);
|
||||
}
|
||||
@@ -739,9 +739,9 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *
|
||||
|
||||
void GameRuleManager::unloadCurrentGameRules()
|
||||
{
|
||||
if (m_currentLevelGenerationOptions != nullptr)
|
||||
if (m_currentLevelGenerationOptions != NULL)
|
||||
{
|
||||
if (m_currentGameRuleDefinitions != nullptr
|
||||
if (m_currentGameRuleDefinitions != NULL
|
||||
&& m_currentLevelGenerationOptions->isFromSave())
|
||||
m_levelRules.removeLevelRule( m_currentGameRuleDefinitions );
|
||||
|
||||
@@ -757,6 +757,6 @@ void GameRuleManager::unloadCurrentGameRules()
|
||||
}
|
||||
}
|
||||
|
||||
m_currentGameRuleDefinitions = nullptr;
|
||||
m_currentLevelGenerationOptions = nullptr;
|
||||
m_currentGameRuleDefinitions = NULL;
|
||||
m_currentLevelGenerationOptions = NULL;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ bool JustGrSource::ready() { return true; }
|
||||
|
||||
LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||
{
|
||||
m_spawnPos = nullptr;
|
||||
m_stringTable = nullptr;
|
||||
m_spawnPos = NULL;
|
||||
m_stringTable = NULL;
|
||||
|
||||
m_hasLoadedData = false;
|
||||
|
||||
@@ -56,7 +56,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||
m_minY = INT_MAX;
|
||||
m_bRequiresGameRules = false;
|
||||
|
||||
m_pbBaseSaveData = nullptr;
|
||||
m_pbBaseSaveData = NULL;
|
||||
m_dwBaseSaveSize = 0;
|
||||
|
||||
m_parentDLCPack = parentPack;
|
||||
@@ -66,7 +66,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||
LevelGenerationOptions::~LevelGenerationOptions()
|
||||
{
|
||||
clearSchematics();
|
||||
if(m_spawnPos != nullptr) delete m_spawnPos;
|
||||
if(m_spawnPos != NULL) delete m_spawnPos;
|
||||
for (auto& it : m_schematicRules )
|
||||
{
|
||||
delete it;
|
||||
@@ -141,26 +141,26 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
||||
|
||||
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic)
|
||||
{
|
||||
rule = new ApplySchematicRuleDefinition(this);
|
||||
m_schematicRules.push_back(static_cast<ApplySchematicRuleDefinition *>(rule));
|
||||
m_schematicRules.push_back((ApplySchematicRuleDefinition *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_GenerateStructure)
|
||||
{
|
||||
rule = new ConsoleGenerateStructure();
|
||||
m_structureRules.push_back(static_cast<ConsoleGenerateStructure *>(rule));
|
||||
m_structureRules.push_back((ConsoleGenerateStructure *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_BiomeOverride)
|
||||
{
|
||||
rule = new BiomeOverride();
|
||||
m_biomeOverrides.push_back(static_cast<BiomeOverride *>(rule));
|
||||
m_biomeOverrides.push_back((BiomeOverride *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_StartFeature)
|
||||
{
|
||||
rule = new StartFeature();
|
||||
m_features.push_back(static_cast<StartFeature *>(rule));
|
||||
m_features.push_back((StartFeature *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -180,21 +180,21 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
||||
}
|
||||
else if(attributeName.compare(L"spawnX") == 0)
|
||||
{
|
||||
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_spawnPos->x = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",value);
|
||||
}
|
||||
else if(attributeName.compare(L"spawnY") == 0)
|
||||
{
|
||||
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_spawnPos->y = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",value);
|
||||
}
|
||||
else if(attributeName.compare(L"spawnZ") == 0)
|
||||
{
|
||||
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_spawnPos->z = value;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",value);
|
||||
@@ -268,7 +268,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk)
|
||||
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
|
||||
{
|
||||
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
|
||||
structureStart->postProcess(chunk->level, nullptr, bb);
|
||||
structureStart->postProcess(chunk->level, NULL, bb);
|
||||
delete bb;
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f
|
||||
return it->second;
|
||||
}
|
||||
|
||||
ConsoleSchematicFile *schematic = nullptr;
|
||||
ConsoleSchematicFile *schematic = NULL;
|
||||
byteArray data(pbData,dwLen);
|
||||
ByteArrayInputStream bais(data);
|
||||
DataInputStream dis(&bais);
|
||||
@@ -366,7 +366,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f
|
||||
|
||||
ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &filename)
|
||||
{
|
||||
ConsoleSchematicFile *schematic = nullptr;
|
||||
ConsoleSchematicFile *schematic = NULL;
|
||||
// If we have already loaded this, just return
|
||||
auto it = m_schematics.find(filename);
|
||||
if(it != m_schematics.end())
|
||||
@@ -399,7 +399,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table)
|
||||
|
||||
LPCWSTR LevelGenerationOptions::getString(const wstring &key)
|
||||
{
|
||||
if(m_stringTable == nullptr)
|
||||
if(m_stringTable == NULL)
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
@@ -456,7 +456,7 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
|
||||
void LevelGenerationOptions::loadBaseSaveData()
|
||||
{
|
||||
int mountIndex = -1;
|
||||
if(m_parentDLCPack != nullptr) mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
||||
if(m_parentDLCPack != NULL) mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
||||
|
||||
if(mountIndex > -1)
|
||||
{
|
||||
@@ -485,7 +485,7 @@ void LevelGenerationOptions::loadBaseSaveData()
|
||||
|
||||
int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask)
|
||||
{
|
||||
LevelGenerationOptions *lgo = static_cast<LevelGenerationOptions *>(pParam);
|
||||
LevelGenerationOptions *lgo = (LevelGenerationOptions *)pParam;
|
||||
lgo->m_bLoadingData = false;
|
||||
if(dwErr!=ERROR_SUCCESS)
|
||||
{
|
||||
@@ -499,7 +499,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
int gameRulesCount = lgo->m_parentDLCPack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader);
|
||||
for(int i = 0; i < gameRulesCount; ++i)
|
||||
{
|
||||
DLCGameRulesHeader *dlcFile = static_cast<DLCGameRulesHeader *>(lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
|
||||
DLCGameRulesHeader *dlcFile = (DLCGameRulesHeader *) lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
|
||||
|
||||
if (!dlcFile->getGrfPath().empty())
|
||||
{
|
||||
@@ -513,10 +513,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
pchFilename, // file name
|
||||
GENERIC_READ, // access mode
|
||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||
nullptr, // Unused
|
||||
NULL, // Unused
|
||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||
nullptr // Unsupported
|
||||
NULL // Unsupported
|
||||
);
|
||||
#else
|
||||
const char *pchFilename=wstringtofilename(grf.getPath());
|
||||
@@ -524,10 +524,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
pchFilename, // file name
|
||||
GENERIC_READ, // access mode
|
||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||
nullptr, // Unused
|
||||
NULL, // Unused
|
||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||
nullptr // Unsupported
|
||||
NULL // Unsupported
|
||||
);
|
||||
#endif
|
||||
|
||||
@@ -536,7 +536,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
DWORD dwFileSize = grf.length();
|
||||
DWORD bytesRead;
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
app.FatalLoadError();
|
||||
@@ -565,10 +565,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
pchFilename, // file name
|
||||
GENERIC_READ, // access mode
|
||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||
nullptr, // Unused
|
||||
NULL, // Unused
|
||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||
nullptr // Unsupported
|
||||
NULL // Unsupported
|
||||
);
|
||||
#else
|
||||
const char *pchFilename=wstringtofilename(save.getPath());
|
||||
@@ -576,18 +576,18 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
pchFilename, // file name
|
||||
GENERIC_READ, // access mode
|
||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||
nullptr, // Unused
|
||||
NULL, // Unused
|
||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||
nullptr // Unsupported
|
||||
NULL // Unsupported
|
||||
);
|
||||
#endif
|
||||
|
||||
if( fileHandle != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
app.FatalLoadError();
|
||||
@@ -624,8 +624,8 @@ void LevelGenerationOptions::reset_start()
|
||||
|
||||
void LevelGenerationOptions::reset_finish()
|
||||
{
|
||||
//if (m_spawnPos) { delete m_spawnPos; m_spawnPos = nullptr; }
|
||||
//if (m_stringTable) { delete m_stringTable; m_stringTable = nullptr; }
|
||||
//if (m_spawnPos) { delete m_spawnPos; m_spawnPos = NULL; }
|
||||
//if (m_stringTable) { delete m_stringTable; m_stringTable = NULL; }
|
||||
|
||||
if (isFromDLC())
|
||||
{
|
||||
@@ -694,8 +694,8 @@ bool LevelGenerationOptions::ready() { return info()->ready(); }
|
||||
|
||||
void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; }
|
||||
PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; }
|
||||
bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != nullptr; }
|
||||
void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = nullptr; m_dwBaseSaveSize = 0; }
|
||||
bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; }
|
||||
void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; }
|
||||
|
||||
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
|
||||
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
|
||||
|
||||
@@ -167,7 +167,7 @@ private:
|
||||
bool m_bLoadingData;
|
||||
|
||||
public:
|
||||
LevelGenerationOptions(DLCPack *parentPack = nullptr);
|
||||
LevelGenerationOptions(DLCPack *parentPack = NULL);
|
||||
~LevelGenerationOptions();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType();
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
LevelRuleset *getRequiredGameRules();
|
||||
|
||||
void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile);
|
||||
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = nullptr);
|
||||
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = NULL);
|
||||
|
||||
void loadStringTable(StringTable *table);
|
||||
LPCWSTR getString(const wstring &key);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
LevelRuleset::LevelRuleset()
|
||||
{
|
||||
m_stringTable = nullptr;
|
||||
m_stringTable = NULL;
|
||||
}
|
||||
|
||||
LevelRuleset::~LevelRuleset()
|
||||
@@ -26,11 +26,11 @@ void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
|
||||
|
||||
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea)
|
||||
{
|
||||
rule = new NamedAreaRuleDefinition();
|
||||
m_areas.push_back(static_cast<NamedAreaRuleDefinition *>(rule));
|
||||
m_areas.push_back((NamedAreaRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -46,7 +46,7 @@ void LevelRuleset::loadStringTable(StringTable *table)
|
||||
|
||||
LPCWSTR LevelRuleset::getString(const wstring &key)
|
||||
{
|
||||
if(m_stringTable == nullptr)
|
||||
if(m_stringTable == NULL)
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att
|
||||
else if(attributeName.compare(L"feature") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_feature = static_cast<StructureFeature::EFeatureTypes>(value);
|
||||
m_feature = (StructureFeature::EFeatureTypes)value;
|
||||
app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",m_feature);
|
||||
}
|
||||
else
|
||||
@@ -58,6 +58,6 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att
|
||||
|
||||
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation)
|
||||
{
|
||||
if(orientation != nullptr) *orientation = m_orientation;
|
||||
if(orientation != NULL) *orientation = m_orientation;
|
||||
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
|
||||
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
||||
m_health = 0;
|
||||
m_food = 0;
|
||||
m_spawnPos = nullptr;
|
||||
m_spawnPos = NULL;
|
||||
m_yRot = 0.0f;
|
||||
}
|
||||
|
||||
@@ -65,11 +65,11 @@ void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
|
||||
|
||||
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
||||
{
|
||||
rule = new AddItemRuleDefinition();
|
||||
m_items.push_back(static_cast<AddItemRuleDefinition *>(rule));
|
||||
m_items.push_back((AddItemRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -84,21 +84,21 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons
|
||||
{
|
||||
if(attributeName.compare(L"spawnX") == 0)
|
||||
{
|
||||
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_spawnPos->x = value;
|
||||
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value);
|
||||
}
|
||||
else if(attributeName.compare(L"spawnY") == 0)
|
||||
{
|
||||
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_spawnPos->y = value;
|
||||
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value);
|
||||
}
|
||||
else if(attributeName.compare(L"spawnZ") == 0)
|
||||
{
|
||||
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_spawnPos->z = value;
|
||||
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",value);
|
||||
@@ -148,7 +148,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
double z = player->z;
|
||||
float yRot = player->yRot;
|
||||
float xRot = player->xRot;
|
||||
if(m_spawnPos != nullptr)
|
||||
if(m_spawnPos != NULL)
|
||||
{
|
||||
x = m_spawnPos->x;
|
||||
y = m_spawnPos->y;
|
||||
@@ -160,7 +160,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
yRot = m_yRot;
|
||||
}
|
||||
|
||||
if(m_spawnPos != nullptr || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
||||
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
||||
|
||||
for(auto& addItem : m_items)
|
||||
{
|
||||
|
||||
@@ -33,11 +33,11 @@ void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *>
|
||||
|
||||
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
||||
{
|
||||
rule = new AddItemRuleDefinition();
|
||||
m_items.push_back(static_cast<AddItemRuleDefinition *>(rule));
|
||||
m_items.push_back((AddItemRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -70,7 +70,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
||||
|
||||
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
||||
{
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
|
||||
{
|
||||
// Remove the current tile entity
|
||||
level->removeTileEntity( worldX, worldY, worldZ );
|
||||
@@ -81,7 +81,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
||||
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||
|
||||
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
||||
if ( container != nullptr )
|
||||
if ( container != NULL )
|
||||
{
|
||||
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
|
||||
// Add items
|
||||
|
||||
@@ -46,7 +46,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
|
||||
|
||||
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
||||
{
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
|
||||
{
|
||||
// Remove the current tile entity
|
||||
level->removeTileEntity( worldX, worldY, worldZ );
|
||||
@@ -59,7 +59,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
|
||||
#endif
|
||||
if( entity != nullptr )
|
||||
if( entity != NULL )
|
||||
{
|
||||
entity->setEntityId(m_entityId);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ LeaderboardInterface::LeaderboardInterface(LeaderboardManager *man)
|
||||
m_manager = man;
|
||||
m_pending = false;
|
||||
|
||||
m_filter = static_cast<LeaderboardManager::EFilterMode>(-1);
|
||||
m_callback = nullptr;
|
||||
m_filter = (LeaderboardManager::EFilterMode) -1;
|
||||
m_callback = NULL;
|
||||
m_difficulty = 0;
|
||||
m_type = LeaderboardManager::eStatsType_UNDEFINED;
|
||||
m_startIndex = 0;
|
||||
|
||||
@@ -12,7 +12,7 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] =
|
||||
void LeaderboardManager::DeleteInstance()
|
||||
{
|
||||
delete m_instance;
|
||||
m_instance = nullptr;
|
||||
m_instance = NULL;
|
||||
}
|
||||
|
||||
LeaderboardManager::LeaderboardManager()
|
||||
@@ -26,7 +26,7 @@ void LeaderboardManager::zeroReadParameters()
|
||||
{
|
||||
m_difficulty = -1;
|
||||
m_statsType = eStatsType_UNDEFINED;
|
||||
m_readListener = nullptr;
|
||||
m_readListener = NULL;
|
||||
m_startIndex = 0;
|
||||
m_readCount = 0;
|
||||
m_eFilterMode = eFM_UNDEFINED;
|
||||
|
||||
@@ -35,7 +35,7 @@ SonyLeaderboardManager::SonyLeaderboardManager()
|
||||
|
||||
m_myXUID = INVALID_XUID;
|
||||
|
||||
m_scores = nullptr;
|
||||
m_scores = NULL;
|
||||
|
||||
m_statsType = eStatsType_Kills;
|
||||
m_difficulty = 0;
|
||||
@@ -47,7 +47,7 @@ SonyLeaderboardManager::SonyLeaderboardManager()
|
||||
InitializeCriticalSection(&m_csViewsLock);
|
||||
|
||||
m_running = false;
|
||||
m_threadScoreboard = nullptr;
|
||||
m_threadScoreboard = NULL;
|
||||
}
|
||||
|
||||
SonyLeaderboardManager::~SonyLeaderboardManager()
|
||||
@@ -288,7 +288,7 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||
SonyRtcTick last_sort_date;
|
||||
SceNpScoreRankNumber mTotalRecord;
|
||||
|
||||
SceNpId *npIds = nullptr;
|
||||
SceNpId *npIds = NULL;
|
||||
|
||||
int ret;
|
||||
uint32_t num = 0;
|
||||
@@ -322,7 +322,7 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||
ZeroMemory(comments, sizeof(SceNpScoreComment) * num);
|
||||
|
||||
/* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\
|
||||
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n",
|
||||
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n",
|
||||
transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId),
|
||||
rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount
|
||||
); */
|
||||
@@ -342,9 +342,9 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||
|
||||
destroyTransactionContext(ret);
|
||||
|
||||
if (npIds != nullptr) delete [] npIds;
|
||||
if (ptr != nullptr) delete [] ptr;
|
||||
if (comments != nullptr) delete [] comments;
|
||||
if (npIds != NULL) delete [] npIds;
|
||||
if (ptr != NULL) delete [] ptr;
|
||||
if (comments != NULL) delete [] comments;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -355,9 +355,9 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||
|
||||
m_eStatsState = eStatsState_Failed;
|
||||
|
||||
if (npIds != nullptr) delete [] npIds;
|
||||
if (ptr != nullptr) delete [] ptr;
|
||||
if (comments != nullptr) delete [] comments;
|
||||
if (npIds != NULL) delete [] npIds;
|
||||
if (ptr != NULL) delete [] ptr;
|
||||
if (comments != NULL) delete [] comments;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -387,14 +387,14 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||
comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments
|
||||
#endif
|
||||
|
||||
nullptr, 0, // GameData. (unused)
|
||||
NULL, 0, // GameData. (unused)
|
||||
|
||||
tmpNum,
|
||||
|
||||
&last_sort_date,
|
||||
&mTotalRecord,
|
||||
|
||||
nullptr // Reserved, specify null.
|
||||
NULL // Reserved, specify null.
|
||||
);
|
||||
|
||||
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
|
||||
@@ -425,7 +425,7 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||
m_readCount = num;
|
||||
|
||||
// Filter scorers and construct output structure.
|
||||
if (m_scores != nullptr) delete [] m_scores;
|
||||
if (m_scores != NULL) delete [] m_scores;
|
||||
m_scores = new ReadScore[m_readCount];
|
||||
convertToOutput(m_readCount, m_scores, ptr, comments);
|
||||
m_maxRank = m_readCount;
|
||||
@@ -458,7 +458,7 @@ error3:
|
||||
delete [] ptr;
|
||||
delete [] comments;
|
||||
error2:
|
||||
if (npIds != nullptr) delete [] npIds;
|
||||
if (npIds != NULL) delete [] npIds;
|
||||
error1:
|
||||
if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
|
||||
app.DebugPrintf("[SonyLeaderboardManager] getScoreByIds() FAILED, ret=0x%X\n", ret);
|
||||
@@ -511,14 +511,14 @@ bool SonyLeaderboardManager::getScoreByRange()
|
||||
|
||||
comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data
|
||||
|
||||
nullptr, 0, // GameData.
|
||||
NULL, 0, // GameData.
|
||||
|
||||
num,
|
||||
|
||||
&last_sort_date,
|
||||
&m_maxRank, // 'Total number of players registered in the target scoreboard.'
|
||||
|
||||
nullptr // Reserved, specify null.
|
||||
NULL // Reserved, specify null.
|
||||
);
|
||||
|
||||
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
|
||||
@@ -539,7 +539,7 @@ bool SonyLeaderboardManager::getScoreByRange()
|
||||
delete [] ptr;
|
||||
delete [] comments;
|
||||
|
||||
m_scores = nullptr;
|
||||
m_scores = NULL;
|
||||
m_readCount = 0;
|
||||
|
||||
m_eStatsState = eStatsState_Ready;
|
||||
@@ -557,7 +557,7 @@ bool SonyLeaderboardManager::getScoreByRange()
|
||||
|
||||
//m_stats = ptr; //Maybe: addPadding(num,ptr);
|
||||
|
||||
if (m_scores != nullptr) delete [] m_scores;
|
||||
if (m_scores != NULL) delete [] m_scores;
|
||||
m_readCount = ret;
|
||||
m_scores = new ReadScore[m_readCount];
|
||||
for (int i=0; i<m_readCount; i++)
|
||||
@@ -642,15 +642,15 @@ bool SonyLeaderboardManager::setScore()
|
||||
rscore.m_score, //IN: new score,
|
||||
|
||||
&comment, // Comments
|
||||
nullptr, // GameInfo
|
||||
NULL, // GameInfo
|
||||
|
||||
&tmp, //OUT: current rank,
|
||||
|
||||
#ifndef __PS3__
|
||||
nullptr, //compareDate
|
||||
NULL, //compareDate
|
||||
#endif
|
||||
|
||||
nullptr // Reserved, specify null.
|
||||
NULL // Reserved, specify null.
|
||||
);
|
||||
|
||||
if (ret==SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) //0x8002A415
|
||||
@@ -695,7 +695,7 @@ void SonyLeaderboardManager::Tick()
|
||||
{
|
||||
case eStatsState_Ready:
|
||||
{
|
||||
assert(m_scores != nullptr || m_readCount == 0);
|
||||
assert(m_scores != NULL || m_readCount == 0);
|
||||
|
||||
view.m_numQueries = m_readCount;
|
||||
view.m_queries = m_scores;
|
||||
@@ -707,7 +707,7 @@ void SonyLeaderboardManager::Tick()
|
||||
if (view.m_numQueries > 0)
|
||||
ret = eStatsReturn_Success;
|
||||
|
||||
if (m_readListener != nullptr)
|
||||
if (m_readListener != NULL)
|
||||
{
|
||||
app.DebugPrintf("[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount);
|
||||
m_readListener->OnStatsReadComplete(ret, m_maxRank, view);
|
||||
@@ -716,16 +716,16 @@ void SonyLeaderboardManager::Tick()
|
||||
m_eStatsState = eStatsState_Idle;
|
||||
|
||||
delete [] m_scores;
|
||||
m_scores = nullptr;
|
||||
m_scores = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case eStatsState_Failed:
|
||||
{
|
||||
view.m_numQueries = 0;
|
||||
view.m_queries = nullptr;
|
||||
view.m_queries = NULL;
|
||||
|
||||
if ( m_readListener != nullptr )
|
||||
if ( m_readListener != NULL )
|
||||
m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view);
|
||||
|
||||
m_eStatsState = eStatsState_Idle;
|
||||
@@ -747,7 +747,7 @@ bool SonyLeaderboardManager::OpenSession()
|
||||
{
|
||||
if (m_openSessions == 0)
|
||||
{
|
||||
if (m_threadScoreboard == nullptr)
|
||||
if (m_threadScoreboard == NULL)
|
||||
{
|
||||
m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
|
||||
m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
|
||||
@@ -837,7 +837,7 @@ void SonyLeaderboardManager::FlushStats() {}
|
||||
|
||||
void SonyLeaderboardManager::CancelOperation()
|
||||
{
|
||||
m_readListener = nullptr;
|
||||
m_readListener = NULL;
|
||||
m_eStatsState = eStatsState_Canceled;
|
||||
|
||||
if (m_requestId != 0)
|
||||
@@ -980,7 +980,7 @@ void SonyLeaderboardManager::fromBase32(void *out, SceNpScoreComment *in)
|
||||
for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++)
|
||||
{
|
||||
ch[0] = getComment(in)[i];
|
||||
unsigned char fivebits = strtol(ch, nullptr, 32) << 3;
|
||||
unsigned char fivebits = strtol(ch, NULL, 32) << 3;
|
||||
|
||||
int sByte = (i*5) / 8;
|
||||
int eByte = (5+(i*5)) / 8;
|
||||
@@ -1041,7 +1041,7 @@ bool SonyLeaderboardManager::test_string(string testing)
|
||||
int ctx = createTransactionContext(m_titleContext);
|
||||
if (ctx<0) return false;
|
||||
|
||||
int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, nullptr);
|
||||
int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL);
|
||||
|
||||
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED)
|
||||
{
|
||||
|
||||
@@ -56,8 +56,8 @@ CGameNetworkManager::CGameNetworkManager()
|
||||
m_bFullSessionMessageOnNextSessionChange = false;
|
||||
|
||||
#ifdef __ORBIS__
|
||||
m_pUpsell = nullptr;
|
||||
m_pInviteInfo = nullptr;
|
||||
m_pUpsell = NULL;
|
||||
m_pInviteInfo = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -120,26 +120,26 @@ void CGameNetworkManager::DoWork()
|
||||
s_pPlatformNetworkManager->DoWork();
|
||||
|
||||
#ifdef __ORBIS__
|
||||
if (m_pUpsell != nullptr && m_pUpsell->hasResponse())
|
||||
if (m_pUpsell != NULL && m_pUpsell->hasResponse())
|
||||
{
|
||||
int iPad_invited = m_iPlayerInvited, iPad_checking = m_pUpsell->m_userIndex;
|
||||
|
||||
m_iPlayerInvited = -1;
|
||||
|
||||
delete m_pUpsell;
|
||||
m_pUpsell = nullptr;
|
||||
m_pUpsell = NULL;
|
||||
|
||||
if (ProfileManager.HasPlayStationPlus(iPad_checking))
|
||||
{
|
||||
this->GameInviteReceived(iPad_invited, m_pInviteInfo);
|
||||
|
||||
// m_pInviteInfo deleted by GameInviteReceived.
|
||||
m_pInviteInfo = nullptr;
|
||||
m_pInviteInfo = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_pInviteInfo;
|
||||
m_pInviteInfo = nullptr;
|
||||
m_pInviteInfo = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -194,16 +194,16 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
ProfileManager.SetDeferredSignoutEnabled(true);
|
||||
#endif
|
||||
|
||||
int64_t seed = 0;
|
||||
if (lpParameter != nullptr)
|
||||
int64_t seed = 0;
|
||||
if(lpParameter != NULL)
|
||||
{
|
||||
NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter);
|
||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||
seed = param->seed;
|
||||
|
||||
app.setLevelGenerationOptions(param->levelGen);
|
||||
if(param->levelGen != nullptr)
|
||||
if(param->levelGen != NULL)
|
||||
{
|
||||
if(app.getLevelGenerationOptions() == nullptr)
|
||||
if(app.getLevelGenerationOptions() == NULL)
|
||||
{
|
||||
app.DebugPrintf("Game rule was not loaded, and seed is required. Exiting.\n");
|
||||
return false;
|
||||
@@ -248,10 +248,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
pchFilename, // file name
|
||||
GENERIC_READ, // access mode
|
||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||
nullptr, // Unused
|
||||
NULL, // Unused
|
||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||
nullptr // Unsupported
|
||||
NULL // Unsupported
|
||||
);
|
||||
#else
|
||||
const char *pchFilename=wstringtofilename(grf.getPath());
|
||||
@@ -259,18 +259,18 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
pchFilename, // file name
|
||||
GENERIC_READ, // access mode
|
||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||
nullptr, // Unused
|
||||
NULL, // Unused
|
||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
||||
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||
nullptr // Unsupported
|
||||
NULL // Unsupported
|
||||
);
|
||||
#endif
|
||||
|
||||
if( fileHandle != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
app.FatalLoadError();
|
||||
@@ -312,7 +312,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
}
|
||||
else
|
||||
{
|
||||
Socket::Initialise(nullptr);
|
||||
Socket::Initialise(NULL);
|
||||
}
|
||||
|
||||
#ifndef _XBOX
|
||||
@@ -358,27 +358,27 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
|
||||
if( g_NetworkManager.IsHost() )
|
||||
{
|
||||
connection = new ClientConnection(minecraft, nullptr);
|
||||
connection = new ClientConnection(minecraft, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(ProfileManager.GetLockedProfile());
|
||||
if(pNetworkPlayer == nullptr)
|
||||
if(pNetworkPlayer == NULL)
|
||||
{
|
||||
MinecraftServer::HaltServer();
|
||||
app.DebugPrintf("%d\n",ProfileManager.GetLockedProfile());
|
||||
// If the player is nullptr here then something went wrong in the session setup, and continuing will end up in a crash
|
||||
// If the player is NULL here then something went wrong in the session setup, and continuing will end up in a crash
|
||||
return false;
|
||||
}
|
||||
|
||||
Socket *socket = pNetworkPlayer->GetSocket();
|
||||
|
||||
// Fix for #13259 - CRASH: Gameplay: loading process is halted when player loads saved data
|
||||
if(socket == nullptr)
|
||||
if(socket == NULL)
|
||||
{
|
||||
assert(false);
|
||||
MinecraftServer::HaltServer();
|
||||
// If the socket is nullptr here then something went wrong in the session setup, and continuing will end up in a crash
|
||||
// If the socket is NULL here then something went wrong in the session setup, and continuing will end up in a crash
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -389,12 +389,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
{
|
||||
assert(false);
|
||||
delete connection;
|
||||
connection = nullptr;
|
||||
connection = NULL;
|
||||
MinecraftServer::HaltServer();
|
||||
return false;
|
||||
}
|
||||
|
||||
connection->send(std::make_shared<PreLoginPacket>(minecraft->user->name));
|
||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
|
||||
|
||||
// Tick connection until we're ready to go. The stages involved in this are:
|
||||
// (1) Creating the ClientConnection sends a prelogin packet to the server
|
||||
@@ -453,7 +453,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
// Already have setup the primary pad
|
||||
if(idx == ProfileManager.GetPrimaryPad() ) continue;
|
||||
|
||||
if( GetLocalPlayerByUserIndex(idx) != nullptr && !ProfileManager.IsSignedIn(idx) )
|
||||
if( GetLocalPlayerByUserIndex(idx) != NULL && !ProfileManager.IsSignedIn(idx) )
|
||||
{
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
||||
Socket *socket = pNetworkPlayer->GetSocket();
|
||||
@@ -467,7 +467,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
// when joining any other way, so just because they are signed in doesn't mean they are in the session
|
||||
// 4J Stu - If they are in the session, then we should add them to the game. Otherwise we won't be able to add them later
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
||||
if( pNetworkPlayer == nullptr )
|
||||
if( pNetworkPlayer == NULL )
|
||||
continue;
|
||||
|
||||
ClientConnection *connection;
|
||||
@@ -481,7 +481,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||
// Open the socket on the server end to accept incoming data
|
||||
Socket::addIncomingSocket(socket);
|
||||
|
||||
connection->send(std::make_shared<PreLoginPacket>(convStringToWstring(ProfileManager.GetGamertag(idx))));
|
||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) );
|
||||
|
||||
createdConnections.push_back( connection );
|
||||
|
||||
@@ -744,7 +744,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame(FriendSession
|
||||
// Make sure that the Primary Pad is in by default
|
||||
localUsersMask |= GetLocalPlayerMask( ProfileManager.GetPrimaryPad() );
|
||||
|
||||
return static_cast<eJoinGameResult>(s_pPlatformNetworkManager->JoinGame(searchResult, localUsersMask, primaryUserIndex));
|
||||
return (eJoinGameResult)(s_pPlatformNetworkManager->JoinGame( searchResult, localUsersMask, primaryUserIndex ));
|
||||
}
|
||||
|
||||
void CGameNetworkManager::CancelJoinGame(LPVOID lpParam)
|
||||
@@ -762,7 +762,7 @@ bool CGameNetworkManager::LeaveGame(bool bMigrateHost)
|
||||
|
||||
int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad)
|
||||
{
|
||||
INVITE_INFO * pInviteInfo = static_cast<INVITE_INFO *>(pParam);
|
||||
INVITE_INFO * pInviteInfo = (INVITE_INFO *)pParam;
|
||||
|
||||
if(bContinue==true)
|
||||
{
|
||||
@@ -801,9 +801,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||
// Check if user-created content is allowed, as we cannot play multiplayer if it's not
|
||||
bool noUGC = false;
|
||||
#if defined(__PS3__) || defined(__PSVITA__)
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,nullptr,nullptr);
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL);
|
||||
#elif defined(__ORBIS__)
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&noUGC,nullptr);
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL);
|
||||
#endif
|
||||
|
||||
if(noUGC)
|
||||
@@ -823,7 +823,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||
{
|
||||
#if defined(__ORBIS__) || defined(__PSVITA__)
|
||||
bool chatRestricted = false;
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,nullptr,nullptr);
|
||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,NULL,NULL);
|
||||
if(chatRestricted)
|
||||
{
|
||||
ProfileManager.DisplaySystemMessage( 0, ProfileManager.GetPrimaryPad() );
|
||||
@@ -912,7 +912,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||
app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
||||
}
|
||||
// If we failed before the server started, clear the game rules. Otherwise the server will clear it up.
|
||||
if(MinecraftServer::getInstance() == nullptr) app.m_gameRules.unloadCurrentGameRules();
|
||||
if(MinecraftServer::getInstance() == NULL) app.m_gameRules.unloadCurrentGameRules();
|
||||
Tile::ReleaseThreadStorage();
|
||||
return -1;
|
||||
}
|
||||
@@ -929,15 +929,15 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||
|
||||
int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||
{
|
||||
int64_t seed = 0;
|
||||
if (lpParameter != nullptr)
|
||||
int64_t seed = 0;
|
||||
if(lpParameter != NULL)
|
||||
{
|
||||
NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter);
|
||||
NetworkGameInitData *param = (NetworkGameInitData *)lpParameter;
|
||||
seed = param->seed;
|
||||
app.SetGameHostOption(eGameHostOption_All,param->settings);
|
||||
|
||||
// 4J Stu - If we are loading a DLC save that's separate from the texture pack, load
|
||||
if( param->levelGen != nullptr && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) )
|
||||
if( param->levelGen != NULL && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) )
|
||||
{
|
||||
while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()))
|
||||
{
|
||||
@@ -966,7 +966,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||
IntCache::ReleaseThreadStorage();
|
||||
Level::destroyLightingCache();
|
||||
|
||||
if(lpParameter != nullptr) delete lpParameter;
|
||||
if(lpParameter != NULL) delete lpParameter;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -979,7 +979,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
//app.SetGameStarted(false);
|
||||
UIScene_PauseMenu::_ExitWorld(nullptr);
|
||||
UIScene_PauseMenu::_ExitWorld(NULL);
|
||||
|
||||
while( g_NetworkManager.IsInSession() )
|
||||
{
|
||||
@@ -988,7 +988,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
||||
|
||||
// Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in
|
||||
#if !defined(__PS3__) && !defined(__PSVITA__)
|
||||
JoinFromInviteData *inviteData = static_cast<JoinFromInviteData *>(lpParam);
|
||||
JoinFromInviteData *inviteData = (JoinFromInviteData *)lpParam;
|
||||
app.SetAction(inviteData->dwUserIndex, eAppAction_JoinFromInvite, lpParam);
|
||||
#else
|
||||
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()))
|
||||
@@ -1216,14 +1216,14 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||
#endif
|
||||
|
||||
// Null the network player of all the server players that are local, to stop them being removed from the server when removed from the session
|
||||
if( pServer != nullptr )
|
||||
if( pServer != NULL )
|
||||
{
|
||||
PlayerList *players = pServer->getPlayers();
|
||||
for(auto& servPlayer : players->players)
|
||||
{
|
||||
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
||||
{
|
||||
servPlayer->connection->connection->getSocket()->setPlayer(nullptr);
|
||||
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1259,7 +1259,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||
char numLocalPlayers = 0;
|
||||
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
|
||||
{
|
||||
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr )
|
||||
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL )
|
||||
{
|
||||
numLocalPlayers++;
|
||||
localUsersMask |= GetLocalPlayerMask(index);
|
||||
@@ -1277,11 +1277,11 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||
}
|
||||
|
||||
// Restore the network player of all the server players that are local
|
||||
if( pServer != nullptr )
|
||||
if( pServer != NULL )
|
||||
{
|
||||
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
|
||||
{
|
||||
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr )
|
||||
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL )
|
||||
{
|
||||
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
|
||||
|
||||
@@ -1295,7 +1295,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||
}
|
||||
|
||||
// Player might have a pending connection
|
||||
if (pMinecraft->m_pendingLocalConnections[index] != nullptr)
|
||||
if (pMinecraft->m_pendingLocalConnections[index] != NULL)
|
||||
{
|
||||
// Update the network player
|
||||
pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index));
|
||||
@@ -1361,8 +1361,8 @@ void CGameNetworkManager::renderQueueMeter()
|
||||
#ifdef _XBOX
|
||||
int height = 720;
|
||||
|
||||
CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(nullptr, false);
|
||||
CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(nullptr, false);
|
||||
CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(NULL, false);
|
||||
CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(NULL, false);
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
pMinecraft->gui->renderGraph(CGameNetworkManager::messageQueue_length, CGameNetworkManager::messageQueuePos, CGameNetworkManager::messageQueue, 10, 1000, CGameNetworkManager::byteQueue, 100, 25000);
|
||||
@@ -1426,7 +1426,7 @@ void CGameNetworkManager::StateChange_AnyToStarting()
|
||||
{
|
||||
LoadingInputParams *loadingParams = new LoadingInputParams();
|
||||
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
||||
loadingParams->lpParam = nullptr;
|
||||
loadingParams->lpParam = NULL;
|
||||
|
||||
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
||||
completionData->bShowBackground=TRUE;
|
||||
@@ -1447,7 +1447,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying)
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i);
|
||||
if(pNetworkPlayer != nullptr && ProfileManager.IsSignedIn( i ) )
|
||||
if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) )
|
||||
{
|
||||
app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i );
|
||||
Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex());
|
||||
@@ -1482,12 +1482,12 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
Socket *socket = nullptr;
|
||||
Socket *socket = NULL;
|
||||
shared_ptr<MultiplayerLocalPlayer> mpPlayer = nullptr;
|
||||
int userIdx = pNetworkPlayer->GetUserIndex();
|
||||
if (userIdx >= 0 && userIdx < XUSER_MAX_COUNT)
|
||||
mpPlayer = pMinecraft->localplayers[userIdx];
|
||||
if( localPlayer && mpPlayer != nullptr && mpPlayer->connection != nullptr)
|
||||
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
|
||||
{
|
||||
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change
|
||||
socket = mpPlayer->connection->getSocket();
|
||||
@@ -1523,14 +1523,14 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||
|
||||
if( connection->createdOk )
|
||||
{
|
||||
connection->send(std::make_shared<PreLoginPacket>(pNetworkPlayer->GetOnlineName()));
|
||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) );
|
||||
pMinecraft->addPendingLocalConnection(idx, connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
pMinecraft->connectionDisconnected( idx , DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
||||
delete connection;
|
||||
connection = nullptr;
|
||||
connection = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1540,10 +1540,10 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||
void CGameNetworkManager::CloseConnection( INetworkPlayer *pNetworkPlayer )
|
||||
{
|
||||
MinecraftServer *server = MinecraftServer::getInstance();
|
||||
if( server != nullptr )
|
||||
if( server != NULL )
|
||||
{
|
||||
PlayerList *players = server->getPlayers();
|
||||
if( players != nullptr )
|
||||
if( players != NULL )
|
||||
{
|
||||
players->closePlayerConnectionBySmallId(pNetworkPlayer->GetSmallId());
|
||||
}
|
||||
@@ -1559,7 +1559,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
||||
for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad)
|
||||
{
|
||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||
if (pNetworkPlayer == nullptr) continue;
|
||||
if (pNetworkPlayer == NULL) continue;
|
||||
|
||||
app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK);
|
||||
if (multiplayer)
|
||||
@@ -1586,7 +1586,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
||||
{
|
||||
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(Minecraft::GetInstance()->localplayers[idx] != nullptr)
|
||||
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
||||
{
|
||||
TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
||||
}
|
||||
@@ -1609,7 +1609,7 @@ void CGameNetworkManager::PlayerLeaving( INetworkPlayer *pNetworkPlayer )
|
||||
{
|
||||
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(Minecraft::GetInstance()->localplayers[idx] != nullptr)
|
||||
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
||||
{
|
||||
TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
||||
}
|
||||
@@ -1632,7 +1632,7 @@ void CGameNetworkManager::WriteStats( INetworkPlayer *pNetworkPlayer )
|
||||
void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *pInviteInfo)
|
||||
{
|
||||
#ifdef __ORBIS__
|
||||
if (m_pUpsell != nullptr)
|
||||
if (m_pUpsell != NULL)
|
||||
{
|
||||
delete pInviteInfo;
|
||||
return;
|
||||
@@ -1721,7 +1721,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
{
|
||||
// 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player)
|
||||
// 4J Stu - If we are not in a game, then bring in all players signed in
|
||||
if(index==userIndex || pMinecraft->localplayers[index]!=nullptr )
|
||||
if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
|
||||
{
|
||||
++joiningUsers;
|
||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||
@@ -1736,7 +1736,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
BOOL pccAllowed = TRUE;
|
||||
BOOL pccFriendsAllowed = TRUE;
|
||||
#if defined(__PS3__) || defined(__PSVITA__)
|
||||
ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,nullptr);
|
||||
ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL);
|
||||
#else
|
||||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||
@@ -1781,14 +1781,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
|
||||
// 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard
|
||||
//StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
|
||||
//StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
|
||||
ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,XUSER_INDEX_ANY);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(__ORBIS__) || defined(__PSVITA__)
|
||||
bool chatRestricted = false;
|
||||
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr);
|
||||
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL);
|
||||
if(chatRestricted)
|
||||
{
|
||||
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() );
|
||||
@@ -1984,7 +1984,7 @@ const char *CGameNetworkManager::GetOnlineName(int playerIdx)
|
||||
|
||||
void CGameNetworkManager::ServerReadyCreate(bool create)
|
||||
{
|
||||
m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : nullptr );
|
||||
m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : NULL );
|
||||
}
|
||||
|
||||
void CGameNetworkManager::ServerReady()
|
||||
@@ -2000,17 +2000,17 @@ void CGameNetworkManager::ServerReadyWait()
|
||||
void CGameNetworkManager::ServerReadyDestroy()
|
||||
{
|
||||
delete m_hServerReadyEvent;
|
||||
m_hServerReadyEvent = nullptr;
|
||||
m_hServerReadyEvent = NULL;
|
||||
}
|
||||
|
||||
bool CGameNetworkManager::ServerReadyValid()
|
||||
{
|
||||
return ( m_hServerReadyEvent != nullptr );
|
||||
return ( m_hServerReadyEvent != NULL );
|
||||
}
|
||||
|
||||
void CGameNetworkManager::ServerStoppedCreate(bool create)
|
||||
{
|
||||
m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : nullptr );
|
||||
m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : NULL );
|
||||
}
|
||||
|
||||
void CGameNetworkManager::ServerStopped()
|
||||
@@ -2051,12 +2051,12 @@ void CGameNetworkManager::ServerStoppedWait()
|
||||
void CGameNetworkManager::ServerStoppedDestroy()
|
||||
{
|
||||
delete m_hServerStoppedEvent;
|
||||
m_hServerStoppedEvent = nullptr;
|
||||
m_hServerStoppedEvent = NULL;
|
||||
}
|
||||
|
||||
bool CGameNetworkManager::ServerStoppedValid()
|
||||
{
|
||||
return ( m_hServerStoppedEvent != nullptr );
|
||||
return ( m_hServerStoppedEvent != NULL );
|
||||
}
|
||||
|
||||
int CGameNetworkManager::GetJoiningReadyPercentage()
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
|
||||
bool LeaveGame(bool bMigrateHost);
|
||||
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||
void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr);
|
||||
void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
void SendInviteGUI(int iPad);
|
||||
void ResetLeavingGame();
|
||||
|
||||
@@ -137,17 +137,17 @@ public:
|
||||
|
||||
// Events
|
||||
|
||||
void ServerReadyCreate(bool create); // Create the signal (or set to nullptr)
|
||||
void ServerReadyCreate(bool create); // Create the signal (or set to NULL)
|
||||
void ServerReady(); // Signal that we are ready
|
||||
void ServerReadyWait(); // Wait for the signal
|
||||
void ServerReadyDestroy(); // Destroy signal
|
||||
bool ServerReadyValid(); // Is non-nullptr
|
||||
bool ServerReadyValid(); // Is non-NULL
|
||||
|
||||
void ServerStoppedCreate(bool create); // Create the signal
|
||||
void ServerStopped(); // Signal that we are ready
|
||||
void ServerStoppedWait(); // Wait for the signal
|
||||
void ServerStoppedDestroy(); // Destroy signal
|
||||
bool ServerStoppedValid(); // Is non-nullptr
|
||||
void ServerStoppedWait(); // Wait for the signal
|
||||
void ServerStoppedDestroy(); // Destroy signal
|
||||
bool ServerStoppedValid(); // Is non-NULL
|
||||
|
||||
#ifdef __PSVITA__
|
||||
static bool usingAdhocMode();
|
||||
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
|
||||
|
||||
public:
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr) = 0;
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL) = 0;
|
||||
|
||||
private:
|
||||
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0;
|
||||
|
||||
@@ -26,7 +26,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||
bool createFakeSocket = false;
|
||||
bool localPlayer = false;
|
||||
|
||||
NetworkPlayerXbox *networkPlayer = static_cast<NetworkPlayerXbox *>(addNetworkPlayer(pQNetPlayer));
|
||||
NetworkPlayerXbox *networkPlayer = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer);
|
||||
|
||||
if( pQNetPlayer->IsLocal() )
|
||||
{
|
||||
@@ -103,7 +103,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||
|
||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(playerChangedCallback[idx] != nullptr)
|
||||
if(playerChangedCallback[idx] != NULL)
|
||||
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false );
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||
int localPlayerCount = 0;
|
||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount;
|
||||
if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount;
|
||||
}
|
||||
|
||||
float appTime = app.getAppTime();
|
||||
@@ -127,11 +127,11 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer)
|
||||
app.DebugPrintf("Player 0x%p \"%ls\" leaving.\n", pQNetPlayer, pQNetPlayer->GetGamertag());
|
||||
|
||||
INetworkPlayer* networkPlayer = getNetworkPlayer(pQNetPlayer);
|
||||
if (networkPlayer == nullptr)
|
||||
if (networkPlayer == NULL)
|
||||
return;
|
||||
|
||||
Socket* socket = networkPlayer->GetSocket();
|
||||
if (socket != nullptr)
|
||||
if (socket != NULL)
|
||||
{
|
||||
if (m_pIQNet->IsHost())
|
||||
g_NetworkManager.CloseConnection(networkPlayer);
|
||||
@@ -146,7 +146,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer)
|
||||
|
||||
for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if (playerChangedCallback[idx] != nullptr)
|
||||
if (playerChangedCallback[idx] != NULL)
|
||||
playerChangedCallback[idx](playerChangedCallbackParam[idx], networkPlayer, true);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||
g_pPlatformNetworkManager = this;
|
||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||
{
|
||||
playerChangedCallback[ i ] = nullptr;
|
||||
playerChangedCallback[ i ] = NULL;
|
||||
}
|
||||
|
||||
m_bLeavingGame = false;
|
||||
@@ -173,8 +173,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||
m_bSearchPending = false;
|
||||
|
||||
m_bIsOfflineGame = false;
|
||||
m_pSearchParam = nullptr;
|
||||
m_SessionsUpdatedCallback = nullptr;
|
||||
m_pSearchParam = NULL;
|
||||
m_SessionsUpdatedCallback = NULL;
|
||||
|
||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||
{
|
||||
@@ -182,10 +182,10 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||
m_lastSearchStartTime[i] = 0;
|
||||
|
||||
// The results that will be filled in with the current search
|
||||
m_pSearchResults[i] = nullptr;
|
||||
m_pQoSResult[i] = nullptr;
|
||||
m_pCurrentSearchResults[i] = nullptr;
|
||||
m_pCurrentQoSResult[i] = nullptr;
|
||||
m_pSearchResults[i] = NULL;
|
||||
m_pQoSResult[i] = NULL;
|
||||
m_pCurrentSearchResults[i] = NULL;
|
||||
m_pCurrentQoSResult[i] = NULL;
|
||||
m_currentSearchResultsCount[i] = 0;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ void CPlatformNetworkManagerStub::DoWork()
|
||||
while (WinsockNetLayer::PopDisconnectedSmallId(&disconnectedSmallId))
|
||||
{
|
||||
IQNetPlayer* qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId);
|
||||
if (qnetPlayer != nullptr && qnetPlayer->m_smallId == disconnectedSmallId)
|
||||
if (qnetPlayer != NULL && qnetPlayer->m_smallId == disconnectedSmallId)
|
||||
{
|
||||
NotifyPlayerLeaving(qnetPlayer);
|
||||
qnetPlayer->m_smallId = 0;
|
||||
@@ -386,7 +386,7 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame,
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
int port = WIN64_NET_DEFAULT_PORT;
|
||||
const char* bindIp = nullptr;
|
||||
const char* bindIp = NULL;
|
||||
if (g_Win64DedicatedServer)
|
||||
{
|
||||
if (g_Win64DedicatedServerPort > 0)
|
||||
@@ -419,7 +419,7 @@ bool CPlatformNetworkManagerStub::_StartGame()
|
||||
int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int localUsersMask, int primaryUserIndex)
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (searchResult == nullptr)
|
||||
if (searchResult == NULL)
|
||||
return CGameNetworkManager::JOINGAME_FAIL_GENERAL;
|
||||
|
||||
const char* hostIP = searchResult->data.hostIP;
|
||||
@@ -493,8 +493,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void
|
||||
{
|
||||
if(playerChangedCallbackParam[iPad] == callbackParam)
|
||||
{
|
||||
playerChangedCallback[iPad] = nullptr;
|
||||
playerChangedCallbackParam[iPad] = nullptr;
|
||||
playerChangedCallback[iPad] = NULL;
|
||||
playerChangedCallbackParam[iPad] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
||||
if (IQNet::m_player[i].m_isRemote)
|
||||
{
|
||||
INetworkPlayer* pNetworkPlayer = getNetworkPlayer(&IQNet::m_player[i]);
|
||||
if (pNetworkPlayer != nullptr && pNetworkPlayer->GetSocket() != nullptr)
|
||||
if (pNetworkPlayer != NULL && pNetworkPlayer->GetSocket() != NULL)
|
||||
{
|
||||
Socket::addIncomingSocket(pNetworkPlayer->GetSocket());
|
||||
}
|
||||
@@ -524,14 +524,14 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/)
|
||||
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
|
||||
{
|
||||
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
||||
//
|
||||
// if( this->m_bLeavingGame )
|
||||
// return;
|
||||
//
|
||||
// if( GetHostPlayer() == nullptr )
|
||||
// if( GetHostPlayer() == NULL )
|
||||
// return;
|
||||
//
|
||||
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
||||
@@ -551,13 +551,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_hostGameSessionData.players[i] = nullptr;
|
||||
// m_hostGameSessionData.players[i] = NULL;
|
||||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_hostGameSessionData.players[i] = nullptr;
|
||||
// m_hostGameSessionData.players[i] = NULL;
|
||||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||
// }
|
||||
// }
|
||||
@@ -568,18 +568,18 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
||||
|
||||
int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpParam )
|
||||
{
|
||||
INetworkPlayer *pNetworkPlayer = static_cast<INetworkPlayer *>(lpParam);
|
||||
INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam;
|
||||
|
||||
Socket *socket = pNetworkPlayer->GetSocket();
|
||||
|
||||
if( socket != nullptr )
|
||||
if( socket != NULL )
|
||||
{
|
||||
//printf("Waiting for socket closed event\n");
|
||||
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
||||
|
||||
//printf("Socket closed event has fired\n");
|
||||
// 4J Stu - Clear our reference to this socket
|
||||
pNetworkPlayer->SetSocket( nullptr );
|
||||
pNetworkPlayer->SetSocket( NULL );
|
||||
delete socket;
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset()
|
||||
void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index)
|
||||
{
|
||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return;
|
||||
if( pNetworkPlayer == nullptr ) return;
|
||||
if( pNetworkPlayer == NULL ) return;
|
||||
|
||||
for( unsigned int i = 0; i < m_playerFlags.size(); i++ )
|
||||
{
|
||||
@@ -685,7 +685,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer,
|
||||
bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index)
|
||||
{
|
||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false;
|
||||
if( pNetworkPlayer == nullptr )
|
||||
if( pNetworkPlayer == NULL )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -713,7 +713,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats()
|
||||
|
||||
for(unsigned int i = 0; i < GetPlayerCount(); ++i)
|
||||
{
|
||||
IQNetPlayer *pQNetPlayer = static_cast<NetworkPlayerXbox *>(GetPlayerByIndex(i))->GetQNetPlayer();
|
||||
IQNetPlayer *pQNetPlayer = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer();
|
||||
|
||||
if(!pQNetPlayer->IsLocal())
|
||||
{
|
||||
@@ -728,7 +728,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats()
|
||||
void CPlatformNetworkManagerStub::TickSearch()
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (m_SessionsUpdatedCallback == nullptr)
|
||||
if (m_SessionsUpdatedCallback == NULL)
|
||||
return;
|
||||
|
||||
static DWORD lastSearchTime = 0;
|
||||
@@ -757,7 +757,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
|
||||
size_t nameLen = wcslen(lanSessions[i].hostName);
|
||||
info->displayLabel = new wchar_t[nameLen + 1];
|
||||
wcscpy_s(info->displayLabel, nameLen + 1, lanSessions[i].hostName);
|
||||
info->displayLabelLength = static_cast<unsigned char>(nameLen);
|
||||
info->displayLabelLength = (unsigned char)nameLen;
|
||||
info->displayLabelViewableStartIndex = 0;
|
||||
|
||||
info->data.netVersion = lanSessions[i].netVersion;
|
||||
@@ -772,8 +772,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
|
||||
info->data.playerCount = lanSessions[i].playerCount;
|
||||
info->data.maxPlayers = lanSessions[i].maxPlayers;
|
||||
|
||||
info->sessionId = static_cast<uint64_t>(inet_addr(lanSessions[i].hostIP)) |
|
||||
static_cast<uint64_t>(lanSessions[i].hostPort) << 32;
|
||||
info->sessionId = (SessionID)((uint64_t)inet_addr(lanSessions[i].hostIP) | ((uint64_t)lanSessions[i].hostPort << 32));
|
||||
|
||||
friendsSessions[0].push_back(info);
|
||||
}
|
||||
@@ -813,7 +812,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
|
||||
size_t nameLen = wcslen(label);
|
||||
info->displayLabel = new wchar_t[nameLen+1];
|
||||
wcscpy_s(info->displayLabel, nameLen + 1, label);
|
||||
info->displayLabelLength = static_cast<unsigned char>(nameLen);
|
||||
info->displayLabelLength = (unsigned char)nameLen;
|
||||
info->displayLabelViewableStartIndex = 0;
|
||||
info->data.isReadyToJoin = true;
|
||||
info->data.isJoinable = true;
|
||||
@@ -827,9 +826,9 @@ void CPlatformNetworkManagerStub::SearchForGames()
|
||||
std::fclose(file);
|
||||
}
|
||||
|
||||
m_searchResultsCount[0] = static_cast<int>(friendsSessions[0].size());
|
||||
m_searchResultsCount[0] = (int)friendsSessions[0].size();
|
||||
|
||||
if (m_SessionsUpdatedCallback != nullptr)
|
||||
if (m_SessionsUpdatedCallback != NULL)
|
||||
m_SessionsUpdatedCallback(m_pSearchParam);
|
||||
#endif
|
||||
}
|
||||
@@ -877,7 +876,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh()
|
||||
m_searchResultsCount[i] = 0;
|
||||
m_lastSearchStartTime[i] = 0;
|
||||
delete m_pSearchResults[i];
|
||||
m_pSearchResults[i] = nullptr;
|
||||
m_pSearchResults[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,7 +903,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer)
|
||||
|
||||
INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer)
|
||||
{
|
||||
return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr;
|
||||
return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
GameSessionData m_hostGameSessionData;
|
||||
CGameNetworkManager *m_pGameNetworkManager;
|
||||
public:
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr);
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
|
||||
private:
|
||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
|
||||
FriendSessionInfo()
|
||||
{
|
||||
displayLabel = nullptr;
|
||||
displayLabel = NULL;
|
||||
displayLabelLength = 0;
|
||||
displayLabelViewableStartIndex = 0;
|
||||
hasPartyMember = false;
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
|
||||
~FriendSessionInfo()
|
||||
{
|
||||
if (displayLabel != nullptr)
|
||||
if (displayLabel != NULL)
|
||||
delete displayLabel;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer)
|
||||
{
|
||||
m_sqrPlayer = qnetPlayer;
|
||||
m_pSocket = nullptr;
|
||||
m_pSocket = NULL;
|
||||
m_lastChunkPacketTime = 0;
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ unsigned char NetworkPlayerSony::GetSmallId()
|
||||
void NetworkPlayerSony::SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority, bool ack)
|
||||
{
|
||||
// TODO - handle priority
|
||||
m_sqrPlayer->SendData( static_cast<NetworkPlayerSony *>(player)->m_sqrPlayer, pvData, dataSize, ack );
|
||||
m_sqrPlayer->SendData( ((NetworkPlayerSony *)player)->m_sqrPlayer, pvData, dataSize, ack );
|
||||
}
|
||||
|
||||
bool NetworkPlayerSony::IsSameSystem(INetworkPlayer *player)
|
||||
{
|
||||
return m_sqrPlayer->IsSameSystem(static_cast<NetworkPlayerSony *>(player)->m_sqrPlayer);
|
||||
return m_sqrPlayer->IsSameSystem(((NetworkPlayerSony *)player)->m_sqrPlayer);
|
||||
}
|
||||
|
||||
int NetworkPlayerSony::GetOutstandingAckCount()
|
||||
@@ -133,5 +133,5 @@ int NetworkPlayerSony::GetTimeSinceLastChunkPacket_ms()
|
||||
}
|
||||
|
||||
int64_t currentTime = System::currentTimeMillis();
|
||||
return static_cast<int>(currentTime - m_lastChunkPacketTime);
|
||||
return (int)( currentTime - m_lastChunkPacketTime );
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro
|
||||
INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom);
|
||||
Socket *socket = pPlayerFrom->GetSocket();
|
||||
|
||||
if(socket != nullptr)
|
||||
if(socket != NULL)
|
||||
socket->pushDataToQueue(data, dataSize, false);
|
||||
}
|
||||
else
|
||||
@@ -132,7 +132,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro
|
||||
INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo);
|
||||
Socket *socket = pPlayerTo->GetSocket();
|
||||
//app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag());
|
||||
if(socket != nullptr)
|
||||
if(socket != NULL)
|
||||
socket->pushDataToQueue(data, dataSize);
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
||||
|
||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(playerChangedCallback[idx] != nullptr)
|
||||
if(playerChangedCallback[idx] != NULL)
|
||||
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false );
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
||||
int localPlayerCount = 0;
|
||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount;
|
||||
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount;
|
||||
}
|
||||
|
||||
float appTime = app.getAppTime();
|
||||
@@ -258,7 +258,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||
{
|
||||
// Get our wrapper object associated with this player.
|
||||
Socket *socket = networkPlayer->GetSocket();
|
||||
if( socket != nullptr )
|
||||
if( socket != NULL )
|
||||
{
|
||||
// If we are in game then remove this player from the game as well.
|
||||
// We may get here either from the player requesting to exit the game,
|
||||
@@ -274,19 +274,19 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||
// We need this as long as the game server still needs to communicate with the player
|
||||
//delete socket;
|
||||
|
||||
networkPlayer->SetSocket( nullptr );
|
||||
networkPlayer->SetSocket( NULL );
|
||||
}
|
||||
|
||||
if( m_pSQRNet->IsHost() && !m_bHostChanged )
|
||||
{
|
||||
if( isSystemPrimaryPlayer(pSQRPlayer) )
|
||||
{
|
||||
SQRNetworkPlayer *pNewSQRPrimaryPlayer = nullptr;
|
||||
SQRNetworkPlayer *pNewSQRPrimaryPlayer = NULL;
|
||||
for(unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i )
|
||||
{
|
||||
SQRNetworkPlayer *pSQRPlayer2 = m_pSQRNet->GetPlayerByIndex( i );
|
||||
|
||||
if ( pSQRPlayer2 != nullptr && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) )
|
||||
if ( pSQRPlayer2 != NULL && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) )
|
||||
{
|
||||
pNewSQRPrimaryPlayer = pSQRPlayer2;
|
||||
break;
|
||||
@@ -298,7 +298,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||
m_machineSQRPrimaryPlayers.erase( it );
|
||||
}
|
||||
|
||||
if( pNewSQRPrimaryPlayer != nullptr )
|
||||
if( pNewSQRPrimaryPlayer != NULL )
|
||||
m_machineSQRPrimaryPlayers.push_back( pNewSQRPrimaryPlayer );
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||
|
||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if(playerChangedCallback[idx] != nullptr)
|
||||
if(playerChangedCallback[idx] != NULL)
|
||||
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true );
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||
int localPlayerCount = 0;
|
||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||
{
|
||||
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount;
|
||||
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount;
|
||||
}
|
||||
|
||||
float appTime = app.getAppTime();
|
||||
@@ -391,7 +391,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||
if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
||||
{
|
||||
// we're signed into the PSN, but we won't be online yet, force a sign-in online here
|
||||
m_pSQRNet_Vita->AttemptPSNSignIn(nullptr, nullptr);
|
||||
m_pSQRNet_Vita->AttemptPSNSignIn(NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||
g_pPlatformNetworkManager = this;
|
||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||
{
|
||||
playerChangedCallback[ i ] = nullptr;
|
||||
playerChangedCallback[ i ] = NULL;
|
||||
}
|
||||
|
||||
m_bLeavingGame = false;
|
||||
@@ -413,11 +413,11 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||
m_bSearchPending = false;
|
||||
|
||||
m_bIsOfflineGame = false;
|
||||
m_pSearchParam = nullptr;
|
||||
m_SessionsUpdatedCallback = nullptr;
|
||||
m_pSearchParam = NULL;
|
||||
m_SessionsUpdatedCallback = NULL;
|
||||
|
||||
m_searchResultsCount = 0;
|
||||
m_pSearchResults = nullptr;
|
||||
m_pSearchResults = NULL;
|
||||
|
||||
m_lastSearchStartTime = 0;
|
||||
|
||||
@@ -622,11 +622,11 @@ bool CPlatformNetworkManagerSony::RemoveLocalPlayerByUserIndex( int userIndex )
|
||||
SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(userIndex);
|
||||
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
||||
|
||||
if(pNetworkPlayer != nullptr)
|
||||
if(pNetworkPlayer != NULL)
|
||||
{
|
||||
Socket *socket = pNetworkPlayer->GetSocket();
|
||||
|
||||
if( socket != nullptr )
|
||||
if( socket != NULL )
|
||||
{
|
||||
// We can't remove the player from qnet until we have stopped using it to communicate
|
||||
C4JThread* thread = new C4JThread(&CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed");
|
||||
@@ -702,11 +702,11 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost)
|
||||
SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad());
|
||||
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
||||
|
||||
if(pNetworkPlayer != nullptr)
|
||||
if(pNetworkPlayer != NULL)
|
||||
{
|
||||
Socket *socket = pNetworkPlayer->GetSocket();
|
||||
|
||||
if( socket != nullptr )
|
||||
if( socket != NULL )
|
||||
{
|
||||
//printf("Waiting for socket closed event\n");
|
||||
DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
||||
@@ -718,13 +718,13 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost)
|
||||
// 4J Stu - Clear our reference to this socket
|
||||
pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad());
|
||||
pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
||||
pNetworkPlayer->SetSocket( nullptr );
|
||||
pNetworkPlayer->SetSocket( NULL );
|
||||
}
|
||||
delete socket;
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("Socket is already nullptr\n");
|
||||
//printf("Socket is already NULL\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,8 +878,8 @@ void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void
|
||||
{
|
||||
if(playerChangedCallbackParam[iPad] == callbackParam)
|
||||
{
|
||||
playerChangedCallback[iPad] = nullptr;
|
||||
playerChangedCallbackParam[iPad] = nullptr;
|
||||
playerChangedCallback[iPad] = NULL;
|
||||
playerChangedCallbackParam[iPad] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -917,7 +917,7 @@ bool CPlatformNetworkManagerSony::_RunNetworkGame()
|
||||
|
||||
// Note that this does less than the xbox equivalent as we have HandleResyncPlayerRequest that is called by the underlying SQRNetworkManager when players are added/removed etc., so this
|
||||
// call is only used to update the game host settings & then do the final push out of the data.
|
||||
void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/)
|
||||
void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
|
||||
{
|
||||
if( this->m_bLeavingGame )
|
||||
return;
|
||||
@@ -934,7 +934,7 @@ void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
||||
|
||||
// If this is called With a pNetworkPlayerLeaving, then the call has ultimately started within SQRNetworkManager::RemoveRemotePlayersAndSync, so we don't need to sync each change
|
||||
// as that function does a sync at the end of all changes.
|
||||
if( pNetworkPlayerLeaving == nullptr )
|
||||
if( pNetworkPlayerLeaving == NULL )
|
||||
{
|
||||
m_pSQRNet->UpdateExternalRoomData();
|
||||
}
|
||||
@@ -946,14 +946,14 @@ int CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc( void* lpP
|
||||
|
||||
Socket *socket = pNetworkPlayer->GetSocket();
|
||||
|
||||
if( socket != nullptr )
|
||||
if( socket != NULL )
|
||||
{
|
||||
//printf("Waiting for socket closed event\n");
|
||||
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
||||
|
||||
//printf("Socket closed event has fired\n");
|
||||
// 4J Stu - Clear our reference to this socket
|
||||
pNetworkPlayer->SetSocket( nullptr );
|
||||
pNetworkPlayer->SetSocket( NULL );
|
||||
delete socket;
|
||||
}
|
||||
|
||||
@@ -1030,7 +1030,7 @@ void CPlatformNetworkManagerSony::SystemFlagReset()
|
||||
void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index)
|
||||
{
|
||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return;
|
||||
if( pNetworkPlayer == nullptr ) return;
|
||||
if( pNetworkPlayer == NULL ) return;
|
||||
|
||||
for( unsigned int i = 0; i < m_playerFlags.size(); i++ )
|
||||
{
|
||||
@@ -1046,7 +1046,7 @@ void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer,
|
||||
bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index)
|
||||
{
|
||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false;
|
||||
if( pNetworkPlayer == nullptr )
|
||||
if( pNetworkPlayer == NULL )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1064,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer,
|
||||
wstring CPlatformNetworkManagerSony::GatherStats()
|
||||
{
|
||||
#if 0
|
||||
return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_MESSAGES ) )
|
||||
+ L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ) );
|
||||
return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
|
||||
+ L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
|
||||
#else
|
||||
return L"";
|
||||
#endif
|
||||
@@ -1111,7 +1111,7 @@ void CPlatformNetworkManagerSony::TickSearch()
|
||||
}
|
||||
m_bSearchPending = false;
|
||||
|
||||
if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam);
|
||||
if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1126,7 +1126,7 @@ void CPlatformNetworkManagerSony::TickSearch()
|
||||
if( usingAdhocMode())
|
||||
searchDelay = 5000;
|
||||
#endif
|
||||
if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + searchDelay) < GetTickCount() )
|
||||
if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + searchDelay) < GetTickCount() )
|
||||
{
|
||||
if( m_pSQRNet->FriendRoomManagerSearch() )
|
||||
{
|
||||
@@ -1189,7 +1189,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
|
||||
if(memcmp( &pSearchResult->info.sessionID, &sessionId, sizeof(SessionID) ) != 0) continue;
|
||||
|
||||
bool foundSession = false;
|
||||
FriendSessionInfo *sessionInfo = nullptr;
|
||||
FriendSessionInfo *sessionInfo = NULL;
|
||||
auto itFriendSession = friendsSessions[iPad].begin();
|
||||
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
|
||||
{
|
||||
@@ -1231,7 +1231,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
|
||||
sessionInfo->data.isJoinable)
|
||||
{
|
||||
foundSessionInfo->data = sessionInfo->data;
|
||||
if(foundSessionInfo->displayLabel != nullptr) delete [] foundSessionInfo->displayLabel;
|
||||
if(foundSessionInfo->displayLabel != NULL) delete [] foundSessionInfo->displayLabel;
|
||||
foundSessionInfo->displayLabel = new wchar_t[100];
|
||||
memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) );
|
||||
foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength;
|
||||
@@ -1267,7 +1267,7 @@ void CPlatformNetworkManagerSony::ForceFriendsSessionRefresh()
|
||||
m_lastSearchStartTime = 0;
|
||||
m_searchResultsCount = 0;
|
||||
delete m_pSearchResults;
|
||||
m_pSearchResults = nullptr;
|
||||
m_pSearchResults = NULL;
|
||||
}
|
||||
|
||||
INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
||||
@@ -1293,7 +1293,7 @@ void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlay
|
||||
|
||||
INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
||||
{
|
||||
return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : nullptr;
|
||||
return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ private:
|
||||
GameSessionData m_hostGameSessionData;
|
||||
CGameNetworkManager *m_pGameNetworkManager;
|
||||
public:
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr);
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
|
||||
private:
|
||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||
|
||||
@@ -16,7 +16,7 @@ int SQRNetworkManager::GetSendQueueSizeBytes()
|
||||
for(int i = 0; i < playerCount; ++i)
|
||||
{
|
||||
SQRNetworkPlayer *player = GetPlayerByIndex( i );
|
||||
if( player != nullptr )
|
||||
if( player != NULL )
|
||||
{
|
||||
queueSize += player->GetTotalSendQueueBytes();
|
||||
}
|
||||
@@ -31,7 +31,7 @@ int SQRNetworkManager::GetSendQueueSizeMessages()
|
||||
for(int i = 0; i < playerCount; ++i)
|
||||
{
|
||||
SQRNetworkPlayer *player = GetPlayerByIndex( i );
|
||||
if( player != nullptr )
|
||||
if( player != NULL )
|
||||
{
|
||||
queueSize += player->GetTotalSendQueueMessages();
|
||||
}
|
||||
|
||||
@@ -279,12 +279,12 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
|
||||
{
|
||||
// no data, just the flag
|
||||
assert(dataSize == 0);
|
||||
assert(data == nullptr);
|
||||
assert(data == NULL);
|
||||
int dataSize = dataRemaining;
|
||||
if( dataSize > SNP_MAX_PAYLOAD ) dataSize = SNP_MAX_PAYLOAD;
|
||||
sendBlock.start = nullptr;
|
||||
sendBlock.end = nullptr;
|
||||
sendBlock.current = nullptr;
|
||||
sendBlock.start = NULL;
|
||||
sendBlock.end = NULL;
|
||||
sendBlock.current = NULL;
|
||||
sendBlock.ack = ackFlags;
|
||||
m_sendQueue.push(sendBlock);
|
||||
}
|
||||
@@ -387,9 +387,9 @@ int SQRNetworkPlayer::ReadDataPacket(void* data, int dataSize)
|
||||
|
||||
unsigned char* packetData = new unsigned char[packetSize];
|
||||
#ifdef __PS3__
|
||||
int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr );
|
||||
int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL );
|
||||
#else // __ORBIS__ && __PSVITA__
|
||||
int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr );
|
||||
int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL );
|
||||
#endif
|
||||
if(bytesRead == sc_wouldBlockFlag)
|
||||
{
|
||||
@@ -426,9 +426,9 @@ void SQRNetworkPlayer::ReadAck()
|
||||
{
|
||||
DataPacketHeader header;
|
||||
#ifdef __PS3__
|
||||
int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr );
|
||||
int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL );
|
||||
#else // __ORBIS__ && __PSVITA__
|
||||
int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr );
|
||||
int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL );
|
||||
#endif
|
||||
if(bytesRead == sc_wouldBlockFlag)
|
||||
{
|
||||
@@ -459,7 +459,7 @@ void SQRNetworkPlayer::ReadAck()
|
||||
|
||||
void SQRNetworkPlayer::WriteAck()
|
||||
{
|
||||
SendInternal(nullptr, 0, e_flag_AckReturning);
|
||||
SendInternal(NULL, 0, e_flag_AckReturning);
|
||||
}
|
||||
|
||||
int SQRNetworkPlayer::GetOutstandingAckCount()
|
||||
|
||||
@@ -63,7 +63,7 @@ class SQRNetworkPlayer
|
||||
public:
|
||||
DataPacketHeader() : m_dataSize(0), m_ackFlags(e_flag_AckUnknown) {}
|
||||
DataPacketHeader(int dataSize, AckFlags ackFlags) : m_dataSize(dataSize), m_ackFlags(ackFlags) { }
|
||||
AckFlags GetAckFlags() { return static_cast<AckFlags>(m_ackFlags);}
|
||||
AckFlags GetAckFlags() { return (AckFlags)m_ackFlags;}
|
||||
int GetDataSize() { return m_dataSize; }
|
||||
};
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ static SceRemoteStorageStatus statParams;
|
||||
// void remoteStorageCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
|
||||
// {
|
||||
// app.DebugPrintf("remoteStorageCallback err : 0x%08x\n");
|
||||
//
|
||||
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, nullptr);
|
||||
//
|
||||
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL);
|
||||
// }
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ static SceRemoteStorageStatus statParams;
|
||||
void SonyRemoteStorage::SetRetrievedDescData()
|
||||
{
|
||||
DescriptionData* pDescDataTest = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
ESavePlatform testPlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3]));
|
||||
ESavePlatform testPlatform = (ESavePlatform)MAKE_FOURCC(pDescDataTest->m_platform[0], pDescDataTest->m_platform[1], pDescDataTest->m_platform[2], pDescDataTest->m_platform[3]);
|
||||
if(testPlatform == SAVE_FILE_PLATFORM_NONE)
|
||||
{
|
||||
// new version of the descData
|
||||
DescriptionData_V2* pDescData2 = (DescriptionData_V2*)m_remoteFileInfo->fileDescription;
|
||||
m_retrievedDescData.m_descDataVersion = GetU32FromHexBytes(pDescData2->m_descDataVersion);
|
||||
m_retrievedDescData.m_savePlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3]));
|
||||
m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData2->m_platform[0], pDescData2->m_platform[1], pDescData2->m_platform[2], pDescData2->m_platform[3]);
|
||||
m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData2->m_seed);
|
||||
m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData2->m_hostOptions);
|
||||
m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData2->m_texturePack);
|
||||
@@ -58,7 +58,7 @@ void SonyRemoteStorage::SetRetrievedDescData()
|
||||
// old version,copy the data across to the new version
|
||||
DescriptionData* pDescData = (DescriptionData*)m_remoteFileInfo->fileDescription;
|
||||
m_retrievedDescData.m_descDataVersion = 1;
|
||||
m_retrievedDescData.m_savePlatform = static_cast<ESavePlatform>(MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]));
|
||||
m_retrievedDescData.m_savePlatform = (ESavePlatform)MAKE_FOURCC(pDescData->m_platform[0], pDescData->m_platform[1], pDescData->m_platform[2], pDescData->m_platform[3]);
|
||||
m_retrievedDescData.m_seed = GetU64FromHexBytes(pDescData->m_seed);
|
||||
m_retrievedDescData.m_hostOptions = GetU32FromHexBytes(pDescData->m_hostOptions);
|
||||
m_retrievedDescData.m_texturePack = GetU32FromHexBytes(pDescData->m_texturePack);
|
||||
@@ -73,7 +73,7 @@ void SonyRemoteStorage::SetRetrievedDescData()
|
||||
|
||||
void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
|
||||
{
|
||||
SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam);
|
||||
SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam;
|
||||
app.DebugPrintf("remoteStorageGetInfoCallback err : 0x%08x\n", error_code);
|
||||
if(error_code == 0)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ void getSaveInfoReturnCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int
|
||||
|
||||
static void getSaveInfoInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
|
||||
{
|
||||
SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam);
|
||||
SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam;
|
||||
if(error_code != 0)
|
||||
{
|
||||
app.DebugPrintf("getSaveInfoInitCallback err : 0x%08x\n", error_code);
|
||||
@@ -143,7 +143,7 @@ bool SonyRemoteStorage::getSaveData( const char* localDirname, CallbackFunc cb,
|
||||
|
||||
static void setSaveDataInitCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code)
|
||||
{
|
||||
SonyRemoteStorage* pRemoteStorage = static_cast<SonyRemoteStorage *>(lpParam);
|
||||
SonyRemoteStorage* pRemoteStorage = (SonyRemoteStorage*)lpParam;
|
||||
if(error_code != 0)
|
||||
{
|
||||
app.DebugPrintf("setSaveDataInitCallback err : 0x%08x\n", error_code);
|
||||
@@ -181,7 +181,7 @@ const char* SonyRemoteStorage::getLocalFilename()
|
||||
const char* SonyRemoteStorage::getSaveNameUTF8()
|
||||
{
|
||||
if(m_getInfoStatus != e_infoFound)
|
||||
return nullptr;
|
||||
return NULL;
|
||||
return m_retrievedDescData.m_saveNameUTF8;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ bool SonyRemoteStorage::setData( PSAVE_INFO info, CallbackFunc cb, LPVOID lpPara
|
||||
|
||||
int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes)
|
||||
{
|
||||
SonyRemoteStorage *pClass= static_cast<SonyRemoteStorage *>(lpParam);
|
||||
SonyRemoteStorage *pClass= (SonyRemoteStorage *)lpParam;
|
||||
|
||||
if(pClass->m_bAborting)
|
||||
{
|
||||
@@ -261,12 +261,12 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n");
|
||||
pClass->m_thumbnailData = nullptr;
|
||||
app.DebugPrintf("Thumbnail data is NULL, or has size 0\n");
|
||||
pClass->m_thumbnailData = NULL;
|
||||
pClass->m_thumbnailDataSize = 0;
|
||||
}
|
||||
|
||||
if(pClass->m_SetDataThread != nullptr)
|
||||
if(pClass->m_SetDataThread != NULL)
|
||||
delete pClass->m_SetDataThread;
|
||||
|
||||
pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread");
|
||||
@@ -277,7 +277,7 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum
|
||||
|
||||
int SonyRemoteStorage::setDataThread(void* lpParam)
|
||||
{
|
||||
SonyRemoteStorage* pClass = static_cast<SonyRemoteStorage *>(lpParam);
|
||||
SonyRemoteStorage* pClass = (SonyRemoteStorage*)lpParam;
|
||||
pClass->m_startTime = System::currentTimeMillis();
|
||||
pClass->setDataInternal();
|
||||
return 0;
|
||||
@@ -322,8 +322,8 @@ int SonyRemoteStorage::getDataProgress()
|
||||
|
||||
int64_t time = System::currentTimeMillis();
|
||||
int elapsedSecs = (time - m_startTime) / 1000;
|
||||
float estimatedTransfered = static_cast<float>(elapsedSecs * transferRatePerSec);
|
||||
int progVal = m_dataProgress + (estimatedTransfered / static_cast<float>(totalSize)) * 100;
|
||||
float estimatedTransfered = float(elapsedSecs * transferRatePerSec);
|
||||
int progVal = m_dataProgress + (estimatedTransfered / float(totalSize)) * 100;
|
||||
if(progVal > nextChunk)
|
||||
return nextChunk;
|
||||
if(progVal > 99)
|
||||
@@ -346,7 +346,7 @@ bool SonyRemoteStorage::shutdown()
|
||||
app.DebugPrintf("Term request done \n");
|
||||
m_bInitialised = false;
|
||||
free(m_memPoolBuffer);
|
||||
m_memPoolBuffer = nullptr;
|
||||
m_memPoolBuffer = NULL;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -406,11 +406,10 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData)
|
||||
unsigned int uiHostOptions;
|
||||
bool bHostOptionsRead;
|
||||
DWORD uiTexturePack;
|
||||
char seed[22];
|
||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize, reinterpret_cast<unsigned char*>(seed),
|
||||
uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||
char seed[22];
|
||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||
|
||||
int64_t iSeed = strtoll(seed, nullptr,10);
|
||||
int64_t iSeed = strtoll(seed,NULL,10);
|
||||
SetU64HexBytes(descData.m_seed, iSeed);
|
||||
// Save the host options that this world was last played with
|
||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||
@@ -449,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
|
||||
char seed[22];
|
||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||
|
||||
int64_t iSeed = strtoll(seed, nullptr,10);
|
||||
int64_t iSeed = strtoll(seed,NULL,10);
|
||||
SetU64HexBytes(descData.m_seed, iSeed);
|
||||
// Save the host options that this world was last played with
|
||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
|
||||
static int setDataThread(void* lpParam);
|
||||
|
||||
SonyRemoteStorage() : m_getInfoStatus(e_noInfoFound), m_bInitialised(false),m_memPoolBuffer(nullptr) {}
|
||||
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
||||
|
||||
protected:
|
||||
const char* getRemoteSaveFilename();
|
||||
|
||||
@@ -148,7 +148,7 @@ This should be tracked independently of saved games (restoring a save should not
|
||||
*/
|
||||
INT CTelemetryManager::GetSecondsSinceInitialize()
|
||||
{
|
||||
return static_cast<INT>(app.getAppTime() - m_initialiseTime);
|
||||
return (INT)(app.getAppTime() - m_initialiseTime);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -165,21 +165,21 @@ INT CTelemetryManager::GetMode(DWORD dwUserId)
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if( pMinecraft->localplayers[dwUserId] != nullptr && pMinecraft->localplayers[dwUserId]->level != nullptr && pMinecraft->localplayers[dwUserId]->level->getLevelData() != nullptr )
|
||||
if( pMinecraft->localplayers[dwUserId] != NULL && pMinecraft->localplayers[dwUserId]->level != NULL && pMinecraft->localplayers[dwUserId]->level->getLevelData() != NULL )
|
||||
{
|
||||
GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType();
|
||||
|
||||
if (gameType->isSurvival())
|
||||
{
|
||||
mode = static_cast<INT>(eTelem_ModeId_Survival);
|
||||
mode = (INT)eTelem_ModeId_Survival;
|
||||
}
|
||||
else if (gameType->isCreative())
|
||||
{
|
||||
mode = static_cast<INT>(eTelem_ModeId_Creative);
|
||||
mode = (INT)eTelem_ModeId_Creative;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = static_cast<INT>(eTelem_ModeId_Undefined);
|
||||
mode = (INT)eTelem_ModeId_Undefined;
|
||||
}
|
||||
}
|
||||
return mode;
|
||||
@@ -198,11 +198,11 @@ INT CTelemetryManager::GetSubMode(DWORD dwUserId)
|
||||
|
||||
if(Minecraft::GetInstance()->isTutorial())
|
||||
{
|
||||
subMode = static_cast<INT>(eTelem_SubModeId_Tutorial);
|
||||
subMode = (INT)eTelem_SubModeId_Tutorial;
|
||||
}
|
||||
else
|
||||
{
|
||||
subMode = static_cast<INT>(eTelem_SubModeId_Normal);
|
||||
subMode = (INT)eTelem_SubModeId_Normal;
|
||||
}
|
||||
|
||||
return subMode;
|
||||
@@ -220,7 +220,7 @@ INT CTelemetryManager::GetLevelId(DWORD dwUserId)
|
||||
{
|
||||
INT levelId = (INT)eTelem_LevelId_Undefined;
|
||||
|
||||
levelId = static_cast<INT>(eTelem_LevelId_PlayerGeneratedLevel);
|
||||
levelId = (INT)eTelem_LevelId_PlayerGeneratedLevel;
|
||||
|
||||
return levelId;
|
||||
}
|
||||
@@ -237,18 +237,18 @@ INT CTelemetryManager::GetSubLevelId(DWORD dwUserId)
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if(pMinecraft->localplayers[dwUserId] != nullptr)
|
||||
if(pMinecraft->localplayers[dwUserId] != NULL)
|
||||
{
|
||||
switch(pMinecraft->localplayers[dwUserId]->dimension)
|
||||
{
|
||||
case 0:
|
||||
subLevelId = static_cast<INT>(eTelem_SubLevelId_Overworld);
|
||||
subLevelId = (INT)eTelem_SubLevelId_Overworld;
|
||||
break;
|
||||
case -1:
|
||||
subLevelId = static_cast<INT>(eTelem_SubLevelId_Nether);
|
||||
subLevelId = (INT)eTelem_SubLevelId_Nether;
|
||||
break;
|
||||
case 1:
|
||||
subLevelId = static_cast<INT>(eTelem_SubLevelId_End);
|
||||
subLevelId = (INT)eTelem_SubLevelId_End;
|
||||
break;
|
||||
};
|
||||
}
|
||||
@@ -272,7 +272,7 @@ Helps differentiate level attempts when a play plays the same mode/level - espec
|
||||
*/
|
||||
INT CTelemetryManager::GetLevelInstanceID()
|
||||
{
|
||||
return static_cast<INT>(m_levelInstanceID);
|
||||
return (INT)m_levelInstanceID;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -314,19 +314,19 @@ INT CTelemetryManager::GetSingleOrMultiplayer()
|
||||
|
||||
if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0)
|
||||
{
|
||||
singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Single_Player);
|
||||
singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Single_Player;
|
||||
}
|
||||
else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0)
|
||||
{
|
||||
singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Multiplayer_Local);
|
||||
singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Local;
|
||||
}
|
||||
else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0)
|
||||
{
|
||||
singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Multiplayer_Live);
|
||||
singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Live;
|
||||
}
|
||||
else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0)
|
||||
{
|
||||
singleOrMultiplayer = static_cast<INT>(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live);
|
||||
singleOrMultiplayer = (INT)eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live;
|
||||
}
|
||||
|
||||
return singleOrMultiplayer;
|
||||
@@ -343,16 +343,16 @@ INT CTelemetryManager::GetDifficultyLevel(INT diff)
|
||||
switch(diff)
|
||||
{
|
||||
case 0:
|
||||
difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Easiest);
|
||||
difficultyLevel = (INT)eSen_DifficultyLevel_Easiest;
|
||||
break;
|
||||
case 1:
|
||||
difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Easier);
|
||||
difficultyLevel = (INT)eSen_DifficultyLevel_Easier;
|
||||
break;
|
||||
case 2:
|
||||
difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Normal);
|
||||
difficultyLevel = (INT)eSen_DifficultyLevel_Normal;
|
||||
break;
|
||||
case 3:
|
||||
difficultyLevel = static_cast<INT>(eSen_DifficultyLevel_Harder);
|
||||
difficultyLevel = (INT)eSen_DifficultyLevel_Harder;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -372,11 +372,11 @@ INT CTelemetryManager::GetLicense()
|
||||
|
||||
if(ProfileManager.IsFullVersion())
|
||||
{
|
||||
license = static_cast<INT>(eSen_License_Full_Purchased_Title);
|
||||
license = (INT)eSen_License_Full_Purchased_Title;
|
||||
}
|
||||
else
|
||||
{
|
||||
license = static_cast<INT>(eSen_License_Trial_or_Demo);
|
||||
license = (INT)eSen_License_Trial_or_Demo;
|
||||
}
|
||||
return license;
|
||||
}
|
||||
@@ -411,15 +411,15 @@ INT CTelemetryManager::GetAudioSettings(DWORD dwUserId)
|
||||
|
||||
if(volume == 0)
|
||||
{
|
||||
audioSettings = static_cast<INT>(eSen_AudioSettings_Off);
|
||||
audioSettings = (INT)eSen_AudioSettings_Off;
|
||||
}
|
||||
else if(volume == DEFAULT_VOLUME_LEVEL)
|
||||
{
|
||||
audioSettings = static_cast<INT>(eSen_AudioSettings_On_Default);
|
||||
audioSettings = (INT)eSen_AudioSettings_On_Default;
|
||||
}
|
||||
else
|
||||
{
|
||||
audioSettings = static_cast<INT>(eSen_AudioSettings_On_CustomSetting);
|
||||
audioSettings = (INT)eSen_AudioSettings_On_CustomSetting;
|
||||
}
|
||||
}
|
||||
return audioSettings;
|
||||
|
||||
@@ -61,9 +61,9 @@ void ChangeStateConstraint::tick(int iPad)
|
||||
// Send update settings packet to server
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||
{
|
||||
player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs));
|
||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ void ChangeStateConstraint::tick(int iPad)
|
||||
|
||||
if(m_changeGameMode)
|
||||
{
|
||||
if(minecraft->localgameModes[iPad] != nullptr)
|
||||
if(minecraft->localgameModes[iPad] != NULL)
|
||||
{
|
||||
m_changedFromGameMode = minecraft->localplayers[iPad]->abilities.instabuild ? GameType::CREATIVE : GameType::SURVIVAL;
|
||||
|
||||
@@ -102,9 +102,9 @@ void ChangeStateConstraint::tick(int iPad)
|
||||
// Send update settings packet to server
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||
{
|
||||
player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs));
|
||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,9 +126,9 @@ void ChangeStateConstraint::tick(int iPad)
|
||||
// Send update settings packet to server
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||
{
|
||||
player->connection->send(std::make_shared<PlayerInfoPacket>(player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs));
|
||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
public:
|
||||
virtual ConstraintType getType() { return e_ConstraintChangeState; }
|
||||
|
||||
ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = nullptr );
|
||||
ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = NULL );
|
||||
~ChangeStateConstraint();
|
||||
|
||||
virtual void tick(int iPad);
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
#include "ChoiceTask.h"
|
||||
#include "..\..\..\Minecraft.World\Material.h"
|
||||
#include "..\..\Windows64\KeyboardMouseInput.h"
|
||||
#include "Common/UI/UI.h"
|
||||
|
||||
ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
||||
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
||||
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
||||
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||
: TutorialTask( tutorial, descriptionId, false, NULL, true, false, false )
|
||||
{
|
||||
if(requiresUserInput == true)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "CompleteUsingItemTask.h"
|
||||
|
||||
CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion)
|
||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr)
|
||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL)
|
||||
{
|
||||
m_iValidItemsA= new int [itemIdsLength];
|
||||
for(int i=0;i<itemIdsLength;i++)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
||||
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount)
|
||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr, showMinimumTime )
|
||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL, showMinimumTime )
|
||||
{
|
||||
for(unsigned int i = 0; i < mappingsLength; ++i)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ private:
|
||||
bool CompletionMaskIsValid();
|
||||
public:
|
||||
ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
||||
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=nullptr, int iCompletionMaskACount=0, int iSouthpawMappings[]=nullptr, unsigned int uiSouthpawMappingsCount=0);
|
||||
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=NULL, int iCompletionMaskACount=0, int iSouthpawMappings[]=NULL, unsigned int uiSouthpawMappingsCount=0);
|
||||
~ControllerTask();
|
||||
virtual bool isCompleted();
|
||||
virtual void setAsCurrentTask(bool active = true);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
|
||||
CraftTask::CraftTask( int itemId, int auxValue, int quantity,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= nullptr*/,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= NULL*/,
|
||||
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ )
|
||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||
m_quantity( quantity ),
|
||||
@@ -17,7 +17,7 @@ CraftTask::CraftTask( int itemId, int auxValue, int quantity,
|
||||
}
|
||||
|
||||
CraftTask::CraftTask( int *items, int *auxValues, int numItems, int quantity,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= nullptr*/,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= NULL*/,
|
||||
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ )
|
||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||
m_quantity( quantity ),
|
||||
|
||||
@@ -5,10 +5,10 @@ class CraftTask : public TutorialTask
|
||||
{
|
||||
public:
|
||||
CraftTask( int itemId, int auxValue, int quantity,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL,
|
||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true );
|
||||
CraftTask( int *items, int *auxValues, int numItems, int quantity,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL,
|
||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true );
|
||||
|
||||
~CraftTask();
|
||||
|
||||
@@ -22,7 +22,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri
|
||||
|
||||
int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||
{
|
||||
if(item != nullptr)
|
||||
if(item != NULL)
|
||||
{
|
||||
bool itemFound = false;
|
||||
for(unsigned int i=0;i<m_iItemsCount;i++)
|
||||
@@ -48,7 +48,7 @@ int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||
|
||||
int DiggerItemHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity)
|
||||
{
|
||||
if(item != nullptr)
|
||||
if(item != NULL)
|
||||
{
|
||||
bool itemFound = false;
|
||||
for(unsigned int i=0;i<m_iItemsCount;i++)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
EffectChangedTask::EffectChangedTask(Tutorial *tutorial, int descriptionId, MobEffect *effect, bool apply,
|
||||
bool enablePreCompletion, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders )
|
||||
: TutorialTask(tutorial,descriptionId,enablePreCompletion,nullptr,bShowMinimumTime,bAllowFade,bTaskReminders)
|
||||
: TutorialTask(tutorial,descriptionId,enablePreCompletion,NULL,bShowMinimumTime,bAllowFade,bTaskReminders)
|
||||
{
|
||||
m_effect = effect;
|
||||
m_apply = apply;
|
||||
|
||||
@@ -154,10 +154,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
addTask(e_Tutorial_State_Gameplay, new UseItemTask(Item::door_wood->id, this, IDS_TUTORIAL_TASK_PLACE_DOOR) );
|
||||
addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::torch_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_TORCH) );
|
||||
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
vector<TutorialConstraint *> *areaConstraints = new vector<TutorialConstraint *>();
|
||||
areaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -283,10 +283,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* MINECART
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"minecartArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Minecart, IDS_TUTORIAL_HINT_MINECART, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) );
|
||||
}
|
||||
@@ -298,10 +298,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* BOAT
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Boat, IDS_TUTORIAL_HINT_BOAT, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) );
|
||||
}
|
||||
@@ -313,10 +313,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* FISHING
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Fishing, IDS_TUTORIAL_HINT_FISHING, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) );
|
||||
}
|
||||
@@ -328,10 +328,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* PISTON - SELF-REPAIRING BRIDGE
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_None, IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1, true ) );
|
||||
}
|
||||
@@ -343,10 +343,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* PISTON - PISTON AND REDSTONE CIRCUITS
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State redstoneAndPistonStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Redstone_And_Piston, redstoneAndPistonStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -368,10 +368,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* PORTAL
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Portal, portalStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -391,10 +391,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* CREATIVE
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"creativeArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_CreativeMode, creativeStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1,true,true,GameType::CREATIVE) );
|
||||
@@ -411,7 +411,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
ProcedureCompoundTask *creativeFinalTask = new ProcedureCompoundTask( this );
|
||||
|
||||
AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea");
|
||||
if(exitArea != nullptr)
|
||||
if(exitArea != NULL)
|
||||
{
|
||||
vector<TutorialConstraint *> *creativeExitAreaConstraints = new vector<TutorialConstraint *>();
|
||||
creativeExitAreaConstraints->push_back( new AreaConstraint( -1, exitArea->x0,exitArea->y0,exitArea->z0,exitArea->x1,exitArea->y1,exitArea->z1,true,false) );
|
||||
@@ -434,10 +434,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* BREWING
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -467,10 +467,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* ENCHANTING
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enchanting, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -492,10 +492,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* ANVIL
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -517,10 +517,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* TRADING
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Trading, tradingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -541,10 +541,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* FIREWORKS
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -563,10 +563,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* BEACON
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -585,10 +585,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* HOPPER
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -610,10 +610,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* ENDERCHEST
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enderchests, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -632,10 +632,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* FARMING
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -661,10 +661,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* BREEDING
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"breedingArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
@@ -689,10 +689,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
|
||||
* SNOW AND IRON GOLEM
|
||||
*
|
||||
*/
|
||||
if(app.getGameRuleDefinitions() != nullptr)
|
||||
if(app.getGameRuleDefinitions() != NULL)
|
||||
{
|
||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea");
|
||||
if(area != nullptr)
|
||||
if(area != NULL)
|
||||
{
|
||||
eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay};
|
||||
AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Golem, golemStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "FullTutorialActiveTask.h"
|
||||
|
||||
FullTutorialActiveTask::FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/)
|
||||
: TutorialTask( tutorial, -1, false, nullptr, false, false, false )
|
||||
: TutorialTask( tutorial, -1, false, NULL, false, false, false )
|
||||
{
|
||||
m_completeAction = completeAction;
|
||||
}
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
#include "InfoTask.h"
|
||||
#include "..\..\..\Minecraft.World\Material.h"
|
||||
#include "..\..\Windows64\KeyboardMouseInput.h"
|
||||
#include "Common/UI/UI.h"
|
||||
|
||||
InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
||||
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||
: TutorialTask( tutorial, descriptionId, false, NULL, true, false, false )
|
||||
{
|
||||
if(requiresUserInput == true)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ class PickupTask : public TutorialTask
|
||||
{
|
||||
public:
|
||||
PickupTask( int itemId, unsigned int quantity, int auxValue,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL,
|
||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true )
|
||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||
m_itemId( itemId),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user