mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Updated NULL to nullptr and fixing some type issues
This commit is contained in:
parent
31c2699a32
commit
6d1d3b59cb
|
|
@ -51,7 +51,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||||
glColor4f(1, 1, 1, 1);
|
glColor4f(1, 1, 1, 1);
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
Slot *hoveredSlot = NULL;
|
Slot *hoveredSlot = nullptr;
|
||||||
|
|
||||||
for ( Slot *slot : *menu->slots )
|
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;
|
shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
||||||
if (inventory->getCarried() != NULL)
|
if (inventory->getCarried() != nullptr)
|
||||||
{
|
{
|
||||||
glTranslatef(0, 0, 32);
|
glTranslatef(0, 0, 32);
|
||||||
// Slot old = carriedSlot;
|
// Slot old = carriedSlot;
|
||||||
|
|
@ -90,7 +90,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||||
|
|
||||||
renderLabels();
|
renderLabels();
|
||||||
|
|
||||||
if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem())
|
if (inventory->getCarried() == nullptr && hoveredSlot != nullptr && hoveredSlot->hasItem())
|
||||||
{
|
{
|
||||||
|
|
||||||
wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
||||||
|
|
@ -127,7 +127,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
|
||||||
int y = slot->y;
|
int y = slot->y;
|
||||||
shared_ptr<ItemInstance> item = slot->getItem();
|
shared_ptr<ItemInstance> item = slot->getItem();
|
||||||
|
|
||||||
if (item == NULL)
|
if (item == nullptr)
|
||||||
{
|
{
|
||||||
int icon = slot->getNoItemIcon();
|
int icon = slot->getNoItemIcon();
|
||||||
if (icon >= 0)
|
if (icon >= 0)
|
||||||
|
|
@ -151,7 +151,7 @@ Slot *AbstractContainerScreen::findSlot(int x, int y)
|
||||||
{
|
{
|
||||||
if (isHovering(slot, x, y)) return slot;
|
if (isHovering(slot, x, y)) return slot;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractContainerScreen::isHovering(Slot *slot, int xm, int ym)
|
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);
|
bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight);
|
||||||
|
|
||||||
int slotId = -1;
|
int slotId = -1;
|
||||||
if (slot != NULL) slotId = slot->index;
|
if (slot != nullptr) slotId = slot->index;
|
||||||
|
|
||||||
if (clickedOutside)
|
if (clickedOutside)
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +210,7 @@ void AbstractContainerScreen::keyPressed(wchar_t eventCharacter, int eventKey)
|
||||||
|
|
||||||
void AbstractContainerScreen::removed()
|
void AbstractContainerScreen::removed()
|
||||||
{
|
{
|
||||||
if (minecraft->player == NULL) return;
|
if (minecraft->player == nullptr) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
|
void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,16 @@ AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &na
|
||||||
{
|
{
|
||||||
// 4J init
|
// 4J init
|
||||||
textureId = -1;
|
textureId = -1;
|
||||||
m_colourTable = NULL;
|
m_colourTable = nullptr;
|
||||||
|
|
||||||
|
|
||||||
this->file = file;
|
this->file = file;
|
||||||
this->fallback = fallback;
|
this->fallback = fallback;
|
||||||
|
|
||||||
m_iconData = NULL;
|
m_iconData = nullptr;
|
||||||
m_iconSize = 0;
|
m_iconSize = 0;
|
||||||
|
|
||||||
m_comparisonData = NULL;
|
m_comparisonData = nullptr;
|
||||||
m_comparisonSize = 0;
|
m_comparisonSize = 0;
|
||||||
|
|
||||||
// 4J Stu - These calls need to be in the most derived version of the class
|
// 4J Stu - These calls need to be in the most derived version of the class
|
||||||
|
|
@ -41,7 +41,7 @@ void AbstractTexturePack::loadIcon()
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||||
|
|
||||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png");
|
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png");
|
||||||
|
|
||||||
UINT size = 0;
|
UINT size = 0;
|
||||||
|
|
@ -57,7 +57,7 @@ void AbstractTexturePack::loadComparison()
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||||
|
|
||||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png");
|
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png");
|
||||||
|
|
||||||
UINT size = 0;
|
UINT size = 0;
|
||||||
|
|
@ -70,8 +70,8 @@ void AbstractTexturePack::loadDescription()
|
||||||
{
|
{
|
||||||
// 4J Unused currently
|
// 4J Unused currently
|
||||||
#if 0
|
#if 0
|
||||||
InputStream *inputStream = NULL;
|
InputStream *inputStream = nullptr;
|
||||||
BufferedReader *br = NULL;
|
BufferedReader *br = nullptr;
|
||||||
//try {
|
//try {
|
||||||
inputStream = getResourceImplementation(L"/pack.txt");
|
inputStream = getResourceImplementation(L"/pack.txt");
|
||||||
br = new BufferedReader(new InputStreamReader(inputStream));
|
br = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
|
@ -81,12 +81,12 @@ void AbstractTexturePack::loadDescription()
|
||||||
//} finally {
|
//} finally {
|
||||||
// TODO [EB]: use IOUtils.closeSilently()
|
// TODO [EB]: use IOUtils.closeSilently()
|
||||||
// try {
|
// try {
|
||||||
if (br != NULL)
|
if (br != nullptr)
|
||||||
{
|
{
|
||||||
br->close();
|
br->close();
|
||||||
delete br;
|
delete br;
|
||||||
}
|
}
|
||||||
if (inputStream != NULL)
|
if (inputStream != nullptr)
|
||||||
{
|
{
|
||||||
inputStream->close();
|
inputStream->close();
|
||||||
delete inputStream;
|
delete inputStream;
|
||||||
|
|
@ -105,7 +105,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
|
||||||
{
|
{
|
||||||
app.DebugPrintf("texture - %ls\n",name.c_str());
|
app.DebugPrintf("texture - %ls\n",name.c_str());
|
||||||
InputStream *is = getResourceImplementation(name);
|
InputStream *is = getResourceImplementation(name);
|
||||||
if (is == NULL && fallback != NULL && allowFallback)
|
if (is == nullptr && fallback != nullptr && allowFallback)
|
||||||
{
|
{
|
||||||
is = fallback->getResource(name, true);
|
is = fallback->getResource(name, true);
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +121,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
|
||||||
|
|
||||||
void AbstractTexturePack::unload(Textures *textures)
|
void AbstractTexturePack::unload(Textures *textures)
|
||||||
{
|
{
|
||||||
if (iconImage != NULL && textureId != -1)
|
if (iconImage != nullptr && textureId != -1)
|
||||||
{
|
{
|
||||||
textures->releaseTexture(textureId);
|
textures->releaseTexture(textureId);
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ void AbstractTexturePack::unload(Textures *textures)
|
||||||
|
|
||||||
void AbstractTexturePack::load(Textures *textures)
|
void AbstractTexturePack::load(Textures *textures)
|
||||||
{
|
{
|
||||||
if (iconImage != NULL)
|
if (iconImage != nullptr)
|
||||||
{
|
{
|
||||||
if (textureId == -1)
|
if (textureId == -1)
|
||||||
{
|
{
|
||||||
|
|
@ -149,7 +149,7 @@ bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback)
|
||||||
{
|
{
|
||||||
bool hasFile = this->hasFile(name);
|
bool hasFile = this->hasFile(name);
|
||||||
|
|
||||||
return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile;
|
return !hasFile && (allowFallback && fallback != nullptr) ? fallback->hasFile(name, allowFallback) : hasFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD AbstractTexturePack::getId()
|
DWORD AbstractTexturePack::getId()
|
||||||
|
|
@ -231,7 +231,7 @@ void AbstractTexturePack::loadDefaultUI()
|
||||||
{
|
{
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
// load from the .xzp file
|
// load from the .xzp file
|
||||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||||
|
|
||||||
// Load new skin
|
// Load new skin
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
|
|
@ -240,7 +240,7 @@ void AbstractTexturePack::loadDefaultUI()
|
||||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");
|
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");
|
||||||
|
|
||||||
XuiFreeVisuals(L"");
|
XuiFreeVisuals(L"");
|
||||||
app.LoadSkin(szResourceLocator,NULL);//L"TexturePack");
|
app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack");
|
||||||
//CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
|
//CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
|
||||||
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
||||||
#else
|
#else
|
||||||
|
|
@ -259,7 +259,7 @@ void AbstractTexturePack::loadDefaultColourTable()
|
||||||
// Load the file
|
// Load the file
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
// need to check if it's a BD build, so pass in the name
|
// need to check if it's a BD build, so pass in the name
|
||||||
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col"));
|
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":nullptr).append(L"res/colours.col"));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
|
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
|
||||||
|
|
@ -269,12 +269,12 @@ void AbstractTexturePack::loadDefaultColourTable()
|
||||||
if(coloursFile.exists())
|
if(coloursFile.exists())
|
||||||
{
|
{
|
||||||
DWORD dwLength = coloursFile.length();
|
DWORD dwLength = coloursFile.length();
|
||||||
byteArray data(dwLength);
|
byteArray data(static_cast<unsigned int>(dwLength));
|
||||||
|
|
||||||
FileInputStream fis(coloursFile);
|
FileInputStream fis(coloursFile);
|
||||||
fis.read(data,0,dwLength);
|
fis.read(data,0,dwLength);
|
||||||
fis.close();
|
fis.close();
|
||||||
if(m_colourTable != NULL) delete m_colourTable;
|
if(m_colourTable != nullptr) delete m_colourTable;
|
||||||
m_colourTable = new ColourTable(data.data, dwLength);
|
m_colourTable = new ColourTable(data.data, dwLength);
|
||||||
|
|
||||||
delete [] data.data;
|
delete [] data.data;
|
||||||
|
|
@ -290,7 +290,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
|
||||||
{
|
{
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
// load from the .xzp file
|
// load from the .xzp file
|
||||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||||
|
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||||
|
|
@ -309,7 +309,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
|
||||||
{
|
{
|
||||||
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/");
|
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/");
|
||||||
HXUIOBJ hScene;
|
HXUIOBJ hScene;
|
||||||
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene);
|
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", nullptr, &hScene);
|
||||||
|
|
||||||
if(HRESULT_SUCCEEDED(hr))
|
if(HRESULT_SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
|
|
@ -333,7 +333,7 @@ void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj)
|
||||||
HXUIOBJ child;
|
HXUIOBJ child;
|
||||||
HRESULT hr = XuiElementGetFirstChild(hObj, &child);
|
HRESULT hr = XuiElementGetFirstChild(hObj, &child);
|
||||||
|
|
||||||
while(HRESULT_SUCCEEDED(hr) && child != NULL)
|
while(HRESULT_SUCCEEDED(hr) && child != nullptr)
|
||||||
{
|
{
|
||||||
LPCWSTR childName;
|
LPCWSTR childName;
|
||||||
XuiElementGetId(child,&childName);
|
XuiElementGetId(child,&childName);
|
||||||
|
|
@ -374,7 +374,7 @@ void AbstractTexturePack::unloadUI()
|
||||||
|
|
||||||
wstring AbstractTexturePack::getXuiRootPath()
|
wstring AbstractTexturePack::getXuiRootPath()
|
||||||
{
|
{
|
||||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
|
||||||
|
|
||||||
// Load new skin
|
// Load new skin
|
||||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||||
|
|
@ -386,14 +386,14 @@ wstring AbstractTexturePack::getXuiRootPath()
|
||||||
|
|
||||||
PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes)
|
PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes)
|
||||||
{
|
{
|
||||||
if(m_iconSize == 0 || m_iconData == NULL) loadIcon();
|
if(m_iconSize == 0 || m_iconData == nullptr) loadIcon();
|
||||||
dwImageBytes = m_iconSize;
|
dwImageBytes = m_iconSize;
|
||||||
return m_iconData;
|
return m_iconData;
|
||||||
}
|
}
|
||||||
|
|
||||||
PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes)
|
PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes)
|
||||||
{
|
{
|
||||||
if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison();
|
if(m_comparisonSize == 0 || m_comparisonData == nullptr) loadComparison();
|
||||||
|
|
||||||
dwImageBytes = m_comparisonSize;
|
dwImageBytes = m_comparisonSize;
|
||||||
return m_comparisonData;
|
return m_comparisonData;
|
||||||
|
|
|
||||||
|
|
@ -89,5 +89,5 @@ public:
|
||||||
virtual unsigned int getDLCParentPackId();
|
virtual unsigned int getDLCParentPackId();
|
||||||
virtual unsigned char getDLCSubPackId();
|
virtual unsigned char getDLCSubPackId();
|
||||||
virtual ColourTable *getColourTable() { return m_colourTable; }
|
virtual ColourTable *getColourTable() { return m_colourTable; }
|
||||||
virtual ArchiveFile *getArchiveFile() { return NULL; }
|
virtual ArchiveFile *getArchiveFile() { return nullptr; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ AchievementPopup::AchievementPopup(Minecraft *mc)
|
||||||
// 4J - added initialisers
|
// 4J - added initialisers
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
ach = NULL;
|
ach = nullptr;
|
||||||
startTime = 0;
|
startTime = 0;
|
||||||
isHelper = false;
|
isHelper = false;
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ void AchievementPopup::render()
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
if (ach == NULL || startTime == 0) return;
|
if (ach == nullptr || startTime == 0) return;
|
||||||
|
|
||||||
double time = (System::currentTimeMillis() - startTime) / 3000.0;
|
double time = (System::currentTimeMillis() - startTime) / 3000.0;
|
||||||
if (isHelper)
|
if (isHelper)
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void AchievementScreen::buttonClicked(Button *button)
|
||||||
{
|
{
|
||||||
if (button->id == 1)
|
if (button->id == 1)
|
||||||
{
|
{
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(nullptr);
|
||||||
// minecraft->grabMouse(); // 4J removed
|
// minecraft->grabMouse(); // 4J removed
|
||||||
}
|
}
|
||||||
Screen::buttonClicked(button);
|
Screen::buttonClicked(button);
|
||||||
|
|
@ -62,7 +62,7 @@ void AchievementScreen::keyPressed(char eventCharacter, int eventKey)
|
||||||
{
|
{
|
||||||
if (eventKey == minecraft->options->keyBuild->key)
|
if (eventKey == minecraft->options->keyBuild->key)
|
||||||
{
|
{
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(nullptr);
|
||||||
// minecraft->grabMouse(); // 4J removed
|
// minecraft->grabMouse(); // 4J removed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -286,7 +286,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||||
vLine(x2, y1, y2, color);
|
vLine(x2, y1, y2, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
Achievement *hoveredAchievement = NULL;
|
Achievement *hoveredAchievement = nullptr;
|
||||||
ItemRenderer *ir = new ItemRenderer();
|
ItemRenderer *ir = new ItemRenderer();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
@ -372,7 +372,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
Screen::render(xm, ym, a);
|
Screen::render(xm, ym, a);
|
||||||
|
|
||||||
if (hoveredAchievement != NULL)
|
if (hoveredAchievement != nullptr)
|
||||||
{
|
{
|
||||||
Achievement *ach = hoveredAchievement;
|
Achievement *ach = hoveredAchievement;
|
||||||
wstring name = ach->name;
|
wstring name = ach->name;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ void ArchiveFile::_readHeader(DataInputStream *dis)
|
||||||
|
|
||||||
ArchiveFile::ArchiveFile(File file)
|
ArchiveFile::ArchiveFile(File file)
|
||||||
{
|
{
|
||||||
m_cachedData = NULL;
|
m_cachedData = nullptr;
|
||||||
m_sourcefile = file;
|
m_sourcefile = file;
|
||||||
app.DebugPrintf("Loading archive file...\n");
|
app.DebugPrintf("Loading archive file...\n");
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
|
|
@ -48,7 +48,7 @@ ArchiveFile::ArchiveFile(File file)
|
||||||
FileInputStream fis(file);
|
FileInputStream fis(file);
|
||||||
|
|
||||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||||
byteArray readArray(file.length());
|
byteArray readArray(static_cast<unsigned int>(file.length()));
|
||||||
fis.read(readArray,0,file.length());
|
fis.read(readArray,0,file.length());
|
||||||
|
|
||||||
ByteArrayInputStream bais(readArray);
|
ByteArrayInputStream bais(readArray);
|
||||||
|
|
@ -122,20 +122,20 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||||
HANDLE hfile = CreateFile( m_sourcefile.getPath().c_str(),
|
HANDLE hfile = CreateFile( m_sourcefile.getPath().c_str(),
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL
|
nullptr
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
app.DebugPrintf("Createfile archive\n");
|
app.DebugPrintf("Createfile archive\n");
|
||||||
HANDLE hfile = CreateFile( wstringtofilename(m_sourcefile.getPath()),
|
HANDLE hfile = CreateFile( wstringtofilename(m_sourcefile.getPath()),
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL
|
nullptr
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||||
app.DebugPrintf("hfile ok\n");
|
app.DebugPrintf("hfile ok\n");
|
||||||
DWORD ok = SetFilePointer( hfile,
|
DWORD ok = SetFilePointer( hfile,
|
||||||
data->ptr,
|
data->ptr,
|
||||||
NULL,
|
nullptr,
|
||||||
FILE_BEGIN
|
FILE_BEGIN
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||||
(LPVOID) pbData,
|
(LPVOID) pbData,
|
||||||
data->filesize,
|
data->filesize,
|
||||||
&bytesRead,
|
&bytesRead,
|
||||||
NULL
|
nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
if(bSuccess==FALSE)
|
if(bSuccess==FALSE)
|
||||||
|
|
@ -182,7 +182,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Compressed filenames are preceeded with an asterisk.
|
// Compressed filenames are preceeded with an asterisk.
|
||||||
if ( data->isCompressed && out.data != NULL )
|
if ( data->isCompressed && out.data != nullptr )
|
||||||
{
|
{
|
||||||
/* 4J-JEV:
|
/* 4J-JEV:
|
||||||
* If a compressed file is accessed before compression object is
|
* If a compressed file is accessed before compression object is
|
||||||
|
|
@ -204,7 +204,7 @@ byteArray ArchiveFile::getFile(const wstring &filename)
|
||||||
out.length = decompressedSize;
|
out.length = decompressedSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(out.data != NULL); // THERE IS NO FILE WITH THIS NAME!
|
assert(out.data != nullptr); // THERE IS NO FILE WITH THIS NAME!
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 v1 = v0 + 0.999f / 16.0f / 4;
|
||||||
float r = 0.1f * size;
|
float r = 0.1f * size;
|
||||||
|
|
||||||
if (tex != NULL)
|
if (tex != nullptr)
|
||||||
{
|
{
|
||||||
u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||||
u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ BufferedImage::BufferedImage(int width,int height,int type)
|
||||||
|
|
||||||
for( int i = 1 ; i < 10; i++ )
|
for( int i = 1 ; i < 10; i++ )
|
||||||
{
|
{
|
||||||
data[i] = NULL;
|
data[i] = nullptr;
|
||||||
}
|
}
|
||||||
this->width = width;
|
this->width = width;
|
||||||
this->height = height;
|
this->height = height;
|
||||||
|
|
@ -140,7 +140,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
|
||||||
|
|
||||||
for( int l = 0 ; l < 10; l++ )
|
for( int l = 0 ; l < 10; l++ )
|
||||||
{
|
{
|
||||||
data[l] = NULL;
|
data[l] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int l = 0; l < 10; l++ )
|
for( int l = 0; l < 10; l++ )
|
||||||
|
|
@ -193,12 +193,12 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
wstring filePath = File;
|
wstring filePath = File;
|
||||||
BYTE *pbData = NULL;
|
BYTE *pbData = nullptr;
|
||||||
DWORD dwBytes = 0;
|
DWORD dwBytes = 0;
|
||||||
|
|
||||||
for( int l = 0 ; l < 10; l++ )
|
for( int l = 0 ; l < 10; l++ )
|
||||||
{
|
{
|
||||||
data[l] = NULL;
|
data[l] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int l = 0; l < 10; l++ )
|
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);
|
DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
|
||||||
pbData = dlcFile->getData(dwBytes);
|
pbData = dlcFile->getData(dwBytes);
|
||||||
if(pbData == NULL || dwBytes == 0)
|
if(pbData == nullptr || dwBytes == 0)
|
||||||
{
|
{
|
||||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||||
if( l == 0 )
|
if( l == 0 )
|
||||||
|
|
@ -269,7 +269,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes)
|
||||||
int iCurrentByte=0;
|
int iCurrentByte=0;
|
||||||
for( int l = 0 ; l < 10; l++ )
|
for( int l = 0 ; l < 10; l++ )
|
||||||
{
|
{
|
||||||
data[l] = NULL;
|
data[l] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DXIMAGE_INFO ImageInfo;
|
D3DXIMAGE_INFO ImageInfo;
|
||||||
|
|
@ -329,7 +329,7 @@ int *BufferedImage::getData(int level)
|
||||||
|
|
||||||
Graphics *BufferedImage::getGraphics()
|
Graphics *BufferedImage::getGraphics()
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns the transparency. Returns either OPAQUE, BITMASK, or TRANSLUCENT.
|
//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);
|
this->getRGB(x, y, w, h, arrayWrapper,0,w);
|
||||||
|
|
||||||
int level = 1;
|
int level = 1;
|
||||||
while(getData(level) != NULL)
|
while(getData(level) != nullptr)
|
||||||
{
|
{
|
||||||
int ww = w >> level;
|
int ww = w >> level;
|
||||||
int hh = h >> level;
|
int hh = h >> level;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class DLCPack;
|
||||||
class BufferedImage
|
class BufferedImage
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int *data[10]; // Arrays for mipmaps - NULL if not used
|
int *data[10]; // Arrays for mipmaps - nullptr if not used
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
void ByteFlip4(unsigned int &data); // 4J added
|
void ByteFlip4(unsigned int &data); // 4J added
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||||
{
|
{
|
||||||
if (eventKey == Keyboard::KEY_ESCAPE)
|
if (eventKey == Keyboard::KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (eventKey == Keyboard::KEY_RETURN)
|
if (eventKey == Keyboard::KEY_RETURN)
|
||||||
|
|
@ -44,7 +44,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||||
minecraft->player->chat(trim);
|
minecraft->player->chat(trim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (eventKey == Keyboard::KEY_BACK && message.length() > 0) message = message.substr(0, message.length() - 1);
|
if (eventKey == Keyboard::KEY_BACK && message.length() > 0) message = message.substr(0, message.length() - 1);
|
||||||
|
|
@ -67,7 +67,7 @@ void ChatScreen::mouseClicked(int x, int y, int buttonNum)
|
||||||
{
|
{
|
||||||
if (buttonNum == 0)
|
if (buttonNum == 0)
|
||||||
{
|
{
|
||||||
if (minecraft->gui->selectedName != L"") // 4J - was NULL comparison
|
if (minecraft->gui->selectedName != L"") // 4J - was nullptr comparison
|
||||||
{
|
{
|
||||||
if (message.length() > 0 && message[message.length()-1]!=L' ')
|
if (message.length() > 0 && message[message.length()-1]!=L' ')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
|
||||||
Tile *tile = chest->getTile();
|
Tile *tile = chest->getTile();
|
||||||
data = chest->getData();
|
data = chest->getData();
|
||||||
|
|
||||||
if (dynamic_cast<ChestTile*>(tile) != NULL && data == 0)
|
if (dynamic_cast<ChestTile*>(tile) != nullptr && data == 0)
|
||||||
{
|
{
|
||||||
static_cast<ChestTile *>(tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z);
|
static_cast<ChestTile *>(tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z);
|
||||||
data = chest->getData();
|
data = chest->getData();
|
||||||
|
|
@ -60,11 +60,11 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
|
||||||
|
|
||||||
chest->checkNeighbors();
|
chest->checkNeighbors();
|
||||||
}
|
}
|
||||||
if (chest->n.lock() != NULL || chest->w.lock() != NULL) return;
|
if (chest->n.lock() != nullptr || chest->w.lock() != nullptr) return;
|
||||||
|
|
||||||
|
|
||||||
ChestModel *model;
|
ChestModel *model;
|
||||||
if (chest->e.lock() != NULL || chest->s.lock() != NULL)
|
if (chest->e.lock() != nullptr || chest->s.lock() != nullptr)
|
||||||
{
|
{
|
||||||
model = largeChestModel;
|
model = largeChestModel;
|
||||||
|
|
||||||
|
|
@ -112,11 +112,11 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
|
||||||
if (data == 4) rot = 90;
|
if (data == 4) rot = 90;
|
||||||
if (data == 5) rot = -90;
|
if (data == 5) rot = -90;
|
||||||
|
|
||||||
if (data == 2 && chest->e.lock() != NULL)
|
if (data == 2 && chest->e.lock() != nullptr)
|
||||||
{
|
{
|
||||||
glTranslatef(1, 0, 0);
|
glTranslatef(1, 0, 0);
|
||||||
}
|
}
|
||||||
if (data == 5 && chest->s.lock() != NULL)
|
if (data == 5 && chest->s.lock() != nullptr)
|
||||||
{
|
{
|
||||||
glTranslatef(0, 0, -1);
|
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);
|
glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||||
|
|
||||||
float open = chest->oOpenness + (chest->openness - chest->oOpenness) * a;
|
float open = chest->oOpenness + (chest->openness - chest->oOpenness) * a;
|
||||||
if (chest->n.lock() != NULL)
|
if (chest->n.lock() != nullptr)
|
||||||
{
|
{
|
||||||
float open2 = chest->n.lock()->oOpenness + (chest->n.lock()->openness - chest->n.lock()->oOpenness) * a;
|
float open2 = chest->n.lock()->oOpenness + (chest->n.lock()->openness - chest->n.lock()->oOpenness) * a;
|
||||||
if (open2 > open) open = open2;
|
if (open2 > open) open = open2;
|
||||||
}
|
}
|
||||||
if (chest->w.lock() != NULL)
|
if (chest->w.lock() != nullptr)
|
||||||
{
|
{
|
||||||
float open2 = chest->w.lock()->oOpenness + (chest->w.lock()->openness - chest->w.lock()->oOpenness) * a;
|
float open2 = chest->w.lock()->oOpenness + (chest->w.lock()->openness - chest->w.lock()->oOpenness) * a;
|
||||||
if (open2 > open) open = open2;
|
if (open2 > open) open = open2;
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ void Chunk::makeCopyForRebuild(Chunk *source)
|
||||||
this->ym = source->ym;
|
this->ym = source->ym;
|
||||||
this->zm = source->zm;
|
this->zm = source->zm;
|
||||||
this->bb = source->bb;
|
this->bb = source->bb;
|
||||||
this->clipChunk = NULL;
|
this->clipChunk = nullptr;
|
||||||
this->id = source->id;
|
this->id = source->id;
|
||||||
this->globalRenderableTileEntities = source->globalRenderableTileEntities;
|
this->globalRenderableTileEntities = source->globalRenderableTileEntities;
|
||||||
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs;
|
||||||
|
|
@ -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
|
// 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
|
// 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.
|
// the cache anyway.
|
||||||
ChunkRebuildData* pOutData = NULL;
|
ChunkRebuildData* pOutData = nullptr;
|
||||||
g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0);
|
g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0);
|
||||||
|
|
||||||
Tesselator::Bounds bounds;
|
Tesselator::Bounds bounds;
|
||||||
|
|
@ -981,7 +981,7 @@ void Chunk::reset()
|
||||||
void Chunk::_delete()
|
void Chunk::_delete()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
level = NULL;
|
level = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Chunk::getList(int layer)
|
int Chunk::getList(int layer)
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, const wstring& ip, int
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
delete socket;
|
delete socket;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -106,9 +106,9 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs
|
||||||
// 4J - added initiliasers
|
// 4J - added initiliasers
|
||||||
random = new Random();
|
random = new Random();
|
||||||
done = false;
|
done = false;
|
||||||
level = NULL;
|
level = nullptr;
|
||||||
started = false;
|
started = false;
|
||||||
savedDataStorage = new SavedDataStorage(NULL);
|
savedDataStorage = new SavedDataStorage(nullptr);
|
||||||
maxPlayers = 20;
|
maxPlayers = 20;
|
||||||
|
|
||||||
this->minecraft = minecraft;
|
this->minecraft = minecraft;
|
||||||
|
|
@ -122,7 +122,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs
|
||||||
m_userIndex = iUserIndex;
|
m_userIndex = iUserIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( socket == NULL )
|
if( socket == nullptr )
|
||||||
{
|
{
|
||||||
socket = new Socket(); // 4J - Local connection
|
socket = new Socket(); // 4J - Local connection
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +134,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
// TODO 4J Stu - This will cause issues since the session player owns the socket
|
// TODO 4J Stu - This will cause issues since the session player owns the socket
|
||||||
//delete socket;
|
//delete socket;
|
||||||
}
|
}
|
||||||
|
|
@ -157,8 +157,8 @@ void ClientConnection::tick()
|
||||||
|
|
||||||
INetworkPlayer *ClientConnection::getNetworkPlayer()
|
INetworkPlayer *ClientConnection::getNetworkPlayer()
|
||||||
{
|
{
|
||||||
if( connection != NULL && connection->getSocket() != NULL) return connection->getSocket()->getPlayer();
|
if( connection != nullptr && connection->getSocket() != nullptr) return connection->getSocket()->getPlayer();
|
||||||
else return NULL;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
|
|
@ -167,7 +167,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
|
|
||||||
PlayerUID OnlineXuid;
|
PlayerUID OnlineXuid;
|
||||||
ProfileManager.GetXUID(m_userIndex,&OnlineXuid,true); // online xuid
|
ProfileManager.GetXUID(m_userIndex,&OnlineXuid,true); // online xuid
|
||||||
MOJANG_DATA *pMojangData = NULL;
|
MOJANG_DATA *pMojangData = nullptr;
|
||||||
|
|
||||||
if(!g_NetworkManager.IsLocalGame())
|
if(!g_NetworkManager.IsLocalGame())
|
||||||
{
|
{
|
||||||
|
|
@ -208,7 +208,7 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
|
|
||||||
if(iUserID!=-1)
|
if(iUserID!=-1)
|
||||||
{
|
{
|
||||||
BYTE *pBuffer=NULL;
|
BYTE *pBuffer=nullptr;
|
||||||
DWORD dwSize=0;
|
DWORD dwSize=0;
|
||||||
bool bRes;
|
bool bRes;
|
||||||
|
|
||||||
|
|
@ -285,17 +285,17 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
|
|
||||||
|
|
||||||
Level *dimensionLevel = minecraft->getLevel( packet->dimension );
|
Level *dimensionLevel = minecraft->getLevel( packet->dimension );
|
||||||
if( dimensionLevel == NULL )
|
if( dimensionLevel == nullptr )
|
||||||
{
|
{
|
||||||
level = new MultiPlayerLevel(this, new LevelSettings(packet->seed, GameType::byId(packet->gameType), false, false, packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty);
|
level = new MultiPlayerLevel(this, new LevelSettings(packet->seed, GameType::byId(packet->gameType), false, false, packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty);
|
||||||
|
|
||||||
// 4J Stu - We want to share the SavedDataStorage between levels
|
// 4J Stu - We want to share the SavedDataStorage between levels
|
||||||
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
||||||
Level *activeLevel = minecraft->getLevel(otherDimensionId);
|
Level *activeLevel = minecraft->getLevel(otherDimensionId);
|
||||||
if( activeLevel != NULL )
|
if( activeLevel != nullptr )
|
||||||
{
|
{
|
||||||
// Don't need to delete it here as it belongs to a client connection while will delete it when it's done
|
// Don't need to delete it here as it belongs to a client connection while will delete it when it's done
|
||||||
//if( level->savedDataStorage != NULL ) delete level->savedDataStorage;
|
//if( level->savedDataStorage != nullptr ) delete level->savedDataStorage;
|
||||||
level->savedDataStorage = activeLevel->savedDataStorage;
|
level->savedDataStorage = activeLevel->savedDataStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,12 +341,12 @@ void ClientConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||||
level = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension );
|
level = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension );
|
||||||
shared_ptr<Player> player;
|
shared_ptr<Player> player;
|
||||||
|
|
||||||
if(level==NULL)
|
if(level==nullptr)
|
||||||
{
|
{
|
||||||
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
int otherDimensionId = packet->dimension == 0 ? -1 : 0;
|
||||||
MultiPlayerLevel *activeLevel = minecraft->getLevel(otherDimensionId);
|
MultiPlayerLevel *activeLevel = minecraft->getLevel(otherDimensionId);
|
||||||
|
|
||||||
if(activeLevel == NULL)
|
if(activeLevel == nullptr)
|
||||||
{
|
{
|
||||||
otherDimensionId = packet->dimension == 0 ? 1 : (packet->dimension == -1 ? 1 : -1);
|
otherDimensionId = packet->dimension == 0 ? 1 : (packet->dimension == -1 ? 1 : -1);
|
||||||
activeLevel = minecraft->getLevel(otherDimensionId);
|
activeLevel = minecraft->getLevel(otherDimensionId);
|
||||||
|
|
@ -433,7 +433,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
shared_ptr<Entity> owner = getEntity(packet->data);
|
shared_ptr<Entity> owner = getEntity(packet->data);
|
||||||
|
|
||||||
// 4J - check all local players to find match
|
// 4J - check all local players to find match
|
||||||
if( owner == NULL )
|
if( owner == nullptr )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -449,7 +449,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (owner != NULL && owner->instanceof(eTYPE_PLAYER))
|
if (owner != nullptr && owner->instanceof(eTYPE_PLAYER))
|
||||||
{
|
{
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
||||||
shared_ptr<FishingHook> hook = shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
shared_ptr<FishingHook> hook = shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
||||||
|
|
@ -549,7 +549,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
shared_ptr<Entity> owner = getEntity(packet->data);
|
shared_ptr<Entity> owner = getEntity(packet->data);
|
||||||
|
|
||||||
// 4J - check all local players to find match
|
// 4J - check all local players to find match
|
||||||
if( owner == NULL )
|
if( owner == nullptr )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -565,7 +565,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(owner);
|
||||||
if (player != NULL)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
shared_ptr<FishingHook> hook = shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
shared_ptr<FishingHook> hook = shared_ptr<FishingHook>( new FishingHook(level, x, y, z, player) );
|
||||||
e = hook;
|
e = hook;
|
||||||
|
|
@ -609,7 +609,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (e != NULL)
|
if (e != nullptr)
|
||||||
{
|
{
|
||||||
e->xp = packet->x;
|
e->xp = packet->x;
|
||||||
e->yp = packet->y;
|
e->yp = packet->y;
|
||||||
|
|
@ -661,7 +661,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
shared_ptr<Entity> owner = getEntity(packet->data);
|
shared_ptr<Entity> owner = getEntity(packet->data);
|
||||||
|
|
||||||
// 4J - check all local players to find match
|
// 4J - check all local players to find match
|
||||||
if( owner == NULL )
|
if( owner == nullptr )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -676,7 +676,7 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( owner != NULL && owner->instanceof(eTYPE_LIVINGENTITY) )
|
if ( owner != nullptr && owner->instanceof(eTYPE_LIVINGENTITY) )
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<Arrow>(e)->owner = dynamic_pointer_cast<LivingEntity>(owner);
|
dynamic_pointer_cast<Arrow>(e)->owner = dynamic_pointer_cast<LivingEntity>(owner);
|
||||||
}
|
}
|
||||||
|
|
@ -709,7 +709,7 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr<AddGlobalEntityPacket> p
|
||||||
double z = packet->z / 32.0;
|
double z = packet->z / 32.0;
|
||||||
shared_ptr<Entity> e;// = nullptr;
|
shared_ptr<Entity> e;// = nullptr;
|
||||||
if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = shared_ptr<LightningBolt>( new LightningBolt(level, x, y, z) );
|
if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = shared_ptr<LightningBolt>( new LightningBolt(level, x, y, z) );
|
||||||
if (e != NULL)
|
if (e != nullptr)
|
||||||
{
|
{
|
||||||
e->xp = packet->x;
|
e->xp = packet->x;
|
||||||
e->yp = packet->y;
|
e->yp = packet->y;
|
||||||
|
|
@ -730,14 +730,14 @@ void ClientConnection::handleAddPainting(shared_ptr<AddPaintingPacket> packet)
|
||||||
void ClientConnection::handleSetEntityMotion(shared_ptr<SetEntityMotionPacket> packet)
|
void ClientConnection::handleSetEntityMotion(shared_ptr<SetEntityMotionPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleSetEntityData(shared_ptr<SetEntityDataPacket> packet)
|
void ClientConnection::handleSetEntityData(shared_ptr<SetEntityDataPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e != NULL && packet->getUnpackedData() != NULL)
|
if (e != nullptr && packet->getUnpackedData() != nullptr)
|
||||||
{
|
{
|
||||||
e->getEntityData()->assignValues(packet->getUnpackedData());
|
e->getEntityData()->assignValues(packet->getUnpackedData());
|
||||||
}
|
}
|
||||||
|
|
@ -764,7 +764,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
// a duplicate remote player for a local slot by checking the username directly.
|
// a duplicate remote player for a local slot by checking the username directly.
|
||||||
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if (minecraft->localplayers[idx] != NULL && minecraft->localplayers[idx]->name == packet->name)
|
if (minecraft->localplayers[idx] != nullptr && minecraft->localplayers[idx]->name == packet->name)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("AddPlayerPacket received for local player name %ls\n", packet->name.c_str());
|
app.DebugPrintf("AddPlayerPacket received for local player name %ls\n", packet->name.c_str());
|
||||||
return;
|
return;
|
||||||
|
|
@ -778,7 +778,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
// their stored server index rather than using it directly as an array subscript.
|
// their stored server index rather than using it directly as an array subscript.
|
||||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(minecraft->localplayers[idx] != NULL &&
|
if(minecraft->localplayers[idx] != nullptr &&
|
||||||
minecraft->localplayers[idx]->getPlayerIndex() == packet->m_playerIndex)
|
minecraft->localplayers[idx]->getPlayerIndex() == packet->m_playerIndex)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("AddPlayerPacket received for local player (controller %d, server index %d), skipping RemotePlayer creation\n", idx, packet->m_playerIndex);
|
app.DebugPrintf("AddPlayerPacket received for local player (controller %d, server index %d), skipping RemotePlayer creation\n", idx, packet->m_playerIndex);
|
||||||
|
|
@ -804,7 +804,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
#ifdef _DURANGO
|
#ifdef _DURANGO
|
||||||
// On Durango request player display name from network manager
|
// On Durango request player display name from network manager
|
||||||
INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerByXuid(player->getXuid());
|
INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerByXuid(player->getXuid());
|
||||||
if (networkPlayer != NULL) player->m_displayName = networkPlayer->GetDisplayName();
|
if (networkPlayer != nullptr) player->m_displayName = networkPlayer->GetDisplayName();
|
||||||
#else
|
#else
|
||||||
// On all other platforms display name is just gamertag so don't check with the network manager
|
// On all other platforms display name is just gamertag so don't check with the network manager
|
||||||
player->m_displayName = player->getName();
|
player->m_displayName = player->getName();
|
||||||
|
|
@ -812,7 +812,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
{
|
{
|
||||||
IQNetPlayer* matchedQNetPlayer = NULL;
|
IQNetPlayer* matchedQNetPlayer = nullptr;
|
||||||
PlayerUID pktXuid = player->getXuid();
|
PlayerUID pktXuid = player->getXuid();
|
||||||
const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e;
|
const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e;
|
||||||
// Legacy compatibility path for peers still using embedded smallId XUIDs.
|
// Legacy compatibility path for peers still using embedded smallId XUIDs.
|
||||||
|
|
@ -820,7 +820,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
{
|
{
|
||||||
BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE);
|
BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE);
|
||||||
INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId);
|
INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId);
|
||||||
if (np != NULL)
|
if (np != nullptr)
|
||||||
{
|
{
|
||||||
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
|
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
|
||||||
matchedQNetPlayer = npx->GetQNetPlayer();
|
matchedQNetPlayer = npx->GetQNetPlayer();
|
||||||
|
|
@ -828,17 +828,17 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current Win64 path: identify QNet player by name and attach packet XUID.
|
// Current Win64 path: identify QNet player by name and attach packet XUID.
|
||||||
if (matchedQNetPlayer == NULL)
|
if (matchedQNetPlayer == nullptr)
|
||||||
{
|
{
|
||||||
for (BYTE smallId = 0; smallId < MINECRAFT_NET_MAX_PLAYERS; ++smallId)
|
for (BYTE smallId = 0; smallId < MINECRAFT_NET_MAX_PLAYERS; ++smallId)
|
||||||
{
|
{
|
||||||
INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId);
|
INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId);
|
||||||
if (np == NULL)
|
if (np == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
|
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
|
||||||
IQNetPlayer* qp = npx->GetQNetPlayer();
|
IQNetPlayer* qp = npx->GetQNetPlayer();
|
||||||
if (qp != NULL && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0)
|
if (qp != nullptr && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0)
|
||||||
{
|
{
|
||||||
matchedQNetPlayer = qp;
|
matchedQNetPlayer = qp;
|
||||||
break;
|
break;
|
||||||
|
|
@ -846,7 +846,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchedQNetPlayer != NULL)
|
if (matchedQNetPlayer != nullptr)
|
||||||
{
|
{
|
||||||
// Store packet-authoritative XUID on this network slot so later lookups by XUID
|
// Store packet-authoritative XUID on this network slot so later lookups by XUID
|
||||||
// (e.g. remove player, display mapping) work for both legacy and uid.dat clients.
|
// (e.g. remove player, display mapping) work for both legacy and uid.dat clients.
|
||||||
|
|
@ -864,7 +864,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
int item = packet->carriedItem;
|
int item = packet->carriedItem;
|
||||||
if (item == 0)
|
if (item == 0)
|
||||||
{
|
{
|
||||||
player->inventory->items[player->inventory->selected] = shared_ptr<ItemInstance>(); // NULL;
|
player->inventory->items[player->inventory->selected] = shared_ptr<ItemInstance>(); // nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -883,13 +883,13 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",player->customTextureUrl.c_str(), player->name.c_str());
|
app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",player->customTextureUrl.c_str(), player->name.c_str());
|
||||||
|
|
||||||
send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) );
|
send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(player->customTextureUrl,nullptr,0) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl))
|
else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl))
|
||||||
{
|
{
|
||||||
// Update the ref count on the memory texture data
|
// Update the ref count on the memory texture data
|
||||||
app.AddMemoryTextureFile(player->customTextureUrl,NULL,0);
|
app.AddMemoryTextureFile(player->customTextureUrl,nullptr,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.DebugPrintf("Custom skin for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl.c_str());
|
app.DebugPrintf("Custom skin for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl.c_str());
|
||||||
|
|
@ -899,13 +899,13 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) )
|
if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Client sending texture packet to get custom cape %ls for player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str());
|
app.DebugPrintf("Client sending texture packet to get custom cape %ls for player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str());
|
||||||
send(shared_ptr<TexturePacket>( new TexturePacket(player->customTextureUrl2,NULL,0) ) );
|
send(shared_ptr<TexturePacket>( new TexturePacket(player->customTextureUrl2,nullptr,0) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2))
|
else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2))
|
||||||
{
|
{
|
||||||
// Update the ref count on the memory texture data
|
// Update the ref count on the memory texture data
|
||||||
app.AddMemoryTextureFile(player->customTextureUrl2,NULL,0);
|
app.AddMemoryTextureFile(player->customTextureUrl2,nullptr,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.DebugPrintf("Custom cape for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl2.c_str());
|
app.DebugPrintf("Custom cape for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl2.c_str());
|
||||||
|
|
@ -913,7 +913,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
level->putEntity(packet->id, player);
|
level->putEntity(packet->id, player);
|
||||||
|
|
||||||
vector<shared_ptr<SynchedEntityData::DataItem> > *unpackedData = packet->getUnpackedData();
|
vector<shared_ptr<SynchedEntityData::DataItem> > *unpackedData = packet->getUnpackedData();
|
||||||
if (unpackedData != NULL)
|
if (unpackedData != nullptr)
|
||||||
{
|
{
|
||||||
player->getEntityData()->assignValues(unpackedData);
|
player->getEntityData()->assignValues(unpackedData);
|
||||||
}
|
}
|
||||||
|
|
@ -923,7 +923,7 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
|
||||||
void ClientConnection::handleTeleportEntity(shared_ptr<TeleportEntityPacket> packet)
|
void ClientConnection::handleTeleportEntity(shared_ptr<TeleportEntityPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
e->xp = packet->x;
|
e->xp = packet->x;
|
||||||
e->yp = packet->y;
|
e->yp = packet->y;
|
||||||
e->zp = packet->z;
|
e->zp = packet->z;
|
||||||
|
|
@ -952,7 +952,7 @@ void ClientConnection::handleSetCarriedItem(shared_ptr<SetCarriedItemPacket> pac
|
||||||
void ClientConnection::handleMoveEntity(shared_ptr<MoveEntityPacket> packet)
|
void ClientConnection::handleMoveEntity(shared_ptr<MoveEntityPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
e->xp += packet->xa;
|
e->xp += packet->xa;
|
||||||
e->yp += packet->ya;
|
e->yp += packet->ya;
|
||||||
e->zp += packet->za;
|
e->zp += packet->za;
|
||||||
|
|
@ -973,7 +973,7 @@ void ClientConnection::handleMoveEntity(shared_ptr<MoveEntityPacket> packet)
|
||||||
void ClientConnection::handleRotateMob(shared_ptr<RotateHeadPacket> packet)
|
void ClientConnection::handleRotateMob(shared_ptr<RotateHeadPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
float yHeadRot = packet->yHeadRot * 360 / 256.f;
|
float yHeadRot = packet->yHeadRot * 360 / 256.f;
|
||||||
e->setYHeadRot(yHeadRot);
|
e->setYHeadRot(yHeadRot);
|
||||||
}
|
}
|
||||||
|
|
@ -981,7 +981,7 @@ void ClientConnection::handleRotateMob(shared_ptr<RotateHeadPacket> packet)
|
||||||
void ClientConnection::handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> packet)
|
void ClientConnection::handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
e->xp += packet->xa;
|
e->xp += packet->xa;
|
||||||
e->yp += packet->ya;
|
e->yp += packet->ya;
|
||||||
e->zp += packet->za;
|
e->zp += packet->za;
|
||||||
|
|
@ -1007,18 +1007,18 @@ void ClientConnection::handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packe
|
||||||
for (int i = 0; i < packet->ids.length; i++)
|
for (int i = 0; i < packet->ids.length; i++)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> entity = getEntity(packet->ids[i]);
|
shared_ptr<Entity> entity = getEntity(packet->ids[i]);
|
||||||
if (entity != NULL && entity->GetType() == eTYPE_PLAYER)
|
if (entity != nullptr && entity->GetType() == eTYPE_PLAYER)
|
||||||
{
|
{
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
||||||
if (player != NULL)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
PlayerUID xuid = player->getXuid();
|
PlayerUID xuid = player->getXuid();
|
||||||
INetworkPlayer* np = g_NetworkManager.GetPlayerByXuid(xuid);
|
INetworkPlayer* np = g_NetworkManager.GetPlayerByXuid(xuid);
|
||||||
if (np != NULL)
|
if (np != nullptr)
|
||||||
{
|
{
|
||||||
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
|
NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np;
|
||||||
IQNetPlayer* qp = npx->GetQNetPlayer();
|
IQNetPlayer* qp = npx->GetQNetPlayer();
|
||||||
if (qp != NULL)
|
if (qp != nullptr)
|
||||||
{
|
{
|
||||||
extern CPlatformNetworkManagerStub* g_pPlatformNetworkManager;
|
extern CPlatformNetworkManagerStub* g_pPlatformNetworkManager;
|
||||||
g_pPlatformNetworkManager->NotifyPlayerLeaving(qp);
|
g_pPlatformNetworkManager->NotifyPlayerLeaving(qp);
|
||||||
|
|
@ -1088,7 +1088,7 @@ void ClientConnection::handleMovePlayer(shared_ptr<MovePlayerPacket> packet)
|
||||||
player->zOld = player->z;
|
player->zOld = player->z;
|
||||||
|
|
||||||
started = true;
|
started = true;
|
||||||
minecraft->setScreen(NULL);
|
minecraft->setScreen(nullptr);
|
||||||
|
|
||||||
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players are spawned at incorrect places after re-joining previously saved and loaded "Mass Effect World".
|
// Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players are spawned at incorrect places after re-joining previously saved and loaded "Mass Effect World".
|
||||||
// Move this check from Minecraft::createExtraLocalPlayer
|
// Move this check from Minecraft::createExtraLocalPlayer
|
||||||
|
|
@ -1298,7 +1298,7 @@ void ClientConnection::handleDisconnect(shared_ptr<DisconnectPacket> packet)
|
||||||
app.SetDisconnectReason( packet->reason );
|
app.SetDisconnectReason( packet->reason );
|
||||||
|
|
||||||
app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE);
|
app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE);
|
||||||
//minecraft->setLevel(NULL);
|
//minecraft->setLevel(nullptr);
|
||||||
//minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected", L"disconnect.genericReason", &packet->reason));
|
//minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected", L"disconnect.genericReason", &packet->reason));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1321,14 +1321,14 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
uiIDA[0]=IDS_CONFIRM_OK;
|
uiIDA[0]=IDS_CONFIRM_OK;
|
||||||
ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,NULL);
|
ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE);
|
app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//minecraft->setLevel(NULL);
|
//minecraft->setLevel(nullptr);
|
||||||
//minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason, reasonObjects));
|
//minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason, reasonObjects));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1366,7 +1366,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> pac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to == NULL)
|
if (to == nullptr)
|
||||||
{
|
{
|
||||||
// Don't know if this should ever really happen, but seems safest to try and remove the entity that has been collected even if we can't
|
// Don't know if this should ever really happen, but seems safest to try and remove the entity that has been collected even if we can't
|
||||||
// create a particle as we don't know what really collected it
|
// create a particle as we don't know what really collected it
|
||||||
|
|
@ -1374,7 +1374,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> pac
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from != NULL)
|
if (from != nullptr)
|
||||||
{
|
{
|
||||||
// If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In
|
// If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In
|
||||||
// particular, we don't want to remove the item entity until we are processing it for the right connection, or else we won't have a valid
|
// particular, we don't want to remove the item entity until we are processing it for the right connection, or else we won't have a valid
|
||||||
|
|
@ -1388,7 +1388,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> pac
|
||||||
// the tutorial for the player that actually picked up the item
|
// the tutorial for the player that actually picked up the item
|
||||||
int playerPad = player->GetXboxPad();
|
int playerPad = player->GetXboxPad();
|
||||||
|
|
||||||
if( minecraft->localgameModes[playerPad] != NULL )
|
if( minecraft->localgameModes[playerPad] != nullptr )
|
||||||
{
|
{
|
||||||
// 4J-PB - add in the XP orb sound
|
// 4J-PB - add in the XP orb sound
|
||||||
if(from->GetType() == eTYPE_EXPERIENCEORB)
|
if(from->GetType() == eTYPE_EXPERIENCEORB)
|
||||||
|
|
@ -1830,7 +1830,7 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
||||||
void ClientConnection::handleAnimate(shared_ptr<AnimatePacket> packet)
|
void ClientConnection::handleAnimate(shared_ptr<AnimatePacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
if (packet->action == AnimatePacket::SWING)
|
if (packet->action == AnimatePacket::SWING)
|
||||||
{
|
{
|
||||||
if (e->instanceof(eTYPE_LIVINGENTITY)) dynamic_pointer_cast<LivingEntity>(e)->swing();
|
if (e->instanceof(eTYPE_LIVINGENTITY)) dynamic_pointer_cast<LivingEntity>(e)->swing();
|
||||||
|
|
@ -1867,7 +1867,7 @@ void ClientConnection::handleAnimate(shared_ptr<AnimatePacket> packet)
|
||||||
void ClientConnection::handleEntityActionAtPosition(shared_ptr<EntityActionAtPositionPacket> packet)
|
void ClientConnection::handleEntityActionAtPosition(shared_ptr<EntityActionAtPositionPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
if (packet->action == EntityActionAtPositionPacket::START_SLEEP)
|
if (packet->action == EntityActionAtPositionPacket::START_SLEEP)
|
||||||
{
|
{
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||||
|
|
@ -1927,7 +1927,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
// Is this user friends with the host player?
|
// Is this user friends with the host player?
|
||||||
BOOL result;
|
BOOL result;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,nullptr);
|
||||||
if(error == ERROR_SUCCESS && result != TRUE)
|
if(error == ERROR_SUCCESS && result != TRUE)
|
||||||
{
|
{
|
||||||
canPlay = FALSE;
|
canPlay = FALSE;
|
||||||
|
|
@ -1957,7 +1957,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
// Is this user friends with the host player?
|
// Is this user friends with the host player?
|
||||||
BOOL result;
|
BOOL result;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL);
|
error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,nullptr);
|
||||||
if(error == ERROR_SUCCESS && result != TRUE)
|
if(error == ERROR_SUCCESS && result != TRUE)
|
||||||
{
|
{
|
||||||
canPlay = FALSE;
|
canPlay = FALSE;
|
||||||
|
|
@ -2009,7 +2009,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
{
|
{
|
||||||
if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
|
if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
|
||||||
{
|
{
|
||||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
|
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,nullptr);
|
||||||
if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = TRUE;
|
if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2037,7 +2037,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
{
|
{
|
||||||
if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
|
if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) )
|
||||||
{
|
{
|
||||||
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL);
|
error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,nullptr);
|
||||||
if(error == ERROR_SUCCESS) canPlay &= result;
|
if(error == ERROR_SUCCESS) canPlay &= result;
|
||||||
}
|
}
|
||||||
if(!canPlay) break;
|
if(!canPlay) break;
|
||||||
|
|
@ -2060,7 +2060,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
{
|
{
|
||||||
bool bChatRestricted=false;
|
bool bChatRestricted=false;
|
||||||
|
|
||||||
ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,NULL,NULL);
|
ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,nullptr,nullptr);
|
||||||
|
|
||||||
// Chat restricted orbis players can still play online
|
// Chat restricted orbis players can still play online
|
||||||
#ifndef __ORBIS__
|
#ifndef __ORBIS__
|
||||||
|
|
@ -2149,11 +2149,11 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||||
// which seems to be very unstable at the point of starting up the game
|
// which seems to be very unstable at the point of starting up the game
|
||||||
if(m_userIndex == ProfileManager.GetPrimaryPad())
|
if(m_userIndex == ProfileManager.GetPrimaryPad())
|
||||||
{
|
{
|
||||||
ProfileManager.GetChatAndContentRestrictions(m_userIndex,false,&bChatRestricted,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(m_userIndex,false,&bChatRestricted,&bContentRestricted,nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,&bContentRestricted,nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chat restricted orbis players can still play online
|
// Chat restricted orbis players can still play online
|
||||||
|
|
@ -2404,7 +2404,7 @@ void ClientConnection::handleAddMob(shared_ptr<AddMobPacket> packet)
|
||||||
level->putEntity(packet->id, mob);
|
level->putEntity(packet->id, mob);
|
||||||
|
|
||||||
vector<shared_ptr<SynchedEntityData::DataItem> > *unpackedData = packet->getUnpackedData();
|
vector<shared_ptr<SynchedEntityData::DataItem> > *unpackedData = packet->getUnpackedData();
|
||||||
if (unpackedData != NULL)
|
if (unpackedData != nullptr)
|
||||||
{
|
{
|
||||||
mob->getEntityData()->assignValues(unpackedData);
|
mob->getEntityData()->assignValues(unpackedData);
|
||||||
}
|
}
|
||||||
|
|
@ -2439,10 +2439,10 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr<SetEntityLinkPacket> pa
|
||||||
|
|
||||||
// 4J: If the destination entity couldn't be found, defer handling of this packet
|
// 4J: If the destination entity couldn't be found, defer handling of this packet
|
||||||
// This was added to support leashing (the entity link packet is sent before the add entity packet)
|
// This was added to support leashing (the entity link packet is sent before the add entity packet)
|
||||||
if (destEntity == NULL && packet->destId >= 0)
|
if (destEntity == nullptr && packet->destId >= 0)
|
||||||
{
|
{
|
||||||
// We don't handle missing source entities because it shouldn't happen
|
// We don't handle missing source entities because it shouldn't happen
|
||||||
assert(!(sourceEntity == NULL && packet->sourceId >= 0));
|
assert(!(sourceEntity == nullptr && packet->sourceId >= 0));
|
||||||
|
|
||||||
deferredEntityLinkPackets.push_back(DeferredEntityLinkPacket(packet));
|
deferredEntityLinkPackets.push_back(DeferredEntityLinkPacket(packet));
|
||||||
return;
|
return;
|
||||||
|
|
@ -2455,16 +2455,16 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr<SetEntityLinkPacket> pa
|
||||||
{
|
{
|
||||||
sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex];
|
sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex];
|
||||||
|
|
||||||
if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) (dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(false);
|
if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) (dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(false);
|
||||||
|
|
||||||
displayMountMessage = (sourceEntity->riding == NULL && destEntity != NULL);
|
displayMountMessage = (sourceEntity->riding == nullptr && destEntity != nullptr);
|
||||||
}
|
}
|
||||||
else if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT))
|
else if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT))
|
||||||
{
|
{
|
||||||
(dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(true);
|
(dynamic_pointer_cast<Boat>(destEntity))->setDoLerp(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceEntity == NULL) return;
|
if (sourceEntity == nullptr) return;
|
||||||
|
|
||||||
sourceEntity->ride(destEntity);
|
sourceEntity->ride(destEntity);
|
||||||
|
|
||||||
|
|
@ -2478,9 +2478,9 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr<SetEntityLinkPacket> pa
|
||||||
}
|
}
|
||||||
else if (packet->type == SetEntityLinkPacket::LEASH)
|
else if (packet->type == SetEntityLinkPacket::LEASH)
|
||||||
{
|
{
|
||||||
if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB) )
|
if ( (sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB) )
|
||||||
{
|
{
|
||||||
if (destEntity != NULL)
|
if (destEntity != nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
(dynamic_pointer_cast<Mob>(sourceEntity))->setLeashedTo(destEntity, false);
|
(dynamic_pointer_cast<Mob>(sourceEntity))->setLeashedTo(destEntity, false);
|
||||||
|
|
@ -2496,7 +2496,7 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr<SetEntityLinkPacket> pa
|
||||||
void ClientConnection::handleEntityEvent(shared_ptr<EntityEventPacket> packet)
|
void ClientConnection::handleEntityEvent(shared_ptr<EntityEventPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->entityId);
|
shared_ptr<Entity> e = getEntity(packet->entityId);
|
||||||
if (e != NULL) e->handleEntityEvent(packet->eventId);
|
if (e != nullptr) e->handleEntityEvent(packet->eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Entity> ClientConnection::getEntity(int entityId)
|
shared_ptr<Entity> ClientConnection::getEntity(int entityId)
|
||||||
|
|
@ -2520,7 +2520,7 @@ void ClientConnection::handleSetHealth(shared_ptr<SetHealthPacket> packet)
|
||||||
// We need food
|
// We need food
|
||||||
if(packet->food < FoodConstants::HEAL_LEVEL - 1)
|
if(packet->food < FoodConstants::HEAL_LEVEL - 1)
|
||||||
{
|
{
|
||||||
if(minecraft->localgameModes[m_userIndex] != NULL && !minecraft->localgameModes[m_userIndex]->hasInfiniteItems() )
|
if(minecraft->localgameModes[m_userIndex] != nullptr && !minecraft->localgameModes[m_userIndex]->hasInfiniteItems() )
|
||||||
{
|
{
|
||||||
minecraft->localgameModes[m_userIndex]->getTutorial()->changeTutorialState(e_Tutorial_State_Food_Bar);
|
minecraft->localgameModes[m_userIndex]->getTutorial()->changeTutorialState(e_Tutorial_State_Food_Bar);
|
||||||
}
|
}
|
||||||
|
|
@ -2544,7 +2544,7 @@ void ClientConnection::handleTexture(shared_ptr<TexturePacket> packet)
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str());
|
wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
PBYTE pbData=NULL;
|
PBYTE pbData=nullptr;
|
||||||
DWORD dwBytes=0;
|
DWORD dwBytes=0;
|
||||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||||
|
|
||||||
|
|
@ -2576,7 +2576,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str());
|
wprintf(L"Client received request for custom texture and geometry %ls\n",packet->textureName.c_str());
|
||||||
#endif
|
#endif
|
||||||
PBYTE pbData=NULL;
|
PBYTE pbData=nullptr;
|
||||||
DWORD dwBytes=0;
|
DWORD dwBytes=0;
|
||||||
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes);
|
||||||
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName);
|
DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName);
|
||||||
|
|
@ -2626,7 +2626,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr<TextureAndGeometryPac
|
||||||
void ClientConnection::handleTextureChange(shared_ptr<TextureChangePacket> packet)
|
void ClientConnection::handleTextureChange(shared_ptr<TextureChangePacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if ( (e == NULL) || !e->instanceof(eTYPE_PLAYER) ) return;
|
if ( (e == nullptr) || !e->instanceof(eTYPE_PLAYER) ) return;
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||||
|
|
||||||
bool isLocalPlayer = false;
|
bool isLocalPlayer = false;
|
||||||
|
|
@ -2667,22 +2667,22 @@ void ClientConnection::handleTextureChange(shared_ptr<TextureChangePacket> packe
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"handleTextureChange - Client sending texture packet to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
wprintf(L"handleTextureChange - Client sending texture packet to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(shared_ptr<TexturePacket>( new TexturePacket(packet->path,NULL,0) ) );
|
send(shared_ptr<TexturePacket>( new TexturePacket(packet->path,nullptr,0) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
||||||
{
|
{
|
||||||
// Update the ref count on the memory texture data
|
// Update the ref count on the memory texture data
|
||||||
app.AddMemoryTextureFile(packet->path,NULL,0);
|
app.AddMemoryTextureFile(packet->path,nullptr,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet)
|
void ClientConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->id);
|
shared_ptr<Entity> e = getEntity(packet->id);
|
||||||
if (e == NULL) return;
|
if (e == nullptr) return;
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(e);
|
||||||
if( e == NULL) return;
|
if( e == nullptr) return;
|
||||||
|
|
||||||
bool isLocalPlayer = false;
|
bool isLocalPlayer = false;
|
||||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||||
|
|
@ -2712,13 +2712,13 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptr<TextureAndGeome
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"handleTextureAndGeometryChange - Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
wprintf(L"handleTextureAndGeometryChange - Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str());
|
||||||
#endif
|
#endif
|
||||||
send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->path,NULL,0) ) );
|
send(shared_ptr<TextureAndGeometryPacket>( new TextureAndGeometryPacket(packet->path,nullptr,0) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path))
|
||||||
{
|
{
|
||||||
// Update the ref count on the memory texture data
|
// Update the ref count on the memory texture data
|
||||||
app.AddMemoryTextureFile(packet->path,NULL,0);
|
app.AddMemoryTextureFile(packet->path,nullptr,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2739,12 +2739,12 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
||||||
level->removeClientConnection(this, false);
|
level->removeClientConnection(this, false);
|
||||||
|
|
||||||
MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension );
|
MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension );
|
||||||
if( dimensionLevel == NULL )
|
if( dimensionLevel == nullptr )
|
||||||
{
|
{
|
||||||
dimensionLevel = new MultiPlayerLevel(this, new LevelSettings(packet->mapSeed, packet->playerGameType, false, minecraft->level->getLevelData()->isHardcore(), packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty);
|
dimensionLevel = new MultiPlayerLevel(this, new LevelSettings(packet->mapSeed, packet->playerGameType, false, minecraft->level->getLevelData()->isHardcore(), packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty);
|
||||||
|
|
||||||
// 4J Stu - We want to shared the savedDataStorage between both levels
|
// 4J Stu - We want to shared the savedDataStorage between both levels
|
||||||
//if( dimensionLevel->savedDataStorage != NULL )
|
//if( dimensionLevel->savedDataStorage != nullptr )
|
||||||
//{
|
//{
|
||||||
// Don't need to delete it here as it belongs to a client connection while will delete it when it's done
|
// Don't need to delete it here as it belongs to a client connection while will delete it when it's done
|
||||||
// delete dimensionLevel->savedDataStorage;+
|
// delete dimensionLevel->savedDataStorage;+
|
||||||
|
|
@ -2784,7 +2784,7 @@ void ClientConnection::handleRespawn(shared_ptr<RespawnPacket> packet)
|
||||||
TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( minecraft->localgameModes[m_userIndex] != NULL )
|
if( minecraft->localgameModes[m_userIndex] != nullptr )
|
||||||
{
|
{
|
||||||
TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_userIndex];
|
TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_userIndex];
|
||||||
gameMode->getTutorial()->showTutorialPopup(false);
|
gameMode->getTutorial()->showTutorialPopup(false);
|
||||||
|
|
@ -3111,9 +3111,9 @@ void ClientConnection::handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket>
|
||||||
if(packet->slot >= 36 && packet->slot < 36 + 9)
|
if(packet->slot >= 36 && packet->slot < 36 + 9)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem();
|
shared_ptr<ItemInstance> lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem();
|
||||||
if (packet->item != NULL)
|
if (packet->item != nullptr)
|
||||||
{
|
{
|
||||||
if (lastItem == NULL || lastItem->count < packet->item->count)
|
if (lastItem == nullptr || lastItem->count < packet->item->count)
|
||||||
{
|
{
|
||||||
packet->item->popTime = Inventory::POP_TIME_DURATION;
|
packet->item->popTime = Inventory::POP_TIME_DURATION;
|
||||||
}
|
}
|
||||||
|
|
@ -3131,7 +3131,7 @@ void ClientConnection::handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket>
|
||||||
void ClientConnection::handleContainerAck(shared_ptr<ContainerAckPacket> packet)
|
void ClientConnection::handleContainerAck(shared_ptr<ContainerAckPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[m_userIndex];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[m_userIndex];
|
||||||
AbstractContainerMenu *menu = NULL;
|
AbstractContainerMenu *menu = nullptr;
|
||||||
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY)
|
if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY)
|
||||||
{
|
{
|
||||||
menu = player->inventoryMenu;
|
menu = player->inventoryMenu;
|
||||||
|
|
@ -3140,7 +3140,7 @@ void ClientConnection::handleContainerAck(shared_ptr<ContainerAckPacket> packet)
|
||||||
{
|
{
|
||||||
menu = player->containerMenu;
|
menu = player->containerMenu;
|
||||||
}
|
}
|
||||||
if (menu != NULL)
|
if (menu != nullptr)
|
||||||
{
|
{
|
||||||
if (!packet->accepted)
|
if (!packet->accepted)
|
||||||
{
|
{
|
||||||
|
|
@ -3165,7 +3165,7 @@ void ClientConnection::handleContainerContent(shared_ptr<ContainerSetContentPack
|
||||||
void ClientConnection::handleTileEditorOpen(shared_ptr<TileEditorOpenPacket> packet)
|
void ClientConnection::handleTileEditorOpen(shared_ptr<TileEditorOpenPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> tileEntity = level->getTileEntity(packet->x, packet->y, packet->z);
|
shared_ptr<TileEntity> tileEntity = level->getTileEntity(packet->x, packet->y, packet->z);
|
||||||
if (tileEntity != NULL)
|
if (tileEntity != nullptr)
|
||||||
{
|
{
|
||||||
minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity);
|
minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity);
|
||||||
}
|
}
|
||||||
|
|
@ -3188,7 +3188,7 @@ void ClientConnection::handleSignUpdate(shared_ptr<SignUpdatePacket> packet)
|
||||||
shared_ptr<TileEntity> te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
shared_ptr<TileEntity> te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
||||||
|
|
||||||
// 4J-PB - on a client connecting, the line below fails
|
// 4J-PB - on a client connecting, the line below fails
|
||||||
if (dynamic_pointer_cast<SignTileEntity>(te) != NULL)
|
if (dynamic_pointer_cast<SignTileEntity>(te) != nullptr)
|
||||||
{
|
{
|
||||||
shared_ptr<SignTileEntity> ste = dynamic_pointer_cast<SignTileEntity>(te);
|
shared_ptr<SignTileEntity> ste = dynamic_pointer_cast<SignTileEntity>(te);
|
||||||
for (int i = 0; i < MAX_SIGN_LINES; i++)
|
for (int i = 0; i < MAX_SIGN_LINES; i++)
|
||||||
|
|
@ -3204,7 +3204,7 @@ void ClientConnection::handleSignUpdate(shared_ptr<SignUpdatePacket> packet)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.DebugPrintf("dynamic_pointer_cast<SignTileEntity>(te) == NULL\n");
|
app.DebugPrintf("dynamic_pointer_cast<SignTileEntity>(te) == nullptr\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3219,21 +3219,21 @@ void ClientConnection::handleTileEntityData(shared_ptr<TileEntityDataPacket> pac
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
shared_ptr<TileEntity> te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z);
|
||||||
|
|
||||||
if (te != NULL)
|
if (te != nullptr)
|
||||||
{
|
{
|
||||||
if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast<MobSpawnerTileEntity>(te) != NULL)
|
if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast<MobSpawnerTileEntity>(te) != nullptr)
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<MobSpawnerTileEntity>(te)->load(packet->tag);
|
dynamic_pointer_cast<MobSpawnerTileEntity>(te)->load(packet->tag);
|
||||||
}
|
}
|
||||||
else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && dynamic_pointer_cast<CommandBlockEntity>(te) != NULL)
|
else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && dynamic_pointer_cast<CommandBlockEntity>(te) != nullptr)
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<CommandBlockEntity>(te)->load(packet->tag);
|
dynamic_pointer_cast<CommandBlockEntity>(te)->load(packet->tag);
|
||||||
}
|
}
|
||||||
else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast<BeaconTileEntity>(te) != NULL)
|
else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast<BeaconTileEntity>(te) != nullptr)
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<BeaconTileEntity>(te)->load(packet->tag);
|
dynamic_pointer_cast<BeaconTileEntity>(te)->load(packet->tag);
|
||||||
}
|
}
|
||||||
else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast<SkullTileEntity>(te) != NULL)
|
else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast<SkullTileEntity>(te) != nullptr)
|
||||||
{
|
{
|
||||||
dynamic_pointer_cast<SkullTileEntity>(te)->load(packet->tag);
|
dynamic_pointer_cast<SkullTileEntity>(te)->load(packet->tag);
|
||||||
}
|
}
|
||||||
|
|
@ -3244,7 +3244,7 @@ void ClientConnection::handleTileEntityData(shared_ptr<TileEntityDataPacket> pac
|
||||||
void ClientConnection::handleContainerSetData(shared_ptr<ContainerSetDataPacket> packet)
|
void ClientConnection::handleContainerSetData(shared_ptr<ContainerSetDataPacket> packet)
|
||||||
{
|
{
|
||||||
onUnhandledPacket(packet);
|
onUnhandledPacket(packet);
|
||||||
if (minecraft->localplayers[m_userIndex]->containerMenu != NULL && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId)
|
if (minecraft->localplayers[m_userIndex]->containerMenu != nullptr && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId)
|
||||||
{
|
{
|
||||||
minecraft->localplayers[m_userIndex]->containerMenu->setData(packet->id, packet->value);
|
minecraft->localplayers[m_userIndex]->containerMenu->setData(packet->id, packet->value);
|
||||||
}
|
}
|
||||||
|
|
@ -3253,7 +3253,7 @@ void ClientConnection::handleContainerSetData(shared_ptr<ContainerSetDataPacket>
|
||||||
void ClientConnection::handleSetEquippedItem(shared_ptr<SetEquippedItemPacket> packet)
|
void ClientConnection::handleSetEquippedItem(shared_ptr<SetEquippedItemPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> entity = getEntity(packet->entity);
|
shared_ptr<Entity> entity = getEntity(packet->entity);
|
||||||
if (entity != NULL)
|
if (entity != nullptr)
|
||||||
{
|
{
|
||||||
// 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game
|
// 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game
|
||||||
entity->setEquippedSlot(packet->slot, packet->getItem() );
|
entity->setEquippedSlot(packet->slot, packet->getItem() );
|
||||||
|
|
@ -3279,7 +3279,7 @@ void ClientConnection::handleTileDestruction(shared_ptr<TileDestructionPacket> p
|
||||||
|
|
||||||
bool ClientConnection::canHandleAsyncPackets()
|
bool ClientConnection::canHandleAsyncPackets()
|
||||||
{
|
{
|
||||||
return minecraft != NULL && minecraft->level != NULL && minecraft->localplayers[m_userIndex] != NULL && level != NULL;
|
return minecraft != nullptr && minecraft->level != nullptr && minecraft->localplayers[m_userIndex] != nullptr && level != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handleGameEvent(shared_ptr<GameEventPacket> gameEventPacket)
|
void ClientConnection::handleGameEvent(shared_ptr<GameEventPacket> gameEventPacket)
|
||||||
|
|
@ -3288,7 +3288,7 @@ void ClientConnection::handleGameEvent(shared_ptr<GameEventPacket> gameEventPack
|
||||||
int param = gameEventPacket->param;
|
int param = gameEventPacket->param;
|
||||||
if (event >= 0 && event < GameEventPacket::EVENT_LANGUAGE_ID_LENGTH)
|
if (event >= 0 && event < GameEventPacket::EVENT_LANGUAGE_ID_LENGTH)
|
||||||
{
|
{
|
||||||
if (GameEventPacket::EVENT_LANGUAGE_ID[event] > 0) // 4J - was NULL check
|
if (GameEventPacket::EVENT_LANGUAGE_ID[event] > 0) // 4J - was nullptr check
|
||||||
{
|
{
|
||||||
minecraft->localplayers[m_userIndex]->displayClientMessage(GameEventPacket::EVENT_LANGUAGE_ID[event]);
|
minecraft->localplayers[m_userIndex]->displayClientMessage(GameEventPacket::EVENT_LANGUAGE_ID[event]);
|
||||||
}
|
}
|
||||||
|
|
@ -3320,7 +3320,7 @@ void ClientConnection::handleGameEvent(shared_ptr<GameEventPacket> gameEventPack
|
||||||
ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false);
|
ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false);
|
||||||
|
|
||||||
// This just allows it to be shown
|
// This just allows it to be shown
|
||||||
if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
|
if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
|
||||||
// Temporarily make this scene fullscreen
|
// Temporarily make this scene fullscreen
|
||||||
CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen );
|
CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen );
|
||||||
|
|
||||||
|
|
@ -3328,8 +3328,8 @@ void ClientConnection::handleGameEvent(shared_ptr<GameEventPacket> gameEventPack
|
||||||
#else
|
#else
|
||||||
app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex);
|
app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex);
|
||||||
// This just allows it to be shown
|
// This just allows it to be shown
|
||||||
if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
|
if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
|
||||||
ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem, NULL, eUILayer_Scene, eUIGroup_Fullscreen);
|
ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem, nullptr, eUILayer_Scene, eUIGroup_Fullscreen);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if( event == GameEventPacket::START_SAVING )
|
else if( event == GameEventPacket::START_SAVING )
|
||||||
|
|
@ -3373,7 +3373,7 @@ void ClientConnection::handleLevelEvent(shared_ptr<LevelEventPacket> packet)
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if(minecraft->localplayers[i] != NULL && minecraft->localplayers[i]->level != NULL && minecraft->localplayers[i]->level->dimension->id == 1)
|
if(minecraft->localplayers[i] != nullptr && minecraft->localplayers[i]->level != nullptr && minecraft->localplayers[i]->level->dimension->id == 1)
|
||||||
{
|
{
|
||||||
minecraft->localplayers[i]->awardStat(GenericStats::completeTheEnd(),GenericStats::param_noArgs());
|
minecraft->localplayers[i]->awardStat(GenericStats::completeTheEnd(),GenericStats::param_noArgs());
|
||||||
}
|
}
|
||||||
|
|
@ -3400,7 +3400,7 @@ void ClientConnection::handleAwardStat(shared_ptr<AwardStatPacket> packet)
|
||||||
void ClientConnection::handleUpdateMobEffect(shared_ptr<UpdateMobEffectPacket> packet)
|
void ClientConnection::handleUpdateMobEffect(shared_ptr<UpdateMobEffectPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->entityId);
|
shared_ptr<Entity> e = getEntity(packet->entityId);
|
||||||
if ( (e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY) ) return;
|
if ( (e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY) ) return;
|
||||||
|
|
||||||
//( dynamic_pointer_cast<LivingEntity>(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier));
|
//( dynamic_pointer_cast<LivingEntity>(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier));
|
||||||
|
|
||||||
|
|
@ -3412,7 +3412,7 @@ void ClientConnection::handleUpdateMobEffect(shared_ptr<UpdateMobEffectPacket> p
|
||||||
void ClientConnection::handleRemoveMobEffect(shared_ptr<RemoveMobEffectPacket> packet)
|
void ClientConnection::handleRemoveMobEffect(shared_ptr<RemoveMobEffectPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = getEntity(packet->entityId);
|
shared_ptr<Entity> e = getEntity(packet->entityId);
|
||||||
if ( (e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY) ) return;
|
if ( (e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY) ) return;
|
||||||
|
|
||||||
( dynamic_pointer_cast<LivingEntity>(e) )->removeEffectNoUpdate(packet->effectId);
|
( dynamic_pointer_cast<LivingEntity>(e) )->removeEffectNoUpdate(packet->effectId);
|
||||||
}
|
}
|
||||||
|
|
@ -3428,7 +3428,7 @@ void ClientConnection::handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet)
|
||||||
|
|
||||||
INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId);
|
INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId);
|
||||||
|
|
||||||
if(networkPlayer != NULL && networkPlayer->IsHost())
|
if(networkPlayer != nullptr && networkPlayer->IsHost())
|
||||||
{
|
{
|
||||||
// Some settings should always be considered on for the host player
|
// Some settings should always be considered on for the host player
|
||||||
Player::enableAllPlayerPrivileges(startingPrivileges,true);
|
Player::enableAllPlayerPrivileges(startingPrivileges,true);
|
||||||
|
|
@ -3439,17 +3439,17 @@ void ClientConnection::handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet)
|
||||||
app.UpdatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, packet->m_playerPrivileges);
|
app.UpdatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, packet->m_playerPrivileges);
|
||||||
|
|
||||||
shared_ptr<Entity> entity = getEntity(packet->m_entityId);
|
shared_ptr<Entity> entity = getEntity(packet->m_entityId);
|
||||||
if(entity != NULL && entity->instanceof(eTYPE_PLAYER))
|
if(entity != nullptr && entity->instanceof(eTYPE_PLAYER))
|
||||||
{
|
{
|
||||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
||||||
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_playerPrivileges);
|
player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_playerPrivileges);
|
||||||
}
|
}
|
||||||
if(networkPlayer != NULL && networkPlayer->IsLocal())
|
if(networkPlayer != nullptr && networkPlayer->IsLocal())
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = minecraft->localplayers[i];
|
shared_ptr<MultiplayerLocalPlayer> localPlayer = minecraft->localplayers[i];
|
||||||
if(localPlayer != NULL && localPlayer->connection != NULL && localPlayer->connection->getNetworkPlayer() == networkPlayer )
|
if(localPlayer != nullptr && localPlayer->connection != nullptr && localPlayer->connection->getNetworkPlayer() == networkPlayer )
|
||||||
{
|
{
|
||||||
localPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,packet->m_playerPrivileges);
|
localPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,packet->m_playerPrivileges);
|
||||||
displayPrivilegeChanges(localPlayer,startingPrivileges);
|
displayPrivilegeChanges(localPlayer,startingPrivileges);
|
||||||
|
|
@ -3647,7 +3647,7 @@ void ClientConnection::handleServerSettingsChanged(shared_ptr<ServerSettingsChan
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < minecraft->levels.length; ++i)
|
for(unsigned int i = 0; i < minecraft->levels.length; ++i)
|
||||||
{
|
{
|
||||||
if( minecraft->levels[i] != NULL )
|
if( minecraft->levels[i] != nullptr )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("ClientConnection::handleServerSettingsChanged - Difficulty = %d",packet->data);
|
app.DebugPrintf("ClientConnection::handleServerSettingsChanged - Difficulty = %d",packet->data);
|
||||||
minecraft->levels[i]->difficulty = packet->data;
|
minecraft->levels[i]->difficulty = packet->data;
|
||||||
|
|
@ -3681,11 +3681,11 @@ void ClientConnection::handleUpdateProgress(shared_ptr<UpdateProgressPacket> pac
|
||||||
void ClientConnection::handleUpdateGameRuleProgressPacket(shared_ptr<UpdateGameRuleProgressPacket> packet)
|
void ClientConnection::handleUpdateGameRuleProgressPacket(shared_ptr<UpdateGameRuleProgressPacket> packet)
|
||||||
{
|
{
|
||||||
LPCWSTR string = app.GetGameRulesString(packet->m_messageId);
|
LPCWSTR string = app.GetGameRulesString(packet->m_messageId);
|
||||||
if(string != NULL)
|
if(string != nullptr)
|
||||||
{
|
{
|
||||||
wstring message(string);
|
wstring message(string);
|
||||||
message = GameRuleDefinition::generateDescriptionString(packet->m_definitionType,message,packet->m_data.data,packet->m_data.length);
|
message = GameRuleDefinition::generateDescriptionString(packet->m_definitionType,message,packet->m_data.data,packet->m_data.length);
|
||||||
if(minecraft->localgameModes[m_userIndex]!=NULL)
|
if(minecraft->localgameModes[m_userIndex]!=nullptr)
|
||||||
{
|
{
|
||||||
minecraft->localgameModes[m_userIndex]->getTutorial()->setMessage(message, packet->m_icon, packet->m_auxValue);
|
minecraft->localgameModes[m_userIndex]->getTutorial()->setMessage(message, packet->m_icon, packet->m_auxValue);
|
||||||
}
|
}
|
||||||
|
|
@ -3731,7 +3731,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
UINT uiIDA[2];
|
UINT uiIDA[2];
|
||||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||||
uiIDA[1]=IDS_CONFIRM_OK;
|
uiIDA[1]=IDS_CONFIRM_OK;
|
||||||
ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL);
|
ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#else
|
#else
|
||||||
|
|
@ -3746,7 +3746,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
UINT uiIDA[2];
|
UINT uiIDA[2];
|
||||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||||
uiIDA[1]=IDS_CONFIRM_OK;
|
uiIDA[1]=IDS_CONFIRM_OK;
|
||||||
ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL);
|
ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3924,7 +3924,7 @@ void ClientConnection::handleParticleEvent(shared_ptr<LevelParticlesPacket> pack
|
||||||
void ClientConnection::handleUpdateAttributes(shared_ptr<UpdateAttributesPacket> packet)
|
void ClientConnection::handleUpdateAttributes(shared_ptr<UpdateAttributesPacket> packet)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> entity = getEntity(packet->getEntityId());
|
shared_ptr<Entity> entity = getEntity(packet->getEntityId());
|
||||||
if (entity == NULL) return;
|
if (entity == nullptr) return;
|
||||||
|
|
||||||
if ( !entity->instanceof(eTYPE_LIVINGENTITY) )
|
if ( !entity->instanceof(eTYPE_LIVINGENTITY) )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
ClockTexture::ClockTexture() : StitchedTexture(L"clock", L"clock")
|
ClockTexture::ClockTexture() : StitchedTexture(L"clock", L"clock")
|
||||||
{
|
{
|
||||||
rot = rota = 0.0;
|
rot = rota = 0.0;
|
||||||
m_dataTexture = NULL;
|
m_dataTexture = nullptr;
|
||||||
m_iPad = XUSER_INDEX_ANY;
|
m_iPad = XUSER_INDEX_ANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ void ClockTexture::cycleFrames()
|
||||||
Minecraft *mc = Minecraft::GetInstance();
|
Minecraft *mc = Minecraft::GetInstance();
|
||||||
|
|
||||||
double rott = 0;
|
double rott = 0;
|
||||||
if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL)
|
if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr)
|
||||||
{
|
{
|
||||||
float time = mc->localplayers[m_iPad]->level->getTimeOfDay(1);
|
float time = mc->localplayers[m_iPad]->level->getTimeOfDay(1);
|
||||||
rott = time;
|
rott = time;
|
||||||
|
|
@ -55,7 +55,7 @@ void ClockTexture::cycleFrames()
|
||||||
rot += rota;
|
rot += rota;
|
||||||
|
|
||||||
// 4J Stu - We share data with another texture
|
// 4J Stu - We share data with another texture
|
||||||
if(m_dataTexture != NULL)
|
if(m_dataTexture != nullptr)
|
||||||
{
|
{
|
||||||
int newFrame = static_cast<int>((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size();
|
int newFrame = static_cast<int>((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size();
|
||||||
while (newFrame < 0)
|
while (newFrame < 0)
|
||||||
|
|
@ -95,7 +95,7 @@ int ClockTexture::getSourceHeight() const
|
||||||
|
|
||||||
int ClockTexture::getFrames()
|
int ClockTexture::getFrames()
|
||||||
{
|
{
|
||||||
if(m_dataTexture == NULL)
|
if(m_dataTexture == nullptr)
|
||||||
{
|
{
|
||||||
return StitchedTexture::getFrames();
|
return StitchedTexture::getFrames();
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +107,7 @@ int ClockTexture::getFrames()
|
||||||
|
|
||||||
void ClockTexture::freeFrameTextures()
|
void ClockTexture::freeFrameTextures()
|
||||||
{
|
{
|
||||||
if(m_dataTexture == NULL)
|
if(m_dataTexture == nullptr)
|
||||||
{
|
{
|
||||||
StitchedTexture::freeFrameTextures();
|
StitchedTexture::freeFrameTextures();
|
||||||
}
|
}
|
||||||
|
|
@ -115,5 +115,5 @@ void ClockTexture::freeFrameTextures()
|
||||||
|
|
||||||
bool ClockTexture::hasOwnData()
|
bool ClockTexture::hasOwnData()
|
||||||
{
|
{
|
||||||
return m_dataTexture == NULL;
|
return m_dataTexture == nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +57,7 @@ void SoundEngine::updateSoundEffectVolume(float fVal) {}
|
||||||
void SoundEngine::add(const wstring& name, File *file) {}
|
void SoundEngine::add(const wstring& name, File *file) {}
|
||||||
void SoundEngine::addMusic(const wstring& name, File *file) {}
|
void SoundEngine::addMusic(const wstring& name, File *file) {}
|
||||||
void SoundEngine::addStreaming(const wstring& name, File *file) {}
|
void SoundEngine::addStreaming(const wstring& name, File *file) {}
|
||||||
char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return NULL; }
|
char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return nullptr; }
|
||||||
bool SoundEngine::isStreamingWavebankReady() { return true; }
|
bool SoundEngine::isStreamingWavebankReady() { return true; }
|
||||||
void SoundEngine::playMusicTick() {};
|
void SoundEngine::playMusicTick() {};
|
||||||
|
|
||||||
|
|
@ -335,7 +335,7 @@ void SoundEngine::tick(shared_ptr<Mob> *players, float a)
|
||||||
bool bListenerPostionSet = false;
|
bool bListenerPostionSet = false;
|
||||||
for( size_t i = 0; i < MAX_LOCAL_PLAYERS; i++ )
|
for( size_t i = 0; i < MAX_LOCAL_PLAYERS; i++ )
|
||||||
{
|
{
|
||||||
if( players[i] != NULL )
|
if( players[i] != nullptr )
|
||||||
{
|
{
|
||||||
m_ListenerA[i].bValid=true;
|
m_ListenerA[i].bValid=true;
|
||||||
F32 x,y,z;
|
F32 x,y,z;
|
||||||
|
|
@ -402,7 +402,7 @@ SoundEngine::SoundEngine()
|
||||||
m_iMusicDelay=0;
|
m_iMusicDelay=0;
|
||||||
m_validListenerCount=0;
|
m_validListenerCount=0;
|
||||||
|
|
||||||
m_bHeardTrackA=NULL;
|
m_bHeardTrackA=nullptr;
|
||||||
|
|
||||||
// Start the streaming music playing some music from the overworld
|
// Start the streaming music playing some music from the overworld
|
||||||
SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
||||||
|
|
@ -551,8 +551,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||||
&m_engine,
|
&m_engine,
|
||||||
finalPath,
|
finalPath,
|
||||||
MA_SOUND_FLAG_ASYNC,
|
MA_SOUND_FLAG_ASYNC,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&s->sound) != MA_SUCCESS)
|
&s->sound) != MA_SUCCESS)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Failed to initialize sound from file: %s\n", finalPath);
|
app.DebugPrintf("Failed to initialize sound from file: %s\n", finalPath);
|
||||||
|
|
@ -635,8 +635,8 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
|
||||||
&m_engine,
|
&m_engine,
|
||||||
finalPath,
|
finalPath,
|
||||||
MA_SOUND_FLAG_ASYNC,
|
MA_SOUND_FLAG_ASYNC,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&s->sound) != MA_SUCCESS)
|
&s->sound) != MA_SUCCESS)
|
||||||
{
|
{
|
||||||
delete s;
|
delete s;
|
||||||
|
|
@ -703,7 +703,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y , float z,
|
||||||
|
|
||||||
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
|
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]!=NULL)
|
if(pMinecraft->localplayers[i]!=nullptr)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
||||||
{
|
{
|
||||||
|
|
@ -797,7 +797,7 @@ int SoundEngine::getMusicID(int iDomain)
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
// Before the game has started?
|
// Before the game has started?
|
||||||
if(pMinecraft==NULL)
|
if(pMinecraft==nullptr)
|
||||||
{
|
{
|
||||||
// any track from the overworld
|
// any track from the overworld
|
||||||
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
|
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
|
||||||
|
|
@ -930,8 +930,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter)
|
||||||
&soundEngine->m_engine,
|
&soundEngine->m_engine,
|
||||||
soundEngine->m_szStreamName,
|
soundEngine->m_szStreamName,
|
||||||
MA_SOUND_FLAG_STREAM,
|
MA_SOUND_FLAG_STREAM,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&soundEngine->m_musicStream);
|
&soundEngine->m_musicStream);
|
||||||
|
|
||||||
if (result != MA_SUCCESS)
|
if (result != MA_SUCCESS)
|
||||||
|
|
@ -1189,7 +1189,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
if( !m_openStreamThread->isRunning() )
|
if( !m_openStreamThread->isRunning() )
|
||||||
{
|
{
|
||||||
delete m_openStreamThread;
|
delete m_openStreamThread;
|
||||||
m_openStreamThread = NULL;
|
m_openStreamThread = nullptr;
|
||||||
|
|
||||||
app.DebugPrintf("OpenStreamThreadProc finished. m_musicStreamActive=%d\n", m_musicStreamActive);
|
app.DebugPrintf("OpenStreamThreadProc finished. m_musicStreamActive=%d\n", m_musicStreamActive);
|
||||||
|
|
||||||
|
|
@ -1246,7 +1246,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
if( !m_openStreamThread->isRunning() )
|
if( !m_openStreamThread->isRunning() )
|
||||||
{
|
{
|
||||||
delete m_openStreamThread;
|
delete m_openStreamThread;
|
||||||
m_openStreamThread = NULL;
|
m_openStreamThread = nullptr;
|
||||||
m_StreamState = eMusicStreamState_Stop;
|
m_StreamState = eMusicStreamState_Stop;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1282,14 +1282,14 @@ void SoundEngine::playMusicUpdate()
|
||||||
}
|
}
|
||||||
if(GetIsPlayingStreamingGameMusic())
|
if(GetIsPlayingStreamingGameMusic())
|
||||||
{
|
{
|
||||||
//if(m_MusicInfo.pCue!=NULL)
|
//if(m_MusicInfo.pCue!=nullptr)
|
||||||
{
|
{
|
||||||
bool playerInEnd = false;
|
bool playerInEnd = false;
|
||||||
bool playerInNether=false;
|
bool playerInNether=false;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
for(unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i)
|
for(unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]!=NULL)
|
if(pMinecraft->localplayers[i]!=nullptr)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
||||||
{
|
{
|
||||||
|
|
@ -1420,7 +1420,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
|
|
||||||
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
|
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]!=NULL)
|
if(pMinecraft->localplayers[i]!=nullptr)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -112,8 +112,8 @@ extern "C" {
|
||||||
// query get_info to find the exact amount required. yes I know
|
// query get_info to find the exact amount required. yes I know
|
||||||
// this is lame).
|
// this is lame).
|
||||||
//
|
//
|
||||||
// If you pass in a non-NULL buffer of the type below, allocation
|
// If you pass in a non-nullptr buffer of the type below, allocation
|
||||||
// will occur from it as described above. Otherwise just pass NULL
|
// will occur from it as described above. Otherwise just pass nullptr
|
||||||
// to use malloc()/alloca()
|
// to use malloc()/alloca()
|
||||||
|
|
||||||
typedef struct
|
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)
|
// 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
|
// 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;
|
// data parsed/consumed on this call in *datablock_memory_consumed_in_bytes;
|
||||||
// on failure, returns NULL on error and sets *error, does not change *datablock_memory_consumed
|
// on failure, returns nullptr 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
|
// if returns nullptr 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
|
// incomplete and you need to pass in a larger block from the start of the file
|
||||||
|
|
||||||
extern int stb_vorbis_decode_frame_pushdata(
|
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.
|
// without writing state-machiney code to record a partial detection.
|
||||||
//
|
//
|
||||||
// The number of channels returned are stored in *channels (which can be
|
// The number of channels returned are stored in *channels (which can be
|
||||||
// NULL--it is always the same as the number of channels reported by
|
// nullptr--it is always the same as the number of channels reported by
|
||||||
// get_info). *output will contain an array of float* buffers, one per
|
// get_info). *output will contain an array of float* buffers, one per
|
||||||
// channel. In other words, (*output)[0][0] contains the first sample from
|
// channel. In other words, (*output)[0][0] contains the first sample from
|
||||||
// the first channel, and (*output)[1][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,
|
extern stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len,
|
||||||
int *error, const stb_vorbis_alloc *alloc_buffer);
|
int *error, const stb_vorbis_alloc *alloc_buffer);
|
||||||
// create an ogg vorbis decoder from an ogg vorbis stream in memory (note
|
// create an ogg vorbis decoder from an ogg vorbis stream in memory (note
|
||||||
// this must be the entire stream!). on failure, returns NULL and sets *error
|
// this must be the entire stream!). on failure, returns nullptr and sets *error
|
||||||
|
|
||||||
#ifndef STB_VORBIS_NO_STDIO
|
#ifndef STB_VORBIS_NO_STDIO
|
||||||
extern stb_vorbis * stb_vorbis_open_filename(const char *filename,
|
extern stb_vorbis * stb_vorbis_open_filename(const char *filename,
|
||||||
int *error, const stb_vorbis_alloc *alloc_buffer);
|
int *error, const stb_vorbis_alloc *alloc_buffer);
|
||||||
// create an ogg vorbis decoder from a filename via fopen(). on failure,
|
// create an ogg vorbis decoder from a filename via fopen(). on failure,
|
||||||
// returns NULL and sets *error (possibly to VORBIS_file_open_failure).
|
// returns nullptr and sets *error (possibly to VORBIS_file_open_failure).
|
||||||
|
|
||||||
extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close,
|
extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close,
|
||||||
int *error, const stb_vorbis_alloc *alloc_buffer);
|
int *error, const stb_vorbis_alloc *alloc_buffer);
|
||||||
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
||||||
// the _current_ seek point (ftell). on failure, returns NULL and sets *error.
|
// the _current_ seek point (ftell). on failure, returns nullptr and sets *error.
|
||||||
// note that stb_vorbis must "own" this stream; if you seek it in between
|
// 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
|
// 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
|
// 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);
|
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
|
// 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.
|
// the _current_ seek point (ftell); the stream will be of length 'len' bytes.
|
||||||
// on failure, returns NULL and sets *error. note that stb_vorbis must "own"
|
// on failure, returns nullptr and sets *error. note that stb_vorbis must "own"
|
||||||
// this stream; if you seek it in between calls to stb_vorbis, it will become
|
// this stream; if you seek it in between calls to stb_vorbis, it will become
|
||||||
// confused.
|
// confused.
|
||||||
#endif
|
#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);
|
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
|
// decode the next frame and return the number of samples. the number of
|
||||||
// channels returned are stored in *channels (which can be NULL--it is always
|
// channels returned are stored in *channels (which can be nullptr--it is always
|
||||||
// the same as the number of channels reported by get_info). *output will
|
// 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
|
// contain an array of float* buffers, one per channel. These outputs will
|
||||||
// be overwritten on the next call to stb_vorbis_get_frame_*.
|
// be overwritten on the next call to stb_vorbis_get_frame_*.
|
||||||
|
|
@ -588,7 +588,7 @@ enum STBVorbisError
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
#else // STB_VORBIS_NO_CRT
|
#else // STB_VORBIS_NO_CRT
|
||||||
#define NULL 0
|
#define nullptr 0
|
||||||
#define malloc(s) 0
|
#define malloc(s) 0
|
||||||
#define free(s) ((void) 0)
|
#define free(s) ((void) 0)
|
||||||
#define realloc(s) 0
|
#define realloc(s) 0
|
||||||
|
|
@ -949,11 +949,11 @@ static void *setup_malloc(vorb *f, int sz)
|
||||||
f->setup_memory_required += sz;
|
f->setup_memory_required += sz;
|
||||||
if (f->alloc.alloc_buffer) {
|
if (f->alloc.alloc_buffer) {
|
||||||
void *p = (char *) f->alloc.alloc_buffer + f->setup_offset;
|
void *p = (char *) f->alloc.alloc_buffer + f->setup_offset;
|
||||||
if (f->setup_offset + sz > f->temp_offset) return NULL;
|
if (f->setup_offset + sz > f->temp_offset) return nullptr;
|
||||||
f->setup_offset += sz;
|
f->setup_offset += sz;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
return sz ? malloc(sz) : NULL;
|
return sz ? malloc(sz) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_free(vorb *f, void *p)
|
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.
|
sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs.
|
||||||
if (f->alloc.alloc_buffer) {
|
if (f->alloc.alloc_buffer) {
|
||||||
if (f->temp_offset - sz < f->setup_offset) return NULL;
|
if (f->temp_offset - sz < f->setup_offset) return nullptr;
|
||||||
f->temp_offset -= sz;
|
f->temp_offset -= sz;
|
||||||
return (char *) f->alloc.alloc_buffer + f->temp_offset;
|
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;
|
int i;
|
||||||
prep_huffman(f);
|
prep_huffman(f);
|
||||||
|
|
||||||
if (c->codewords == NULL && c->sorted_codewords == NULL)
|
if (c->codewords == nullptr && c->sorted_codewords == nullptr)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// cases to use binary search: sorted_codewords && !c->codewords
|
// cases to use binary search: sorted_codewords && !c->codewords
|
||||||
// sorted_codewords && c->entries > 8
|
// sorted_codewords && c->entries > 8
|
||||||
if (c->entries > 8 ? c->sorted_codewords!=NULL : !c->codewords) {
|
if (c->entries > 8 ? c->sorted_codewords!=nullptr : !c->codewords) {
|
||||||
// binary search
|
// binary search
|
||||||
uint32 code = bit_reverse(f->acc);
|
uint32 code = bit_reverse(f->acc);
|
||||||
int x=0, n=c->sorted_entries, len;
|
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?
|
// @OPTIMIZE: reduce register pressure by using fewer variables?
|
||||||
int save_point = temp_alloc_save(f);
|
int save_point = temp_alloc_save(f);
|
||||||
float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2));
|
float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2));
|
||||||
float *u=NULL,*v=NULL;
|
float *u=nullptr,*v=nullptr;
|
||||||
// twiddle factors
|
// twiddle factors
|
||||||
float *A = f->A[blocktype];
|
float *A = f->A[blocktype];
|
||||||
|
|
||||||
|
|
@ -3057,7 +3057,7 @@ static float *get_window(vorb *f, int len)
|
||||||
len <<= 1;
|
len <<= 1;
|
||||||
if (len == f->blocksize_0) return f->window[0];
|
if (len == f->blocksize_0) return f->window[0];
|
||||||
if (len == f->blocksize_1) return f->window[1];
|
if (len == f->blocksize_1) return f->window[1];
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef STB_VORBIS_NO_DEFER_FLOOR
|
#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 (map->chan[j].mux == i) {
|
||||||
if (zero_channel[j]) {
|
if (zero_channel[j]) {
|
||||||
do_not_decode[ch] = TRUE;
|
do_not_decode[ch] = TRUE;
|
||||||
residue_buffers[ch] = NULL;
|
residue_buffers[ch] = nullptr;
|
||||||
} else {
|
} else {
|
||||||
do_not_decode[ch] = FALSE;
|
do_not_decode[ch] = FALSE;
|
||||||
residue_buffers[ch] = f->channel_buffers[j];
|
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]) {
|
if (really_zero_channel[i]) {
|
||||||
memset(f->channel_buffers[i], 0, sizeof(*f->channel_buffers[i]) * n2);
|
memset(f->channel_buffers[i], 0, sizeof(*f->channel_buffers[i]) * n2);
|
||||||
} else {
|
} else {
|
||||||
do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], NULL);
|
do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
@ -3464,7 +3464,7 @@ static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)
|
||||||
if (f->previous_length) {
|
if (f->previous_length) {
|
||||||
int i,j, n = f->previous_length;
|
int i,j, n = f->previous_length;
|
||||||
float *w = get_window(f, n);
|
float *w = get_window(f, n);
|
||||||
if (w == NULL) return 0;
|
if (w == nullptr) return 0;
|
||||||
for (i=0; i < f->channels; ++i) {
|
for (i=0; i < f->channels; ++i) {
|
||||||
for (j=0; j < n; ++j)
|
for (j=0; j < n; ++j)
|
||||||
f->channel_buffers[i][left+j] =
|
f->channel_buffers[i][left+j] =
|
||||||
|
|
@ -3647,24 +3647,24 @@ static int start_decoder(vorb *f)
|
||||||
//file vendor
|
//file vendor
|
||||||
len = get32_packet(f);
|
len = get32_packet(f);
|
||||||
f->vendor = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
f->vendor = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
||||||
if (f->vendor == NULL) return error(f, VORBIS_outofmem);
|
if (f->vendor == nullptr) return error(f, VORBIS_outofmem);
|
||||||
for(i=0; i < len; ++i) {
|
for(i=0; i < len; ++i) {
|
||||||
f->vendor[i] = get8_packet(f);
|
f->vendor[i] = get8_packet(f);
|
||||||
}
|
}
|
||||||
f->vendor[len] = (char)'\0';
|
f->vendor[len] = (char)'\0';
|
||||||
//user comments
|
//user comments
|
||||||
f->comment_list_length = get32_packet(f);
|
f->comment_list_length = get32_packet(f);
|
||||||
f->comment_list = NULL;
|
f->comment_list = nullptr;
|
||||||
if (f->comment_list_length > 0)
|
if (f->comment_list_length > 0)
|
||||||
{
|
{
|
||||||
f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length));
|
f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length));
|
||||||
if (f->comment_list == NULL) return error(f, VORBIS_outofmem);
|
if (f->comment_list == nullptr) return error(f, VORBIS_outofmem);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i < f->comment_list_length; ++i) {
|
for(i=0; i < f->comment_list_length; ++i) {
|
||||||
len = get32_packet(f);
|
len = get32_packet(f);
|
||||||
f->comment_list[i] = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
f->comment_list[i] = (char*)setup_malloc(f, sizeof(char) * (len+1));
|
||||||
if (f->comment_list[i] == NULL) return error(f, VORBIS_outofmem);
|
if (f->comment_list[i] == nullptr) return error(f, VORBIS_outofmem);
|
||||||
|
|
||||||
for(j=0; j < len; ++j) {
|
for(j=0; j < len; ++j) {
|
||||||
f->comment_list[i][j] = get8_packet(f);
|
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->codebook_count = get_bits(f,8) + 1;
|
||||||
f->codebooks = (Codebook *) setup_malloc(f, sizeof(*f->codebooks) * f->codebook_count);
|
f->codebooks = (Codebook *) setup_malloc(f, sizeof(*f->codebooks) * f->codebook_count);
|
||||||
if (f->codebooks == NULL) return error(f, VORBIS_outofmem);
|
if (f->codebooks == nullptr) return error(f, VORBIS_outofmem);
|
||||||
memset(f->codebooks, 0, sizeof(*f->codebooks) * f->codebook_count);
|
memset(f->codebooks, 0, sizeof(*f->codebooks) * f->codebook_count);
|
||||||
for (i=0; i < f->codebook_count; ++i) {
|
for (i=0; i < f->codebook_count; ++i) {
|
||||||
uint32 *values;
|
uint32 *values;
|
||||||
|
|
@ -3771,7 +3771,7 @@ static int start_decoder(vorb *f)
|
||||||
f->setup_temp_memory_required = c->entries;
|
f->setup_temp_memory_required = c->entries;
|
||||||
|
|
||||||
c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries);
|
c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries);
|
||||||
if (c->codeword_lengths == NULL) return error(f, VORBIS_outofmem);
|
if (c->codeword_lengths == nullptr) return error(f, VORBIS_outofmem);
|
||||||
memcpy(c->codeword_lengths, lengths, c->entries);
|
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!
|
setup_temp_free(f, lengths, c->entries); // note this is only safe if there have been no intervening temp mallocs!
|
||||||
lengths = c->codeword_lengths;
|
lengths = c->codeword_lengths;
|
||||||
|
|
@ -3791,7 +3791,7 @@ static int start_decoder(vorb *f)
|
||||||
}
|
}
|
||||||
|
|
||||||
c->sorted_entries = sorted_count;
|
c->sorted_entries = sorted_count;
|
||||||
values = NULL;
|
values = nullptr;
|
||||||
|
|
||||||
CHECK(f);
|
CHECK(f);
|
||||||
if (!c->sparse) {
|
if (!c->sparse) {
|
||||||
|
|
@ -3820,11 +3820,11 @@ static int start_decoder(vorb *f)
|
||||||
if (c->sorted_entries) {
|
if (c->sorted_entries) {
|
||||||
// allocate an extra slot for sentinels
|
// allocate an extra slot for sentinels
|
||||||
c->sorted_codewords = (uint32 *) setup_malloc(f, sizeof(*c->sorted_codewords) * (c->sorted_entries+1));
|
c->sorted_codewords = (uint32 *) setup_malloc(f, sizeof(*c->sorted_codewords) * (c->sorted_entries+1));
|
||||||
if (c->sorted_codewords == NULL) return error(f, VORBIS_outofmem);
|
if (c->sorted_codewords == nullptr) return error(f, VORBIS_outofmem);
|
||||||
// allocate an extra slot at the front so that c->sorted_values[-1] is defined
|
// 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
|
// 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));
|
c->sorted_values = ( int *) setup_malloc(f, sizeof(*c->sorted_values ) * (c->sorted_entries+1));
|
||||||
if (c->sorted_values == NULL) return error(f, VORBIS_outofmem);
|
if (c->sorted_values == nullptr) return error(f, VORBIS_outofmem);
|
||||||
++c->sorted_values;
|
++c->sorted_values;
|
||||||
c->sorted_values[-1] = -1;
|
c->sorted_values[-1] = -1;
|
||||||
compute_sorted_huffman(c, lengths, values);
|
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, values, sizeof(*values)*c->sorted_entries);
|
||||||
setup_temp_free(f, c->codewords, sizeof(*c->codewords)*c->sorted_entries);
|
setup_temp_free(f, c->codewords, sizeof(*c->codewords)*c->sorted_entries);
|
||||||
setup_temp_free(f, lengths, c->entries);
|
setup_temp_free(f, lengths, c->entries);
|
||||||
c->codewords = NULL;
|
c->codewords = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
compute_accelerated_huffman(c);
|
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);
|
if (c->lookup_values == 0) return error(f, VORBIS_invalid_setup);
|
||||||
mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values);
|
mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values);
|
||||||
if (mults == NULL) return error(f, VORBIS_outofmem);
|
if (mults == nullptr) return error(f, VORBIS_outofmem);
|
||||||
for (j=0; j < (int) c->lookup_values; ++j) {
|
for (j=0; j < (int) c->lookup_values; ++j) {
|
||||||
int q = get_bits(f, c->value_bits);
|
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); }
|
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);
|
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->sorted_entries * c->dimensions);
|
||||||
} else
|
} else
|
||||||
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->entries * c->dimensions);
|
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->entries * c->dimensions);
|
||||||
if (c->multiplicands == NULL) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); }
|
if (c->multiplicands == nullptr) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); }
|
||||||
len = sparse ? c->sorted_entries : c->entries;
|
len = sparse ? c->sorted_entries : c->entries;
|
||||||
for (j=0; j < len; ++j) {
|
for (j=0; j < len; ++j) {
|
||||||
unsigned int z = sparse ? c->sorted_values[j] : j;
|
unsigned int z = sparse ? c->sorted_values[j] : j;
|
||||||
|
|
@ -3902,7 +3902,7 @@ static int start_decoder(vorb *f)
|
||||||
float last=0;
|
float last=0;
|
||||||
CHECK(f);
|
CHECK(f);
|
||||||
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->lookup_values);
|
c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->lookup_values);
|
||||||
if (c->multiplicands == NULL) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); }
|
if (c->multiplicands == nullptr) { 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) {
|
for (j=0; j < (int) c->lookup_values; ++j) {
|
||||||
float val = mults[j] * c->delta_value + c->minimum_value + last;
|
float val = mults[j] * c->delta_value + c->minimum_value + last;
|
||||||
c->multiplicands[j] = val;
|
c->multiplicands[j] = val;
|
||||||
|
|
@ -3931,7 +3931,7 @@ static int start_decoder(vorb *f)
|
||||||
// Floors
|
// Floors
|
||||||
f->floor_count = get_bits(f, 6)+1;
|
f->floor_count = get_bits(f, 6)+1;
|
||||||
f->floor_config = (Floor *) setup_malloc(f, f->floor_count * sizeof(*f->floor_config));
|
f->floor_config = (Floor *) setup_malloc(f, f->floor_count * sizeof(*f->floor_config));
|
||||||
if (f->floor_config == NULL) return error(f, VORBIS_outofmem);
|
if (f->floor_config == nullptr) return error(f, VORBIS_outofmem);
|
||||||
for (i=0; i < f->floor_count; ++i) {
|
for (i=0; i < f->floor_count; ++i) {
|
||||||
f->floor_types[i] = get_bits(f, 16);
|
f->floor_types[i] = get_bits(f, 16);
|
||||||
if (f->floor_types[i] > 1) return error(f, VORBIS_invalid_setup);
|
if (f->floor_types[i] > 1) return error(f, VORBIS_invalid_setup);
|
||||||
|
|
@ -4007,7 +4007,7 @@ static int start_decoder(vorb *f)
|
||||||
// Residue
|
// Residue
|
||||||
f->residue_count = get_bits(f, 6)+1;
|
f->residue_count = get_bits(f, 6)+1;
|
||||||
f->residue_config = (Residue *) setup_malloc(f, f->residue_count * sizeof(f->residue_config[0]));
|
f->residue_config = (Residue *) setup_malloc(f, f->residue_count * sizeof(f->residue_config[0]));
|
||||||
if (f->residue_config == NULL) return error(f, VORBIS_outofmem);
|
if (f->residue_config == nullptr) return error(f, VORBIS_outofmem);
|
||||||
memset(f->residue_config, 0, f->residue_count * sizeof(f->residue_config[0]));
|
memset(f->residue_config, 0, f->residue_count * sizeof(f->residue_config[0]));
|
||||||
for (i=0; i < f->residue_count; ++i) {
|
for (i=0; i < f->residue_count; ++i) {
|
||||||
uint8 residue_cascade[64];
|
uint8 residue_cascade[64];
|
||||||
|
|
@ -4029,7 +4029,7 @@ static int start_decoder(vorb *f)
|
||||||
residue_cascade[j] = high_bits*8 + low_bits;
|
residue_cascade[j] = high_bits*8 + low_bits;
|
||||||
}
|
}
|
||||||
r->residue_books = (short (*)[8]) setup_malloc(f, sizeof(r->residue_books[0]) * r->classifications);
|
r->residue_books = (short (*)[8]) setup_malloc(f, sizeof(r->residue_books[0]) * r->classifications);
|
||||||
if (r->residue_books == NULL) return error(f, VORBIS_outofmem);
|
if (r->residue_books == nullptr) return error(f, VORBIS_outofmem);
|
||||||
for (j=0; j < r->classifications; ++j) {
|
for (j=0; j < r->classifications; ++j) {
|
||||||
for (k=0; k < 8; ++k) {
|
for (k=0; k < 8; ++k) {
|
||||||
if (residue_cascade[j] & (1 << 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 classwords = f->codebooks[r->classbook].dimensions;
|
||||||
int temp = j;
|
int temp = j;
|
||||||
r->classdata[j] = (uint8 *) setup_malloc(f, sizeof(r->classdata[j][0]) * classwords);
|
r->classdata[j] = (uint8 *) setup_malloc(f, sizeof(r->classdata[j][0]) * classwords);
|
||||||
if (r->classdata[j] == NULL) return error(f, VORBIS_outofmem);
|
if (r->classdata[j] == nullptr) return error(f, VORBIS_outofmem);
|
||||||
for (k=classwords-1; k >= 0; --k) {
|
for (k=classwords-1; k >= 0; --k) {
|
||||||
r->classdata[j][k] = temp % r->classifications;
|
r->classdata[j][k] = temp % r->classifications;
|
||||||
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_count = get_bits(f,6)+1;
|
||||||
f->mapping = (Mapping *) setup_malloc(f, f->mapping_count * sizeof(*f->mapping));
|
f->mapping = (Mapping *) setup_malloc(f, f->mapping_count * sizeof(*f->mapping));
|
||||||
if (f->mapping == NULL) return error(f, VORBIS_outofmem);
|
if (f->mapping == nullptr) return error(f, VORBIS_outofmem);
|
||||||
memset(f->mapping, 0, f->mapping_count * sizeof(*f->mapping));
|
memset(f->mapping, 0, f->mapping_count * sizeof(*f->mapping));
|
||||||
for (i=0; i < f->mapping_count; ++i) {
|
for (i=0; i < f->mapping_count; ++i) {
|
||||||
Mapping *m = f->mapping + i;
|
Mapping *m = f->mapping + i;
|
||||||
int mapping_type = get_bits(f,16);
|
int mapping_type = get_bits(f,16);
|
||||||
if (mapping_type != 0) return error(f, VORBIS_invalid_setup);
|
if (mapping_type != 0) return error(f, VORBIS_invalid_setup);
|
||||||
m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan));
|
m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan));
|
||||||
if (m->chan == NULL) return error(f, VORBIS_outofmem);
|
if (m->chan == nullptr) return error(f, VORBIS_outofmem);
|
||||||
if (get_bits(f,1))
|
if (get_bits(f,1))
|
||||||
m->submaps = get_bits(f,4)+1;
|
m->submaps = get_bits(f,4)+1;
|
||||||
else
|
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->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->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
|
||||||
f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist);
|
f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist);
|
||||||
if (f->channel_buffers[i] == NULL || f->previous_window[i] == NULL || f->finalY[i] == NULL) return error(f, VORBIS_outofmem);
|
if (f->channel_buffers[i] == nullptr || f->previous_window[i] == nullptr || f->finalY[i] == nullptr) return error(f, VORBIS_outofmem);
|
||||||
memset(f->channel_buffers[i], 0, sizeof(float) * f->blocksize_1);
|
memset(f->channel_buffers[i], 0, sizeof(float) * f->blocksize_1);
|
||||||
#ifdef STB_VORBIS_NO_DEFER_FLOOR
|
#ifdef STB_VORBIS_NO_DEFER_FLOOR
|
||||||
f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
|
f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
|
||||||
if (f->floor_buffers[i] == NULL) return error(f, VORBIS_outofmem);
|
if (f->floor_buffers[i] == nullptr) return error(f, VORBIS_outofmem);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4232,7 +4232,7 @@ static void vorbis_deinit(stb_vorbis *p)
|
||||||
setup_free(p, c->codewords);
|
setup_free(p, c->codewords);
|
||||||
setup_free(p, c->sorted_codewords);
|
setup_free(p, c->sorted_codewords);
|
||||||
// c->sorted_values[-1] is the first entry in the array
|
// c->sorted_values[-1] is the first entry in the array
|
||||||
setup_free(p, c->sorted_values ? c->sorted_values-1 : NULL);
|
setup_free(p, c->sorted_values ? c->sorted_values-1 : nullptr);
|
||||||
}
|
}
|
||||||
setup_free(p, p->codebooks);
|
setup_free(p, p->codebooks);
|
||||||
}
|
}
|
||||||
|
|
@ -4266,14 +4266,14 @@ static void vorbis_deinit(stb_vorbis *p)
|
||||||
|
|
||||||
void stb_vorbis_close(stb_vorbis *p)
|
void stb_vorbis_close(stb_vorbis *p)
|
||||||
{
|
{
|
||||||
if (p == NULL) return;
|
if (p == nullptr) return;
|
||||||
vorbis_deinit(p);
|
vorbis_deinit(p);
|
||||||
setup_free(p,p);
|
setup_free(p,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
|
static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
|
||||||
{
|
{
|
||||||
memset(p, 0, sizeof(*p)); // NULL out all malloc'd pointers to start
|
memset(p, 0, sizeof(*p)); // nullptr out all malloc'd pointers to start
|
||||||
if (z) {
|
if (z) {
|
||||||
p->alloc = *z;
|
p->alloc = *z;
|
||||||
p->alloc.alloc_buffer_length_in_bytes &= ~7;
|
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->eof = 0;
|
||||||
p->error = VORBIS__no_error;
|
p->error = VORBIS__no_error;
|
||||||
p->stream = NULL;
|
p->stream = nullptr;
|
||||||
p->codebooks = NULL;
|
p->codebooks = nullptr;
|
||||||
p->page_crc_tests = -1;
|
p->page_crc_tests = -1;
|
||||||
#ifndef STB_VORBIS_NO_STDIO
|
#ifndef STB_VORBIS_NO_STDIO
|
||||||
p->close_on_free = FALSE;
|
p->close_on_free = FALSE;
|
||||||
p->f = NULL;
|
p->f = nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4509,7 +4509,7 @@ int stb_vorbis_decode_frame_pushdata(
|
||||||
|
|
||||||
stb_vorbis *stb_vorbis_open_pushdata(
|
stb_vorbis *stb_vorbis_open_pushdata(
|
||||||
const unsigned char *data, int data_len, // the memory available for decoding
|
const unsigned char *data, int data_len, // the memory available for decoding
|
||||||
int *data_used, // only defined if result is not NULL
|
int *data_used, // only defined if result is not nullptr
|
||||||
int *error, const stb_vorbis_alloc *alloc)
|
int *error, const stb_vorbis_alloc *alloc)
|
||||||
{
|
{
|
||||||
stb_vorbis *f, p;
|
stb_vorbis *f, p;
|
||||||
|
|
@ -4523,7 +4523,7 @@ stb_vorbis *stb_vorbis_open_pushdata(
|
||||||
else
|
else
|
||||||
*error = p.error;
|
*error = p.error;
|
||||||
vorbis_deinit(&p);
|
vorbis_deinit(&p);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
f = vorbis_alloc(&p);
|
f = vorbis_alloc(&p);
|
||||||
if (f) {
|
if (f) {
|
||||||
|
|
@ -4533,7 +4533,7 @@ stb_vorbis *stb_vorbis_open_pushdata(
|
||||||
return f;
|
return f;
|
||||||
} else {
|
} else {
|
||||||
vorbis_deinit(&p);
|
vorbis_deinit(&p);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // STB_VORBIS_NO_PUSHDATA_API
|
#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);
|
set_file_offset(f, previous_safe);
|
||||||
|
|
||||||
while (vorbis_find_page(f, &end, NULL)) {
|
while (vorbis_find_page(f, &end, nullptr)) {
|
||||||
if (end >= limit_offset && stb_vorbis_get_file_offset(f) < limit_offset)
|
if (end >= limit_offset && stb_vorbis_get_file_offset(f) < limit_offset)
|
||||||
return 1;
|
return 1;
|
||||||
set_file_offset(f, end);
|
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);
|
set_file_offset(f, left.page_end + (delta / 2) - 32768);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vorbis_find_page(f, NULL, NULL)) goto error;
|
if (!vorbis_find_page(f, nullptr, nullptr)) goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -4920,7 +4920,7 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number)
|
||||||
if (sample_number != f->current_loc) {
|
if (sample_number != f->current_loc) {
|
||||||
int n;
|
int n;
|
||||||
uint32 frame_start = f->current_loc;
|
uint32 frame_start = f->current_loc;
|
||||||
stb_vorbis_get_frame_float(f, &n, NULL);
|
stb_vorbis_get_frame_float(f, &n, nullptr);
|
||||||
assert(sample_number > frame_start);
|
assert(sample_number > frame_start);
|
||||||
assert(f->channel_buffer_start + (int) (sample_number-frame_start) <= f->channel_buffer_end);
|
assert(f->channel_buffer_start + (int) (sample_number-frame_start) <= f->channel_buffer_end);
|
||||||
f->channel_buffer_start += (sample_number - frame_start);
|
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;
|
if (error) *error = p.error;
|
||||||
vorbis_deinit(&p);
|
vorbis_deinit(&p);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, const stb_vorbis_alloc *alloc)
|
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;
|
FILE *f;
|
||||||
#if defined(_WIN32) && defined(__STDC_WANT_SECURE_LIB__)
|
#if defined(_WIN32) && defined(__STDC_WANT_SECURE_LIB__)
|
||||||
if (0 != fopen_s(&f, filename, "rb"))
|
if (0 != fopen_s(&f, filename, "rb"))
|
||||||
f = NULL;
|
f = nullptr;
|
||||||
#else
|
#else
|
||||||
f = fopen(filename, "rb");
|
f = fopen(filename, "rb");
|
||||||
#endif
|
#endif
|
||||||
if (f)
|
if (f)
|
||||||
return stb_vorbis_open_file(f, TRUE, error, alloc);
|
return stb_vorbis_open_file(f, TRUE, error, alloc);
|
||||||
if (error) *error = VORBIS_file_open_failure;
|
if (error) *error = VORBIS_file_open_failure;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#endif // STB_VORBIS_NO_STDIO
|
#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;
|
stb_vorbis *f, p;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
if (error) *error = VORBIS_unexpected_eof;
|
if (error) *error = VORBIS_unexpected_eof;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
vorbis_init(&p, alloc);
|
vorbis_init(&p, alloc);
|
||||||
p.stream = (uint8 *) data;
|
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;
|
if (error) *error = p.error;
|
||||||
vorbis_deinit(&p);
|
vorbis_deinit(&p);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef STB_VORBIS_NO_INTEGER_CONVERSION
|
#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)
|
int stb_vorbis_get_frame_short(stb_vorbis *f, int num_c, short **buffer, int num_samples)
|
||||||
{
|
{
|
||||||
float **output = NULL;
|
float **output = nullptr;
|
||||||
int len = stb_vorbis_get_frame_float(f, NULL, &output);
|
int len = stb_vorbis_get_frame_float(f, nullptr, &output);
|
||||||
if (len > num_samples) len = num_samples;
|
if (len > num_samples) len = num_samples;
|
||||||
if (len)
|
if (len)
|
||||||
convert_samples_short(num_c, buffer, 0, f->channels, output, 0, 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;
|
float **output;
|
||||||
int len;
|
int len;
|
||||||
if (num_c == 1) return stb_vorbis_get_frame_short(f,num_c,&buffer, num_shorts);
|
if (num_c == 1) return stb_vorbis_get_frame_short(f,num_c,&buffer, num_shorts);
|
||||||
len = stb_vorbis_get_frame_float(f, NULL, &output);
|
len = stb_vorbis_get_frame_float(f, nullptr, &output);
|
||||||
if (len) {
|
if (len) {
|
||||||
if (len*num_c > num_shorts) len = num_shorts / num_c;
|
if (len*num_c > num_shorts) len = num_shorts / num_c;
|
||||||
convert_channels_short_interleaved(num_c, buffer, f->channels, output, 0, len);
|
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;
|
n += k;
|
||||||
f->channel_buffer_start += k;
|
f->channel_buffer_start += k;
|
||||||
if (n == len) break;
|
if (n == len) break;
|
||||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break;
|
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
@ -5333,7 +5333,7 @@ int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, in
|
||||||
n += k;
|
n += k;
|
||||||
f->channel_buffer_start += k;
|
f->channel_buffer_start += k;
|
||||||
if (n == len) break;
|
if (n == len) break;
|
||||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break;
|
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break;
|
||||||
}
|
}
|
||||||
return n;
|
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;
|
int data_len, offset, total, limit, error;
|
||||||
short *data;
|
short *data;
|
||||||
stb_vorbis *v = stb_vorbis_open_filename(filename, &error, NULL);
|
stb_vorbis *v = stb_vorbis_open_filename(filename, &error, nullptr);
|
||||||
if (v == NULL) return -1;
|
if (v == nullptr) return -1;
|
||||||
limit = v->channels * 4096;
|
limit = v->channels * 4096;
|
||||||
*channels = v->channels;
|
*channels = v->channels;
|
||||||
if (sample_rate)
|
if (sample_rate)
|
||||||
|
|
@ -5352,7 +5352,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_
|
||||||
offset = data_len = 0;
|
offset = data_len = 0;
|
||||||
total = limit;
|
total = limit;
|
||||||
data = (short *) malloc(total * sizeof(*data));
|
data = (short *) malloc(total * sizeof(*data));
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
stb_vorbis_close(v);
|
stb_vorbis_close(v);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
@ -5365,7 +5365,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_
|
||||||
short *data2;
|
short *data2;
|
||||||
total *= 2;
|
total *= 2;
|
||||||
data2 = (short *) realloc(data, total * sizeof(*data));
|
data2 = (short *) realloc(data, total * sizeof(*data));
|
||||||
if (data2 == NULL) {
|
if (data2 == nullptr) {
|
||||||
free(data);
|
free(data);
|
||||||
stb_vorbis_close(v);
|
stb_vorbis_close(v);
|
||||||
return -2;
|
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;
|
int data_len, offset, total, limit, error;
|
||||||
short *data;
|
short *data;
|
||||||
stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, NULL);
|
stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, nullptr);
|
||||||
if (v == NULL) return -1;
|
if (v == nullptr) return -1;
|
||||||
limit = v->channels * 4096;
|
limit = v->channels * 4096;
|
||||||
*channels = v->channels;
|
*channels = v->channels;
|
||||||
if (sample_rate)
|
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;
|
offset = data_len = 0;
|
||||||
total = limit;
|
total = limit;
|
||||||
data = (short *) malloc(total * sizeof(*data));
|
data = (short *) malloc(total * sizeof(*data));
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
stb_vorbis_close(v);
|
stb_vorbis_close(v);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
@ -5405,7 +5405,7 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp
|
||||||
short *data2;
|
short *data2;
|
||||||
total *= 2;
|
total *= 2;
|
||||||
data2 = (short *) realloc(data, total * sizeof(*data));
|
data2 = (short *) realloc(data, total * sizeof(*data));
|
||||||
if (data2 == NULL) {
|
if (data2 == nullptr) {
|
||||||
free(data);
|
free(data);
|
||||||
stb_vorbis_close(v);
|
stb_vorbis_close(v);
|
||||||
return -2;
|
return -2;
|
||||||
|
|
@ -5440,7 +5440,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float
|
||||||
f->channel_buffer_start += k;
|
f->channel_buffer_start += k;
|
||||||
if (n == len)
|
if (n == len)
|
||||||
break;
|
break;
|
||||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs))
|
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return n;
|
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;
|
f->channel_buffer_start += k;
|
||||||
if (n == num_samples)
|
if (n == num_samples)
|
||||||
break;
|
break;
|
||||||
if (!stb_vorbis_get_frame_float(f, NULL, &outputs))
|
if (!stb_vorbis_get_frame_float(f, nullptr, &outputs))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ CMinecraftApp::CMinecraftApp()
|
||||||
{
|
{
|
||||||
m_eTMSAction[i]=eTMSAction_Idle;
|
m_eTMSAction[i]=eTMSAction_Idle;
|
||||||
m_eXuiAction[i]=eAppAction_Idle;
|
m_eXuiAction[i]=eAppAction_Idle;
|
||||||
m_eXuiActionParam[i] = NULL;
|
m_eXuiActionParam[i] = nullptr;
|
||||||
//m_dwAdditionalModelParts[i] = 0;
|
//m_dwAdditionalModelParts[i] = 0;
|
||||||
|
|
||||||
if(FAILED(XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY ,&m_currentSigninInfo[i])))
|
if(FAILED(XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY ,&m_currentSigninInfo[i])))
|
||||||
|
|
@ -157,9 +157,9 @@ CMinecraftApp::CMinecraftApp()
|
||||||
// m_bRead_TMS_XUIDS_XML=false;
|
// m_bRead_TMS_XUIDS_XML=false;
|
||||||
// m_bRead_TMS_DLCINFO_XML=false;
|
// m_bRead_TMS_DLCINFO_XML=false;
|
||||||
|
|
||||||
m_pDLCFileBuffer=NULL;
|
m_pDLCFileBuffer=nullptr;
|
||||||
m_dwDLCFileSize=0;
|
m_dwDLCFileSize=0;
|
||||||
m_pBannedListFileBuffer=NULL;
|
m_pBannedListFileBuffer=nullptr;
|
||||||
m_dwBannedListFileSize=0;
|
m_dwBannedListFileSize=0;
|
||||||
|
|
||||||
m_bDefaultCapeInstallAttempted=false;
|
m_bDefaultCapeInstallAttempted=false;
|
||||||
|
|
@ -763,7 +763,7 @@ bool CMinecraftApp::LoadBeaconMenu(int iPad ,shared_ptr<Inventory> inventory, sh
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
static void Win64_GetSettingsPath(char *outPath, DWORD size)
|
static void Win64_GetSettingsPath(char *outPath, DWORD size)
|
||||||
{
|
{
|
||||||
GetModuleFileNameA(NULL, outPath, size);
|
GetModuleFileNameA(nullptr, outPath, size);
|
||||||
char *lastSlash = strrchr(outPath, '\\');
|
char *lastSlash = strrchr(outPath, '\\');
|
||||||
if (lastSlash) *(lastSlash + 1) = '\0';
|
if (lastSlash) *(lastSlash + 1) = '\0';
|
||||||
strncat_s(outPath, size, "settings.dat", _TRUNCATE);
|
strncat_s(outPath, size, "settings.dat", _TRUNCATE);
|
||||||
|
|
@ -773,7 +773,7 @@ static void Win64_SaveSettings(GAME_SETTINGS *gs)
|
||||||
if (!gs) return;
|
if (!gs) return;
|
||||||
char filePath[MAX_PATH] = {};
|
char filePath[MAX_PATH] = {};
|
||||||
Win64_GetSettingsPath(filePath, MAX_PATH);
|
Win64_GetSettingsPath(filePath, MAX_PATH);
|
||||||
FILE *f = NULL;
|
FILE *f = nullptr;
|
||||||
if (fopen_s(&f, filePath, "wb") == 0 && f)
|
if (fopen_s(&f, filePath, "wb") == 0 && f)
|
||||||
{
|
{
|
||||||
fwrite(gs, sizeof(GAME_SETTINGS), 1, f);
|
fwrite(gs, sizeof(GAME_SETTINGS), 1, f);
|
||||||
|
|
@ -785,7 +785,7 @@ static void Win64_LoadSettings(GAME_SETTINGS *gs)
|
||||||
if (!gs) return;
|
if (!gs) return;
|
||||||
char filePath[MAX_PATH] = {};
|
char filePath[MAX_PATH] = {};
|
||||||
Win64_GetSettingsPath(filePath, MAX_PATH);
|
Win64_GetSettingsPath(filePath, MAX_PATH);
|
||||||
FILE *f = NULL;
|
FILE *f = nullptr;
|
||||||
if (fopen_s(&f, filePath, "rb") == 0 && f)
|
if (fopen_s(&f, filePath, "rb") == 0 && f)
|
||||||
{
|
{
|
||||||
GAME_SETTINGS temp = {};
|
GAME_SETTINGS temp = {};
|
||||||
|
|
@ -838,7 +838,7 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con
|
||||||
SetGameSettings(iPad,eGameSetting_Gamma,50);
|
SetGameSettings(iPad,eGameSetting_Gamma,50);
|
||||||
|
|
||||||
// 4J-PB - Don't reset the difficult level if we're in-game
|
// 4J-PB - Don't reset the difficult level if we're in-game
|
||||||
if(Minecraft::GetInstance()->level==NULL)
|
if(Minecraft::GetInstance()->level==nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n");
|
app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n");
|
||||||
SetGameSettings(iPad,eGameSetting_Difficulty,1);
|
SetGameSettings(iPad,eGameSetting_Difficulty,1);
|
||||||
|
|
@ -1400,7 +1400,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
app.SetGameHostOption(eGameHostOption_Difficulty,pMinecraft->options->difficulty);
|
app.SetGameHostOption(eGameHostOption_Difficulty,pMinecraft->options->difficulty);
|
||||||
|
|
||||||
// send this to the other players if we are in-game
|
// send this to the other players if we are in-game
|
||||||
bool bInGame=pMinecraft->level!=NULL;
|
bool bInGame=pMinecraft->level!=nullptr;
|
||||||
|
|
||||||
// Game Host only (and for now we can't change the diff while in game, so this shouldn't happen)
|
// Game Host only (and for now we can't change the diff while in game, so this shouldn't happen)
|
||||||
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
|
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
|
||||||
|
|
@ -1464,7 +1464,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
break;
|
break;
|
||||||
case eGameSetting_GamertagsVisible:
|
case eGameSetting_GamertagsVisible:
|
||||||
{
|
{
|
||||||
bool bInGame=pMinecraft->level!=NULL;
|
bool bInGame=pMinecraft->level!=nullptr;
|
||||||
|
|
||||||
// Game Host only
|
// Game Host only
|
||||||
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
|
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
|
||||||
|
|
@ -1493,7 +1493,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
case eGameSetting_DisplaySplitscreenGamertags:
|
case eGameSetting_DisplaySplitscreenGamertags:
|
||||||
for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[idx] != NULL)
|
if(pMinecraft->localplayers[idx] != nullptr)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
||||||
{
|
{
|
||||||
|
|
@ -1539,7 +1539,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
||||||
break;
|
break;
|
||||||
case eGameSetting_BedrockFog:
|
case eGameSetting_BedrockFog:
|
||||||
{
|
{
|
||||||
bool bInGame=pMinecraft->level!=NULL;
|
bool bInGame=pMinecraft->level!=nullptr;
|
||||||
|
|
||||||
// Game Host only
|
// Game Host only
|
||||||
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
|
if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad()))
|
||||||
|
|
@ -1596,7 +1596,7 @@ void CMinecraftApp::SetPlayerSkin(int iPad,DWORD dwSkinId)
|
||||||
|
|
||||||
TelemetryManager->RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin);
|
TelemetryManager->RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin);
|
||||||
|
|
||||||
if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId);
|
if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1608,8 +1608,8 @@ wstring CMinecraftApp::GetPlayerSkinName(int iPad)
|
||||||
DWORD CMinecraftApp::GetPlayerSkinId(int iPad)
|
DWORD CMinecraftApp::GetPlayerSkinId(int iPad)
|
||||||
{
|
{
|
||||||
// 4J-PB -check the user has rights to use this skin - they may have had at some point but the entitlement has been removed.
|
// 4J-PB -check the user has rights to use this skin - they may have had at some point but the entitlement has been removed.
|
||||||
DLCPack *Pack=NULL;
|
DLCPack *Pack=nullptr;
|
||||||
DLCSkinFile *skinFile=NULL;
|
DLCSkinFile *skinFile=nullptr;
|
||||||
DWORD dwSkin=GameSettingsA[iPad]->dwSelectedSkin;
|
DWORD dwSkin=GameSettingsA[iPad]->dwSelectedSkin;
|
||||||
wchar_t chars[256];
|
wchar_t chars[256];
|
||||||
|
|
||||||
|
|
@ -1664,7 +1664,7 @@ void CMinecraftApp::SetPlayerCape(int iPad,DWORD dwCapeId)
|
||||||
|
|
||||||
//SentientManager.RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin);
|
//SentientManager.RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin);
|
||||||
|
|
||||||
if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId);
|
if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring CMinecraftApp::GetPlayerCapeName(int iPad)
|
wstring CMinecraftApp::GetPlayerCapeName(int iPad)
|
||||||
|
|
@ -1734,7 +1734,7 @@ void CMinecraftApp::ValidateFavoriteSkins(int iPad)
|
||||||
// Also check they haven't reverted to a trial pack
|
// Also check they haven't reverted to a trial pack
|
||||||
DLCPack *pDLCPack=app.m_dlcManager.getPackContainingSkin(chars);
|
DLCPack *pDLCPack=app.m_dlcManager.getPackContainingSkin(chars);
|
||||||
|
|
||||||
if(pDLCPack!=NULL)
|
if(pDLCPack!=nullptr)
|
||||||
{
|
{
|
||||||
// 4J-PB - We should let players add the free skins to their favourites as well!
|
// 4J-PB - We should let players add the free skins to their favourites as well!
|
||||||
//DLCFile *pDLCFile=pDLCPack->getFile(DLCManager::e_DLCType_Skin,chars);
|
//DLCFile *pDLCFile=pDLCPack->getFile(DLCManager::e_DLCType_Skin,chars);
|
||||||
|
|
@ -1781,7 +1781,7 @@ void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage)
|
||||||
unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad)
|
unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad)
|
||||||
{
|
{
|
||||||
// if there are no game settings read yet, return the default language
|
// if there are no game settings read yet, return the default language
|
||||||
if(GameSettingsA[iPad]==NULL)
|
if(GameSettingsA[iPad]==nullptr)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1800,7 +1800,7 @@ void CMinecraftApp::SetMinecraftLocale(int iPad, unsigned char ucLocale)
|
||||||
unsigned char CMinecraftApp::GetMinecraftLocale(int iPad)
|
unsigned char CMinecraftApp::GetMinecraftLocale(int iPad)
|
||||||
{
|
{
|
||||||
// if there are no game settings read yet, return the default language
|
// if there are no game settings read yet, return the default language
|
||||||
if(GameSettingsA[iPad]==NULL)
|
if(GameSettingsA[iPad]==nullptr)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -2470,7 +2470,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay
|
||||||
|
|
||||||
shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
|
shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
|
||||||
|
|
||||||
if(bOverridePlayer || player==NULL)
|
if(bOverridePlayer || player==nullptr)
|
||||||
{
|
{
|
||||||
return GameSettingsA[iPad]->uiDebugBitmask;
|
return GameSettingsA[iPad]->uiDebugBitmask;
|
||||||
}
|
}
|
||||||
|
|
@ -2782,7 +2782,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
app.SetAutosaveTimerTime();
|
app.SetAutosaveTimerTime();
|
||||||
SetAction(i,eAppAction_Idle);
|
SetAction(i,eAppAction_Idle);
|
||||||
// Check that there is a name for the save - if we're saving from the tutorial and this is the first save from the tutorial, we'll not have a name
|
// Check that there is a name for the save - if we're saving from the tutorial and this is the first save from the tutorial, we'll not have a name
|
||||||
/*if(StorageManager.GetSaveName()==NULL)
|
/*if(StorageManager.GetSaveName()==nullptr)
|
||||||
{
|
{
|
||||||
app.NavigateToScene(i,eUIScene_SaveWorld);
|
app.NavigateToScene(i,eUIScene_SaveWorld);
|
||||||
}
|
}
|
||||||
|
|
@ -2851,7 +2851,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false);
|
ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false);
|
||||||
|
|
||||||
// This just allows it to be shown
|
// This just allows it to be shown
|
||||||
if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
|
if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
|
||||||
|
|
||||||
//INT saveOrCheckpointId = 0;
|
//INT saveOrCheckpointId = 0;
|
||||||
//bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
|
//bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
|
||||||
|
|
@ -2927,7 +2927,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
// send the message
|
// send the message
|
||||||
for(int idx=0;idx<XUSER_MAX_COUNT;idx++)
|
for(int idx=0;idx<XUSER_MAX_COUNT;idx++)
|
||||||
{
|
{
|
||||||
if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL))
|
if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr))
|
||||||
{
|
{
|
||||||
XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg );
|
XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg );
|
||||||
}
|
}
|
||||||
|
|
@ -3009,7 +3009,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
// send the message
|
// send the message
|
||||||
for(int idx=0;idx<XUSER_MAX_COUNT;idx++)
|
for(int idx=0;idx<XUSER_MAX_COUNT;idx++)
|
||||||
{
|
{
|
||||||
if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL))
|
if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr))
|
||||||
{
|
{
|
||||||
XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg );
|
XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg );
|
||||||
}
|
}
|
||||||
|
|
@ -3235,8 +3235,8 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
||||||
// If param is non-null then this is a forced exit by the server, so make sure the player knows why
|
// If param is non-null then this is a forced exit by the server, so make sure the player knows why
|
||||||
// 4J Stu - Changed - Don't use the FullScreenProgressScreen for action, use a dialog instead
|
// 4J Stu - Changed - Don't use the FullScreenProgressScreen for action, use a dialog instead
|
||||||
completionData->bRequiresUserAction = FALSE;//(param != NULL) ? TRUE : FALSE;
|
completionData->bRequiresUserAction = FALSE;//(param != nullptr) ? TRUE : FALSE;
|
||||||
completionData->bShowTips = (param != NULL) ? FALSE : TRUE;
|
completionData->bShowTips = (param != nullptr) ? FALSE : TRUE;
|
||||||
completionData->bShowBackground=TRUE;
|
completionData->bShowBackground=TRUE;
|
||||||
completionData->bShowLogo=TRUE;
|
completionData->bShowLogo=TRUE;
|
||||||
completionData->type = e_ProgressCompletion_NavigateToHomeMenu;
|
completionData->type = e_ProgressCompletion_NavigateToHomeMenu;
|
||||||
|
|
@ -3348,7 +3348,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
break;
|
break;
|
||||||
case eAppAction_WaitForRespawnComplete:
|
case eAppAction_WaitForRespawnComplete:
|
||||||
player = pMinecraft->localplayers[i];
|
player = pMinecraft->localplayers[i];
|
||||||
if(player != NULL && player->GetPlayerRespawned())
|
if(player != nullptr && player->GetPlayerRespawned())
|
||||||
{
|
{
|
||||||
SetAction(i,eAppAction_Idle);
|
SetAction(i,eAppAction_Idle);
|
||||||
|
|
||||||
|
|
@ -3373,7 +3373,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
break;
|
break;
|
||||||
case eAppAction_WaitForDimensionChangeComplete:
|
case eAppAction_WaitForDimensionChangeComplete:
|
||||||
player = pMinecraft->localplayers[i];
|
player = pMinecraft->localplayers[i];
|
||||||
if(player != NULL && player->connection && player->connection->isStarted())
|
if(player != nullptr && player->connection && player->connection->isStarted())
|
||||||
{
|
{
|
||||||
SetAction(i,eAppAction_Idle);
|
SetAction(i,eAppAction_Idle);
|
||||||
ui.CloseUIScenes(i);
|
ui.CloseUIScenes(i);
|
||||||
|
|
@ -3687,7 +3687,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
// unload any texture pack audio
|
// unload any texture pack audio
|
||||||
// if there is audio in use, clear out the audio, and unmount the pack
|
// if there is audio in use, clear out the audio, and unmount the pack
|
||||||
TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected();
|
TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected();
|
||||||
DLCTexturePack *pDLCTexPack=NULL;
|
DLCTexturePack *pDLCTexPack=nullptr;
|
||||||
|
|
||||||
if(pTexPack->hasAudio())
|
if(pTexPack->hasAudio())
|
||||||
{
|
{
|
||||||
|
|
@ -3711,11 +3711,11 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
if(pDLCTexPack->m_pStreamedWaveBank!=NULL)
|
if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)
|
||||||
{
|
{
|
||||||
pDLCTexPack->m_pStreamedWaveBank->Destroy();
|
pDLCTexPack->m_pStreamedWaveBank->Destroy();
|
||||||
}
|
}
|
||||||
if(pDLCTexPack->m_pSoundBank!=NULL)
|
if(pDLCTexPack->m_pSoundBank!=nullptr)
|
||||||
{
|
{
|
||||||
pDLCTexPack->m_pSoundBank->Destroy();
|
pDLCTexPack->m_pSoundBank->Destroy();
|
||||||
}
|
}
|
||||||
|
|
@ -3735,7 +3735,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedIn(index) )
|
if(ProfileManager.IsSignedIn(index) )
|
||||||
{
|
{
|
||||||
if(index==i || pMinecraft->localplayers[index]!=NULL )
|
if(index==i || pMinecraft->localplayers[index]!=nullptr )
|
||||||
{
|
{
|
||||||
m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask( index );
|
m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask( index );
|
||||||
}
|
}
|
||||||
|
|
@ -3843,7 +3843,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
|
|
||||||
LoadingInputParams *loadingParams = new LoadingInputParams();
|
LoadingInputParams *loadingParams = new LoadingInputParams();
|
||||||
loadingParams->func = &CGameNetworkManager::ChangeSessionTypeThreadProc;
|
loadingParams->func = &CGameNetworkManager::ChangeSessionTypeThreadProc;
|
||||||
loadingParams->lpParam = NULL;
|
loadingParams->lpParam = nullptr;
|
||||||
|
|
||||||
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
|
|
@ -3924,7 +3924,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
|
|
||||||
LoadingInputParams *loadingParams = new LoadingInputParams();
|
LoadingInputParams *loadingParams = new LoadingInputParams();
|
||||||
loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc;
|
loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc;
|
||||||
loadingParams->lpParam = NULL;
|
loadingParams->lpParam = nullptr;
|
||||||
|
|
||||||
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
||||||
completionData->bRequiresUserAction=FALSE;
|
completionData->bRequiresUserAction=FALSE;
|
||||||
|
|
@ -4223,7 +4223,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting);
|
SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting);
|
||||||
app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,"\\",eTMSAction_TMSPP_XUIDSFile);
|
app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,"\\",eTMSAction_TMSPP_XUIDSFile);
|
||||||
#elif defined _XBOX_ONE
|
#elif defined _XBOX_ONE
|
||||||
//StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",NULL,NULL, 0);
|
//StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",nullptr,nullptr, 0);
|
||||||
SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting);
|
SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting);
|
||||||
app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,eTMSAction_TMSPP_DLCFileOnly);
|
app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,eTMSAction_TMSPP_DLCFileOnly);
|
||||||
#else
|
#else
|
||||||
|
|
@ -4320,7 +4320,7 @@ int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStor
|
||||||
#if defined _XBOX || defined _XBOX_ONE
|
#if defined _XBOX || defined _XBOX_ONE
|
||||||
INetworkPlayer *pHost = g_NetworkManager.GetHostPlayer();
|
INetworkPlayer *pHost = g_NetworkManager.GetHostPlayer();
|
||||||
// unban the level
|
// unban the level
|
||||||
if (pHost != NULL)
|
if (pHost != nullptr)
|
||||||
{
|
{
|
||||||
#if defined _XBOX
|
#if defined _XBOX
|
||||||
pApp->RemoveLevelFromBannedLevelList(iPad,((NetworkPlayerXbox *)pHost)->GetUID(),pApp->GetUniqueMapName());
|
pApp->RemoveLevelFromBannedLevelList(iPad,((NetworkPlayerXbox *)pHost)->GetUID(),pApp->GetUniqueMapName());
|
||||||
|
|
@ -4370,10 +4370,10 @@ void CMinecraftApp::loadMediaArchive()
|
||||||
HANDLE hFile = CreateFile( path.c_str(),
|
HANDLE hFile = CreateFile( path.c_str(),
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
NULL,
|
nullptr,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||||
NULL );
|
nullptr );
|
||||||
|
|
||||||
if( hFile != INVALID_HANDLE_VALUE )
|
if( hFile != INVALID_HANDLE_VALUE )
|
||||||
{
|
{
|
||||||
|
|
@ -4389,7 +4389,7 @@ void CMinecraftApp::loadMediaArchive()
|
||||||
m_fBody,
|
m_fBody,
|
||||||
dwFileSize,
|
dwFileSize,
|
||||||
&m_fSize,
|
&m_fSize,
|
||||||
NULL );
|
nullptr );
|
||||||
|
|
||||||
assert( m_fSize == dwFileSize );
|
assert( m_fSize == dwFileSize );
|
||||||
|
|
||||||
|
|
@ -4401,7 +4401,7 @@ void CMinecraftApp::loadMediaArchive()
|
||||||
{
|
{
|
||||||
assert( false );
|
assert( false );
|
||||||
// AHHHHHHHHHHHH
|
// AHHHHHHHHHHHH
|
||||||
m_mediaArchive = NULL;
|
m_mediaArchive = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -4410,7 +4410,7 @@ void CMinecraftApp::loadStringTable()
|
||||||
{
|
{
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
|
|
||||||
if(m_stringTable!=NULL)
|
if(m_stringTable!=nullptr)
|
||||||
{
|
{
|
||||||
// we need to unload the current string table, this is a reload
|
// we need to unload the current string table, this is a reload
|
||||||
delete m_stringTable;
|
delete m_stringTable;
|
||||||
|
|
@ -4424,7 +4424,7 @@ void CMinecraftApp::loadStringTable()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_stringTable = NULL;
|
m_stringTable = nullptr;
|
||||||
assert(false);
|
assert(false);
|
||||||
// AHHHHHHHHH.
|
// AHHHHHHHHH.
|
||||||
}
|
}
|
||||||
|
|
@ -4437,7 +4437,7 @@ int CMinecraftApp::PrimaryPlayerSignedOutReturned(void *pParam,int iPad,const C4
|
||||||
//Minecraft *pMinecraft=Minecraft::GetInstance();
|
//Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
// if the player is null, we're in the menus
|
// if the player is null, we're in the menus
|
||||||
//if(Minecraft::GetInstance()->player!=NULL)
|
//if(Minecraft::GetInstance()->player!=nullptr)
|
||||||
|
|
||||||
// We always create a session before kicking of any of the game code, so even though we may still be joining/creating a game
|
// We always create a session before kicking of any of the game code, so even though we may still be joining/creating a game
|
||||||
// at this point we want to handle it differently from just being in a menu
|
// at this point we want to handle it differently from just being in a menu
|
||||||
|
|
@ -4458,7 +4458,7 @@ int CMinecraftApp::EthernetDisconnectReturned(void *pParam,int iPad,const C4JSto
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
// if the player is null, we're in the menus
|
// if the player is null, we're in the menus
|
||||||
if(Minecraft::GetInstance()->player!=NULL)
|
if(Minecraft::GetInstance()->player!=nullptr)
|
||||||
{
|
{
|
||||||
app.SetAction(pMinecraft->player->GetXboxPad(),eAppAction_EthernetDisconnectedReturned);
|
app.SetAction(pMinecraft->player->GetXboxPad(),eAppAction_EthernetDisconnectedReturned);
|
||||||
}
|
}
|
||||||
|
|
@ -4490,7 +4490,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
|
||||||
bool saveStats = false;
|
bool saveStats = false;
|
||||||
if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession() )
|
if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession() )
|
||||||
{
|
{
|
||||||
if(lpParameter != NULL )
|
if(lpParameter != nullptr )
|
||||||
{
|
{
|
||||||
switch( app.GetDisconnectReason() )
|
switch( app.GetDisconnectReason() )
|
||||||
{
|
{
|
||||||
|
|
@ -4522,16 +4522,16 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
|
||||||
}
|
}
|
||||||
pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );
|
pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );
|
||||||
// 4J - Force a disconnection, this handles the situation that the server has already disconnected
|
// 4J - Force a disconnection, this handles the situation that the server has already disconnected
|
||||||
if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(false);
|
if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(false);
|
||||||
if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(false);
|
if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exitReasonStringId = IDS_EXITING_GAME;
|
exitReasonStringId = IDS_EXITING_GAME;
|
||||||
pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME );
|
pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME );
|
||||||
|
|
||||||
if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect();
|
if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect();
|
||||||
if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect();
|
if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J Stu - This only does something if we actually have a server, so don't need to do any other checks
|
// 4J Stu - This only does something if we actually have a server, so don't need to do any other checks
|
||||||
|
|
@ -4546,7 +4546,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(lpParameter != NULL )
|
if(lpParameter != nullptr )
|
||||||
{
|
{
|
||||||
switch( app.GetDisconnectReason() )
|
switch( app.GetDisconnectReason() )
|
||||||
{
|
{
|
||||||
|
|
@ -4583,7 +4583,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter )
|
||||||
pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );
|
pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats,true);
|
pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats,true);
|
||||||
|
|
||||||
// 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output:
|
// 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output:
|
||||||
// TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on all storage devices after signing out from a re-launched pre-generated world
|
// TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on all storage devices after signing out from a re-launched pre-generated world
|
||||||
|
|
@ -4609,7 +4609,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM
|
||||||
// bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a full version game with a trial version, the trial crashes
|
// bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a full version game with a trial version, the trial crashes
|
||||||
// 4J-PB - we may be in the main menus here, and we don't have a pMinecraft->player
|
// 4J-PB - we may be in the main menus here, and we don't have a pMinecraft->player
|
||||||
|
|
||||||
if(pMinecraft->player==NULL)
|
if(pMinecraft->player==nullptr)
|
||||||
{
|
{
|
||||||
bNoPlayer=true;
|
bNoPlayer=true;
|
||||||
}
|
}
|
||||||
|
|
@ -4621,7 +4621,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM
|
||||||
// 4J-PB - need to check this user can access the store
|
// 4J-PB - need to check this user can access the store
|
||||||
#if defined(__PS3__) || defined(__PSVITA__)
|
#if defined(__PS3__) || defined(__PSVITA__)
|
||||||
bool bContentRestricted;
|
bool bContentRestricted;
|
||||||
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
|
||||||
if(bContentRestricted)
|
if(bContentRestricted)
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -4666,7 +4666,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes
|
||||||
// 4J-PB - need to check this user can access the store
|
// 4J-PB - need to check this user can access the store
|
||||||
#if defined(__PS3__) || defined(__PSVITA__)
|
#if defined(__PS3__) || defined(__PSVITA__)
|
||||||
bool bContentRestricted;
|
bool bContentRestricted;
|
||||||
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
|
||||||
if(bContentRestricted)
|
if(bContentRestricted)
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -4731,7 +4731,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes
|
||||||
// 4J-PB - need to check this user can access the store
|
// 4J-PB - need to check this user can access the store
|
||||||
#if defined(__PS3__) || defined(__PSVITA__)
|
#if defined(__PS3__) || defined(__PSVITA__)
|
||||||
bool bContentRestricted;
|
bool bContentRestricted;
|
||||||
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
|
||||||
if(bContentRestricted)
|
if(bContentRestricted)
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -4804,7 +4804,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR
|
||||||
// 4J-PB - need to check this user can access the store
|
// 4J-PB - need to check this user can access the store
|
||||||
#if defined(__PS3__) || defined(__PSVITA__)
|
#if defined(__PS3__) || defined(__PSVITA__)
|
||||||
bool bContentRestricted;
|
bool bContentRestricted;
|
||||||
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr);
|
||||||
if(bContentRestricted)
|
if(bContentRestricted)
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -4948,7 +4948,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
|
||||||
if(i == iPrimaryPlayer) continue;
|
if(i == iPrimaryPlayer) continue;
|
||||||
|
|
||||||
// A guest a signed in or out, out of order which invalidates all the guest players we have in the game
|
// A guest a signed in or out, out of order which invalidates all the guest players we have in the game
|
||||||
if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL)
|
if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr)
|
||||||
{
|
{
|
||||||
pApp->DebugPrintf("Recommending removal of player at index %d because their guest id changed\n",i);
|
pApp->DebugPrintf("Recommending removal of player at index %d because their guest id changed\n",i);
|
||||||
pApp->SetAction(i, eAppAction_ExitPlayer);
|
pApp->SetAction(i, eAppAction_ExitPlayer);
|
||||||
|
|
@ -4972,7 +4972,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
|
||||||
|
|
||||||
// 4J-HG: If either the player is in the network manager or in the game, need to exit player
|
// 4J-HG: If either the player is in the network manager or in the game, need to exit player
|
||||||
// TODO: Do we need to check the network manager?
|
// TODO: Do we need to check the network manager?
|
||||||
if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != NULL || Minecraft::GetInstance()->localplayers[i] != NULL)
|
if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr || Minecraft::GetInstance()->localplayers[i] != nullptr)
|
||||||
{
|
{
|
||||||
pApp->DebugPrintf("Player %d signed out\n", i);
|
pApp->DebugPrintf("Player %d signed out\n", i);
|
||||||
pApp->SetAction(i, eAppAction_ExitPlayer);
|
pApp->SetAction(i, eAppAction_ExitPlayer);
|
||||||
|
|
@ -4983,7 +4983,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
|
||||||
// check if any of the addition players have signed out of PSN (primary player is handled below)
|
// check if any of the addition players have signed out of PSN (primary player is handled below)
|
||||||
if(!switchToOffline && i != ProfileManager.GetLockedProfile() && !g_NetworkManager.IsLocalGame())
|
if(!switchToOffline && i != ProfileManager.GetLockedProfile() && !g_NetworkManager.IsLocalGame())
|
||||||
{
|
{
|
||||||
if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL)
|
if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr)
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedInLive(i) == false)
|
if(ProfileManager.IsSignedInLive(i) == false)
|
||||||
{
|
{
|
||||||
|
|
@ -5080,7 +5080,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if(!InputManager.IsPadConnected(i) &&
|
if(!InputManager.IsPadConnected(i) &&
|
||||||
Minecraft::GetInstance()->localplayers[i] != NULL &&
|
Minecraft::GetInstance()->localplayers[i] != nullptr &&
|
||||||
!ui.IsPauseMenuDisplayed(i) && !ui.IsSceneInStack(i, eUIScene_EndPoem) )
|
!ui.IsPauseMenuDisplayed(i) && !ui.IsSceneInStack(i, eUIScene_EndPoem) )
|
||||||
{
|
{
|
||||||
ui.CloseUIScenes(i);
|
ui.CloseUIScenes(i);
|
||||||
|
|
@ -5109,7 +5109,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un
|
||||||
{
|
{
|
||||||
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack;
|
DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack;
|
||||||
XCONTENTDEVICEID deviceID = pDLCTexPack->GetDLCDeviceID();
|
XCONTENTDEVICEID deviceID = pDLCTexPack->GetDLCDeviceID();
|
||||||
if( XContentGetDeviceState( deviceID, NULL ) != ERROR_SUCCESS )
|
if( XContentGetDeviceState( deviceID, nullptr ) != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
// Set texture pack flag so that it is now considered as not having audio - this is critical so that the next playStreaming does what it is meant to do,
|
// Set texture pack flag so that it is now considered as not having audio - this is critical so that the next playStreaming does what it is meant to do,
|
||||||
// and also so that we don't try and unmount this again, or play any sounds from it in the future
|
// and also so that we don't try and unmount this again, or play any sounds from it in the future
|
||||||
|
|
@ -5117,11 +5117,11 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un
|
||||||
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
||||||
Minecraft::GetInstance()->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0);
|
Minecraft::GetInstance()->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
if(pDLCTexPack->m_pStreamedWaveBank!=NULL)
|
if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)
|
||||||
{
|
{
|
||||||
pDLCTexPack->m_pStreamedWaveBank->Destroy();
|
pDLCTexPack->m_pStreamedWaveBank->Destroy();
|
||||||
}
|
}
|
||||||
if(pDLCTexPack->m_pSoundBank!=NULL)
|
if(pDLCTexPack->m_pSoundBank!=nullptr)
|
||||||
{
|
{
|
||||||
pDLCTexPack->m_pSoundBank->Destroy();
|
pDLCTexPack->m_pSoundBank->Destroy();
|
||||||
}
|
}
|
||||||
|
|
@ -5273,7 +5273,7 @@ int CMinecraftApp::GetLocalPlayerCount(void)
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||||
{
|
{
|
||||||
if(pMinecraft != NULL && pMinecraft->localplayers[i] != NULL)
|
if(pMinecraft != nullptr && pMinecraft->localplayers[i] != nullptr)
|
||||||
{
|
{
|
||||||
iPlayerC++;
|
iPlayerC++;
|
||||||
}
|
}
|
||||||
|
|
@ -5423,15 +5423,15 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d
|
||||||
|
|
||||||
DLCPack *pack = app.m_dlcManager.getPack( CONTENT_DATA_DISPLAY_NAME(ContentData) );
|
DLCPack *pack = app.m_dlcManager.getPack( CONTENT_DATA_DISPLAY_NAME(ContentData) );
|
||||||
|
|
||||||
if( pack != NULL && pack->IsCorrupt() )
|
if( pack != nullptr && pack->IsCorrupt() )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Pack '%ls' is corrupt, removing it from the DLC Manager.\n", CONTENT_DATA_DISPLAY_NAME(ContentData));
|
app.DebugPrintf("Pack '%ls' is corrupt, removing it from the DLC Manager.\n", CONTENT_DATA_DISPLAY_NAME(ContentData));
|
||||||
|
|
||||||
app.m_dlcManager.removePack(pack);
|
app.m_dlcManager.removePack(pack);
|
||||||
pack = NULL;
|
pack = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pack == NULL)
|
if(pack == nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", CONTENT_DATA_DISPLAY_NAME(ContentData));
|
app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", CONTENT_DATA_DISPLAY_NAME(ContentData));
|
||||||
|
|
||||||
|
|
@ -5484,7 +5484,7 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d
|
||||||
// // if the file is not already in the memory textures, then read it from TMS
|
// // if the file is not already in the memory textures, then read it from TMS
|
||||||
// if(!bRes)
|
// if(!bRes)
|
||||||
// {
|
// {
|
||||||
// BYTE *pBuffer=NULL;
|
// BYTE *pBuffer=nullptr;
|
||||||
// DWORD dwSize=0;
|
// DWORD dwSize=0;
|
||||||
// // 4J-PB - out for now for DaveK so he doesn't get the birthday cape
|
// // 4J-PB - out for now for DaveK so he doesn't get the birthday cape
|
||||||
// #ifdef _CONTENT_PACKAGE
|
// #ifdef _CONTENT_PACKAGE
|
||||||
|
|
@ -5656,7 +5656,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csMemFilesLock);
|
EnterCriticalSection(&csMemFilesLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData=NULL;
|
PMEMDATA pData=nullptr;
|
||||||
auto it = m_MEM_Files.find(wName);
|
auto it = m_MEM_Files.find(wName);
|
||||||
if(it != m_MEM_Files.end())
|
if(it != m_MEM_Files.end())
|
||||||
{
|
{
|
||||||
|
|
@ -5667,8 +5667,8 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
|
||||||
|
|
||||||
if(pData->dwBytes == 0 && dwBytes != 0)
|
if(pData->dwBytes == 0 && dwBytes != 0)
|
||||||
{
|
{
|
||||||
// This should never be NULL if dwBytes is 0
|
// This should never be nullptr if dwBytes is 0
|
||||||
if(pData->pbData!=NULL) delete [] pData->pbData;
|
if(pData->pbData!=nullptr) delete [] pData->pbData;
|
||||||
|
|
||||||
pData->pbData=pbData;
|
pData->pbData=pbData;
|
||||||
pData->dwBytes=dwBytes;
|
pData->dwBytes=dwBytes;
|
||||||
|
|
@ -5764,7 +5764,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData=NULL;
|
PMEMDATA pData=nullptr;
|
||||||
auto it = m_MEM_TPD.find(iConfig);
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if(it == m_MEM_TPD.end())
|
if(it == m_MEM_TPD.end())
|
||||||
{
|
{
|
||||||
|
|
@ -5784,7 +5784,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&csMemTPDLock);
|
EnterCriticalSection(&csMemTPDLock);
|
||||||
// check it's not already in
|
// check it's not already in
|
||||||
PMEMDATA pData=NULL;
|
PMEMDATA pData=nullptr;
|
||||||
auto it = m_MEM_TPD.find(iConfig);
|
auto it = m_MEM_TPD.find(iConfig);
|
||||||
if(it != m_MEM_TPD.end())
|
if(it != m_MEM_TPD.end())
|
||||||
{
|
{
|
||||||
|
|
@ -5799,7 +5799,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
|
int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
|
||||||
{
|
{
|
||||||
DLC_INFO *pDLCInfo=NULL;
|
DLC_INFO *pDLCInfo=nullptr;
|
||||||
// run through the DLC info to find the right texture pack/mash-up pack
|
// run through the DLC info to find the right texture pack/mash-up pack
|
||||||
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -5817,7 +5817,7 @@ int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
|
||||||
#elif defined _XBOX_ONE
|
#elif defined _XBOX_ONE
|
||||||
int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
|
int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile)
|
||||||
{
|
{
|
||||||
DLC_INFO *pDLCInfo=NULL;
|
DLC_INFO *pDLCInfo=nullptr;
|
||||||
// run through the DLC info to find the right texture pack/mash-up pack
|
// run through the DLC info to find the right texture pack/mash-up pack
|
||||||
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -6018,7 +6018,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
|
||||||
{
|
{
|
||||||
// 4J-PB - need to check this user can access the store
|
// 4J-PB - need to check this user can access the store
|
||||||
bool bContentRestricted;
|
bool bContentRestricted;
|
||||||
ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr);
|
||||||
if(bContentRestricted)
|
if(bContentRestricted)
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
|
|
@ -6037,7 +6037,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
|
||||||
app.DebugPrintf("Texture Pack - %s\n",pchPackName);
|
app.DebugPrintf("Texture Pack - %s\n",pchPackName);
|
||||||
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName);
|
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName);
|
||||||
|
|
||||||
if(pSONYDLCInfo!=NULL)
|
if(pSONYDLCInfo!=nullptr)
|
||||||
{
|
{
|
||||||
char chName[42];
|
char chName[42];
|
||||||
char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN];
|
char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN];
|
||||||
|
|
@ -6087,7 +6087,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
|
||||||
|
|
||||||
DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str());
|
DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str());
|
||||||
|
|
||||||
StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),NULL,NULL);
|
StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),nullptr,nullptr);
|
||||||
|
|
||||||
// the license change coming in when the offer has been installed will cause this scene to refresh
|
// the license change coming in when the offer has been installed will cause this scene to refresh
|
||||||
}
|
}
|
||||||
|
|
@ -6120,7 +6120,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor
|
||||||
// need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth...
|
// need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth...
|
||||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
||||||
|
|
||||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -6166,7 +6166,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4
|
||||||
uiIDA[1]=IDS_CONFIRM_CANCEL;
|
uiIDA[1]=IDS_CONFIRM_CANCEL;
|
||||||
|
|
||||||
// Give the player a warning about the trial version of the texture pack
|
// Give the player a warning about the trial version of the texture pack
|
||||||
ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,NULL);
|
ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,nullptr);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -6678,7 +6678,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
#else
|
#else
|
||||||
wstring replacement = L"";
|
wstring replacement = L"";
|
||||||
switch(uiVKey)
|
switch(uiVKey)
|
||||||
|
|
@ -6777,7 +6777,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
#else
|
#else
|
||||||
wchar_t string[128];
|
wchar_t string[128];
|
||||||
|
|
||||||
|
|
@ -6832,10 +6832,10 @@ HRESULT CMinecraftApp::RegisterMojangData(WCHAR *pXuidName, PlayerUID xuid, WCHA
|
||||||
{
|
{
|
||||||
HRESULT hr=S_OK;
|
HRESULT hr=S_OK;
|
||||||
eXUID eTempXuid=eXUID_Undefined;
|
eXUID eTempXuid=eXUID_Undefined;
|
||||||
MOJANG_DATA *pMojangData=NULL;
|
MOJANG_DATA *pMojangData=nullptr;
|
||||||
|
|
||||||
// ignore the names if we don't recognize them
|
// ignore the names if we don't recognize them
|
||||||
if(pXuidName!=NULL)
|
if(pXuidName!=nullptr)
|
||||||
{
|
{
|
||||||
if( wcscmp( pXuidName, L"XUID_NOTCH" ) == 0 )
|
if( wcscmp( pXuidName, L"XUID_NOTCH" ) == 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -6875,7 +6875,7 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue)
|
||||||
HRESULT hr=S_OK;
|
HRESULT hr=S_OK;
|
||||||
|
|
||||||
// #ifdef _XBOX
|
// #ifdef _XBOX
|
||||||
// if(pType!=NULL)
|
// if(pType!=nullptr)
|
||||||
// {
|
// {
|
||||||
// if(wcscmp(pType,L"XboxOneTransfer")==0)
|
// if(wcscmp(pType,L"XboxOneTransfer")==0)
|
||||||
// {
|
// {
|
||||||
|
|
@ -6926,7 +6926,7 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(pType!=NULL)
|
if(pType!=nullptr)
|
||||||
{
|
{
|
||||||
if(wcscmp(pType,L"Skin")==0)
|
if(wcscmp(pType,L"Skin")==0)
|
||||||
{
|
{
|
||||||
|
|
@ -7111,7 +7111,7 @@ bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID)
|
||||||
auto it = DLCTextures_PackID.find(iPackID);
|
auto it = DLCTextures_PackID.find(iPackID);
|
||||||
if( it == DLCTextures_PackID.end() )
|
if( it == DLCTextures_PackID.end() )
|
||||||
{
|
{
|
||||||
*ppchKeyID=NULL;
|
*ppchKeyID=nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -7131,14 +7131,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName)
|
||||||
if( it == DLCInfo.end() )
|
if( it == DLCInfo.end() )
|
||||||
{
|
{
|
||||||
// nothing for this
|
// nothing for this
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID)
|
DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID)
|
||||||
|
|
@ -7153,7 +7153,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID)
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLC_INFO *CMinecraftApp::GetDLCInfo(int iIndex)
|
DLC_INFO *CMinecraftApp::GetDLCInfo(int iIndex)
|
||||||
|
|
@ -7209,12 +7209,12 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &Produc
|
||||||
}
|
}
|
||||||
// DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(wstring &ProductId)
|
// DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(wstring &ProductId)
|
||||||
// {
|
// {
|
||||||
// return NULL;
|
// return nullptr;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex)
|
DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
DLC_INFO *CMinecraftApp::GetDLCInfoFullOffer(int iIndex)
|
DLC_INFO *CMinecraftApp::GetDLCInfoFullOffer(int iIndex)
|
||||||
{
|
{
|
||||||
|
|
@ -7268,7 +7268,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pull
|
||||||
}
|
}
|
||||||
DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
|
DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
|
||||||
{
|
{
|
||||||
//DLC_INFO *pDLCInfo=NULL;
|
//DLC_INFO *pDLCInfo=nullptr;
|
||||||
if(DLCInfo_Trial.size()>0)
|
if(DLCInfo_Trial.size()>0)
|
||||||
{
|
{
|
||||||
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
|
auto it = DLCInfo_Trial.find(ullOfferID_Trial);
|
||||||
|
|
@ -7276,14 +7276,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
|
||||||
if( it == DLCInfo_Trial.end() )
|
if( it == DLCInfo_Trial.end() )
|
||||||
{
|
{
|
||||||
// nothing for this
|
// nothing for this
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex)
|
DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex)
|
||||||
|
|
@ -7333,14 +7333,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID)
|
||||||
if( it == DLCInfo_Full.end() )
|
if( it == DLCInfo_Full.end() )
|
||||||
{
|
{
|
||||||
// nothing for this
|
// nothing for this
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName)
|
DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName)
|
||||||
{
|
{
|
||||||
|
|
@ -7357,7 +7357,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName)
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
#elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||||
|
|
@ -7373,14 +7373,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full)
|
||||||
if( it == DLCInfo_Full.end() )
|
if( it == DLCInfo_Full.end() )
|
||||||
{
|
{
|
||||||
// nothing for this
|
// nothing for this
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -7471,7 +7471,7 @@ void CMinecraftApp::ExitGameFromRemoteSave( LPVOID lpParameter )
|
||||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||||
uiIDA[1]=IDS_CONFIRM_OK;
|
uiIDA[1]=IDS_CONFIRM_OK;
|
||||||
|
|
||||||
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,NULL);
|
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||||
|
|
@ -7489,7 +7489,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4
|
||||||
// Inform fullscreen progress scene that it's not being cancelled after all
|
// Inform fullscreen progress scene that it's not being cancelled after all
|
||||||
UIScene_FullscreenProgress *pScene = static_cast<UIScene_FullscreenProgress *>(ui.FindScene(eUIScene_FullscreenProgress));
|
UIScene_FullscreenProgress *pScene = static_cast<UIScene_FullscreenProgress *>(ui.FindScene(eUIScene_FullscreenProgress));
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
if(pScene!=NULL)
|
if(pScene!=nullptr)
|
||||||
#else
|
#else
|
||||||
if (pScene != nullptr)
|
if (pScene != nullptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -7505,7 +7505,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4
|
||||||
|
|
||||||
void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index)
|
void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index)
|
||||||
{
|
{
|
||||||
if(index >= 0 && index < 32 && GameSettingsA[iPad] != NULL)
|
if(index >= 0 && index < 32 && GameSettingsA[iPad] != nullptr)
|
||||||
{
|
{
|
||||||
GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1<<index);
|
GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1<<index);
|
||||||
}
|
}
|
||||||
|
|
@ -7534,7 +7534,7 @@ void CMinecraftApp::InvalidateBannedList(int iPad)
|
||||||
if(BannedListA[iPad].pBannedList)
|
if(BannedListA[iPad].pBannedList)
|
||||||
{
|
{
|
||||||
delete [] BannedListA[iPad].pBannedList;
|
delete [] BannedListA[iPad].pBannedList;
|
||||||
BannedListA[iPad].pBannedList=NULL;
|
BannedListA[iPad].pBannedList=nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7577,9 +7577,9 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
|
||||||
|
|
||||||
//bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes);
|
//bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes);
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,NULL,NULL, 0);
|
StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,nullptr,nullptr, 0);
|
||||||
#elif defined _XBOX_ONE
|
#elif defined _XBOX_ONE
|
||||||
StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0);
|
StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// update telemetry too
|
// update telemetry too
|
||||||
|
|
@ -7613,7 +7613,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
|
||||||
{
|
{
|
||||||
PBANNEDLISTDATA pBannedListData = *it;
|
PBANNEDLISTDATA pBannedListData = *it;
|
||||||
|
|
||||||
if(pBannedListData!=NULL)
|
if(pBannedListData!=nullptr)
|
||||||
{
|
{
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
PlayerUID bannedPlayerUID = pBannedListData->wchPlayerUID;
|
PlayerUID bannedPlayerUID = pBannedListData->wchPlayerUID;
|
||||||
|
|
@ -7645,7 +7645,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
StorageManager.DeleteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList");
|
StorageManager.DeleteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList");
|
||||||
#elif defined _XBOX_ONE
|
#elif defined _XBOX_ONE
|
||||||
StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",NULL,NULL, 0);
|
StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",nullptr,nullptr, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -7662,7 +7662,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes);
|
StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes);
|
||||||
#elif defined _XBOX_ONE
|
#elif defined _XBOX_ONE
|
||||||
StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0);
|
StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0);
|
||||||
#endif
|
#endif
|
||||||
delete [] pBannedList;
|
delete [] pBannedList;
|
||||||
}
|
}
|
||||||
|
|
@ -8126,7 +8126,7 @@ unsigned int CMinecraftApp::GetGameHostOption(unsigned int uiHostSettings, eGame
|
||||||
|
|
||||||
bool CMinecraftApp::CanRecordStatsAndAchievements()
|
bool CMinecraftApp::CanRecordStatsAndAchievements()
|
||||||
{
|
{
|
||||||
bool isTutorial = Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->isTutorial();
|
bool isTutorial = Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->isTutorial();
|
||||||
// 4J Stu - All of these options give the host player some advantage, so should not allow achievements
|
// 4J Stu - All of these options give the host player some advantage, so should not allow achievements
|
||||||
return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) ||
|
return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) ||
|
||||||
app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) ||
|
app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) ||
|
||||||
|
|
@ -8844,7 +8844,7 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto
|
||||||
// set this to retrieved whether it found it or not
|
// set this to retrieved whether it found it or not
|
||||||
pCurrent->eState=e_TMS_ContentState_Retrieved;
|
pCurrent->eState=e_TMS_ContentState_Retrieved;
|
||||||
|
|
||||||
if(pFileData!=NULL)
|
if(pFileData!=nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
|
|
@ -9197,7 +9197,7 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect
|
||||||
vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
|
vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
|
||||||
{
|
{
|
||||||
EnterCriticalSection( &csAdditionalModelParts );
|
EnterCriticalSection( &csAdditionalModelParts );
|
||||||
vector<ModelPart *> *pvModelParts=NULL;
|
vector<ModelPart *> *pvModelParts=nullptr;
|
||||||
if(m_AdditionalModelParts.size()>0)
|
if(m_AdditionalModelParts.size()>0)
|
||||||
{
|
{
|
||||||
auto it = m_AdditionalModelParts.find(dwSkinID);
|
auto it = m_AdditionalModelParts.find(dwSkinID);
|
||||||
|
|
@ -9214,7 +9214,7 @@ vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
|
||||||
vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
|
vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
|
||||||
{
|
{
|
||||||
EnterCriticalSection( &csAdditionalSkinBoxes );
|
EnterCriticalSection( &csAdditionalSkinBoxes );
|
||||||
vector<SKIN_BOX *> *pvSkinBoxes=NULL;
|
vector<SKIN_BOX *> *pvSkinBoxes=nullptr;
|
||||||
if(m_AdditionalSkinBoxes.size()>0)
|
if(m_AdditionalSkinBoxes.size()>0)
|
||||||
{
|
{
|
||||||
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
|
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
|
||||||
|
|
@ -9335,7 +9335,7 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
// we need to enable background downloading for the DLC
|
// we need to enable background downloading for the DLC
|
||||||
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
|
||||||
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(app.GetRequiredTexturePackID());
|
SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(app.GetRequiredTexturePackID());
|
||||||
if(pSONYDLCInfo!=NULL)
|
if(pSONYDLCInfo!=nullptr)
|
||||||
{
|
{
|
||||||
char chName[42];
|
char chName[42];
|
||||||
char chKeyName[20];
|
char chKeyName[20];
|
||||||
|
|
@ -9344,7 +9344,7 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN);
|
memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN);
|
||||||
// we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it.
|
// we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it.
|
||||||
// So we assume the first sku for the product is the one we want
|
// So we assume the first sku for the product is the one we want
|
||||||
// MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char
|
// MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char
|
||||||
memset(chKeyName, 0, sizeof(chKeyName));
|
memset(chKeyName, 0, sizeof(chKeyName));
|
||||||
strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16);
|
strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16);
|
||||||
|
|
||||||
|
|
@ -9390,13 +9390,13 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
if( result==C4JStorage::EMessage_ResultAccept ) // Full version
|
if( result==C4JStorage::EMessage_ResultAccept ) // Full version
|
||||||
{
|
{
|
||||||
ullIndexA[0]=ullOfferID_Full;
|
ullIndexA[0]=ullOfferID_Full;
|
||||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
|
||||||
}
|
}
|
||||||
else // trial version
|
else // trial version
|
||||||
{
|
{
|
||||||
DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full);
|
DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full);
|
||||||
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
|
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
|
||||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9406,7 +9406,7 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E
|
||||||
|
|
||||||
int CMinecraftApp::getArchiveFileSize(const wstring &filename)
|
int CMinecraftApp::getArchiveFileSize(const wstring &filename)
|
||||||
{
|
{
|
||||||
TexturePack *tPack = NULL;
|
TexturePack *tPack = nullptr;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
|
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
|
||||||
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename))
|
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename))
|
||||||
|
|
@ -9418,7 +9418,7 @@ int CMinecraftApp::getArchiveFileSize(const wstring &filename)
|
||||||
|
|
||||||
bool CMinecraftApp::hasArchiveFile(const wstring &filename)
|
bool CMinecraftApp::hasArchiveFile(const wstring &filename)
|
||||||
{
|
{
|
||||||
TexturePack *tPack = NULL;
|
TexturePack *tPack = nullptr;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
|
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
|
||||||
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) return true;
|
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) return true;
|
||||||
|
|
@ -9427,7 +9427,7 @@ bool CMinecraftApp::hasArchiveFile(const wstring &filename)
|
||||||
|
|
||||||
byteArray CMinecraftApp::getArchiveFile(const wstring &filename)
|
byteArray CMinecraftApp::getArchiveFile(const wstring &filename)
|
||||||
{
|
{
|
||||||
TexturePack *tPack = NULL;
|
TexturePack *tPack = nullptr;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
|
if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected();
|
||||||
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename))
|
if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename))
|
||||||
|
|
|
||||||
|
|
@ -163,12 +163,12 @@ public:
|
||||||
eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;}
|
eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;}
|
||||||
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
|
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
|
||||||
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
|
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
|
||||||
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
|
void SetAction(int iPad, eXuiAction action, LPVOID param = nullptr);
|
||||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||||
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
|
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
|
||||||
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
|
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
|
||||||
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
||||||
void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = NULL) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = nullptr) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
||||||
eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;}
|
eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;}
|
||||||
void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;}
|
void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;}
|
||||||
|
|
||||||
|
|
@ -862,12 +862,12 @@ public:
|
||||||
|
|
||||||
bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];}
|
bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];}
|
||||||
void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
|
void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
|
||||||
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;}
|
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=nullptr;BannedListA[iPad].dwBytes=0;}
|
||||||
|
|
||||||
DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;}
|
DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;}
|
||||||
void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;}
|
void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;}
|
||||||
|
|
||||||
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
|
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = nullptr; *pdwBytes = 0;}
|
||||||
|
|
||||||
//XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }
|
//XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path)
|
DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path)
|
||||||
{
|
{
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dwBytes = 0;
|
m_dwBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
|
||||||
|
|
||||||
if(uiVersion < CURRENT_AUDIO_VERSION_NUM)
|
if(uiVersion < CURRENT_AUDIO_VERSION_NUM)
|
||||||
{
|
{
|
||||||
if(pbData!=NULL) delete [] pbData;
|
if(pbData!=nullptr) delete [] pbData;
|
||||||
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
DLCColourTableFile::DLCColourTableFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path)
|
DLCColourTableFile::DLCColourTableFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path)
|
||||||
{
|
{
|
||||||
m_colourTable = NULL;
|
m_colourTable = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCColourTableFile::~DLCColourTableFile()
|
DLCColourTableFile::~DLCColourTableFile()
|
||||||
{
|
{
|
||||||
if(m_colourTable != NULL)
|
if(m_colourTable != nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Deleting DLCColourTableFile data\n");
|
app.DebugPrintf("Deleting DLCColourTableFile data\n");
|
||||||
delete m_colourTable;
|
delete m_colourTable;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public:
|
||||||
DWORD getSkinID() { return m_dwSkinId; }
|
DWORD getSkinID() { return m_dwSkinId; }
|
||||||
|
|
||||||
virtual void addData(PBYTE pbData, DWORD dwBytes) {}
|
virtual void addData(PBYTE pbData, DWORD dwBytes) {}
|
||||||
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; }
|
virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return nullptr; }
|
||||||
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value) {}
|
virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value) {}
|
||||||
|
|
||||||
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }
|
virtual wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; }
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
DLCGameRulesFile::DLCGameRulesFile(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path)
|
DLCGameRulesFile::DLCGameRulesFile(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path)
|
||||||
{
|
{
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dwBytes = 0;
|
m_dwBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path)
|
DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path)
|
||||||
{
|
{
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dwBytes = 0;
|
m_dwBytes = 0;
|
||||||
|
|
||||||
m_hasData = false;
|
m_hasData = false;
|
||||||
|
|
||||||
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
|
m_grfPath = path.substr(0, path.length() - 4) + L".grf";
|
||||||
|
|
||||||
lgo = NULL;
|
lgo = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
|
void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
DLCLocalisationFile::DLCLocalisationFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path)
|
DLCLocalisationFile::DLCLocalisationFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path)
|
||||||
{
|
{
|
||||||
m_strings = NULL;
|
m_strings = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes)
|
void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ void DLCManager::addPack(DLCPack *pack)
|
||||||
|
|
||||||
void DLCManager::removePack(DLCPack *pack)
|
void DLCManager::removePack(DLCPack *pack)
|
||||||
{
|
{
|
||||||
if(pack != NULL)
|
if(pack != nullptr)
|
||||||
{
|
{
|
||||||
auto it = find(m_packs.begin(), m_packs.end(), pack);
|
auto it = find(m_packs.begin(), m_packs.end(), pack);
|
||||||
if(it != m_packs.end() ) m_packs.erase(it);
|
if(it != m_packs.end() ) m_packs.erase(it);
|
||||||
|
|
@ -112,7 +112,7 @@ void DLCManager::LanguageChanged(void)
|
||||||
|
|
||||||
DLCPack *DLCManager::getPack(const wstring &name)
|
DLCPack *DLCManager::getPack(const wstring &name)
|
||||||
{
|
{
|
||||||
DLCPack *pack = NULL;
|
DLCPack *pack = nullptr;
|
||||||
//DWORD currentIndex = 0;
|
//DWORD currentIndex = 0;
|
||||||
for( DLCPack * currentPack : m_packs )
|
for( DLCPack * currentPack : m_packs )
|
||||||
{
|
{
|
||||||
|
|
@ -130,7 +130,7 @@ DLCPack *DLCManager::getPack(const wstring &name)
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
||||||
{
|
{
|
||||||
DLCPack *pack = NULL;
|
DLCPack *pack = nullptr;
|
||||||
for( DLCPack *currentPack : m_packs )
|
for( DLCPack *currentPack : m_packs )
|
||||||
{
|
{
|
||||||
wstring wsName=currentPack->getPurchaseOfferId();
|
wstring wsName=currentPack->getPurchaseOfferId();
|
||||||
|
|
@ -147,7 +147,7 @@ DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
|
||||||
|
|
||||||
DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
|
DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
|
||||||
{
|
{
|
||||||
DLCPack *pack = NULL;
|
DLCPack *pack = nullptr;
|
||||||
if( type != e_DLCType_All )
|
if( type != e_DLCType_All )
|
||||||
{
|
{
|
||||||
DWORD currentIndex = 0;
|
DWORD currentIndex = 0;
|
||||||
|
|
@ -181,9 +181,9 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
|
||||||
{
|
{
|
||||||
DWORD foundIndex = 0;
|
DWORD foundIndex = 0;
|
||||||
found = false;
|
found = false;
|
||||||
if(pack == NULL)
|
if(pack == nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("DLCManager: Attempting to find the index for a NULL pack\n");
|
app.DebugPrintf("DLCManager: Attempting to find the index for a nullptr pack\n");
|
||||||
//__debugbreak();
|
//__debugbreak();
|
||||||
return foundIndex;
|
return foundIndex;
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +244,7 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
|
||||||
|
|
||||||
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||||
{
|
{
|
||||||
DLCPack *foundPack = NULL;
|
DLCPack *foundPack = nullptr;
|
||||||
for( DLCPack *pack : m_packs )
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
|
||||||
|
|
@ -261,11 +261,11 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
|
||||||
|
|
||||||
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||||
{
|
{
|
||||||
DLCSkinFile *foundSkinfile = NULL;
|
DLCSkinFile *foundSkinfile = nullptr;
|
||||||
for( DLCPack *pack : m_packs )
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
foundSkinfile=pack->getSkinFile(path);
|
foundSkinfile=pack->getSkinFile(path);
|
||||||
if(foundSkinfile!=NULL)
|
if(foundSkinfile!=nullptr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -276,14 +276,14 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
|
||||||
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||||
{
|
{
|
||||||
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
|
||||||
DLCPack *firstCorruptPack = NULL;
|
DLCPack *firstCorruptPack = nullptr;
|
||||||
|
|
||||||
for( DLCPack *pack : m_packs )
|
for( DLCPack *pack : m_packs )
|
||||||
{
|
{
|
||||||
if( pack->IsCorrupt() )
|
if( pack->IsCorrupt() )
|
||||||
{
|
{
|
||||||
++corruptDLCCount;
|
++corruptDLCCount;
|
||||||
if(firstCorruptPack == NULL) firstCorruptPack = pack;
|
if(firstCorruptPack == nullptr) firstCorruptPack = pack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,13 +291,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
|
||||||
{
|
{
|
||||||
UINT uiIDA[1];
|
UINT uiIDA[1];
|
||||||
uiIDA[0]=IDS_CONFIRM_OK;
|
uiIDA[0]=IDS_CONFIRM_OK;
|
||||||
if(corruptDLCCount == 1 && firstCorruptPack != NULL)
|
if(corruptDLCCount == 1 && firstCorruptPack != nullptr)
|
||||||
{
|
{
|
||||||
// pass in the pack format string
|
// pass in the pack format string
|
||||||
WCHAR wchFormat[132];
|
WCHAR wchFormat[132];
|
||||||
swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str());
|
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(),NULL,NULL,wchFormat);
|
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,wchFormat);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -330,13 +330,13 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||||
if(finalPath.size() == 0) finalPath = path;
|
if(finalPath.size() == 0) finalPath = path;
|
||||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
#elif defined(_DURANGO)
|
#elif defined(_DURANGO)
|
||||||
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||||
if(finalPath.size() == 0) finalPath = wPath;
|
if(finalPath.size() == 0) finalPath = wPath;
|
||||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
#else
|
#else
|
||||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
#endif
|
#endif
|
||||||
if( file == INVALID_HANDLE_VALUE )
|
if( file == INVALID_HANDLE_VALUE )
|
||||||
{
|
{
|
||||||
|
|
@ -347,9 +347,9 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr);
|
||||||
if(bSuccess==FALSE)
|
if(bSuccess==FALSE)
|
||||||
{
|
{
|
||||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||||
|
|
@ -391,7 +391,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||||
|
|
||||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||||
{
|
{
|
||||||
if(pbData!=NULL) delete [] pbData;
|
if(pbData!=nullptr) delete [] pbData;
|
||||||
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -431,8 +431,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||||
{
|
{
|
||||||
DLCManager::EDLCType type = static_cast<DLCManager::EDLCType>(pFile->dwType);
|
DLCManager::EDLCType type = static_cast<DLCManager::EDLCType>(pFile->dwType);
|
||||||
|
|
||||||
DLCFile *dlcFile = NULL;
|
DLCFile *dlcFile = nullptr;
|
||||||
DLCPack *dlcTexturePack = NULL;
|
DLCPack *dlcTexturePack = nullptr;
|
||||||
|
|
||||||
if(type == e_DLCType_TexturePack)
|
if(type == e_DLCType_TexturePack)
|
||||||
{
|
{
|
||||||
|
|
@ -461,8 +461,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(dlcFile != NULL) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData);
|
if(dlcFile != nullptr) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData);
|
||||||
else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData);
|
else if(dlcTexturePack != nullptr) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount);
|
pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount);
|
||||||
|
|
@ -470,15 +470,15 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||||
}
|
}
|
||||||
//pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
//pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM);
|
||||||
|
|
||||||
if(dlcTexturePack != NULL)
|
if(dlcTexturePack != nullptr)
|
||||||
{
|
{
|
||||||
DWORD texturePackFilesProcessed = 0;
|
DWORD texturePackFilesProcessed = 0;
|
||||||
bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,pFile->uiFileSize,dlcTexturePack);
|
bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,pFile->uiFileSize,dlcTexturePack);
|
||||||
pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data
|
pack->SetDataPointer(nullptr); // If it's a child pack, it doesn't own the data
|
||||||
if(!validPack || texturePackFilesProcessed == 0)
|
if(!validPack || texturePackFilesProcessed == 0)
|
||||||
{
|
{
|
||||||
delete dlcTexturePack;
|
delete dlcTexturePack;
|
||||||
dlcTexturePack = NULL;
|
dlcTexturePack = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -491,7 +491,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||||
}
|
}
|
||||||
++dwFilesProcessed;
|
++dwFilesProcessed;
|
||||||
}
|
}
|
||||||
else if(dlcFile != NULL)
|
else if(dlcFile != nullptr)
|
||||||
{
|
{
|
||||||
// Data
|
// Data
|
||||||
dlcFile->addData(pbTemp,pFile->uiFileSize);
|
dlcFile->addData(pbTemp,pFile->uiFileSize);
|
||||||
|
|
@ -537,22 +537,22 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const string &path, DLCPack *pac
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
string finalPath = StorageManager.GetMountedPath(path.c_str());
|
||||||
if(finalPath.size() == 0) finalPath = path;
|
if(finalPath.size() == 0) finalPath = path;
|
||||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
#elif defined(_DURANGO)
|
#elif defined(_DURANGO)
|
||||||
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
wstring finalPath = StorageManager.GetMountedPath(wPath.c_str());
|
||||||
if(finalPath.size() == 0) finalPath = wPath;
|
if(finalPath.size() == 0) finalPath = wPath;
|
||||||
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
#else
|
#else
|
||||||
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
#endif
|
#endif
|
||||||
if( file == INVALID_HANDLE_VALUE )
|
if( file == INVALID_HANDLE_VALUE )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD bytesRead,dwFileSize = GetFileSize(file,NULL);
|
DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr);
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL);
|
BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr);
|
||||||
if(bSuccess==FALSE)
|
if(bSuccess==FALSE)
|
||||||
{
|
{
|
||||||
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
// need to treat the file as corrupt, and flag it, so can't call fatal error
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@ DLCPack::DLCPack(const wstring &name,DWORD dwLicenseMask)
|
||||||
m_isCorrupt = false;
|
m_isCorrupt = false;
|
||||||
m_packId = 0;
|
m_packId = 0;
|
||||||
m_packVersion = 0;
|
m_packVersion = 0;
|
||||||
m_parentPack = NULL;
|
m_parentPack = nullptr;
|
||||||
m_dlcMountIndex = -1;
|
m_dlcMountIndex = -1;
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
m_dlcDeviceID = XCONTENTDEVICE_ANY;
|
m_dlcDeviceID = XCONTENTDEVICE_ANY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
||||||
m_data = NULL;
|
m_data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
|
|
@ -44,11 +44,11 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas
|
||||||
m_isCorrupt = false;
|
m_isCorrupt = false;
|
||||||
m_packId = 0;
|
m_packId = 0;
|
||||||
m_packVersion = 0;
|
m_packVersion = 0;
|
||||||
m_parentPack = NULL;
|
m_parentPack = nullptr;
|
||||||
m_dlcMountIndex = -1;
|
m_dlcMountIndex = -1;
|
||||||
|
|
||||||
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
// This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children.
|
||||||
m_data = NULL;
|
m_data = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ DLCPack::~DLCPack()
|
||||||
wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str());
|
wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str());
|
||||||
#endif
|
#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
|
// 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 == NULL )
|
if( m_parentPack == nullptr )
|
||||||
{
|
{
|
||||||
delete [] m_data;
|
delete [] m_data;
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +85,7 @@ DLCPack::~DLCPack()
|
||||||
|
|
||||||
DWORD DLCPack::GetDLCMountIndex()
|
DWORD DLCPack::GetDLCMountIndex()
|
||||||
{
|
{
|
||||||
if(m_parentPack != NULL)
|
if(m_parentPack != nullptr)
|
||||||
{
|
{
|
||||||
return m_parentPack->GetDLCMountIndex();
|
return m_parentPack->GetDLCMountIndex();
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ DWORD DLCPack::GetDLCMountIndex()
|
||||||
|
|
||||||
XCONTENTDEVICEID DLCPack::GetDLCDeviceID()
|
XCONTENTDEVICEID DLCPack::GetDLCDeviceID()
|
||||||
{
|
{
|
||||||
if(m_parentPack != NULL )
|
if(m_parentPack != nullptr )
|
||||||
{
|
{
|
||||||
return m_parentPack->GetDLCDeviceID();
|
return m_parentPack->GetDLCDeviceID();
|
||||||
}
|
}
|
||||||
|
|
@ -187,7 +187,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned in
|
||||||
|
|
||||||
DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
|
DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
|
||||||
{
|
{
|
||||||
DLCFile *newFile = NULL;
|
DLCFile *newFile = nullptr;
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
|
@ -243,7 +243,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if( newFile != NULL )
|
if( newFile != nullptr )
|
||||||
{
|
{
|
||||||
m_files[newFile->getType()].push_back(newFile);
|
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
|
// MGH - added this comp func, as the embedded func in find_if was confusing the PS3 compiler
|
||||||
static const wstring *g_pathCmpString = NULL;
|
static const wstring *g_pathCmpString = nullptr;
|
||||||
static bool pathCmp(DLCFile *val)
|
static bool pathCmp(DLCFile *val)
|
||||||
{
|
{
|
||||||
return (g_pathCmpString->compare(val->getPath()) == 0);
|
return (g_pathCmpString->compare(val->getPath()) == 0);
|
||||||
|
|
@ -284,13 +284,13 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
|
||||||
|
|
||||||
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
|
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
|
||||||
{
|
{
|
||||||
DLCFile *file = NULL;
|
DLCFile *file = nullptr;
|
||||||
if(type == DLCManager::e_DLCType_All)
|
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 = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
|
||||||
{
|
{
|
||||||
file = getFile(currentType,index);
|
file = getFile(currentType,index);
|
||||||
if(file != NULL) break;
|
if(file != nullptr) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -306,13 +306,13 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index)
|
||||||
|
|
||||||
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
|
DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
|
||||||
{
|
{
|
||||||
DLCFile *file = NULL;
|
DLCFile *file = nullptr;
|
||||||
if(type == DLCManager::e_DLCType_All)
|
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 = static_cast<DLCManager::EDLCType>(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast<DLCManager::EDLCType>(currentType + 1))
|
||||||
{
|
{
|
||||||
file = getFile(currentType,path);
|
file = getFile(currentType,path);
|
||||||
if(file != NULL) break;
|
if(file != nullptr) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -323,7 +323,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
|
||||||
if(it == m_files[type].end())
|
if(it == m_files[type].end())
|
||||||
{
|
{
|
||||||
// Not found
|
// Not found
|
||||||
file = NULL;
|
file = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -420,7 +420,7 @@ void DLCPack::UpdateLanguage()
|
||||||
{
|
{
|
||||||
// find the language file
|
// find the language file
|
||||||
DLCManager::e_DLCType_LocalisationData;
|
DLCManager::e_DLCType_LocalisationData;
|
||||||
DLCFile *file = NULL;
|
DLCFile *file = nullptr;
|
||||||
|
|
||||||
if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0)
|
if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ DLCTextureFile::DLCTextureFile(const wstring &path) : DLCFile(DLCManager::e_DLCT
|
||||||
m_bIsAnim = false;
|
m_bIsAnim = false;
|
||||||
m_animString = L"";
|
m_animString = L"";
|
||||||
|
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dwBytes = 0;
|
m_dwBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@
|
||||||
|
|
||||||
DLCUIDataFile::DLCUIDataFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path)
|
DLCUIDataFile::DLCUIDataFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path)
|
||||||
{
|
{
|
||||||
m_pbData = NULL;
|
m_pbData = nullptr;
|
||||||
m_dwBytes = 0;
|
m_dwBytes = 0;
|
||||||
m_canDeleteData = false;
|
m_canDeleteData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLCUIDataFile::~DLCUIDataFile()
|
DLCUIDataFile::~DLCUIDataFile()
|
||||||
{
|
{
|
||||||
if(m_canDeleteData && m_pbData != NULL)
|
if(m_canDeleteData && m_pbData != nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Deleting DLCUIDataFile data\n");
|
app.DebugPrintf("Deleting DLCUIDataFile data\n");
|
||||||
delete [] m_pbData;
|
delete [] m_pbData;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||||
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
bool enchanted = false;
|
bool enchanted = false;
|
||||||
if (item != NULL)
|
if (item != nullptr)
|
||||||
{
|
{
|
||||||
// 4J-JEV: Ripped code from enchantmenthelpers
|
// 4J-JEV: Ripped code from enchantmenthelpers
|
||||||
// Maybe we want to add an addEnchantment method to 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];
|
Enchantment *e = Enchantment::enchantments[m_enchantmentId];
|
||||||
|
|
||||||
if(e != NULL && e->category->canEnchant(item->getItem()))
|
if(e != nullptr && e->category->canEnchant(item->getItem()))
|
||||||
{
|
{
|
||||||
int level = min(e->getMaxLevel(), m_enchantmentLevel);
|
int level = min(e->getMaxLevel(), m_enchantmentLevel);
|
||||||
item->enchant(e, m_enchantmentLevel);
|
item->enchant(e, m_enchantmentLevel);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
|
|
||||||
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
{
|
{
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment)
|
if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment)
|
||||||
{
|
{
|
||||||
rule = new AddEnchantmentRuleDefinition();
|
rule = new AddEnchantmentRuleDefinition();
|
||||||
|
|
@ -97,7 +97,7 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst
|
||||||
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId)
|
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId)
|
||||||
{
|
{
|
||||||
bool added = false;
|
bool added = false;
|
||||||
if(Item::items[m_itemId] != NULL)
|
if(Item::items[m_itemId] != nullptr)
|
||||||
{
|
{
|
||||||
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
||||||
|
|
@ -118,7 +118,7 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
|
||||||
container->setItem( slotId, newItem );
|
container->setItem( slotId, newItem );
|
||||||
added = true;
|
added = true;
|
||||||
}
|
}
|
||||||
else if(dynamic_pointer_cast<Inventory>(container) != NULL)
|
else if(dynamic_pointer_cast<Inventory>(container) != nullptr)
|
||||||
{
|
{
|
||||||
added = dynamic_pointer_cast<Inventory>(container)->add(newItem);
|
added = dynamic_pointer_cast<Inventory>(container)->add(newItem);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,20 +13,20 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOption
|
||||||
{
|
{
|
||||||
m_levelGenOptions = levelGenOptions;
|
m_levelGenOptions = levelGenOptions;
|
||||||
m_location = Vec3::newPermanent(0,0,0);
|
m_location = Vec3::newPermanent(0,0,0);
|
||||||
m_locationBox = NULL;
|
m_locationBox = nullptr;
|
||||||
m_totalBlocksChanged = 0;
|
m_totalBlocksChanged = 0;
|
||||||
m_totalBlocksChangedLighting = 0;
|
m_totalBlocksChangedLighting = 0;
|
||||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||||
m_completed = false;
|
m_completed = false;
|
||||||
m_dimension = 0;
|
m_dimension = 0;
|
||||||
m_schematic = NULL;
|
m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
|
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
|
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
|
||||||
if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||||
m_schematic = NULL;
|
m_schematic = nullptr;
|
||||||
delete m_location;
|
delete m_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||||
|
|
||||||
void ApplySchematicRuleDefinition::updateLocationBox()
|
void ApplySchematicRuleDefinition::updateLocationBox()
|
||||||
{
|
{
|
||||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
m_locationBox = AABB::newPermanent(0,0,0,0,0,0);
|
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;
|
if(chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
||||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
if(m_locationBox == NULL) updateLocationBox();
|
if(m_locationBox == nullptr) updateLocationBox();
|
||||||
if(chunkBox->intersects( m_locationBox ))
|
if(chunkBox->intersects( m_locationBox ))
|
||||||
{
|
{
|
||||||
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
||||||
|
|
@ -189,7 +189,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
|
||||||
{
|
{
|
||||||
m_completed = true;
|
m_completed = true;
|
||||||
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||||
//m_schematic = NULL;
|
//m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
@ -201,9 +201,9 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
||||||
if(chunk->level->dimension->id != m_dimension) return;
|
if(chunk->level->dimension->id != m_dimension) return;
|
||||||
|
|
||||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
||||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||||
|
|
||||||
if(m_locationBox == NULL) updateLocationBox();
|
if(m_locationBox == nullptr) updateLocationBox();
|
||||||
if(chunkBox->intersects( m_locationBox ))
|
if(chunkBox->intersects( m_locationBox ))
|
||||||
{
|
{
|
||||||
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
||||||
|
|
@ -223,7 +223,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
||||||
{
|
{
|
||||||
m_completed = true;
|
m_completed = true;
|
||||||
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||||
//m_schematic = NULL;
|
//m_schematic = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIXEndNamedEvent();
|
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)
|
bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1)
|
||||||
{
|
{
|
||||||
if( m_locationBox == NULL ) updateLocationBox();
|
if( m_locationBox == nullptr ) updateLocationBox();
|
||||||
return m_locationBox->intersects(x0,y0,z0,x1,y1,z1);
|
return m_locationBox->intersects(x0,y0,z0,x1,y1,z1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ApplySchematicRuleDefinition::getMinY()
|
int ApplySchematicRuleDefinition::getMinY()
|
||||||
{
|
{
|
||||||
if( m_locationBox == NULL ) updateLocationBox();
|
if( m_locationBox == nullptr ) updateLocationBox();
|
||||||
return m_locationBox->y0;
|
return m_locationBox->y0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn
|
||||||
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
bool statusChanged = false;
|
bool statusChanged = false;
|
||||||
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
if(item != nullptr && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||||
{
|
{
|
||||||
if(!getComplete(rule))
|
if(!getComplete(rule))
|
||||||
{
|
{
|
||||||
|
|
@ -92,9 +92,9 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
|
||||||
setComplete(rule, true);
|
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() != NULL)
|
if(rule->getConnection() != nullptr)
|
||||||
{
|
{
|
||||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
|
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,nullptr,0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +106,7 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
||||||
wstring xml = L"";
|
wstring xml = L"";
|
||||||
if(item != NULL)
|
if(item != nullptr)
|
||||||
{
|
{
|
||||||
xml = L"<CollectItemRule itemId=\"" + std::to_wstring(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
|
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"\"";
|
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);
|
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(rule->getConnection() != NULL)
|
if(rule->getConnection() != nullptr)
|
||||||
{
|
{
|
||||||
PacketData data;
|
PacketData data;
|
||||||
data.goal = goal;
|
data.goal = goal;
|
||||||
|
|
@ -45,11 +45,11 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||||
int icon = -1;
|
int icon = -1;
|
||||||
int auxValue = 0;
|
int auxValue = 0;
|
||||||
|
|
||||||
if(m_lastRuleStatusChanged != NULL)
|
if(m_lastRuleStatusChanged != nullptr)
|
||||||
{
|
{
|
||||||
icon = m_lastRuleStatusChanged->getIcon();
|
icon = m_lastRuleStatusChanged->getIcon();
|
||||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||||
m_lastRuleStatusChanged = NULL;
|
m_lastRuleStatusChanged = nullptr;
|
||||||
}
|
}
|
||||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new 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))));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
CompoundGameRuleDefinition::CompoundGameRuleDefinition()
|
CompoundGameRuleDefinition::CompoundGameRuleDefinition()
|
||||||
{
|
{
|
||||||
m_lastRuleStatusChanged = NULL;
|
m_lastRuleStatusChanged = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
||||||
|
|
@ -26,7 +26,7 @@ void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
|
||||||
|
|
||||||
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
{
|
{
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule)
|
if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule)
|
||||||
{
|
{
|
||||||
rule = new CompleteAllRuleDefinition();
|
rule = new CompleteAllRuleDefinition();
|
||||||
|
|
@ -49,13 +49,13 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
|
||||||
wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if(rule != NULL) m_children.push_back(rule);
|
if(rule != nullptr) m_children.push_back(rule);
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
|
void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
|
||||||
{
|
{
|
||||||
GameRule *newRule = NULL;
|
GameRule *newRule = nullptr;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto& it : m_children )
|
for (auto& it : m_children )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
||||||
{
|
{
|
||||||
m_x = m_y = m_z = 0;
|
m_x = m_y = m_z = 0;
|
||||||
boundingBox = NULL;
|
boundingBox = nullptr;
|
||||||
orientation = Direction::NORTH;
|
orientation = Direction::NORTH;
|
||||||
m_dimension = 0;
|
m_dimension = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,7 @@ void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *childre
|
||||||
|
|
||||||
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
{
|
{
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox)
|
if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox)
|
||||||
{
|
{
|
||||||
rule = new XboxStructureActionGenerateBox();
|
rule = new XboxStructureActionGenerateBox();
|
||||||
|
|
@ -112,7 +112,7 @@ void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const
|
||||||
|
|
||||||
BoundingBox* ConsoleGenerateStructure::getBoundingBox()
|
BoundingBox* ConsoleGenerateStructure::getBoundingBox()
|
||||||
{
|
{
|
||||||
if(boundingBox == NULL)
|
if(boundingBox == nullptr)
|
||||||
{
|
{
|
||||||
// Find the max bounds
|
// Find the max bounds
|
||||||
int maxX, maxY, maxZ;
|
int maxX, maxY, maxZ;
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,18 @@ ConsoleSchematicFile::ConsoleSchematicFile()
|
||||||
{
|
{
|
||||||
m_xSize = m_ySize = m_zSize = 0;
|
m_xSize = m_ySize = m_zSize = 0;
|
||||||
m_refCount = 1;
|
m_refCount = 1;
|
||||||
m_data.data = NULL;
|
m_data.data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleSchematicFile::~ConsoleSchematicFile()
|
ConsoleSchematicFile::~ConsoleSchematicFile()
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Deleting schematic file\n");
|
app.DebugPrintf("Deleting schematic file\n");
|
||||||
if(m_data.data != NULL) delete [] m_data.data;
|
if(m_data.data != nullptr) delete [] m_data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleSchematicFile::save(DataOutputStream *dos)
|
void ConsoleSchematicFile::save(DataOutputStream *dos)
|
||||||
{
|
{
|
||||||
if(dos != NULL)
|
if(dos != nullptr)
|
||||||
{
|
{
|
||||||
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
|
||||||
|
|
||||||
void ConsoleSchematicFile::load(DataInputStream *dis)
|
void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||||
{
|
{
|
||||||
if(dis != NULL)
|
if(dis != nullptr)
|
||||||
{
|
{
|
||||||
// VERSION CHECK //
|
// VERSION CHECK //
|
||||||
int version = dis->readInt();
|
int version = dis->readInt();
|
||||||
|
|
@ -75,10 +75,10 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||||
byteArray compressedBuffer(compressedSize);
|
byteArray compressedBuffer(compressedSize);
|
||||||
dis->readFully(compressedBuffer);
|
dis->readFully(compressedBuffer);
|
||||||
|
|
||||||
if(m_data.data != NULL)
|
if(m_data.data != nullptr)
|
||||||
{
|
{
|
||||||
delete [] m_data.data;
|
delete [] m_data.data;
|
||||||
m_data.data = NULL;
|
m_data.data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(compressionType == Compression::eCompressionType_None)
|
if(compressionType == Compression::eCompressionType_None)
|
||||||
|
|
@ -111,17 +111,17 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||||
// READ TAGS //
|
// READ TAGS //
|
||||||
CompoundTag *tag = NbtIo::read(dis);
|
CompoundTag *tag = NbtIo::read(dis);
|
||||||
ListTag<CompoundTag> *tileEntityTags = (ListTag<CompoundTag> *) tag->getList(L"TileEntities");
|
ListTag<CompoundTag> *tileEntityTags = (ListTag<CompoundTag> *) tag->getList(L"TileEntities");
|
||||||
if (tileEntityTags != NULL)
|
if (tileEntityTags != nullptr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < tileEntityTags->size(); i++)
|
for (int i = 0; i < tileEntityTags->size(); i++)
|
||||||
{
|
{
|
||||||
CompoundTag *teTag = tileEntityTags->get(i);
|
CompoundTag *teTag = tileEntityTags->get(i);
|
||||||
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
||||||
|
|
||||||
if(te == NULL)
|
if(te == nullptr)
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
app.DebugPrintf("ConsoleSchematicFile has read a NULL tile entity\n");
|
app.DebugPrintf("ConsoleSchematicFile has read a nullptr tile entity\n");
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListTag<CompoundTag> *entityTags = (ListTag<CompoundTag> *) tag->getList(L"Entities");
|
ListTag<CompoundTag> *entityTags = (ListTag<CompoundTag> *) tag->getList(L"Entities");
|
||||||
if (entityTags != NULL)
|
if (entityTags != nullptr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < entityTags->size(); i++)
|
for (int i = 0; i < entityTags->size(); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -444,7 +444,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
||||||
{
|
{
|
||||||
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( static_cast<int>(targetX) & 15, static_cast<int>(targetY) & 15, static_cast<int>(targetZ) & 15 );
|
||||||
|
|
||||||
if ( teCopy != NULL )
|
if ( teCopy != nullptr )
|
||||||
{
|
{
|
||||||
CompoundTag *teData = new CompoundTag();
|
CompoundTag *teData = new CompoundTag();
|
||||||
te->save(teData);
|
te->save(teData);
|
||||||
|
|
@ -493,7 +493,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag *eTag = it->second;
|
CompoundTag *eTag = it->second;
|
||||||
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
|
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, nullptr);
|
||||||
|
|
||||||
if( e->GetType() == eTYPE_PAINTING )
|
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);
|
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 != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
if(dos != nullptr) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||||
|
|
||||||
if(dos != NULL) dos->writeByte(compressionType);
|
if(dos != nullptr) dos->writeByte(compressionType);
|
||||||
|
|
||||||
//Write xSize
|
//Write xSize
|
||||||
if(dos != NULL) dos->writeInt(xSize);
|
if(dos != nullptr) dos->writeInt(xSize);
|
||||||
|
|
||||||
//Write ySize
|
//Write ySize
|
||||||
if(dos != NULL) dos->writeInt(ySize);
|
if(dos != nullptr) dos->writeInt(ySize);
|
||||||
|
|
||||||
//Write zSize
|
//Write zSize
|
||||||
if(dos != NULL) dos->writeInt(zSize);
|
if(dos != nullptr) dos->writeInt(zSize);
|
||||||
|
|
||||||
//byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, xSize, ySize, zSize, false);
|
//byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, xSize, ySize, zSize, false);
|
||||||
int xRowSize = ySize * zSize;
|
int xRowSize = ySize * zSize;
|
||||||
|
|
@ -660,8 +660,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||||
delete [] result.data;
|
delete [] result.data;
|
||||||
byteArray buffer = byteArray(ucTemp,inputSize);
|
byteArray buffer = byteArray(ucTemp,inputSize);
|
||||||
|
|
||||||
if(dos != NULL) dos->writeInt(inputSize);
|
if(dos != nullptr) dos->writeInt(inputSize);
|
||||||
if(dos != NULL) dos->write(buffer);
|
if(dos != nullptr) dos->write(buffer);
|
||||||
delete [] buffer.data;
|
delete [] buffer.data;
|
||||||
|
|
||||||
CompoundTag tag;
|
CompoundTag tag;
|
||||||
|
|
@ -738,7 +738,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||||
|
|
||||||
tag.put(L"Entities", entitiesTag);
|
tag.put(L"Entities", entitiesTag);
|
||||||
|
|
||||||
if(dos != NULL) NbtIo::write(&tag,dos);
|
if(dos != nullptr) 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)
|
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
|
stringValueMapType m_parameters; // These are the members of this rule that maintain it's state
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameRule(GameRuleDefinition *definition, Connection *connection = NULL);
|
GameRule(GameRuleDefinition *definition, Connection *connection = nullptr);
|
||||||
virtual ~GameRule();
|
virtual ~GameRule();
|
||||||
|
|
||||||
Connection *getConnection() { return m_connection; }
|
Connection *getConnection() { return m_connection; }
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,6 @@ public:
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection);
|
static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection);
|
||||||
static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0);
|
static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = nullptr, int dataLength = 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -85,13 +85,13 @@ WCHAR *GameRuleManager::wchAttrNameA[] =
|
||||||
|
|
||||||
GameRuleManager::GameRuleManager()
|
GameRuleManager::GameRuleManager()
|
||||||
{
|
{
|
||||||
m_currentGameRuleDefinitions = NULL;
|
m_currentGameRuleDefinitions = nullptr;
|
||||||
m_currentLevelGenerationOptions = NULL;
|
m_currentLevelGenerationOptions = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameRuleManager::loadGameRules(DLCPack *pack)
|
void GameRuleManager::loadGameRules(DLCPack *pack)
|
||||||
{
|
{
|
||||||
StringTable *strings = NULL;
|
StringTable *strings = nullptr;
|
||||||
|
|
||||||
if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc"))
|
if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc"))
|
||||||
{
|
{
|
||||||
|
|
@ -237,11 +237,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
// 4J-JEV: Reverse of loadGameRules.
|
// 4J-JEV: Reverse of loadGameRules.
|
||||||
void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
{
|
{
|
||||||
if (m_currentGameRuleDefinitions == NULL &&
|
if (m_currentGameRuleDefinitions == nullptr &&
|
||||||
m_currentLevelGenerationOptions == NULL)
|
m_currentLevelGenerationOptions == nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
|
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
|
||||||
*dOut = NULL;
|
*dOut = nullptr;
|
||||||
*dSize = 0;
|
*dSize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -268,7 +268,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
ByteArrayOutputStream compr_baos;
|
ByteArrayOutputStream compr_baos;
|
||||||
DataOutputStream compr_dos(&compr_baos);
|
DataOutputStream compr_dos(&compr_baos);
|
||||||
|
|
||||||
if (m_currentGameRuleDefinitions == NULL)
|
if (m_currentGameRuleDefinitions == nullptr)
|
||||||
{
|
{
|
||||||
compr_dos.writeInt( 0 ); // numStrings for StringTable
|
compr_dos.writeInt( 0 ); // numStrings for StringTable
|
||||||
compr_dos.writeInt( version_number );
|
compr_dos.writeInt( version_number );
|
||||||
|
|
@ -282,9 +282,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
{
|
{
|
||||||
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
||||||
|
|
||||||
if (st == NULL)
|
if (st == nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!");
|
app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == nullptr!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||||
*dSize = baos.buf.length;
|
*dSize = baos.buf.length;
|
||||||
*dOut = baos.buf.data;
|
*dOut = baos.buf.data;
|
||||||
|
|
||||||
baos.buf.data = NULL;
|
baos.buf.data = nullptr;
|
||||||
|
|
||||||
dos.close(); baos.close();
|
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();
|
for(int i = 0; i < 8; ++i) dis.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayInputStream *contentBais = NULL;
|
ByteArrayInputStream *contentBais = nullptr;
|
||||||
DataInputStream *contentDis = NULL;
|
DataInputStream *contentDis = nullptr;
|
||||||
|
|
||||||
if(compressionType == Compression::eCompressionType_None)
|
if(compressionType == Compression::eCompressionType_None)
|
||||||
{
|
{
|
||||||
|
|
@ -521,7 +521,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
auto it = tagIdMap.find(tagId);
|
auto it = tagIdMap.find(tagId);
|
||||||
if(it != tagIdMap.end()) tagVal = it->second;
|
if(it != tagIdMap.end()) tagVal = it->second;
|
||||||
|
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
|
|
||||||
if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions)
|
if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions)
|
||||||
{
|
{
|
||||||
|
|
@ -548,14 +548,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||||
{
|
{
|
||||||
// Not default
|
// Not default
|
||||||
contentDis->close();
|
contentDis->close();
|
||||||
if(contentBais != NULL) delete contentBais;
|
if(contentBais != nullptr) delete contentBais;
|
||||||
delete contentDis;
|
delete contentDis;
|
||||||
}
|
}
|
||||||
|
|
||||||
dis.close();
|
dis.close();
|
||||||
bais.reset();
|
bais.reset();
|
||||||
|
|
||||||
//if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; }
|
//if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; }
|
||||||
if(!gameRulesAdded) delete gameRules;
|
if(!gameRulesAdded) delete gameRules;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -583,7 +583,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, vector<wstring> *tags
|
||||||
int attID = dis->readInt();
|
int attID = dis->readInt();
|
||||||
wstring value = dis->readUTF();
|
wstring value = dis->readUTF();
|
||||||
|
|
||||||
if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value);
|
if(rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID),value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -597,8 +597,8 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
|
||||||
auto it = tagIdMap->find(tagId);
|
auto it = tagIdMap->find(tagId);
|
||||||
if(it != tagIdMap->end()) tagVal = it->second;
|
if(it != tagIdMap->end()) tagVal = it->second;
|
||||||
|
|
||||||
GameRuleDefinition *childRule = NULL;
|
GameRuleDefinition *childRule = nullptr;
|
||||||
if(rule != NULL) childRule = rule->addChild(tagVal);
|
if(rule != nullptr) childRule = rule->addChild(tagVal);
|
||||||
|
|
||||||
readAttributes(dis,tagsAndAtts,childRule);
|
readAttributes(dis,tagsAndAtts,childRule);
|
||||||
readChildren(dis,tagsAndAtts,tagIdMap,childRule);
|
readChildren(dis,tagsAndAtts,tagIdMap,childRule);
|
||||||
|
|
@ -607,7 +607,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
|
||||||
|
|
||||||
void GameRuleManager::processSchematics(LevelChunk *levelChunk)
|
void GameRuleManager::processSchematics(LevelChunk *levelChunk)
|
||||||
{
|
{
|
||||||
if(getLevelGenerationOptions() != NULL)
|
if(getLevelGenerationOptions() != nullptr)
|
||||||
{
|
{
|
||||||
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
||||||
levelGenOptions->processSchematics(levelChunk);
|
levelGenOptions->processSchematics(levelChunk);
|
||||||
|
|
@ -616,7 +616,7 @@ void GameRuleManager::processSchematics(LevelChunk *levelChunk)
|
||||||
|
|
||||||
void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk)
|
void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk)
|
||||||
{
|
{
|
||||||
if(getLevelGenerationOptions() != NULL)
|
if(getLevelGenerationOptions() != nullptr)
|
||||||
{
|
{
|
||||||
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
||||||
levelGenOptions->processSchematicsLighting(levelChunk);
|
levelGenOptions->processSchematicsLighting(levelChunk);
|
||||||
|
|
@ -701,21 +701,21 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen
|
||||||
{
|
{
|
||||||
unloadCurrentGameRules();
|
unloadCurrentGameRules();
|
||||||
|
|
||||||
m_currentGameRuleDefinitions = NULL;
|
m_currentGameRuleDefinitions = nullptr;
|
||||||
m_currentLevelGenerationOptions = levelGen;
|
m_currentLevelGenerationOptions = levelGen;
|
||||||
|
|
||||||
if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() )
|
if(m_currentLevelGenerationOptions != nullptr && m_currentLevelGenerationOptions->requiresGameRules() )
|
||||||
{
|
{
|
||||||
m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules();
|
m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_currentLevelGenerationOptions != NULL)
|
if(m_currentLevelGenerationOptions != nullptr)
|
||||||
m_currentLevelGenerationOptions->reset_start();
|
m_currentLevelGenerationOptions->reset_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
||||||
{
|
{
|
||||||
if(m_currentGameRuleDefinitions != NULL && !key.empty() )
|
if(m_currentGameRuleDefinitions != nullptr && !key.empty() )
|
||||||
{
|
{
|
||||||
return m_currentGameRuleDefinitions->getString(key);
|
return m_currentGameRuleDefinitions->getString(key);
|
||||||
}
|
}
|
||||||
|
|
@ -739,9 +739,9 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *
|
||||||
|
|
||||||
void GameRuleManager::unloadCurrentGameRules()
|
void GameRuleManager::unloadCurrentGameRules()
|
||||||
{
|
{
|
||||||
if (m_currentLevelGenerationOptions != NULL)
|
if (m_currentLevelGenerationOptions != nullptr)
|
||||||
{
|
{
|
||||||
if (m_currentGameRuleDefinitions != NULL
|
if (m_currentGameRuleDefinitions != nullptr
|
||||||
&& m_currentLevelGenerationOptions->isFromSave())
|
&& m_currentLevelGenerationOptions->isFromSave())
|
||||||
m_levelRules.removeLevelRule( m_currentGameRuleDefinitions );
|
m_levelRules.removeLevelRule( m_currentGameRuleDefinitions );
|
||||||
|
|
||||||
|
|
@ -757,6 +757,6 @@ void GameRuleManager::unloadCurrentGameRules()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentGameRuleDefinitions = NULL;
|
m_currentGameRuleDefinitions = nullptr;
|
||||||
m_currentLevelGenerationOptions = NULL;
|
m_currentLevelGenerationOptions = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ bool JustGrSource::ready() { return true; }
|
||||||
|
|
||||||
LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||||
{
|
{
|
||||||
m_spawnPos = NULL;
|
m_spawnPos = nullptr;
|
||||||
m_stringTable = NULL;
|
m_stringTable = nullptr;
|
||||||
|
|
||||||
m_hasLoadedData = false;
|
m_hasLoadedData = false;
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||||
m_minY = INT_MAX;
|
m_minY = INT_MAX;
|
||||||
m_bRequiresGameRules = false;
|
m_bRequiresGameRules = false;
|
||||||
|
|
||||||
m_pbBaseSaveData = NULL;
|
m_pbBaseSaveData = nullptr;
|
||||||
m_dwBaseSaveSize = 0;
|
m_dwBaseSaveSize = 0;
|
||||||
|
|
||||||
m_parentDLCPack = parentPack;
|
m_parentDLCPack = parentPack;
|
||||||
|
|
@ -66,7 +66,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||||
LevelGenerationOptions::~LevelGenerationOptions()
|
LevelGenerationOptions::~LevelGenerationOptions()
|
||||||
{
|
{
|
||||||
clearSchematics();
|
clearSchematics();
|
||||||
if(m_spawnPos != NULL) delete m_spawnPos;
|
if(m_spawnPos != nullptr) delete m_spawnPos;
|
||||||
for (auto& it : m_schematicRules )
|
for (auto& it : m_schematicRules )
|
||||||
{
|
{
|
||||||
delete it;
|
delete it;
|
||||||
|
|
@ -141,7 +141,7 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
|
|
||||||
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
{
|
{
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic)
|
if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic)
|
||||||
{
|
{
|
||||||
rule = new ApplySchematicRuleDefinition(this);
|
rule = new ApplySchematicRuleDefinition(this);
|
||||||
|
|
@ -180,21 +180,21 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"spawnX") == 0)
|
else if(attributeName.compare(L"spawnX") == 0)
|
||||||
{
|
{
|
||||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||||
int value = _fromString<int>(attributeValue);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->x = value;
|
m_spawnPos->x = value;
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",value);
|
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",value);
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"spawnY") == 0)
|
else if(attributeName.compare(L"spawnY") == 0)
|
||||||
{
|
{
|
||||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||||
int value = _fromString<int>(attributeValue);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->y = value;
|
m_spawnPos->y = value;
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",value);
|
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",value);
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"spawnZ") == 0)
|
else if(attributeName.compare(L"spawnZ") == 0)
|
||||||
{
|
{
|
||||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||||
int value = _fromString<int>(attributeValue);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->z = value;
|
m_spawnPos->z = value;
|
||||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",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))
|
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
|
||||||
{
|
{
|
||||||
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
|
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
|
||||||
structureStart->postProcess(chunk->level, NULL, bb);
|
structureStart->postProcess(chunk->level, nullptr, bb);
|
||||||
delete bb;
|
delete bb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -353,7 +353,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleSchematicFile *schematic = NULL;
|
ConsoleSchematicFile *schematic = nullptr;
|
||||||
byteArray data(pbData,dwLen);
|
byteArray data(pbData,dwLen);
|
||||||
ByteArrayInputStream bais(data);
|
ByteArrayInputStream bais(data);
|
||||||
DataInputStream dis(&bais);
|
DataInputStream dis(&bais);
|
||||||
|
|
@ -366,7 +366,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f
|
||||||
|
|
||||||
ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &filename)
|
ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &filename)
|
||||||
{
|
{
|
||||||
ConsoleSchematicFile *schematic = NULL;
|
ConsoleSchematicFile *schematic = nullptr;
|
||||||
// If we have already loaded this, just return
|
// If we have already loaded this, just return
|
||||||
auto it = m_schematics.find(filename);
|
auto it = m_schematics.find(filename);
|
||||||
if(it != m_schematics.end())
|
if(it != m_schematics.end())
|
||||||
|
|
@ -399,7 +399,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table)
|
||||||
|
|
||||||
LPCWSTR LevelGenerationOptions::getString(const wstring &key)
|
LPCWSTR LevelGenerationOptions::getString(const wstring &key)
|
||||||
{
|
{
|
||||||
if(m_stringTable == NULL)
|
if(m_stringTable == nullptr)
|
||||||
{
|
{
|
||||||
return L"";
|
return L"";
|
||||||
}
|
}
|
||||||
|
|
@ -456,7 +456,7 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
|
||||||
void LevelGenerationOptions::loadBaseSaveData()
|
void LevelGenerationOptions::loadBaseSaveData()
|
||||||
{
|
{
|
||||||
int mountIndex = -1;
|
int mountIndex = -1;
|
||||||
if(m_parentDLCPack != NULL) mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
if(m_parentDLCPack != nullptr) mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
||||||
|
|
||||||
if(mountIndex > -1)
|
if(mountIndex > -1)
|
||||||
{
|
{
|
||||||
|
|
@ -513,10 +513,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||||
pchFilename, // file name
|
pchFilename, // file name
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
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
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
const char *pchFilename=wstringtofilename(grf.getPath());
|
const char *pchFilename=wstringtofilename(grf.getPath());
|
||||||
|
|
@ -524,10 +524,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||||
pchFilename, // file name
|
pchFilename, // file name
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
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
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -536,7 +536,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||||
DWORD dwFileSize = grf.length();
|
DWORD dwFileSize = grf.length();
|
||||||
DWORD bytesRead;
|
DWORD bytesRead;
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||||
if(bSuccess==FALSE)
|
if(bSuccess==FALSE)
|
||||||
{
|
{
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
|
|
@ -565,10 +565,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||||
pchFilename, // file name
|
pchFilename, // file name
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
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
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
const char *pchFilename=wstringtofilename(save.getPath());
|
const char *pchFilename=wstringtofilename(save.getPath());
|
||||||
|
|
@ -576,18 +576,18 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||||
pchFilename, // file name
|
pchFilename, // file name
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
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
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( fileHandle != INVALID_HANDLE_VALUE )
|
if( fileHandle != INVALID_HANDLE_VALUE )
|
||||||
{
|
{
|
||||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL);
|
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr);
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||||
if(bSuccess==FALSE)
|
if(bSuccess==FALSE)
|
||||||
{
|
{
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
|
|
@ -624,8 +624,8 @@ void LevelGenerationOptions::reset_start()
|
||||||
|
|
||||||
void LevelGenerationOptions::reset_finish()
|
void LevelGenerationOptions::reset_finish()
|
||||||
{
|
{
|
||||||
//if (m_spawnPos) { delete m_spawnPos; m_spawnPos = NULL; }
|
//if (m_spawnPos) { delete m_spawnPos; m_spawnPos = nullptr; }
|
||||||
//if (m_stringTable) { delete m_stringTable; m_stringTable = NULL; }
|
//if (m_stringTable) { delete m_stringTable; m_stringTable = nullptr; }
|
||||||
|
|
||||||
if (isFromDLC())
|
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; }
|
void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; }
|
||||||
PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; }
|
PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; }
|
||||||
bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; }
|
bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != nullptr; }
|
||||||
void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; }
|
void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = nullptr; m_dwBaseSaveSize = 0; }
|
||||||
|
|
||||||
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
|
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
|
||||||
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
|
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ private:
|
||||||
bool m_bLoadingData;
|
bool m_bLoadingData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LevelGenerationOptions(DLCPack *parentPack = NULL);
|
LevelGenerationOptions(DLCPack *parentPack = nullptr);
|
||||||
~LevelGenerationOptions();
|
~LevelGenerationOptions();
|
||||||
|
|
||||||
virtual ConsoleGameRules::EGameRuleType getActionType();
|
virtual ConsoleGameRules::EGameRuleType getActionType();
|
||||||
|
|
@ -202,7 +202,7 @@ public:
|
||||||
LevelRuleset *getRequiredGameRules();
|
LevelRuleset *getRequiredGameRules();
|
||||||
|
|
||||||
void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile);
|
void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile);
|
||||||
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = NULL);
|
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = nullptr);
|
||||||
|
|
||||||
void loadStringTable(StringTable *table);
|
void loadStringTable(StringTable *table);
|
||||||
LPCWSTR getString(const wstring &key);
|
LPCWSTR getString(const wstring &key);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
LevelRuleset::LevelRuleset()
|
LevelRuleset::LevelRuleset()
|
||||||
{
|
{
|
||||||
m_stringTable = NULL;
|
m_stringTable = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelRuleset::~LevelRuleset()
|
LevelRuleset::~LevelRuleset()
|
||||||
|
|
@ -26,7 +26,7 @@ void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
|
||||||
|
|
||||||
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
{
|
{
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea)
|
if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea)
|
||||||
{
|
{
|
||||||
rule = new NamedAreaRuleDefinition();
|
rule = new NamedAreaRuleDefinition();
|
||||||
|
|
@ -46,7 +46,7 @@ void LevelRuleset::loadStringTable(StringTable *table)
|
||||||
|
|
||||||
LPCWSTR LevelRuleset::getString(const wstring &key)
|
LPCWSTR LevelRuleset::getString(const wstring &key)
|
||||||
{
|
{
|
||||||
if(m_stringTable == NULL)
|
if(m_stringTable == nullptr)
|
||||||
{
|
{
|
||||||
return L"";
|
return L"";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation)
|
||||||
{
|
{
|
||||||
if(orientation != NULL) *orientation = m_orientation;
|
if(orientation != nullptr) *orientation = m_orientation;
|
||||||
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
|
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
|
||||||
}
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
|
||||||
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
||||||
m_health = 0;
|
m_health = 0;
|
||||||
m_food = 0;
|
m_food = 0;
|
||||||
m_spawnPos = NULL;
|
m_spawnPos = nullptr;
|
||||||
m_yRot = 0.0f;
|
m_yRot = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
|
||||||
|
|
||||||
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
{
|
{
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
||||||
{
|
{
|
||||||
rule = new AddItemRuleDefinition();
|
rule = new AddItemRuleDefinition();
|
||||||
|
|
@ -84,21 +84,21 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons
|
||||||
{
|
{
|
||||||
if(attributeName.compare(L"spawnX") == 0)
|
if(attributeName.compare(L"spawnX") == 0)
|
||||||
{
|
{
|
||||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||||
int value = _fromString<int>(attributeValue);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->x = value;
|
m_spawnPos->x = value;
|
||||||
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value);
|
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value);
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"spawnY") == 0)
|
else if(attributeName.compare(L"spawnY") == 0)
|
||||||
{
|
{
|
||||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||||
int value = _fromString<int>(attributeValue);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->y = value;
|
m_spawnPos->y = value;
|
||||||
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value);
|
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value);
|
||||||
}
|
}
|
||||||
else if(attributeName.compare(L"spawnZ") == 0)
|
else if(attributeName.compare(L"spawnZ") == 0)
|
||||||
{
|
{
|
||||||
if(m_spawnPos == NULL) m_spawnPos = new Pos();
|
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||||
int value = _fromString<int>(attributeValue);
|
int value = _fromString<int>(attributeValue);
|
||||||
m_spawnPos->z = value;
|
m_spawnPos->z = value;
|
||||||
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",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;
|
double z = player->z;
|
||||||
float yRot = player->yRot;
|
float yRot = player->yRot;
|
||||||
float xRot = player->xRot;
|
float xRot = player->xRot;
|
||||||
if(m_spawnPos != NULL)
|
if(m_spawnPos != nullptr)
|
||||||
{
|
{
|
||||||
x = m_spawnPos->x;
|
x = m_spawnPos->x;
|
||||||
y = m_spawnPos->y;
|
y = m_spawnPos->y;
|
||||||
|
|
@ -160,7 +160,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||||
yRot = m_yRot;
|
yRot = m_yRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
if(m_spawnPos != nullptr || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
||||||
|
|
||||||
for(auto& addItem : m_items)
|
for(auto& addItem : m_items)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *>
|
||||||
|
|
||||||
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||||
{
|
{
|
||||||
GameRuleDefinition *rule = NULL;
|
GameRuleDefinition *rule = nullptr;
|
||||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
||||||
{
|
{
|
||||||
rule = new AddItemRuleDefinition();
|
rule = new AddItemRuleDefinition();
|
||||||
|
|
@ -70,7 +70,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
||||||
|
|
||||||
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
||||||
{
|
{
|
||||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
|
if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
|
||||||
{
|
{
|
||||||
// Remove the current tile entity
|
// Remove the current tile entity
|
||||||
level->removeTileEntity( worldX, worldY, worldZ );
|
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 ));
|
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);
|
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
||||||
if ( container != NULL )
|
if ( container != nullptr )
|
||||||
{
|
{
|
||||||
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
|
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
|
||||||
// Add items
|
// Add items
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
|
||||||
|
|
||||||
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
||||||
{
|
{
|
||||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
|
if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
|
||||||
{
|
{
|
||||||
// Remove the current tile entity
|
// Remove the current tile entity
|
||||||
level->removeTileEntity( worldX, worldY, worldZ );
|
level->removeTileEntity( worldX, worldY, worldZ );
|
||||||
|
|
@ -59,7 +59,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
|
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
|
||||||
#endif
|
#endif
|
||||||
if( entity != NULL )
|
if( entity != nullptr )
|
||||||
{
|
{
|
||||||
entity->setEntityId(m_entityId);
|
entity->setEntityId(m_entityId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ LeaderboardInterface::LeaderboardInterface(LeaderboardManager *man)
|
||||||
m_pending = false;
|
m_pending = false;
|
||||||
|
|
||||||
m_filter = static_cast<LeaderboardManager::EFilterMode>(-1);
|
m_filter = static_cast<LeaderboardManager::EFilterMode>(-1);
|
||||||
m_callback = NULL;
|
m_callback = nullptr;
|
||||||
m_difficulty = 0;
|
m_difficulty = 0;
|
||||||
m_type = LeaderboardManager::eStatsType_UNDEFINED;
|
m_type = LeaderboardManager::eStatsType_UNDEFINED;
|
||||||
m_startIndex = 0;
|
m_startIndex = 0;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] =
|
||||||
void LeaderboardManager::DeleteInstance()
|
void LeaderboardManager::DeleteInstance()
|
||||||
{
|
{
|
||||||
delete m_instance;
|
delete m_instance;
|
||||||
m_instance = NULL;
|
m_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaderboardManager::LeaderboardManager()
|
LeaderboardManager::LeaderboardManager()
|
||||||
|
|
@ -26,7 +26,7 @@ void LeaderboardManager::zeroReadParameters()
|
||||||
{
|
{
|
||||||
m_difficulty = -1;
|
m_difficulty = -1;
|
||||||
m_statsType = eStatsType_UNDEFINED;
|
m_statsType = eStatsType_UNDEFINED;
|
||||||
m_readListener = NULL;
|
m_readListener = nullptr;
|
||||||
m_startIndex = 0;
|
m_startIndex = 0;
|
||||||
m_readCount = 0;
|
m_readCount = 0;
|
||||||
m_eFilterMode = eFM_UNDEFINED;
|
m_eFilterMode = eFM_UNDEFINED;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ SonyLeaderboardManager::SonyLeaderboardManager()
|
||||||
|
|
||||||
m_myXUID = INVALID_XUID;
|
m_myXUID = INVALID_XUID;
|
||||||
|
|
||||||
m_scores = NULL;
|
m_scores = nullptr;
|
||||||
|
|
||||||
m_statsType = eStatsType_Kills;
|
m_statsType = eStatsType_Kills;
|
||||||
m_difficulty = 0;
|
m_difficulty = 0;
|
||||||
|
|
@ -47,7 +47,7 @@ SonyLeaderboardManager::SonyLeaderboardManager()
|
||||||
InitializeCriticalSection(&m_csViewsLock);
|
InitializeCriticalSection(&m_csViewsLock);
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
m_threadScoreboard = NULL;
|
m_threadScoreboard = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SonyLeaderboardManager::~SonyLeaderboardManager()
|
SonyLeaderboardManager::~SonyLeaderboardManager()
|
||||||
|
|
@ -288,7 +288,7 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||||
SonyRtcTick last_sort_date;
|
SonyRtcTick last_sort_date;
|
||||||
SceNpScoreRankNumber mTotalRecord;
|
SceNpScoreRankNumber mTotalRecord;
|
||||||
|
|
||||||
SceNpId *npIds = NULL;
|
SceNpId *npIds = nullptr;
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
uint32_t num = 0;
|
uint32_t num = 0;
|
||||||
|
|
@ -322,7 +322,7 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||||
ZeroMemory(comments, sizeof(SceNpScoreComment) * num);
|
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,\
|
/* 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 NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n",
|
rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n",
|
||||||
transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId),
|
transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId),
|
||||||
rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount
|
rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount
|
||||||
); */
|
); */
|
||||||
|
|
@ -342,9 +342,9 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||||
|
|
||||||
destroyTransactionContext(ret);
|
destroyTransactionContext(ret);
|
||||||
|
|
||||||
if (npIds != NULL) delete [] npIds;
|
if (npIds != nullptr) delete [] npIds;
|
||||||
if (ptr != NULL) delete [] ptr;
|
if (ptr != nullptr) delete [] ptr;
|
||||||
if (comments != NULL) delete [] comments;
|
if (comments != nullptr) delete [] comments;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -355,9 +355,9 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||||
|
|
||||||
m_eStatsState = eStatsState_Failed;
|
m_eStatsState = eStatsState_Failed;
|
||||||
|
|
||||||
if (npIds != NULL) delete [] npIds;
|
if (npIds != nullptr) delete [] npIds;
|
||||||
if (ptr != NULL) delete [] ptr;
|
if (ptr != nullptr) delete [] ptr;
|
||||||
if (comments != NULL) delete [] comments;
|
if (comments != nullptr) delete [] comments;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -387,14 +387,14 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||||
comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments
|
comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NULL, 0, // GameData. (unused)
|
nullptr, 0, // GameData. (unused)
|
||||||
|
|
||||||
tmpNum,
|
tmpNum,
|
||||||
|
|
||||||
&last_sort_date,
|
&last_sort_date,
|
||||||
&mTotalRecord,
|
&mTotalRecord,
|
||||||
|
|
||||||
NULL // Reserved, specify null.
|
nullptr // Reserved, specify null.
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
|
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
|
||||||
|
|
@ -425,7 +425,7 @@ bool SonyLeaderboardManager::getScoreByIds()
|
||||||
m_readCount = num;
|
m_readCount = num;
|
||||||
|
|
||||||
// Filter scorers and construct output structure.
|
// Filter scorers and construct output structure.
|
||||||
if (m_scores != NULL) delete [] m_scores;
|
if (m_scores != nullptr) delete [] m_scores;
|
||||||
m_scores = new ReadScore[m_readCount];
|
m_scores = new ReadScore[m_readCount];
|
||||||
convertToOutput(m_readCount, m_scores, ptr, comments);
|
convertToOutput(m_readCount, m_scores, ptr, comments);
|
||||||
m_maxRank = m_readCount;
|
m_maxRank = m_readCount;
|
||||||
|
|
@ -458,7 +458,7 @@ error3:
|
||||||
delete [] ptr;
|
delete [] ptr;
|
||||||
delete [] comments;
|
delete [] comments;
|
||||||
error2:
|
error2:
|
||||||
if (npIds != NULL) delete [] npIds;
|
if (npIds != nullptr) delete [] npIds;
|
||||||
error1:
|
error1:
|
||||||
if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
|
if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed;
|
||||||
app.DebugPrintf("[SonyLeaderboardManager] getScoreByIds() FAILED, ret=0x%X\n", ret);
|
app.DebugPrintf("[SonyLeaderboardManager] getScoreByIds() FAILED, ret=0x%X\n", ret);
|
||||||
|
|
@ -511,14 +511,14 @@ bool SonyLeaderboardManager::getScoreByRange()
|
||||||
|
|
||||||
comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data
|
comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data
|
||||||
|
|
||||||
NULL, 0, // GameData.
|
nullptr, 0, // GameData.
|
||||||
|
|
||||||
num,
|
num,
|
||||||
|
|
||||||
&last_sort_date,
|
&last_sort_date,
|
||||||
&m_maxRank, // 'Total number of players registered in the target scoreboard.'
|
&m_maxRank, // 'Total number of players registered in the target scoreboard.'
|
||||||
|
|
||||||
NULL // Reserved, specify null.
|
nullptr // Reserved, specify null.
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
|
if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED)
|
||||||
|
|
@ -539,7 +539,7 @@ bool SonyLeaderboardManager::getScoreByRange()
|
||||||
delete [] ptr;
|
delete [] ptr;
|
||||||
delete [] comments;
|
delete [] comments;
|
||||||
|
|
||||||
m_scores = NULL;
|
m_scores = nullptr;
|
||||||
m_readCount = 0;
|
m_readCount = 0;
|
||||||
|
|
||||||
m_eStatsState = eStatsState_Ready;
|
m_eStatsState = eStatsState_Ready;
|
||||||
|
|
@ -557,7 +557,7 @@ bool SonyLeaderboardManager::getScoreByRange()
|
||||||
|
|
||||||
//m_stats = ptr; //Maybe: addPadding(num,ptr);
|
//m_stats = ptr; //Maybe: addPadding(num,ptr);
|
||||||
|
|
||||||
if (m_scores != NULL) delete [] m_scores;
|
if (m_scores != nullptr) delete [] m_scores;
|
||||||
m_readCount = ret;
|
m_readCount = ret;
|
||||||
m_scores = new ReadScore[m_readCount];
|
m_scores = new ReadScore[m_readCount];
|
||||||
for (int i=0; i<m_readCount; i++)
|
for (int i=0; i<m_readCount; i++)
|
||||||
|
|
@ -642,15 +642,15 @@ bool SonyLeaderboardManager::setScore()
|
||||||
rscore.m_score, //IN: new score,
|
rscore.m_score, //IN: new score,
|
||||||
|
|
||||||
&comment, // Comments
|
&comment, // Comments
|
||||||
NULL, // GameInfo
|
nullptr, // GameInfo
|
||||||
|
|
||||||
&tmp, //OUT: current rank,
|
&tmp, //OUT: current rank,
|
||||||
|
|
||||||
#ifndef __PS3__
|
#ifndef __PS3__
|
||||||
NULL, //compareDate
|
nullptr, //compareDate
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NULL // Reserved, specify null.
|
nullptr // Reserved, specify null.
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret==SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) //0x8002A415
|
if (ret==SCE_NP_COMMUNITY_SERVER_ERROR_NOT_BEST_SCORE) //0x8002A415
|
||||||
|
|
@ -695,7 +695,7 @@ void SonyLeaderboardManager::Tick()
|
||||||
{
|
{
|
||||||
case eStatsState_Ready:
|
case eStatsState_Ready:
|
||||||
{
|
{
|
||||||
assert(m_scores != NULL || m_readCount == 0);
|
assert(m_scores != nullptr || m_readCount == 0);
|
||||||
|
|
||||||
view.m_numQueries = m_readCount;
|
view.m_numQueries = m_readCount;
|
||||||
view.m_queries = m_scores;
|
view.m_queries = m_scores;
|
||||||
|
|
@ -707,7 +707,7 @@ void SonyLeaderboardManager::Tick()
|
||||||
if (view.m_numQueries > 0)
|
if (view.m_numQueries > 0)
|
||||||
ret = eStatsReturn_Success;
|
ret = eStatsReturn_Success;
|
||||||
|
|
||||||
if (m_readListener != NULL)
|
if (m_readListener != nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount);
|
app.DebugPrintf("[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount);
|
||||||
m_readListener->OnStatsReadComplete(ret, m_maxRank, view);
|
m_readListener->OnStatsReadComplete(ret, m_maxRank, view);
|
||||||
|
|
@ -716,16 +716,16 @@ void SonyLeaderboardManager::Tick()
|
||||||
m_eStatsState = eStatsState_Idle;
|
m_eStatsState = eStatsState_Idle;
|
||||||
|
|
||||||
delete [] m_scores;
|
delete [] m_scores;
|
||||||
m_scores = NULL;
|
m_scores = nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eStatsState_Failed:
|
case eStatsState_Failed:
|
||||||
{
|
{
|
||||||
view.m_numQueries = 0;
|
view.m_numQueries = 0;
|
||||||
view.m_queries = NULL;
|
view.m_queries = nullptr;
|
||||||
|
|
||||||
if ( m_readListener != NULL )
|
if ( m_readListener != nullptr )
|
||||||
m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view);
|
m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view);
|
||||||
|
|
||||||
m_eStatsState = eStatsState_Idle;
|
m_eStatsState = eStatsState_Idle;
|
||||||
|
|
@ -747,7 +747,7 @@ bool SonyLeaderboardManager::OpenSession()
|
||||||
{
|
{
|
||||||
if (m_openSessions == 0)
|
if (m_openSessions == 0)
|
||||||
{
|
{
|
||||||
if (m_threadScoreboard == NULL)
|
if (m_threadScoreboard == nullptr)
|
||||||
{
|
{
|
||||||
m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
|
m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard");
|
||||||
m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
|
m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS);
|
||||||
|
|
@ -837,7 +837,7 @@ void SonyLeaderboardManager::FlushStats() {}
|
||||||
|
|
||||||
void SonyLeaderboardManager::CancelOperation()
|
void SonyLeaderboardManager::CancelOperation()
|
||||||
{
|
{
|
||||||
m_readListener = NULL;
|
m_readListener = nullptr;
|
||||||
m_eStatsState = eStatsState_Canceled;
|
m_eStatsState = eStatsState_Canceled;
|
||||||
|
|
||||||
if (m_requestId != 0)
|
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++)
|
for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++)
|
||||||
{
|
{
|
||||||
ch[0] = getComment(in)[i];
|
ch[0] = getComment(in)[i];
|
||||||
unsigned char fivebits = strtol(ch, NULL, 32) << 3;
|
unsigned char fivebits = strtol(ch, nullptr, 32) << 3;
|
||||||
|
|
||||||
int sByte = (i*5) / 8;
|
int sByte = (i*5) / 8;
|
||||||
int eByte = (5+(i*5)) / 8;
|
int eByte = (5+(i*5)) / 8;
|
||||||
|
|
@ -1041,7 +1041,7 @@ bool SonyLeaderboardManager::test_string(string testing)
|
||||||
int ctx = createTransactionContext(m_titleContext);
|
int ctx = createTransactionContext(m_titleContext);
|
||||||
if (ctx<0) return false;
|
if (ctx<0) return false;
|
||||||
|
|
||||||
int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL);
|
int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, nullptr);
|
||||||
|
|
||||||
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED)
|
if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ CGameNetworkManager::CGameNetworkManager()
|
||||||
m_bFullSessionMessageOnNextSessionChange = false;
|
m_bFullSessionMessageOnNextSessionChange = false;
|
||||||
|
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
m_pUpsell = NULL;
|
m_pUpsell = nullptr;
|
||||||
m_pInviteInfo = NULL;
|
m_pInviteInfo = nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,26 +120,26 @@ void CGameNetworkManager::DoWork()
|
||||||
s_pPlatformNetworkManager->DoWork();
|
s_pPlatformNetworkManager->DoWork();
|
||||||
|
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
if (m_pUpsell != NULL && m_pUpsell->hasResponse())
|
if (m_pUpsell != nullptr && m_pUpsell->hasResponse())
|
||||||
{
|
{
|
||||||
int iPad_invited = m_iPlayerInvited, iPad_checking = m_pUpsell->m_userIndex;
|
int iPad_invited = m_iPlayerInvited, iPad_checking = m_pUpsell->m_userIndex;
|
||||||
|
|
||||||
m_iPlayerInvited = -1;
|
m_iPlayerInvited = -1;
|
||||||
|
|
||||||
delete m_pUpsell;
|
delete m_pUpsell;
|
||||||
m_pUpsell = NULL;
|
m_pUpsell = nullptr;
|
||||||
|
|
||||||
if (ProfileManager.HasPlayStationPlus(iPad_checking))
|
if (ProfileManager.HasPlayStationPlus(iPad_checking))
|
||||||
{
|
{
|
||||||
this->GameInviteReceived(iPad_invited, m_pInviteInfo);
|
this->GameInviteReceived(iPad_invited, m_pInviteInfo);
|
||||||
|
|
||||||
// m_pInviteInfo deleted by GameInviteReceived.
|
// m_pInviteInfo deleted by GameInviteReceived.
|
||||||
m_pInviteInfo = NULL;
|
m_pInviteInfo = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete m_pInviteInfo;
|
delete m_pInviteInfo;
|
||||||
m_pInviteInfo = NULL;
|
m_pInviteInfo = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -195,15 +195,15 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__int64 seed = 0;
|
__int64 seed = 0;
|
||||||
if(lpParameter != NULL)
|
if(lpParameter != nullptr)
|
||||||
{
|
{
|
||||||
NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter);
|
NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter);
|
||||||
seed = param->seed;
|
seed = param->seed;
|
||||||
|
|
||||||
app.setLevelGenerationOptions(param->levelGen);
|
app.setLevelGenerationOptions(param->levelGen);
|
||||||
if(param->levelGen != NULL)
|
if(param->levelGen != nullptr)
|
||||||
{
|
{
|
||||||
if(app.getLevelGenerationOptions() == NULL)
|
if(app.getLevelGenerationOptions() == nullptr)
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Game rule was not loaded, and seed is required. Exiting.\n");
|
app.DebugPrintf("Game rule was not loaded, and seed is required. Exiting.\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -248,10 +248,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
pchFilename, // file name
|
pchFilename, // file name
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
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
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
const char *pchFilename=wstringtofilename(grf.getPath());
|
const char *pchFilename=wstringtofilename(grf.getPath());
|
||||||
|
|
@ -259,18 +259,18 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
pchFilename, // file name
|
pchFilename, // file name
|
||||||
GENERIC_READ, // access mode
|
GENERIC_READ, // access mode
|
||||||
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
|
||||||
NULL, // Unused
|
nullptr, // Unused
|
||||||
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
|
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
|
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
|
||||||
NULL // Unsupported
|
nullptr // Unsupported
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( fileHandle != INVALID_HANDLE_VALUE )
|
if( fileHandle != INVALID_HANDLE_VALUE )
|
||||||
{
|
{
|
||||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL);
|
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr);
|
||||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||||
if(bSuccess==FALSE)
|
if(bSuccess==FALSE)
|
||||||
{
|
{
|
||||||
app.FatalLoadError();
|
app.FatalLoadError();
|
||||||
|
|
@ -312,7 +312,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Socket::Initialise(NULL);
|
Socket::Initialise(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
|
|
@ -358,27 +358,27 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
|
|
||||||
if( g_NetworkManager.IsHost() )
|
if( g_NetworkManager.IsHost() )
|
||||||
{
|
{
|
||||||
connection = new ClientConnection(minecraft, NULL);
|
connection = new ClientConnection(minecraft, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(ProfileManager.GetLockedProfile());
|
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(ProfileManager.GetLockedProfile());
|
||||||
if(pNetworkPlayer == NULL)
|
if(pNetworkPlayer == nullptr)
|
||||||
{
|
{
|
||||||
MinecraftServer::HaltServer();
|
MinecraftServer::HaltServer();
|
||||||
app.DebugPrintf("%d\n",ProfileManager.GetLockedProfile());
|
app.DebugPrintf("%d\n",ProfileManager.GetLockedProfile());
|
||||||
// If the player is NULL here then something went wrong in the session setup, and continuing will end up in a crash
|
// If the player is nullptr here then something went wrong in the session setup, and continuing will end up in a crash
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Socket *socket = pNetworkPlayer->GetSocket();
|
Socket *socket = pNetworkPlayer->GetSocket();
|
||||||
|
|
||||||
// Fix for #13259 - CRASH: Gameplay: loading process is halted when player loads saved data
|
// Fix for #13259 - CRASH: Gameplay: loading process is halted when player loads saved data
|
||||||
if(socket == NULL)
|
if(socket == nullptr)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
MinecraftServer::HaltServer();
|
MinecraftServer::HaltServer();
|
||||||
// If the socket is NULL here then something went wrong in the session setup, and continuing will end up in a crash
|
// If the socket is nullptr here then something went wrong in the session setup, and continuing will end up in a crash
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -389,7 +389,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
delete connection;
|
delete connection;
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
MinecraftServer::HaltServer();
|
MinecraftServer::HaltServer();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -453,7 +453,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
||||||
// Already have setup the primary pad
|
// Already have setup the primary pad
|
||||||
if(idx == ProfileManager.GetPrimaryPad() ) continue;
|
if(idx == ProfileManager.GetPrimaryPad() ) continue;
|
||||||
|
|
||||||
if( GetLocalPlayerByUserIndex(idx) != NULL && !ProfileManager.IsSignedIn(idx) )
|
if( GetLocalPlayerByUserIndex(idx) != nullptr && !ProfileManager.IsSignedIn(idx) )
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
||||||
Socket *socket = pNetworkPlayer->GetSocket();
|
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
|
// 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
|
// 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);
|
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
|
||||||
if( pNetworkPlayer == NULL )
|
if( pNetworkPlayer == nullptr )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ClientConnection *connection;
|
ClientConnection *connection;
|
||||||
|
|
@ -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
|
// Check if user-created content is allowed, as we cannot play multiplayer if it's not
|
||||||
bool noUGC = false;
|
bool noUGC = false;
|
||||||
#if defined(__PS3__) || defined(__PSVITA__)
|
#if defined(__PS3__) || defined(__PSVITA__)
|
||||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL);
|
ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,nullptr,nullptr);
|
||||||
#elif defined(__ORBIS__)
|
#elif defined(__ORBIS__)
|
||||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL);
|
ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&noUGC,nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(noUGC)
|
if(noUGC)
|
||||||
|
|
@ -823,7 +823,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||||
{
|
{
|
||||||
#if defined(__ORBIS__) || defined(__PSVITA__)
|
#if defined(__ORBIS__) || defined(__PSVITA__)
|
||||||
bool chatRestricted = false;
|
bool chatRestricted = false;
|
||||||
ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,NULL,NULL);
|
ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,nullptr,nullptr);
|
||||||
if(chatRestricted)
|
if(chatRestricted)
|
||||||
{
|
{
|
||||||
ProfileManager.DisplaySystemMessage( 0, ProfileManager.GetPrimaryPad() );
|
ProfileManager.DisplaySystemMessage( 0, ProfileManager.GetPrimaryPad() );
|
||||||
|
|
@ -912,7 +912,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||||
app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
||||||
}
|
}
|
||||||
// If we failed before the server started, clear the game rules. Otherwise the server will clear it up.
|
// If we failed before the server started, clear the game rules. Otherwise the server will clear it up.
|
||||||
if(MinecraftServer::getInstance() == NULL) app.m_gameRules.unloadCurrentGameRules();
|
if(MinecraftServer::getInstance() == nullptr) app.m_gameRules.unloadCurrentGameRules();
|
||||||
Tile::ReleaseThreadStorage();
|
Tile::ReleaseThreadStorage();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -930,14 +930,14 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||||
int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||||
{
|
{
|
||||||
__int64 seed = 0;
|
__int64 seed = 0;
|
||||||
if(lpParameter != NULL)
|
if(lpParameter != nullptr)
|
||||||
{
|
{
|
||||||
NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter);
|
NetworkGameInitData *param = static_cast<NetworkGameInitData *>(lpParameter);
|
||||||
seed = param->seed;
|
seed = param->seed;
|
||||||
app.SetGameHostOption(eGameHostOption_All,param->settings);
|
app.SetGameHostOption(eGameHostOption_All,param->settings);
|
||||||
|
|
||||||
// 4J Stu - If we are loading a DLC save that's separate from the texture pack, load
|
// 4J Stu - If we are loading a DLC save that's separate from the texture pack, load
|
||||||
if( param->levelGen != NULL && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) )
|
if( param->levelGen != nullptr && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) )
|
||||||
{
|
{
|
||||||
while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()))
|
while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()))
|
||||||
{
|
{
|
||||||
|
|
@ -966,7 +966,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||||
IntCache::ReleaseThreadStorage();
|
IntCache::ReleaseThreadStorage();
|
||||||
Level::destroyLightingCache();
|
Level::destroyLightingCache();
|
||||||
|
|
||||||
if(lpParameter != NULL) delete lpParameter;
|
if(lpParameter != nullptr) delete lpParameter;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -979,7 +979,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
||||||
Compression::UseDefaultThreadStorage();
|
Compression::UseDefaultThreadStorage();
|
||||||
|
|
||||||
//app.SetGameStarted(false);
|
//app.SetGameStarted(false);
|
||||||
UIScene_PauseMenu::_ExitWorld(NULL);
|
UIScene_PauseMenu::_ExitWorld(nullptr);
|
||||||
|
|
||||||
while( g_NetworkManager.IsInSession() )
|
while( g_NetworkManager.IsInSession() )
|
||||||
{
|
{
|
||||||
|
|
@ -1216,14 +1216,14 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
#endif
|
#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
|
// 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 != NULL )
|
if( pServer != nullptr )
|
||||||
{
|
{
|
||||||
PlayerList *players = pServer->getPlayers();
|
PlayerList *players = pServer->getPlayers();
|
||||||
for(auto& servPlayer : players->players)
|
for(auto& servPlayer : players->players)
|
||||||
{
|
{
|
||||||
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
||||||
{
|
{
|
||||||
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
|
servPlayer->connection->connection->getSocket()->setPlayer(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1259,7 +1259,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
char numLocalPlayers = 0;
|
char numLocalPlayers = 0;
|
||||||
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
|
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL )
|
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr )
|
||||||
{
|
{
|
||||||
numLocalPlayers++;
|
numLocalPlayers++;
|
||||||
localUsersMask |= GetLocalPlayerMask(index);
|
localUsersMask |= GetLocalPlayerMask(index);
|
||||||
|
|
@ -1277,11 +1277,11 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the network player of all the server players that are local
|
// Restore the network player of all the server players that are local
|
||||||
if( pServer != NULL )
|
if( pServer != nullptr )
|
||||||
{
|
{
|
||||||
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
|
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
|
||||||
{
|
{
|
||||||
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL )
|
if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr )
|
||||||
{
|
{
|
||||||
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
|
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
|
||||||
|
|
||||||
|
|
@ -1295,7 +1295,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player might have a pending connection
|
// Player might have a pending connection
|
||||||
if (pMinecraft->m_pendingLocalConnections[index] != NULL)
|
if (pMinecraft->m_pendingLocalConnections[index] != nullptr)
|
||||||
{
|
{
|
||||||
// Update the network player
|
// Update the network player
|
||||||
pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index));
|
pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index));
|
||||||
|
|
@ -1361,8 +1361,8 @@ void CGameNetworkManager::renderQueueMeter()
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
int height = 720;
|
int height = 720;
|
||||||
|
|
||||||
CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(NULL, false);
|
CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(nullptr, false);
|
||||||
CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(NULL, false);
|
CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(nullptr, false);
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
pMinecraft->gui->renderGraph(CGameNetworkManager::messageQueue_length, CGameNetworkManager::messageQueuePos, CGameNetworkManager::messageQueue, 10, 1000, CGameNetworkManager::byteQueue, 100, 25000);
|
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();
|
LoadingInputParams *loadingParams = new LoadingInputParams();
|
||||||
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
|
||||||
loadingParams->lpParam = NULL;
|
loadingParams->lpParam = nullptr;
|
||||||
|
|
||||||
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
|
||||||
completionData->bShowBackground=TRUE;
|
completionData->bShowBackground=TRUE;
|
||||||
|
|
@ -1447,7 +1447,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying)
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i);
|
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i);
|
||||||
if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) )
|
if(pNetworkPlayer != nullptr && ProfileManager.IsSignedIn( i ) )
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i );
|
app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i );
|
||||||
Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex());
|
Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex());
|
||||||
|
|
@ -1482,12 +1482,12 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
Socket *socket = NULL;
|
Socket *socket = nullptr;
|
||||||
shared_ptr<MultiplayerLocalPlayer> mpPlayer = nullptr;
|
shared_ptr<MultiplayerLocalPlayer> mpPlayer = nullptr;
|
||||||
int userIdx = pNetworkPlayer->GetUserIndex();
|
int userIdx = pNetworkPlayer->GetUserIndex();
|
||||||
if (userIdx >= 0 && userIdx < XUSER_MAX_COUNT)
|
if (userIdx >= 0 && userIdx < XUSER_MAX_COUNT)
|
||||||
mpPlayer = pMinecraft->localplayers[userIdx];
|
mpPlayer = pMinecraft->localplayers[userIdx];
|
||||||
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
|
if( localPlayer && mpPlayer != nullptr && mpPlayer->connection != nullptr)
|
||||||
{
|
{
|
||||||
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change
|
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change
|
||||||
socket = mpPlayer->connection->getSocket();
|
socket = mpPlayer->connection->getSocket();
|
||||||
|
|
@ -1530,7 +1530,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||||
{
|
{
|
||||||
pMinecraft->connectionDisconnected( idx , DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
pMinecraft->connectionDisconnected( idx , DisconnectPacket::eDisconnect_ConnectionCreationFailed );
|
||||||
delete connection;
|
delete connection;
|
||||||
connection = NULL;
|
connection = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1540,10 +1540,10 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
||||||
void CGameNetworkManager::CloseConnection( INetworkPlayer *pNetworkPlayer )
|
void CGameNetworkManager::CloseConnection( INetworkPlayer *pNetworkPlayer )
|
||||||
{
|
{
|
||||||
MinecraftServer *server = MinecraftServer::getInstance();
|
MinecraftServer *server = MinecraftServer::getInstance();
|
||||||
if( server != NULL )
|
if( server != nullptr )
|
||||||
{
|
{
|
||||||
PlayerList *players = server->getPlayers();
|
PlayerList *players = server->getPlayers();
|
||||||
if( players != NULL )
|
if( players != nullptr )
|
||||||
{
|
{
|
||||||
players->closePlayerConnectionBySmallId(pNetworkPlayer->GetSmallId());
|
players->closePlayerConnectionBySmallId(pNetworkPlayer->GetSmallId());
|
||||||
}
|
}
|
||||||
|
|
@ -1559,7 +1559,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
||||||
for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad)
|
for (int iPad=0; iPad<XUSER_MAX_COUNT; ++iPad)
|
||||||
{
|
{
|
||||||
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPad);
|
||||||
if (pNetworkPlayer == NULL) continue;
|
if (pNetworkPlayer == nullptr) continue;
|
||||||
|
|
||||||
app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK);
|
app.SetRichPresenceContext(iPad,CONTEXT_GAME_STATE_BLANK);
|
||||||
if (multiplayer)
|
if (multiplayer)
|
||||||
|
|
@ -1586,7 +1586,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer )
|
||||||
{
|
{
|
||||||
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
if(Minecraft::GetInstance()->localplayers[idx] != nullptr)
|
||||||
{
|
{
|
||||||
TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
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)
|
for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(Minecraft::GetInstance()->localplayers[idx] != NULL)
|
if(Minecraft::GetInstance()->localplayers[idx] != nullptr)
|
||||||
{
|
{
|
||||||
TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
|
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)
|
void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *pInviteInfo)
|
||||||
{
|
{
|
||||||
#ifdef __ORBIS__
|
#ifdef __ORBIS__
|
||||||
if (m_pUpsell != NULL)
|
if (m_pUpsell != nullptr)
|
||||||
{
|
{
|
||||||
delete pInviteInfo;
|
delete pInviteInfo;
|
||||||
return;
|
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-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
|
// 4J Stu - If we are not in a game, then bring in all players signed in
|
||||||
if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
|
if(index==userIndex || pMinecraft->localplayers[index]!=nullptr )
|
||||||
{
|
{
|
||||||
++joiningUsers;
|
++joiningUsers;
|
||||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||||
|
|
@ -1736,7 +1736,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
BOOL pccAllowed = TRUE;
|
BOOL pccAllowed = TRUE;
|
||||||
BOOL pccFriendsAllowed = TRUE;
|
BOOL pccFriendsAllowed = TRUE;
|
||||||
#if defined(__PS3__) || defined(__PSVITA__)
|
#if defined(__PS3__) || defined(__PSVITA__)
|
||||||
ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL);
|
ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,nullptr);
|
||||||
#else
|
#else
|
||||||
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
|
||||||
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
|
||||||
|
|
@ -1781,14 +1781,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||||
uiIDA[0]=IDS_CONFIRM_OK;
|
uiIDA[0]=IDS_CONFIRM_OK;
|
||||||
|
|
||||||
// 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard
|
// 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(),NULL,NULL, app.GetStringTable());
|
//StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
|
||||||
ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,XUSER_INDEX_ANY);
|
ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,XUSER_INDEX_ANY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(__ORBIS__) || defined(__PSVITA__)
|
#if defined(__ORBIS__) || defined(__PSVITA__)
|
||||||
bool chatRestricted = false;
|
bool chatRestricted = false;
|
||||||
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL);
|
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr);
|
||||||
if(chatRestricted)
|
if(chatRestricted)
|
||||||
{
|
{
|
||||||
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() );
|
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)
|
void CGameNetworkManager::ServerReadyCreate(bool create)
|
||||||
{
|
{
|
||||||
m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : NULL );
|
m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerReady()
|
void CGameNetworkManager::ServerReady()
|
||||||
|
|
@ -2000,17 +2000,17 @@ void CGameNetworkManager::ServerReadyWait()
|
||||||
void CGameNetworkManager::ServerReadyDestroy()
|
void CGameNetworkManager::ServerReadyDestroy()
|
||||||
{
|
{
|
||||||
delete m_hServerReadyEvent;
|
delete m_hServerReadyEvent;
|
||||||
m_hServerReadyEvent = NULL;
|
m_hServerReadyEvent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameNetworkManager::ServerReadyValid()
|
bool CGameNetworkManager::ServerReadyValid()
|
||||||
{
|
{
|
||||||
return ( m_hServerReadyEvent != NULL );
|
return ( m_hServerReadyEvent != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerStoppedCreate(bool create)
|
void CGameNetworkManager::ServerStoppedCreate(bool create)
|
||||||
{
|
{
|
||||||
m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : NULL );
|
m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameNetworkManager::ServerStopped()
|
void CGameNetworkManager::ServerStopped()
|
||||||
|
|
@ -2051,12 +2051,12 @@ void CGameNetworkManager::ServerStoppedWait()
|
||||||
void CGameNetworkManager::ServerStoppedDestroy()
|
void CGameNetworkManager::ServerStoppedDestroy()
|
||||||
{
|
{
|
||||||
delete m_hServerStoppedEvent;
|
delete m_hServerStoppedEvent;
|
||||||
m_hServerStoppedEvent = NULL;
|
m_hServerStoppedEvent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameNetworkManager::ServerStoppedValid()
|
bool CGameNetworkManager::ServerStoppedValid()
|
||||||
{
|
{
|
||||||
return ( m_hServerStoppedEvent != NULL );
|
return ( m_hServerStoppedEvent != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameNetworkManager::GetJoiningReadyPercentage()
|
int CGameNetworkManager::GetJoiningReadyPercentage()
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ public:
|
||||||
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
|
static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface
|
||||||
bool LeaveGame(bool bMigrateHost);
|
bool LeaveGame(bool bMigrateHost);
|
||||||
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
|
static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||||
void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr);
|
||||||
void SendInviteGUI(int iPad);
|
void SendInviteGUI(int iPad);
|
||||||
void ResetLeavingGame();
|
void ResetLeavingGame();
|
||||||
|
|
||||||
|
|
@ -137,17 +137,17 @@ public:
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
void ServerReadyCreate(bool create); // Create the signal (or set to NULL)
|
void ServerReadyCreate(bool create); // Create the signal (or set to nullptr)
|
||||||
void ServerReady(); // Signal that we are ready
|
void ServerReady(); // Signal that we are ready
|
||||||
void ServerReadyWait(); // Wait for the signal
|
void ServerReadyWait(); // Wait for the signal
|
||||||
void ServerReadyDestroy(); // Destroy signal
|
void ServerReadyDestroy(); // Destroy signal
|
||||||
bool ServerReadyValid(); // Is non-NULL
|
bool ServerReadyValid(); // Is non-nullptr
|
||||||
|
|
||||||
void ServerStoppedCreate(bool create); // Create the signal
|
void ServerStoppedCreate(bool create); // Create the signal
|
||||||
void ServerStopped(); // Signal that we are ready
|
void ServerStopped(); // Signal that we are ready
|
||||||
void ServerStoppedWait(); // Wait for the signal
|
void ServerStoppedWait(); // Wait for the signal
|
||||||
void ServerStoppedDestroy(); // Destroy signal
|
void ServerStoppedDestroy(); // Destroy signal
|
||||||
bool ServerStoppedValid(); // Is non-NULL
|
bool ServerStoppedValid(); // Is non-nullptr
|
||||||
|
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
static bool usingAdhocMode();
|
static bool usingAdhocMode();
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL) = 0;
|
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0;
|
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != nullptr)
|
||||||
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false );
|
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
|
||||||
int localPlayerCount = 0;
|
int localPlayerCount = 0;
|
||||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount;
|
if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
float appTime = app.getAppTime();
|
float appTime = app.getAppTime();
|
||||||
|
|
@ -125,11 +125,11 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer)
|
||||||
app.DebugPrintf("Player 0x%p \"%ls\" leaving.\n", pQNetPlayer, pQNetPlayer->GetGamertag());
|
app.DebugPrintf("Player 0x%p \"%ls\" leaving.\n", pQNetPlayer, pQNetPlayer->GetGamertag());
|
||||||
|
|
||||||
INetworkPlayer* networkPlayer = getNetworkPlayer(pQNetPlayer);
|
INetworkPlayer* networkPlayer = getNetworkPlayer(pQNetPlayer);
|
||||||
if (networkPlayer == NULL)
|
if (networkPlayer == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Socket* socket = networkPlayer->GetSocket();
|
Socket* socket = networkPlayer->GetSocket();
|
||||||
if (socket != NULL)
|
if (socket != nullptr)
|
||||||
{
|
{
|
||||||
if (m_pIQNet->IsHost())
|
if (m_pIQNet->IsHost())
|
||||||
g_NetworkManager.CloseConnection(networkPlayer);
|
g_NetworkManager.CloseConnection(networkPlayer);
|
||||||
|
|
@ -144,7 +144,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer)
|
||||||
|
|
||||||
for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if (playerChangedCallback[idx] != NULL)
|
if (playerChangedCallback[idx] != nullptr)
|
||||||
playerChangedCallback[idx](playerChangedCallbackParam[idx], networkPlayer, true);
|
playerChangedCallback[idx](playerChangedCallbackParam[idx], networkPlayer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +160,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
g_pPlatformNetworkManager = this;
|
g_pPlatformNetworkManager = this;
|
||||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||||
{
|
{
|
||||||
playerChangedCallback[ i ] = NULL;
|
playerChangedCallback[ i ] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLeavingGame = false;
|
m_bLeavingGame = false;
|
||||||
|
|
@ -171,8 +171,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
m_bSearchPending = false;
|
m_bSearchPending = false;
|
||||||
|
|
||||||
m_bIsOfflineGame = false;
|
m_bIsOfflineGame = false;
|
||||||
m_pSearchParam = NULL;
|
m_pSearchParam = nullptr;
|
||||||
m_SessionsUpdatedCallback = NULL;
|
m_SessionsUpdatedCallback = nullptr;
|
||||||
|
|
||||||
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -180,10 +180,10 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
m_lastSearchStartTime[i] = 0;
|
m_lastSearchStartTime[i] = 0;
|
||||||
|
|
||||||
// The results that will be filled in with the current search
|
// The results that will be filled in with the current search
|
||||||
m_pSearchResults[i] = NULL;
|
m_pSearchResults[i] = nullptr;
|
||||||
m_pQoSResult[i] = NULL;
|
m_pQoSResult[i] = nullptr;
|
||||||
m_pCurrentSearchResults[i] = NULL;
|
m_pCurrentSearchResults[i] = nullptr;
|
||||||
m_pCurrentQoSResult[i] = NULL;
|
m_pCurrentQoSResult[i] = nullptr;
|
||||||
m_currentSearchResultsCount[i] = 0;
|
m_currentSearchResultsCount[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +229,7 @@ void CPlatformNetworkManagerStub::DoWork()
|
||||||
while (WinsockNetLayer::PopDisconnectedSmallId(&disconnectedSmallId))
|
while (WinsockNetLayer::PopDisconnectedSmallId(&disconnectedSmallId))
|
||||||
{
|
{
|
||||||
IQNetPlayer* qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId);
|
IQNetPlayer* qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId);
|
||||||
if (qnetPlayer != NULL && qnetPlayer->m_smallId == disconnectedSmallId)
|
if (qnetPlayer != nullptr && qnetPlayer->m_smallId == disconnectedSmallId)
|
||||||
{
|
{
|
||||||
NotifyPlayerLeaving(qnetPlayer);
|
NotifyPlayerLeaving(qnetPlayer);
|
||||||
qnetPlayer->m_smallId = 0;
|
qnetPlayer->m_smallId = 0;
|
||||||
|
|
@ -366,7 +366,7 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame,
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
int port = WIN64_NET_DEFAULT_PORT;
|
int port = WIN64_NET_DEFAULT_PORT;
|
||||||
const char* bindIp = NULL;
|
const char* bindIp = nullptr;
|
||||||
if (g_Win64DedicatedServer)
|
if (g_Win64DedicatedServer)
|
||||||
{
|
{
|
||||||
if (g_Win64DedicatedServerPort > 0)
|
if (g_Win64DedicatedServerPort > 0)
|
||||||
|
|
@ -399,7 +399,7 @@ bool CPlatformNetworkManagerStub::_StartGame()
|
||||||
int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int localUsersMask, int primaryUserIndex)
|
int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int localUsersMask, int primaryUserIndex)
|
||||||
{
|
{
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
if (searchResult == NULL)
|
if (searchResult == nullptr)
|
||||||
return CGameNetworkManager::JOINGAME_FAIL_GENERAL;
|
return CGameNetworkManager::JOINGAME_FAIL_GENERAL;
|
||||||
|
|
||||||
const char* hostIP = searchResult->data.hostIP;
|
const char* hostIP = searchResult->data.hostIP;
|
||||||
|
|
@ -473,8 +473,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void
|
||||||
{
|
{
|
||||||
if(playerChangedCallbackParam[iPad] == callbackParam)
|
if(playerChangedCallbackParam[iPad] == callbackParam)
|
||||||
{
|
{
|
||||||
playerChangedCallback[iPad] = NULL;
|
playerChangedCallback[iPad] = nullptr;
|
||||||
playerChangedCallbackParam[iPad] = NULL;
|
playerChangedCallbackParam[iPad] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -494,7 +494,7 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
||||||
if (IQNet::m_player[i].m_isRemote)
|
if (IQNet::m_player[i].m_isRemote)
|
||||||
{
|
{
|
||||||
INetworkPlayer* pNetworkPlayer = getNetworkPlayer(&IQNet::m_player[i]);
|
INetworkPlayer* pNetworkPlayer = getNetworkPlayer(&IQNet::m_player[i]);
|
||||||
if (pNetworkPlayer != NULL && pNetworkPlayer->GetSocket() != NULL)
|
if (pNetworkPlayer != nullptr && pNetworkPlayer->GetSocket() != nullptr)
|
||||||
{
|
{
|
||||||
Socket::addIncomingSocket(pNetworkPlayer->GetSocket());
|
Socket::addIncomingSocket(pNetworkPlayer->GetSocket());
|
||||||
}
|
}
|
||||||
|
|
@ -504,14 +504,14 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
|
void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/)
|
||||||
{
|
{
|
||||||
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
// DWORD playerCount = m_pIQNet->GetPlayerCount();
|
||||||
//
|
//
|
||||||
// if( this->m_bLeavingGame )
|
// if( this->m_bLeavingGame )
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// if( GetHostPlayer() == NULL )
|
// if( GetHostPlayer() == nullptr )
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
// for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
|
||||||
|
|
@ -531,13 +531,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// m_hostGameSessionData.players[i] = NULL;
|
// m_hostGameSessionData.players[i] = nullptr;
|
||||||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// m_hostGameSessionData.players[i] = NULL;
|
// m_hostGameSessionData.players[i] = nullptr;
|
||||||
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
// memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
@ -552,14 +552,14 @@ int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpP
|
||||||
|
|
||||||
Socket *socket = pNetworkPlayer->GetSocket();
|
Socket *socket = pNetworkPlayer->GetSocket();
|
||||||
|
|
||||||
if( socket != NULL )
|
if( socket != nullptr )
|
||||||
{
|
{
|
||||||
//printf("Waiting for socket closed event\n");
|
//printf("Waiting for socket closed event\n");
|
||||||
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
||||||
|
|
||||||
//printf("Socket closed event has fired\n");
|
//printf("Socket closed event has fired\n");
|
||||||
// 4J Stu - Clear our reference to this socket
|
// 4J Stu - Clear our reference to this socket
|
||||||
pNetworkPlayer->SetSocket( NULL );
|
pNetworkPlayer->SetSocket( nullptr );
|
||||||
delete socket;
|
delete socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -631,7 +631,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset()
|
||||||
void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index)
|
void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index)
|
||||||
{
|
{
|
||||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return;
|
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return;
|
||||||
if( pNetworkPlayer == NULL ) return;
|
if( pNetworkPlayer == nullptr ) return;
|
||||||
|
|
||||||
for( unsigned int i = 0; i < m_playerFlags.size(); i++ )
|
for( unsigned int i = 0; i < m_playerFlags.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -647,7 +647,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer,
|
||||||
bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index)
|
bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index)
|
||||||
{
|
{
|
||||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false;
|
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false;
|
||||||
if( pNetworkPlayer == NULL )
|
if( pNetworkPlayer == nullptr )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -690,7 +690,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats()
|
||||||
void CPlatformNetworkManagerStub::TickSearch()
|
void CPlatformNetworkManagerStub::TickSearch()
|
||||||
{
|
{
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
if (m_SessionsUpdatedCallback == NULL)
|
if (m_SessionsUpdatedCallback == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static DWORD lastSearchTime = 0;
|
static DWORD lastSearchTime = 0;
|
||||||
|
|
@ -790,7 +790,7 @@ void CPlatformNetworkManagerStub::SearchForGames()
|
||||||
|
|
||||||
m_searchResultsCount[0] = static_cast<int>(friendsSessions[0].size());
|
m_searchResultsCount[0] = static_cast<int>(friendsSessions[0].size());
|
||||||
|
|
||||||
if (m_SessionsUpdatedCallback != NULL)
|
if (m_SessionsUpdatedCallback != nullptr)
|
||||||
m_SessionsUpdatedCallback(m_pSearchParam);
|
m_SessionsUpdatedCallback(m_pSearchParam);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -838,7 +838,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh()
|
||||||
m_searchResultsCount[i] = 0;
|
m_searchResultsCount[i] = 0;
|
||||||
m_lastSearchStartTime[i] = 0;
|
m_lastSearchStartTime[i] = 0;
|
||||||
delete m_pSearchResults[i];
|
delete m_pSearchResults[i];
|
||||||
m_pSearchResults[i] = NULL;
|
m_pSearchResults[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -865,7 +865,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer)
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer)
|
INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer)
|
||||||
{
|
{
|
||||||
return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL;
|
return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ private:
|
||||||
GameSessionData m_hostGameSessionData;
|
GameSessionData m_hostGameSessionData;
|
||||||
CGameNetworkManager *m_pGameNetworkManager;
|
CGameNetworkManager *m_pGameNetworkManager;
|
||||||
public:
|
public:
|
||||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ public:
|
||||||
|
|
||||||
FriendSessionInfo()
|
FriendSessionInfo()
|
||||||
{
|
{
|
||||||
displayLabel = NULL;
|
displayLabel = nullptr;
|
||||||
displayLabelLength = 0;
|
displayLabelLength = 0;
|
||||||
displayLabelViewableStartIndex = 0;
|
displayLabelViewableStartIndex = 0;
|
||||||
hasPartyMember = false;
|
hasPartyMember = false;
|
||||||
|
|
@ -121,7 +121,7 @@ public:
|
||||||
|
|
||||||
~FriendSessionInfo()
|
~FriendSessionInfo()
|
||||||
{
|
{
|
||||||
if (displayLabel != NULL)
|
if (displayLabel != nullptr)
|
||||||
delete displayLabel;
|
delete displayLabel;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer)
|
NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer)
|
||||||
{
|
{
|
||||||
m_sqrPlayer = qnetPlayer;
|
m_sqrPlayer = qnetPlayer;
|
||||||
m_pSocket = NULL;
|
m_pSocket = nullptr;
|
||||||
m_lastChunkPacketTime = 0;
|
m_lastChunkPacketTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro
|
||||||
INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom);
|
INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom);
|
||||||
Socket *socket = pPlayerFrom->GetSocket();
|
Socket *socket = pPlayerFrom->GetSocket();
|
||||||
|
|
||||||
if(socket != NULL)
|
if(socket != nullptr)
|
||||||
socket->pushDataToQueue(data, dataSize, false);
|
socket->pushDataToQueue(data, dataSize, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -132,7 +132,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro
|
||||||
INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo);
|
INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo);
|
||||||
Socket *socket = pPlayerTo->GetSocket();
|
Socket *socket = pPlayerTo->GetSocket();
|
||||||
//app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag());
|
//app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag());
|
||||||
if(socket != NULL)
|
if(socket != nullptr)
|
||||||
socket->pushDataToQueue(data, dataSize);
|
socket->pushDataToQueue(data, dataSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -226,7 +226,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != nullptr)
|
||||||
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false );
|
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
|
||||||
int localPlayerCount = 0;
|
int localPlayerCount = 0;
|
||||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount;
|
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
float appTime = app.getAppTime();
|
float appTime = app.getAppTime();
|
||||||
|
|
@ -258,7 +258,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||||
{
|
{
|
||||||
// Get our wrapper object associated with this player.
|
// Get our wrapper object associated with this player.
|
||||||
Socket *socket = networkPlayer->GetSocket();
|
Socket *socket = networkPlayer->GetSocket();
|
||||||
if( socket != NULL )
|
if( socket != nullptr )
|
||||||
{
|
{
|
||||||
// If we are in game then remove this player from the game as well.
|
// 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,
|
// 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
|
// We need this as long as the game server still needs to communicate with the player
|
||||||
//delete socket;
|
//delete socket;
|
||||||
|
|
||||||
networkPlayer->SetSocket( NULL );
|
networkPlayer->SetSocket( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pSQRNet->IsHost() && !m_bHostChanged )
|
if( m_pSQRNet->IsHost() && !m_bHostChanged )
|
||||||
{
|
{
|
||||||
if( isSystemPrimaryPlayer(pSQRPlayer) )
|
if( isSystemPrimaryPlayer(pSQRPlayer) )
|
||||||
{
|
{
|
||||||
SQRNetworkPlayer *pNewSQRPrimaryPlayer = NULL;
|
SQRNetworkPlayer *pNewSQRPrimaryPlayer = nullptr;
|
||||||
for(unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i )
|
for(unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i )
|
||||||
{
|
{
|
||||||
SQRNetworkPlayer *pSQRPlayer2 = m_pSQRNet->GetPlayerByIndex( i );
|
SQRNetworkPlayer *pSQRPlayer2 = m_pSQRNet->GetPlayerByIndex( i );
|
||||||
|
|
||||||
if ( pSQRPlayer2 != NULL && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) )
|
if ( pSQRPlayer2 != nullptr && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) )
|
||||||
{
|
{
|
||||||
pNewSQRPrimaryPlayer = pSQRPlayer2;
|
pNewSQRPrimaryPlayer = pSQRPlayer2;
|
||||||
break;
|
break;
|
||||||
|
|
@ -298,7 +298,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||||
m_machineSQRPrimaryPlayers.erase( it );
|
m_machineSQRPrimaryPlayers.erase( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pNewSQRPrimaryPlayer != NULL )
|
if( pNewSQRPrimaryPlayer != nullptr )
|
||||||
m_machineSQRPrimaryPlayers.push_back( pNewSQRPrimaryPlayer );
|
m_machineSQRPrimaryPlayers.push_back( pNewSQRPrimaryPlayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,7 +311,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||||
|
|
||||||
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if(playerChangedCallback[idx] != NULL)
|
if(playerChangedCallback[idx] != nullptr)
|
||||||
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true );
|
playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,7 +320,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
|
||||||
int localPlayerCount = 0;
|
int localPlayerCount = 0;
|
||||||
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
|
||||||
{
|
{
|
||||||
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount;
|
if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
float appTime = app.getAppTime();
|
float appTime = app.getAppTime();
|
||||||
|
|
@ -391,7 +391,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
||||||
{
|
{
|
||||||
// we're signed into the PSN, but we won't be online yet, force a sign-in online here
|
// we're signed into the PSN, but we won't be online yet, force a sign-in online here
|
||||||
m_pSQRNet_Vita->AttemptPSNSignIn(NULL, NULL);
|
m_pSQRNet_Vita->AttemptPSNSignIn(nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -402,7 +402,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
g_pPlatformNetworkManager = this;
|
g_pPlatformNetworkManager = this;
|
||||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||||
{
|
{
|
||||||
playerChangedCallback[ i ] = NULL;
|
playerChangedCallback[ i ] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLeavingGame = false;
|
m_bLeavingGame = false;
|
||||||
|
|
@ -413,11 +413,11 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa
|
||||||
m_bSearchPending = false;
|
m_bSearchPending = false;
|
||||||
|
|
||||||
m_bIsOfflineGame = false;
|
m_bIsOfflineGame = false;
|
||||||
m_pSearchParam = NULL;
|
m_pSearchParam = nullptr;
|
||||||
m_SessionsUpdatedCallback = NULL;
|
m_SessionsUpdatedCallback = nullptr;
|
||||||
|
|
||||||
m_searchResultsCount = 0;
|
m_searchResultsCount = 0;
|
||||||
m_pSearchResults = NULL;
|
m_pSearchResults = nullptr;
|
||||||
|
|
||||||
m_lastSearchStartTime = 0;
|
m_lastSearchStartTime = 0;
|
||||||
|
|
||||||
|
|
@ -622,11 +622,11 @@ bool CPlatformNetworkManagerSony::RemoveLocalPlayerByUserIndex( int userIndex )
|
||||||
SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(userIndex);
|
SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(userIndex);
|
||||||
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
||||||
|
|
||||||
if(pNetworkPlayer != NULL)
|
if(pNetworkPlayer != nullptr)
|
||||||
{
|
{
|
||||||
Socket *socket = pNetworkPlayer->GetSocket();
|
Socket *socket = pNetworkPlayer->GetSocket();
|
||||||
|
|
||||||
if( socket != NULL )
|
if( socket != nullptr )
|
||||||
{
|
{
|
||||||
// We can't remove the player from qnet until we have stopped using it to communicate
|
// We can't remove the player from qnet until we have stopped using it to communicate
|
||||||
C4JThread* thread = new C4JThread(&CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed");
|
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());
|
SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad());
|
||||||
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
||||||
|
|
||||||
if(pNetworkPlayer != NULL)
|
if(pNetworkPlayer != nullptr)
|
||||||
{
|
{
|
||||||
Socket *socket = pNetworkPlayer->GetSocket();
|
Socket *socket = pNetworkPlayer->GetSocket();
|
||||||
|
|
||||||
if( socket != NULL )
|
if( socket != nullptr )
|
||||||
{
|
{
|
||||||
//printf("Waiting for socket closed event\n");
|
//printf("Waiting for socket closed event\n");
|
||||||
DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
||||||
|
|
@ -718,13 +718,13 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost)
|
||||||
// 4J Stu - Clear our reference to this socket
|
// 4J Stu - Clear our reference to this socket
|
||||||
pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad());
|
pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad());
|
||||||
pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
|
||||||
pNetworkPlayer->SetSocket( NULL );
|
pNetworkPlayer->SetSocket( nullptr );
|
||||||
}
|
}
|
||||||
delete socket;
|
delete socket;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//printf("Socket is already NULL\n");
|
//printf("Socket is already nullptr\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -878,8 +878,8 @@ void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void
|
||||||
{
|
{
|
||||||
if(playerChangedCallbackParam[iPad] == callbackParam)
|
if(playerChangedCallbackParam[iPad] == callbackParam)
|
||||||
{
|
{
|
||||||
playerChangedCallback[iPad] = NULL;
|
playerChangedCallback[iPad] = nullptr;
|
||||||
playerChangedCallbackParam[iPad] = NULL;
|
playerChangedCallbackParam[iPad] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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
|
// 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.
|
// call is only used to update the game host settings & then do the final push out of the data.
|
||||||
void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
|
void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/)
|
||||||
{
|
{
|
||||||
if( this->m_bLeavingGame )
|
if( this->m_bLeavingGame )
|
||||||
return;
|
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
|
// 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.
|
// as that function does a sync at the end of all changes.
|
||||||
if( pNetworkPlayerLeaving == NULL )
|
if( pNetworkPlayerLeaving == nullptr )
|
||||||
{
|
{
|
||||||
m_pSQRNet->UpdateExternalRoomData();
|
m_pSQRNet->UpdateExternalRoomData();
|
||||||
}
|
}
|
||||||
|
|
@ -946,14 +946,14 @@ int CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc( void* lpP
|
||||||
|
|
||||||
Socket *socket = pNetworkPlayer->GetSocket();
|
Socket *socket = pNetworkPlayer->GetSocket();
|
||||||
|
|
||||||
if( socket != NULL )
|
if( socket != nullptr )
|
||||||
{
|
{
|
||||||
//printf("Waiting for socket closed event\n");
|
//printf("Waiting for socket closed event\n");
|
||||||
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
socket->m_socketClosedEvent->WaitForSignal(INFINITE);
|
||||||
|
|
||||||
//printf("Socket closed event has fired\n");
|
//printf("Socket closed event has fired\n");
|
||||||
// 4J Stu - Clear our reference to this socket
|
// 4J Stu - Clear our reference to this socket
|
||||||
pNetworkPlayer->SetSocket( NULL );
|
pNetworkPlayer->SetSocket( nullptr );
|
||||||
delete socket;
|
delete socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1030,7 +1030,7 @@ void CPlatformNetworkManagerSony::SystemFlagReset()
|
||||||
void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index)
|
void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index)
|
||||||
{
|
{
|
||||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return;
|
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return;
|
||||||
if( pNetworkPlayer == NULL ) return;
|
if( pNetworkPlayer == nullptr ) return;
|
||||||
|
|
||||||
for( unsigned int i = 0; i < m_playerFlags.size(); i++ )
|
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)
|
bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index)
|
||||||
{
|
{
|
||||||
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false;
|
if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false;
|
||||||
if( pNetworkPlayer == NULL )
|
if( pNetworkPlayer == nullptr )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1064,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer,
|
||||||
wstring CPlatformNetworkManagerSony::GatherStats()
|
wstring CPlatformNetworkManagerSony::GatherStats()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
|
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( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
|
+ L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ) );
|
||||||
#else
|
#else
|
||||||
return L"";
|
return L"";
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1111,7 +1111,7 @@ void CPlatformNetworkManagerSony::TickSearch()
|
||||||
}
|
}
|
||||||
m_bSearchPending = false;
|
m_bSearchPending = false;
|
||||||
|
|
||||||
if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam);
|
if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1126,7 +1126,7 @@ void CPlatformNetworkManagerSony::TickSearch()
|
||||||
if( usingAdhocMode())
|
if( usingAdhocMode())
|
||||||
searchDelay = 5000;
|
searchDelay = 5000;
|
||||||
#endif
|
#endif
|
||||||
if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + searchDelay) < GetTickCount() )
|
if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + searchDelay) < GetTickCount() )
|
||||||
{
|
{
|
||||||
if( m_pSQRNet->FriendRoomManagerSearch() )
|
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;
|
if(memcmp( &pSearchResult->info.sessionID, &sessionId, sizeof(SessionID) ) != 0) continue;
|
||||||
|
|
||||||
bool foundSession = false;
|
bool foundSession = false;
|
||||||
FriendSessionInfo *sessionInfo = NULL;
|
FriendSessionInfo *sessionInfo = nullptr;
|
||||||
auto itFriendSession = friendsSessions[iPad].begin();
|
auto itFriendSession = friendsSessions[iPad].begin();
|
||||||
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
|
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
|
||||||
{
|
{
|
||||||
|
|
@ -1231,7 +1231,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
|
||||||
sessionInfo->data.isJoinable)
|
sessionInfo->data.isJoinable)
|
||||||
{
|
{
|
||||||
foundSessionInfo->data = sessionInfo->data;
|
foundSessionInfo->data = sessionInfo->data;
|
||||||
if(foundSessionInfo->displayLabel != NULL) delete [] foundSessionInfo->displayLabel;
|
if(foundSessionInfo->displayLabel != nullptr) delete [] foundSessionInfo->displayLabel;
|
||||||
foundSessionInfo->displayLabel = new wchar_t[100];
|
foundSessionInfo->displayLabel = new wchar_t[100];
|
||||||
memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) );
|
memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) );
|
||||||
foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength;
|
foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength;
|
||||||
|
|
@ -1267,7 +1267,7 @@ void CPlatformNetworkManagerSony::ForceFriendsSessionRefresh()
|
||||||
m_lastSearchStartTime = 0;
|
m_lastSearchStartTime = 0;
|
||||||
m_searchResultsCount = 0;
|
m_searchResultsCount = 0;
|
||||||
delete m_pSearchResults;
|
delete m_pSearchResults;
|
||||||
m_pSearchResults = NULL;
|
m_pSearchResults = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
||||||
|
|
@ -1293,7 +1293,7 @@ void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlay
|
||||||
|
|
||||||
INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
|
||||||
{
|
{
|
||||||
return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : NULL;
|
return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ private:
|
||||||
GameSessionData m_hostGameSessionData;
|
GameSessionData m_hostGameSessionData;
|
||||||
CGameNetworkManager *m_pGameNetworkManager;
|
CGameNetworkManager *m_pGameNetworkManager;
|
||||||
public:
|
public:
|
||||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
// 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)
|
for(int i = 0; i < playerCount; ++i)
|
||||||
{
|
{
|
||||||
SQRNetworkPlayer *player = GetPlayerByIndex( i );
|
SQRNetworkPlayer *player = GetPlayerByIndex( i );
|
||||||
if( player != NULL )
|
if( player != nullptr )
|
||||||
{
|
{
|
||||||
queueSize += player->GetTotalSendQueueBytes();
|
queueSize += player->GetTotalSendQueueBytes();
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ int SQRNetworkManager::GetSendQueueSizeMessages()
|
||||||
for(int i = 0; i < playerCount; ++i)
|
for(int i = 0; i < playerCount; ++i)
|
||||||
{
|
{
|
||||||
SQRNetworkPlayer *player = GetPlayerByIndex( i );
|
SQRNetworkPlayer *player = GetPlayerByIndex( i );
|
||||||
if( player != NULL )
|
if( player != nullptr )
|
||||||
{
|
{
|
||||||
queueSize += player->GetTotalSendQueueMessages();
|
queueSize += player->GetTotalSendQueueMessages();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -279,12 +279,12 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack
|
||||||
{
|
{
|
||||||
// no data, just the flag
|
// no data, just the flag
|
||||||
assert(dataSize == 0);
|
assert(dataSize == 0);
|
||||||
assert(data == NULL);
|
assert(data == nullptr);
|
||||||
int dataSize = dataRemaining;
|
int dataSize = dataRemaining;
|
||||||
if( dataSize > SNP_MAX_PAYLOAD ) dataSize = SNP_MAX_PAYLOAD;
|
if( dataSize > SNP_MAX_PAYLOAD ) dataSize = SNP_MAX_PAYLOAD;
|
||||||
sendBlock.start = NULL;
|
sendBlock.start = nullptr;
|
||||||
sendBlock.end = NULL;
|
sendBlock.end = nullptr;
|
||||||
sendBlock.current = NULL;
|
sendBlock.current = nullptr;
|
||||||
sendBlock.ack = ackFlags;
|
sendBlock.ack = ackFlags;
|
||||||
m_sendQueue.push(sendBlock);
|
m_sendQueue.push(sendBlock);
|
||||||
}
|
}
|
||||||
|
|
@ -387,9 +387,9 @@ int SQRNetworkPlayer::ReadDataPacket(void* data, int dataSize)
|
||||||
|
|
||||||
unsigned char* packetData = new unsigned char[packetSize];
|
unsigned char* packetData = new unsigned char[packetSize];
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL );
|
int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr );
|
||||||
#else // __ORBIS__ && __PSVITA__
|
#else // __ORBIS__ && __PSVITA__
|
||||||
int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL );
|
int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr );
|
||||||
#endif
|
#endif
|
||||||
if(bytesRead == sc_wouldBlockFlag)
|
if(bytesRead == sc_wouldBlockFlag)
|
||||||
{
|
{
|
||||||
|
|
@ -426,9 +426,9 @@ void SQRNetworkPlayer::ReadAck()
|
||||||
{
|
{
|
||||||
DataPacketHeader header;
|
DataPacketHeader header;
|
||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL );
|
int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr );
|
||||||
#else // __ORBIS__ && __PSVITA__
|
#else // __ORBIS__ && __PSVITA__
|
||||||
int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL );
|
int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr );
|
||||||
#endif
|
#endif
|
||||||
if(bytesRead == sc_wouldBlockFlag)
|
if(bytesRead == sc_wouldBlockFlag)
|
||||||
{
|
{
|
||||||
|
|
@ -459,7 +459,7 @@ void SQRNetworkPlayer::ReadAck()
|
||||||
|
|
||||||
void SQRNetworkPlayer::WriteAck()
|
void SQRNetworkPlayer::WriteAck()
|
||||||
{
|
{
|
||||||
SendInternal(NULL, 0, e_flag_AckReturning);
|
SendInternal(nullptr, 0, e_flag_AckReturning);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SQRNetworkPlayer::GetOutstandingAckCount()
|
int SQRNetworkPlayer::GetOutstandingAckCount()
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ static SceRemoteStorageStatus statParams;
|
||||||
// {
|
// {
|
||||||
// app.DebugPrintf("remoteStorageCallback err : 0x%08x\n");
|
// app.DebugPrintf("remoteStorageCallback err : 0x%08x\n");
|
||||||
//
|
//
|
||||||
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL);
|
// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, nullptr);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -181,7 +181,7 @@ const char* SonyRemoteStorage::getLocalFilename()
|
||||||
const char* SonyRemoteStorage::getSaveNameUTF8()
|
const char* SonyRemoteStorage::getSaveNameUTF8()
|
||||||
{
|
{
|
||||||
if(m_getInfoStatus != e_infoFound)
|
if(m_getInfoStatus != e_infoFound)
|
||||||
return NULL;
|
return nullptr;
|
||||||
return m_retrievedDescData.m_saveNameUTF8;
|
return m_retrievedDescData.m_saveNameUTF8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -261,12 +261,12 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.DebugPrintf("Thumbnail data is NULL, or has size 0\n");
|
app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n");
|
||||||
pClass->m_thumbnailData = NULL;
|
pClass->m_thumbnailData = nullptr;
|
||||||
pClass->m_thumbnailDataSize = 0;
|
pClass->m_thumbnailDataSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pClass->m_SetDataThread != NULL)
|
if(pClass->m_SetDataThread != nullptr)
|
||||||
delete pClass->m_SetDataThread;
|
delete pClass->m_SetDataThread;
|
||||||
|
|
||||||
pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread");
|
pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread");
|
||||||
|
|
@ -346,7 +346,7 @@ bool SonyRemoteStorage::shutdown()
|
||||||
app.DebugPrintf("Term request done \n");
|
app.DebugPrintf("Term request done \n");
|
||||||
m_bInitialised = false;
|
m_bInitialised = false;
|
||||||
free(m_memPoolBuffer);
|
free(m_memPoolBuffer);
|
||||||
m_memPoolBuffer = NULL;
|
m_memPoolBuffer = nullptr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -409,7 +409,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData)
|
||||||
char seed[22];
|
char seed[22];
|
||||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||||
|
|
||||||
__int64 iSeed = strtoll(seed,NULL,10);
|
__int64 iSeed = strtoll(seed,nullptr,10);
|
||||||
SetU64HexBytes(descData.m_seed, iSeed);
|
SetU64HexBytes(descData.m_seed, iSeed);
|
||||||
// Save the host options that this world was last played with
|
// Save the host options that this world was last played with
|
||||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||||
|
|
@ -448,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData)
|
||||||
char seed[22];
|
char seed[22];
|
||||||
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack);
|
||||||
|
|
||||||
__int64 iSeed = strtoll(seed,NULL,10);
|
__int64 iSeed = strtoll(seed,nullptr,10);
|
||||||
SetU64HexBytes(descData.m_seed, iSeed);
|
SetU64HexBytes(descData.m_seed, iSeed);
|
||||||
// Save the host options that this world was last played with
|
// Save the host options that this world was last played with
|
||||||
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
SetU32HexBytes(descData.m_hostOptions, uiHostOptions);
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ public:
|
||||||
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
|
static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes);
|
||||||
static int setDataThread(void* lpParam);
|
static int setDataThread(void* lpParam);
|
||||||
|
|
||||||
SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
SonyRemoteStorage() : m_memPoolBuffer(nullptr), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char* getRemoteSaveFilename();
|
const char* getRemoteSaveFilename();
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ INT CTelemetryManager::GetMode(DWORD dwUserId)
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
if( pMinecraft->localplayers[dwUserId] != NULL && pMinecraft->localplayers[dwUserId]->level != NULL && pMinecraft->localplayers[dwUserId]->level->getLevelData() != NULL )
|
if( pMinecraft->localplayers[dwUserId] != nullptr && pMinecraft->localplayers[dwUserId]->level != nullptr && pMinecraft->localplayers[dwUserId]->level->getLevelData() != nullptr )
|
||||||
{
|
{
|
||||||
GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType();
|
GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType();
|
||||||
|
|
||||||
|
|
@ -237,7 +237,7 @@ INT CTelemetryManager::GetSubLevelId(DWORD dwUserId)
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
if(pMinecraft->localplayers[dwUserId] != NULL)
|
if(pMinecraft->localplayers[dwUserId] != nullptr)
|
||||||
{
|
{
|
||||||
switch(pMinecraft->localplayers[dwUserId]->dimension)
|
switch(pMinecraft->localplayers[dwUserId]->dimension)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void ChangeStateConstraint::tick(int iPad)
|
||||||
// Send update settings packet to server
|
// Send update settings packet to server
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new 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(m_changeGameMode)
|
||||||
{
|
{
|
||||||
if(minecraft->localgameModes[iPad] != NULL)
|
if(minecraft->localgameModes[iPad] != nullptr)
|
||||||
{
|
{
|
||||||
m_changedFromGameMode = minecraft->localplayers[iPad]->abilities.instabuild ? GameType::CREATIVE : GameType::SURVIVAL;
|
m_changedFromGameMode = minecraft->localplayers[iPad]->abilities.instabuild ? GameType::CREATIVE : GameType::SURVIVAL;
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ void ChangeStateConstraint::tick(int iPad)
|
||||||
// Send update settings packet to server
|
// Send update settings packet to server
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||||
}
|
}
|
||||||
|
|
@ -126,7 +126,7 @@ void ChangeStateConstraint::tick(int iPad)
|
||||||
// Send update settings packet to server
|
// Send update settings packet to server
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new 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:
|
public:
|
||||||
virtual ConstraintType getType() { return e_ConstraintChangeState; }
|
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 = NULL );
|
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();
|
~ChangeStateConstraint();
|
||||||
|
|
||||||
virtual void tick(int iPad);
|
virtual void tick(int iPad);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||||
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/,
|
||||||
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
: TutorialTask( tutorial, descriptionId, false, NULL, true, false, false )
|
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
||||||
{
|
{
|
||||||
if(requiresUserInput == true)
|
if(requiresUserInput == true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "CompleteUsingItemTask.h"
|
#include "CompleteUsingItemTask.h"
|
||||||
|
|
||||||
CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion)
|
CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion)
|
||||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL)
|
: TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr)
|
||||||
{
|
{
|
||||||
m_iValidItemsA= new int [itemIdsLength];
|
m_iValidItemsA= new int [itemIdsLength];
|
||||||
for(int i=0;i<itemIdsLength;i++)
|
for(int i=0;i<itemIdsLength;i++)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
||||||
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount)
|
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount)
|
||||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL, showMinimumTime )
|
: TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr, showMinimumTime )
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < mappingsLength; ++i)
|
for(unsigned int i = 0; i < mappingsLength; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ private:
|
||||||
bool CompletionMaskIsValid();
|
bool CompletionMaskIsValid();
|
||||||
public:
|
public:
|
||||||
ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
|
||||||
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=NULL, int iCompletionMaskACount=0, int iSouthpawMappings[]=NULL, unsigned int uiSouthpawMappingsCount=0);
|
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=nullptr, int iCompletionMaskACount=0, int iSouthpawMappings[]=nullptr, unsigned int uiSouthpawMappingsCount=0);
|
||||||
~ControllerTask();
|
~ControllerTask();
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
virtual void setAsCurrentTask(bool active = true);
|
virtual void setAsCurrentTask(bool active = true);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||||
|
|
||||||
CraftTask::CraftTask( int itemId, int auxValue, int quantity,
|
CraftTask::CraftTask( int itemId, int auxValue, int quantity,
|
||||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= NULL*/,
|
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= nullptr*/,
|
||||||
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ )
|
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ )
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||||
m_quantity( quantity ),
|
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,
|
CraftTask::CraftTask( int *items, int *auxValues, int numItems, int quantity,
|
||||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= NULL*/,
|
Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector<TutorialConstraint *> *inConstraints /*= nullptr*/,
|
||||||
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ )
|
bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ )
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||||
m_quantity( quantity ),
|
m_quantity( quantity ),
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ class CraftTask : public TutorialTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CraftTask( int itemId, int auxValue, int quantity,
|
CraftTask( int itemId, int auxValue, int quantity,
|
||||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL,
|
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true );
|
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true );
|
||||||
CraftTask( int *items, int *auxValues, int numItems, int quantity,
|
CraftTask( int *items, int *auxValues, int numItems, int quantity,
|
||||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL,
|
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true );
|
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true );
|
||||||
|
|
||||||
~CraftTask();
|
~CraftTask();
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri
|
||||||
|
|
||||||
int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != nullptr)
|
||||||
{
|
{
|
||||||
bool itemFound = false;
|
bool itemFound = false;
|
||||||
for(unsigned int i=0;i<m_iItemsCount;i++)
|
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)
|
int DiggerItemHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != nullptr)
|
||||||
{
|
{
|
||||||
bool itemFound = false;
|
bool itemFound = false;
|
||||||
for(unsigned int i=0;i<m_iItemsCount;i++)
|
for(unsigned int i=0;i<m_iItemsCount;i++)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
EffectChangedTask::EffectChangedTask(Tutorial *tutorial, int descriptionId, MobEffect *effect, bool apply,
|
EffectChangedTask::EffectChangedTask(Tutorial *tutorial, int descriptionId, MobEffect *effect, bool apply,
|
||||||
bool enablePreCompletion, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders )
|
bool enablePreCompletion, bool bShowMinimumTime, bool bAllowFade, bool bTaskReminders )
|
||||||
: TutorialTask(tutorial,descriptionId,enablePreCompletion,NULL,bShowMinimumTime,bAllowFade,bTaskReminders)
|
: TutorialTask(tutorial,descriptionId,enablePreCompletion,nullptr,bShowMinimumTime,bAllowFade,bTaskReminders)
|
||||||
{
|
{
|
||||||
m_effect = effect;
|
m_effect = effect;
|
||||||
m_apply = apply;
|
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 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) );
|
addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::torch_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_TORCH) );
|
||||||
|
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
vector<TutorialConstraint *> *areaConstraints = new vector<TutorialConstraint *>();
|
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) );
|
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
|
* MINECART
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"minecartArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"minecartArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
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 ) );
|
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
|
* BOAT
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
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 ) );
|
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
|
* FISHING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
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 ) );
|
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
|
* PISTON - SELF-REPAIRING BRIDGE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
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 ) );
|
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
|
* PISTON - PISTON AND REDSTONE CIRCUITS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State redstoneAndPistonStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* PORTAL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* CREATIVE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"creativeArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"creativeArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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 );
|
ProcedureCompoundTask *creativeFinalTask = new ProcedureCompoundTask( this );
|
||||||
|
|
||||||
AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea");
|
AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea");
|
||||||
if(exitArea != NULL)
|
if(exitArea != nullptr)
|
||||||
{
|
{
|
||||||
vector<TutorialConstraint *> *creativeExitAreaConstraints = new vector<TutorialConstraint *>();
|
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) );
|
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
|
* BREWING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* ENCHANTING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* ANVIL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* TRADING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* FIREWORKS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* BEACON
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* HOPPER
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* ENDERCHEST
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* FARMING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* BREEDING
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"breedingArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"breedingArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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
|
* SNOW AND IRON GOLEM
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(app.getGameRuleDefinitions() != NULL)
|
if(app.getGameRuleDefinitions() != nullptr)
|
||||||
{
|
{
|
||||||
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea");
|
AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea");
|
||||||
if(area != NULL)
|
if(area != nullptr)
|
||||||
{
|
{
|
||||||
eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay};
|
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) );
|
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"
|
#include "FullTutorialActiveTask.h"
|
||||||
|
|
||||||
FullTutorialActiveTask::FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/)
|
FullTutorialActiveTask::FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/)
|
||||||
: TutorialTask( tutorial, -1, false, NULL, false, false, false )
|
: TutorialTask( tutorial, -1, false, nullptr, false, false, false )
|
||||||
{
|
{
|
||||||
m_completeAction = completeAction;
|
m_completeAction = completeAction;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/,
|
||||||
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/)
|
||||||
: TutorialTask( tutorial, descriptionId, false, NULL, true, false, false )
|
: TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false )
|
||||||
{
|
{
|
||||||
if(requiresUserInput == true)
|
if(requiresUserInput == true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class PickupTask : public TutorialTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PickupTask( int itemId, unsigned int quantity, int auxValue,
|
PickupTask( int itemId, unsigned int quantity, int auxValue,
|
||||||
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = NULL,
|
Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true )
|
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true )
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||||
m_itemId( itemId),
|
m_itemId( itemId),
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ ProcedureCompoundTask::~ProcedureCompoundTask()
|
||||||
|
|
||||||
void ProcedureCompoundTask::AddTask(TutorialTask *task)
|
void ProcedureCompoundTask::AddTask(TutorialTask *task)
|
||||||
{
|
{
|
||||||
if(task != NULL)
|
if(task != nullptr)
|
||||||
{
|
{
|
||||||
m_taskSequence.push_back(task);
|
m_taskSequence.push_back(task);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class ProcedureCompoundTask : public TutorialTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProcedureCompoundTask(Tutorial *tutorial )
|
ProcedureCompoundTask(Tutorial *tutorial )
|
||||||
: TutorialTask(tutorial, -1, false, NULL, false, true, false )
|
: TutorialTask(tutorial, -1, false, nullptr, false, true, false )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~ProcedureCompoundTask();
|
~ProcedureCompoundTask();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ private:
|
||||||
EProgressFlagType m_type;
|
EProgressFlagType m_type;
|
||||||
public:
|
public:
|
||||||
ProgressFlagTask(char *flags, char mask, EProgressFlagType type, Tutorial *tutorial ) :
|
ProgressFlagTask(char *flags, char mask, EProgressFlagType type, Tutorial *tutorial ) :
|
||||||
TutorialTask(tutorial, -1, false, NULL ),
|
TutorialTask(tutorial, -1, false, nullptr ),
|
||||||
flags( flags ), m_mask( mask ), m_type( type )
|
flags( flags ), m_mask( mask ), m_type( type )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RideEntityTask(const int eTYPE, Tutorial *tutorial, int descriptionId,
|
RideEntityTask(const int eTYPE, Tutorial *tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL,
|
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||||
bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
||||||
|
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include "StatTask.h"
|
#include "StatTask.h"
|
||||||
|
|
||||||
StatTask::StatTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, Stat *stat, int variance /*= 1*/)
|
StatTask::StatTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, Stat *stat, int variance /*= 1*/)
|
||||||
: TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL )
|
: TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr )
|
||||||
{
|
{
|
||||||
this->stat = stat;
|
this->stat = stat;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ private:
|
||||||
eTutorial_State m_state;
|
eTutorial_State m_state;
|
||||||
public:
|
public:
|
||||||
StateChangeTask(eTutorial_State state,
|
StateChangeTask(eTutorial_State state,
|
||||||
Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL,
|
Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) :
|
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) :
|
||||||
TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||||
m_state( state )
|
m_state( state )
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u
|
||||||
|
|
||||||
bool TakeItemHint::onTake(shared_ptr<ItemInstance> item)
|
bool TakeItemHint::onTake(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != nullptr)
|
||||||
{
|
{
|
||||||
bool itemFound = false;
|
bool itemFound = false;
|
||||||
for(unsigned int i=0;i<m_iItemsCount;i++)
|
for(unsigned int i=0;i<m_iItemsCount;i++)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ int Tutorial::m_iTutorialFreezeTimeValue = 8000;
|
||||||
|
|
||||||
bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other)
|
bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other)
|
||||||
{
|
{
|
||||||
if(other == NULL) return false;
|
if(other == nullptr) return false;
|
||||||
|
|
||||||
bool textTheSame = (m_messageId == other->m_messageId) && (m_messageString.compare(other->m_messageString) == 0);
|
bool textTheSame = (m_messageId == other->m_messageId) && (m_messageString.compare(other->m_messageString) == 0);
|
||||||
bool titleTheSame = (m_titleId == other->m_titleId) && (m_titleString.compare(other->m_titleString) == 0);
|
bool titleTheSame = (m_titleId == other->m_titleId) && (m_titleString.compare(other->m_titleString) == 0);
|
||||||
|
|
@ -360,12 +360,12 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
||||||
m_hintDisplayed = false;
|
m_hintDisplayed = false;
|
||||||
m_freezeTime = false;
|
m_freezeTime = false;
|
||||||
m_timeFrozen = false;
|
m_timeFrozen = false;
|
||||||
m_UIScene = NULL;
|
m_UIScene = nullptr;
|
||||||
m_allowShow = true;
|
m_allowShow = true;
|
||||||
m_bHasTickedOnce = false;
|
m_bHasTickedOnce = false;
|
||||||
m_firstTickTime = 0;
|
m_firstTickTime = 0;
|
||||||
|
|
||||||
m_lastMessage = NULL;
|
m_lastMessage = nullptr;
|
||||||
|
|
||||||
lastMessageTime = 0;
|
lastMessageTime = 0;
|
||||||
m_iTaskReminders = 0;
|
m_iTaskReminders = 0;
|
||||||
|
|
@ -374,13 +374,13 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
||||||
m_CurrentState = e_Tutorial_State_Gameplay;
|
m_CurrentState = e_Tutorial_State_Gameplay;
|
||||||
m_hasStateChanged = false;
|
m_hasStateChanged = false;
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
m_hTutorialScene=NULL;
|
m_hTutorialScene=nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
|
for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
|
||||||
{
|
{
|
||||||
currentTask[i] = NULL;
|
currentTask[i] = nullptr;
|
||||||
currentFailedConstraint[i] = NULL;
|
currentFailedConstraint[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEFAULT TASKS THAT ALL TUTORIALS SHARE
|
// DEFAULT TASKS THAT ALL TUTORIALS SHARE
|
||||||
|
|
@ -1012,7 +1012,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
|
||||||
addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
|
addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
|
||||||
|
|
||||||
// 4J-JEV: Only force the RideEntityTask if we're on the full-tutorial.
|
// 4J-JEV: Only force the RideEntityTask if we're on the full-tutorial.
|
||||||
if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL, false, false, false) );
|
if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr, false, false, false) );
|
||||||
else addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
|
else addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
|
||||||
|
|
||||||
addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
|
addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
|
||||||
|
|
@ -1163,8 +1163,8 @@ Tutorial::~Tutorial()
|
||||||
delete it;
|
delete it;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTask[i] = NULL;
|
currentTask[i] = nullptr;
|
||||||
currentFailedConstraint[i] = NULL;
|
currentFailedConstraint[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1362,7 +1362,7 @@ void Tutorial::tick()
|
||||||
|
|
||||||
if(!m_allowShow)
|
if(!m_allowShow)
|
||||||
{
|
{
|
||||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||||
{
|
{
|
||||||
uiTempDisabled = true;
|
uiTempDisabled = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1412,7 +1412,7 @@ void Tutorial::tick()
|
||||||
|
|
||||||
if(ui.IsPauseMenuDisplayed( m_iPad ) )
|
if(ui.IsPauseMenuDisplayed( m_iPad ) )
|
||||||
{
|
{
|
||||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||||
{
|
{
|
||||||
uiTempDisabled = true;
|
uiTempDisabled = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1460,12 +1460,12 @@ void Tutorial::tick()
|
||||||
|
|
||||||
// Check constraints
|
// Check constraints
|
||||||
// Only need to update these if we aren't already failing something
|
// Only need to update these if we aren't already failing something
|
||||||
if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == NULL || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) )
|
if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == nullptr || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) )
|
||||||
{
|
{
|
||||||
if( currentFailedConstraint[m_CurrentState] != NULL && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) )
|
if( currentFailedConstraint[m_CurrentState] != nullptr && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) )
|
||||||
{
|
{
|
||||||
constraintChanged = true;
|
constraintChanged = true;
|
||||||
currentFailedConstraint[m_CurrentState] = NULL;
|
currentFailedConstraint[m_CurrentState] = nullptr;
|
||||||
}
|
}
|
||||||
for (auto& constraint : constraints[m_CurrentState])
|
for (auto& constraint : constraints[m_CurrentState])
|
||||||
{
|
{
|
||||||
|
|
@ -1477,7 +1477,7 @@ void Tutorial::tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == NULL )
|
if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == nullptr )
|
||||||
{
|
{
|
||||||
// Update tasks
|
// Update tasks
|
||||||
bool isCurrentTask = true;
|
bool isCurrentTask = true;
|
||||||
|
|
@ -1496,7 +1496,7 @@ void Tutorial::tick()
|
||||||
eTutorial_CompletionAction compAction = task->getCompletionAction();
|
eTutorial_CompletionAction compAction = task->getCompletionAction();
|
||||||
it = activeTasks[m_CurrentState].erase( it );
|
it = activeTasks[m_CurrentState].erase( it );
|
||||||
delete task;
|
delete task;
|
||||||
task = NULL;
|
task = nullptr;
|
||||||
|
|
||||||
if( activeTasks[m_CurrentState].size() > 0 )
|
if( activeTasks[m_CurrentState].size() > 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -1552,12 +1552,12 @@ void Tutorial::tick()
|
||||||
{
|
{
|
||||||
setStateCompleted( m_CurrentState );
|
setStateCompleted( m_CurrentState );
|
||||||
|
|
||||||
currentTask[m_CurrentState] = NULL;
|
currentTask[m_CurrentState] = nullptr;
|
||||||
}
|
}
|
||||||
taskChanged = true;
|
taskChanged = true;
|
||||||
|
|
||||||
// If we can complete this early, check if we can complete it right now
|
// If we can complete this early, check if we can complete it right now
|
||||||
if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isPreCompletionEnabled() )
|
if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isPreCompletionEnabled() )
|
||||||
{
|
{
|
||||||
isCurrentTask = true;
|
isCurrentTask = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1566,7 +1566,7 @@ void Tutorial::tick()
|
||||||
{
|
{
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
if( task != NULL && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() )
|
if( task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() )
|
||||||
{
|
{
|
||||||
task->setShownForMinimumTime();
|
task->setShownForMinimumTime();
|
||||||
|
|
||||||
|
|
@ -1587,7 +1587,7 @@ void Tutorial::tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( currentTask[m_CurrentState] == NULL && activeTasks[m_CurrentState].size() > 0 )
|
if( currentTask[m_CurrentState] == nullptr && activeTasks[m_CurrentState].size() > 0 )
|
||||||
{
|
{
|
||||||
currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
|
currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
|
||||||
currentTask[m_CurrentState]->setAsCurrentTask();
|
currentTask[m_CurrentState]->setAsCurrentTask();
|
||||||
|
|
@ -1616,17 +1616,17 @@ void Tutorial::tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( constraintChanged || taskChanged || m_hasStateChanged ||
|
if( constraintChanged || taskChanged || m_hasStateChanged ||
|
||||||
(currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_lastMessage == NULL || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed)
|
(currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_lastMessage == nullptr || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( currentFailedConstraint[m_CurrentState] != NULL )
|
if( currentFailedConstraint[m_CurrentState] != nullptr )
|
||||||
{
|
{
|
||||||
PopupMessageDetails *message = new PopupMessageDetails();
|
PopupMessageDetails *message = new PopupMessageDetails();
|
||||||
message->m_messageId = currentFailedConstraint[m_CurrentState]->getDescriptionId();
|
message->m_messageId = currentFailedConstraint[m_CurrentState]->getDescriptionId();
|
||||||
message->m_allowFade = false;
|
message->m_allowFade = false;
|
||||||
setMessage( message );
|
setMessage( message );
|
||||||
}
|
}
|
||||||
else if( currentTask[m_CurrentState] != NULL )
|
else if( currentTask[m_CurrentState] != nullptr )
|
||||||
{
|
{
|
||||||
PopupMessageDetails *message = new PopupMessageDetails();
|
PopupMessageDetails *message = new PopupMessageDetails();
|
||||||
message->m_messageId = currentTask[m_CurrentState]->getDescriptionId();
|
message->m_messageId = currentTask[m_CurrentState]->getDescriptionId();
|
||||||
|
|
@ -1637,7 +1637,7 @@ void Tutorial::tick()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setMessage( NULL );
|
setMessage( nullptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1646,7 +1646,7 @@ void Tutorial::tick()
|
||||||
m_hintDisplayed = false;
|
m_hintDisplayed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() )
|
if( currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() )
|
||||||
{
|
{
|
||||||
// Reminder
|
// Reminder
|
||||||
PopupMessageDetails *message = new PopupMessageDetails();
|
PopupMessageDetails *message = new PopupMessageDetails();
|
||||||
|
|
@ -1671,7 +1671,7 @@ void Tutorial::tick()
|
||||||
|
|
||||||
bool Tutorial::setMessage(PopupMessageDetails *message)
|
bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
{
|
{
|
||||||
if(message != NULL && !message->m_forceDisplay &&
|
if(message != nullptr && !message->m_forceDisplay &&
|
||||||
m_lastMessageState == m_CurrentState &&
|
m_lastMessageState == m_CurrentState &&
|
||||||
message->isSameContent(m_lastMessage) &&
|
message->isSameContent(m_lastMessage) &&
|
||||||
( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) )
|
( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) )
|
||||||
|
|
@ -1681,7 +1681,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(message != NULL && (message->m_messageId > 0 || !message->m_messageString.empty()) )
|
if(message != nullptr && (message->m_messageId > 0 || !message->m_messageString.empty()) )
|
||||||
{
|
{
|
||||||
m_lastMessageState = m_CurrentState;
|
m_lastMessageState = m_CurrentState;
|
||||||
|
|
||||||
|
|
@ -1695,7 +1695,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto it = messages.find(message->m_messageId);
|
auto it = messages.find(message->m_messageId);
|
||||||
if( it != messages.end() && it->second != NULL )
|
if( it != messages.end() && it->second != nullptr )
|
||||||
{
|
{
|
||||||
TutorialMessage *messageString = it->second;
|
TutorialMessage *messageString = it->second;
|
||||||
text = wstring( messageString->getMessageForDisplay() );
|
text = wstring( messageString->getMessageForDisplay() );
|
||||||
|
|
@ -1725,7 +1725,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
else if(message->m_promptId >= 0)
|
else if(message->m_promptId >= 0)
|
||||||
{
|
{
|
||||||
auto it = messages.find(message->m_promptId);
|
auto it = messages.find(message->m_promptId);
|
||||||
if(it != messages.end() && it->second != NULL)
|
if(it != messages.end() && it->second != nullptr)
|
||||||
{
|
{
|
||||||
TutorialMessage *prompt = it->second;
|
TutorialMessage *prompt = it->second;
|
||||||
text.append( prompt->getMessageForDisplay() );
|
text.append( prompt->getMessageForDisplay() );
|
||||||
|
|
@ -1754,7 +1754,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
ui.SetTutorialDescription( m_iPad, &popupInfo );
|
ui.SetTutorialDescription( m_iPad, &popupInfo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( (m_lastMessage != NULL && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() )
|
else if( (m_lastMessage != nullptr && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() )
|
||||||
{
|
{
|
||||||
// This should cause the popup to dissappear
|
// This should cause the popup to dissappear
|
||||||
TutorialPopupInfo popupInfo;
|
TutorialPopupInfo popupInfo;
|
||||||
|
|
@ -1763,7 +1763,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
|
||||||
ui.SetTutorialDescription( m_iPad, &popupInfo );
|
ui.SetTutorialDescription( m_iPad, &popupInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_lastMessage != NULL) delete m_lastMessage;
|
if(m_lastMessage != nullptr) delete m_lastMessage;
|
||||||
m_lastMessage = message;
|
m_lastMessage = message;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1777,7 +1777,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
||||||
|
|
||||||
bool messageShown = false;
|
bool messageShown = false;
|
||||||
DWORD time = GetTickCount();
|
DWORD time = GetTickCount();
|
||||||
if(message != NULL && (message->m_forceDisplay || hintsOn) &&
|
if(message != nullptr && (message->m_forceDisplay || hintsOn) &&
|
||||||
(!message->m_delay ||
|
(!message->m_delay ||
|
||||||
(
|
(
|
||||||
(m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) ||
|
(m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) ||
|
||||||
|
|
@ -1792,7 +1792,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
|
||||||
{
|
{
|
||||||
m_lastHintDisplayedTime = time;
|
m_lastHintDisplayedTime = time;
|
||||||
m_hintDisplayed = true;
|
m_hintDisplayed = true;
|
||||||
if(hint!=NULL) setHintCompleted( hint );
|
if(hint!=nullptr) setHintCompleted( hint );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return messageShown;
|
return messageShown;
|
||||||
|
|
@ -1815,7 +1815,7 @@ void Tutorial::showTutorialPopup(bool show)
|
||||||
|
|
||||||
if(!show)
|
if(!show)
|
||||||
{
|
{
|
||||||
if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
|
||||||
{
|
{
|
||||||
uiTempDisabled = true;
|
uiTempDisabled = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1926,7 +1926,7 @@ void Tutorial::handleUIInput(int iAction)
|
||||||
{
|
{
|
||||||
if( m_hintDisplayed ) return;
|
if( m_hintDisplayed ) return;
|
||||||
|
|
||||||
if(currentTask[m_CurrentState] != NULL)
|
if(currentTask[m_CurrentState] != nullptr)
|
||||||
currentTask[m_CurrentState]->handleUIInput(iAction);
|
currentTask[m_CurrentState]->handleUIInput(iAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1988,7 +1988,7 @@ void Tutorial::onSelectedItemChanged(shared_ptr<ItemInstance> item)
|
||||||
// Menus and states like riding in a minecart will NOT allow this
|
// Menus and states like riding in a minecart will NOT allow this
|
||||||
if( isSelectedItemState() )
|
if( isSelectedItemState() )
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != nullptr)
|
||||||
{
|
{
|
||||||
switch(item->id)
|
switch(item->id)
|
||||||
{
|
{
|
||||||
|
|
@ -2151,7 +2151,7 @@ void Tutorial::AddConstraint(TutorialConstraint *c)
|
||||||
void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= false*/)
|
void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= false*/)
|
||||||
{
|
{
|
||||||
if( currentFailedConstraint[m_CurrentState] == c )
|
if( currentFailedConstraint[m_CurrentState] == c )
|
||||||
currentFailedConstraint[m_CurrentState] = NULL;
|
currentFailedConstraint[m_CurrentState] = nullptr;
|
||||||
|
|
||||||
if( c->getQueuedForRemoval() )
|
if( c->getQueuedForRemoval() )
|
||||||
{
|
{
|
||||||
|
|
@ -2211,16 +2211,16 @@ void Tutorial::addMessage(int messageId, bool limitRepeats /*= false*/, unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= NULL*/)
|
void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= nullptr*/)
|
||||||
#else
|
#else
|
||||||
void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= NULL*/)
|
void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= nullptr*/)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(newState == m_CurrentState)
|
if(newState == m_CurrentState)
|
||||||
{
|
{
|
||||||
// If clearing the scene, make sure that the tutorial popup has its reference to this scene removed
|
// If clearing the scene, make sure that the tutorial popup has its reference to this scene removed
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
if( scene == NULL )
|
if( scene == nullptr )
|
||||||
{
|
{
|
||||||
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
||||||
}
|
}
|
||||||
|
|
@ -2241,7 +2241,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
|
||||||
}
|
}
|
||||||
|
|
||||||
// The action that caused the change of state may also have completed the current task
|
// The action that caused the change of state may also have completed the current task
|
||||||
if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() )
|
if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isCompleted() )
|
||||||
{
|
{
|
||||||
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
|
||||||
|
|
||||||
|
|
@ -2252,21 +2252,21 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentTask[m_CurrentState] = NULL;
|
currentTask[m_CurrentState] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( currentTask[m_CurrentState] != NULL )
|
if( currentTask[m_CurrentState] != nullptr )
|
||||||
{
|
{
|
||||||
currentTask[m_CurrentState]->onStateChange(newState);
|
currentTask[m_CurrentState]->onStateChange(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that the current message is cleared
|
// Make sure that the current message is cleared
|
||||||
setMessage( NULL );
|
setMessage( nullptr );
|
||||||
|
|
||||||
// If clearing the scene, make sure that the tutorial popup has its reference to this scene removed
|
// If clearing the scene, make sure that the tutorial popup has its reference to this scene removed
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
if( scene == NULL )
|
if( scene == nullptr )
|
||||||
{
|
{
|
||||||
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,9 +139,9 @@ public:
|
||||||
bool getCompleted( int completableId );
|
bool getCompleted( int completableId );
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
void changeTutorialState(eTutorial_State newState, CXuiScene *scene = NULL);
|
void changeTutorialState(eTutorial_State newState, CXuiScene *scene = nullptr);
|
||||||
#else
|
#else
|
||||||
void changeTutorialState(eTutorial_State newState, UIScene *scene = NULL);
|
void changeTutorialState(eTutorial_State newState, UIScene *scene = nullptr);
|
||||||
#endif
|
#endif
|
||||||
bool isSelectedItemState();
|
bool isSelectedItemState();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/)
|
TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/)
|
||||||
: m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ),
|
: m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ),
|
||||||
m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade)
|
m_lastTile( nullptr ), m_hintNeeded( true ), m_allowFade(allowFade)
|
||||||
{
|
{
|
||||||
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
|
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ TutorialMode::TutorialMode(int iPad, Minecraft *minecraft, ClientConnection *con
|
||||||
|
|
||||||
TutorialMode::~TutorialMode()
|
TutorialMode::~TutorialMode()
|
||||||
{
|
{
|
||||||
if(tutorial != NULL)
|
if(tutorial != nullptr)
|
||||||
delete tutorial;
|
delete tutorial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face)
|
||||||
}
|
}
|
||||||
shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
||||||
int damageBefore;
|
int damageBefore;
|
||||||
if(item != NULL)
|
if(item != nullptr)
|
||||||
{
|
{
|
||||||
damageBefore = item->getDamageValue();
|
damageBefore = item->getDamageValue();
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face)
|
||||||
|
|
||||||
if(!tutorial->m_allTutorialsComplete)
|
if(!tutorial->m_allTutorialsComplete)
|
||||||
{
|
{
|
||||||
if ( item != NULL && item->isDamageableItem() )
|
if ( item != nullptr && item->isDamageableItem() )
|
||||||
{
|
{
|
||||||
int max = item->getMaxDamage();
|
int max = item->getMaxDamage();
|
||||||
int damageNow = item->getDamageValue();
|
int damageNow = item->getDamageValue();
|
||||||
|
|
@ -88,7 +88,7 @@ bool TutorialMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr
|
||||||
|
|
||||||
if(!bTestUseOnly)
|
if(!bTestUseOnly)
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != nullptr)
|
||||||
{
|
{
|
||||||
haveItem = true;
|
haveItem = true;
|
||||||
itemCount = item->count;
|
itemCount = item->count;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public:
|
||||||
virtual void startDestroyBlock(int x, int y, int z, int face);
|
virtual void startDestroyBlock(int x, int y, int z, int face);
|
||||||
virtual bool destroyBlock(int x, int y, int z, int face);
|
virtual bool destroyBlock(int x, int y, int z, int face);
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
virtual bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL);
|
virtual bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=nullptr);
|
||||||
virtual void attack(shared_ptr<Player> player, shared_ptr<Entity> entity);
|
virtual void attack(shared_ptr<Player> player, shared_ptr<Entity> entity);
|
||||||
|
|
||||||
virtual bool isInputAllowed(int mapping);
|
virtual bool isInputAllowed(int mapping);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre
|
||||||
areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ),
|
areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ),
|
||||||
m_bAllowFade(bAllowFade), m_bTaskReminders(bTaskReminders), m_bShowMinimumTime( bShowMinimumTime), m_bShownForMinimumTime( false )
|
m_bAllowFade(bAllowFade), m_bTaskReminders(bTaskReminders), m_bShowMinimumTime( bShowMinimumTime), m_bShownForMinimumTime( false )
|
||||||
{
|
{
|
||||||
if(inConstraints != NULL)
|
if(inConstraints != nullptr)
|
||||||
{
|
{
|
||||||
for(auto& constraint : *inConstraints)
|
for(auto& constraint : *inConstraints)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId,
|
UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||||
};
|
};
|
||||||
|
|
@ -16,9 +16,9 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId,
|
UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
||||||
UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId,
|
UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true);
|
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true);
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
||||||
};
|
};
|
||||||
|
|
@ -22,13 +22,13 @@ bool XuiCraftingTask::isCompleted()
|
||||||
switch(m_type)
|
switch(m_type)
|
||||||
{
|
{
|
||||||
case e_Crafting_SelectGroup:
|
case e_Crafting_SelectGroup:
|
||||||
if(craftScene != NULL && craftScene->getCurrentGroup() == m_group)
|
if(craftScene != nullptr && craftScene->getCurrentGroup() == m_group)
|
||||||
{
|
{
|
||||||
completed = true;
|
completed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case e_Crafting_SelectItem:
|
case e_Crafting_SelectItem:
|
||||||
if(craftScene != NULL && craftScene->isItemSelected(m_item))
|
if(craftScene != nullptr && craftScene->isItemSelected(m_item))
|
||||||
{
|
{
|
||||||
completed = true;
|
completed = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Select group
|
// Select group
|
||||||
XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL,
|
XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true )
|
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true )
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||||
m_group(groupToSelect),
|
m_group(groupToSelect),
|
||||||
|
|
@ -20,7 +20,7 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// Select Item
|
// Select Item
|
||||||
XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL,
|
XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = nullptr,
|
||||||
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true )
|
bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true )
|
||||||
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
: TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ),
|
||||||
m_item(itemId),
|
m_item(itemId),
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public:
|
||||||
virtual void StartReloadSkinThread() = 0;
|
virtual void StartReloadSkinThread() = 0;
|
||||||
virtual bool IsReloadingSkin() = 0;
|
virtual bool IsReloadingSkin() = 0;
|
||||||
virtual void CleanUpSkinReload() = 0;
|
virtual void CleanUpSkinReload() = 0;
|
||||||
virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD) = 0;
|
virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = nullptr, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD) = 0;
|
||||||
virtual bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT) = 0;
|
virtual bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT) = 0;
|
||||||
virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0;
|
virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0;
|
||||||
virtual void CloseAllPlayersScenes() = 0;
|
virtual void CloseAllPlayersScenes() = 0;
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ SavedInventoryCursorPos g_savedInventoryCursorPos = { 0.0f, 0.0f, false };
|
||||||
|
|
||||||
IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu()
|
IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu()
|
||||||
{
|
{
|
||||||
m_menu = NULL;
|
m_menu = nullptr;
|
||||||
m_autoDeleteMenu = false;
|
m_autoDeleteMenu = false;
|
||||||
m_lastPointerLabelSlot = NULL;
|
m_lastPointerLabelSlot = nullptr;
|
||||||
|
|
||||||
m_pointerPos.x = 0.0f;
|
m_pointerPos.x = 0.0f;
|
||||||
m_pointerPos.y = 0.0f;
|
m_pointerPos.y = 0.0f;
|
||||||
|
|
@ -41,7 +41,7 @@ IUIScene_AbstractContainerMenu::~IUIScene_AbstractContainerMenu()
|
||||||
|
|
||||||
void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack)
|
void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack)
|
||||||
{
|
{
|
||||||
assert( menu != NULL );
|
assert( menu != nullptr );
|
||||||
|
|
||||||
m_menu = menu;
|
m_menu = menu;
|
||||||
m_autoDeleteMenu = autoDeleteMenu;
|
m_autoDeleteMenu = autoDeleteMenu;
|
||||||
|
|
@ -267,10 +267,10 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips()
|
||||||
void IUIScene_AbstractContainerMenu::onMouseTick()
|
void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if( pMinecraft->localgameModes[getPad()] != NULL)
|
if( pMinecraft->localgameModes[getPad()] != nullptr)
|
||||||
{
|
{
|
||||||
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
|
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||||
if(tutorial != NULL)
|
if(tutorial != nullptr)
|
||||||
{
|
{
|
||||||
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP))
|
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP))
|
||||||
{
|
{
|
||||||
|
|
@ -758,17 +758,17 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||||
// What are we carrying on pointer.
|
// What are we carrying on pointer.
|
||||||
shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||||
shared_ptr<ItemInstance> carriedItem = nullptr;
|
shared_ptr<ItemInstance> carriedItem = nullptr;
|
||||||
if(player != NULL) carriedItem = player->inventory->getCarried();
|
if(player != nullptr) carriedItem = player->inventory->getCarried();
|
||||||
|
|
||||||
shared_ptr<ItemInstance> slotItem = nullptr;
|
shared_ptr<ItemInstance> slotItem = nullptr;
|
||||||
Slot *slot = NULL;
|
Slot *slot = nullptr;
|
||||||
int slotIndex = 0;
|
int slotIndex = 0;
|
||||||
if(bPointerIsOverSlot)
|
if(bPointerIsOverSlot)
|
||||||
{
|
{
|
||||||
slotIndex = iNewSlotIndex + getSectionStartOffset( eSectionUnderPointer );
|
slotIndex = iNewSlotIndex + getSectionStartOffset( eSectionUnderPointer );
|
||||||
slot = m_menu->getSlot(slotIndex);
|
slot = m_menu->getSlot(slotIndex);
|
||||||
}
|
}
|
||||||
bool bIsItemCarried = carriedItem != NULL;
|
bool bIsItemCarried = carriedItem != nullptr;
|
||||||
int iCarriedCount = 0;
|
int iCarriedCount = 0;
|
||||||
bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on pointer as is in slot under pointer.
|
bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on pointer as is in slot under pointer.
|
||||||
if ( bIsItemCarried )
|
if ( bIsItemCarried )
|
||||||
|
|
@ -788,7 +788,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||||
if ( bPointerIsOverSlot )
|
if ( bPointerIsOverSlot )
|
||||||
{
|
{
|
||||||
slotItem = slot->getItem();
|
slotItem = slot->getItem();
|
||||||
bSlotHasItem = slotItem != NULL;
|
bSlotHasItem = slotItem != nullptr;
|
||||||
if ( bSlotHasItem )
|
if ( bSlotHasItem )
|
||||||
{
|
{
|
||||||
iSlotCount = slotItem->GetCount();
|
iSlotCount = slotItem->GetCount();
|
||||||
|
|
@ -829,13 +829,13 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||||
{
|
{
|
||||||
vector<HtmlString> *desc = GetSectionHoverText(eSectionUnderPointer);
|
vector<HtmlString> *desc = GetSectionHoverText(eSectionUnderPointer);
|
||||||
SetPointerText(desc, false);
|
SetPointerText(desc, false);
|
||||||
m_lastPointerLabelSlot = NULL;
|
m_lastPointerLabelSlot = nullptr;
|
||||||
delete desc;
|
delete desc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetPointerText(NULL, false);
|
SetPointerText(nullptr, false);
|
||||||
m_lastPointerLabelSlot = NULL;
|
m_lastPointerLabelSlot = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack;
|
EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack;
|
||||||
|
|
@ -1021,7 +1021,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||||
// Get the info on this item.
|
// Get the info on this item.
|
||||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||||
bool bValidFuel = FurnaceTileEntity::isFuel(item);
|
bool bValidFuel = FurnaceTileEntity::isFuel(item);
|
||||||
bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL;
|
bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != nullptr;
|
||||||
|
|
||||||
if(bValidIngredient)
|
if(bValidIngredient)
|
||||||
{
|
{
|
||||||
|
|
@ -1036,7 +1036,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL)
|
if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr)
|
||||||
{
|
{
|
||||||
buttonY = eToolTipQuickMove;
|
buttonY = eToolTipQuickMove;
|
||||||
}
|
}
|
||||||
|
|
@ -1076,7 +1076,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL)
|
if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr)
|
||||||
{
|
{
|
||||||
buttonY = eToolTipQuickMove;
|
buttonY = eToolTipQuickMove;
|
||||||
}
|
}
|
||||||
|
|
@ -1322,10 +1322,10 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
||||||
bool bHandled = false;
|
bool bHandled = false;
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if( pMinecraft->localgameModes[getPad()] != NULL )
|
if( pMinecraft->localgameModes[getPad()] != nullptr )
|
||||||
{
|
{
|
||||||
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
|
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
|
||||||
if(tutorial != NULL)
|
if(tutorial != nullptr)
|
||||||
{
|
{
|
||||||
tutorial->handleUIInput(iAction);
|
tutorial->handleUIInput(iAction);
|
||||||
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction))
|
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction))
|
||||||
|
|
@ -1513,12 +1513,12 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
||||||
if ( bSlotHasItem )
|
if ( bSlotHasItem )
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
|
shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
|
||||||
if( Minecraft::GetInstance()->localgameModes[iPad] != NULL )
|
if( Minecraft::GetInstance()->localgameModes[iPad] != nullptr )
|
||||||
{
|
{
|
||||||
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
|
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
|
||||||
message->m_messageId = item->getUseDescriptionId();
|
message->m_messageId = item->getUseDescriptionId();
|
||||||
|
|
||||||
if(Item::items[item->id] != NULL) message->m_titleString = Item::items[item->id]->getHoverName(item);
|
if(Item::items[item->id] != nullptr) message->m_titleString = Item::items[item->id]->getHoverName(item);
|
||||||
message->m_titleId = item->getDescriptionId();
|
message->m_titleId = item->getDescriptionId();
|
||||||
|
|
||||||
message->m_icon = item->id;
|
message->m_icon = item->id;
|
||||||
|
|
@ -1526,7 +1526,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
||||||
message->m_forceDisplay = true;
|
message->m_forceDisplay = true;
|
||||||
|
|
||||||
TutorialMode *gameMode = static_cast<TutorialMode *>(Minecraft::GetInstance()->localgameModes[iPad]);
|
TutorialMode *gameMode = static_cast<TutorialMode *>(Minecraft::GetInstance()->localgameModes[iPad]);
|
||||||
gameMode->getTutorial()->setMessage(NULL, message);
|
gameMode->getTutorial()->setMessage(nullptr, message);
|
||||||
ui.PlayUISFX(eSFX_Press);
|
ui.PlayUISFX(eSFX_Press);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1628,7 +1628,7 @@ void IUIScene_AbstractContainerMenu::handleSlotListClicked(ESceneSection eSectio
|
||||||
void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum, bool quickKey)
|
void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum, bool quickKey)
|
||||||
{
|
{
|
||||||
// 4J Stu - Removed this line as unused
|
// 4J Stu - Removed this line as unused
|
||||||
//if (slot != NULL) slotId = slot->index;
|
//if (slot != nullptr) slotId = slot->index;
|
||||||
|
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick(m_menu->containerId, slotId, buttonNum, quickKey, pMinecraft->localplayers[getPad()] );
|
pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick(m_menu->containerId, slotId, buttonNum, quickKey, pMinecraft->localplayers[getPad()] );
|
||||||
|
|
@ -1645,7 +1645,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection)
|
||||||
|
|
||||||
bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB)
|
bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB)
|
||||||
{
|
{
|
||||||
if(itemA == NULL || itemB == NULL) return false;
|
if(itemA == nullptr || itemB == nullptr) return false;
|
||||||
|
|
||||||
return (itemA->id == itemB->id && (!itemB->isStackedByData() || itemB->getAuxValue() == itemA->getAuxValue()) && ItemInstance::tagMatches(itemB, itemA) );
|
return (itemA->id == itemB->id && (!itemB->isStackedByData() || itemB->getAuxValue() == itemA->getAuxValue()) && ItemInstance::tagMatches(itemB, itemA) );
|
||||||
}
|
}
|
||||||
|
|
@ -1654,7 +1654,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
|
||||||
{
|
{
|
||||||
int iResult = 0;
|
int iResult = 0;
|
||||||
|
|
||||||
if(slot != NULL && slot->hasItem())
|
if(slot != nullptr && slot->hasItem())
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = slot->getItem();
|
shared_ptr<ItemInstance> item = slot->getItem();
|
||||||
if ( item->isStackable() )
|
if ( item->isStackable() )
|
||||||
|
|
@ -1673,7 +1673,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
|
||||||
|
|
||||||
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot)
|
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot)
|
||||||
{
|
{
|
||||||
if(slot == NULL) return NULL;
|
if(slot == nullptr) return nullptr;
|
||||||
|
|
||||||
vector<HtmlString> *lines = slot->getItem()->getHoverText(nullptr, false);
|
vector<HtmlString> *lines = slot->getItem()->getHoverText(nullptr, false);
|
||||||
|
|
||||||
|
|
@ -1693,5 +1693,5 @@ vector<HtmlString> *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slo
|
||||||
|
|
||||||
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection)
|
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
IUIScene_AnvilMenu::IUIScene_AnvilMenu()
|
IUIScene_AnvilMenu::IUIScene_AnvilMenu()
|
||||||
{
|
{
|
||||||
m_inventory = nullptr;
|
m_inventory = nullptr;
|
||||||
m_repairMenu = NULL;
|
m_repairMenu = nullptr;
|
||||||
m_itemName = L"";
|
m_itemName = L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,7 +231,7 @@ void IUIScene_AnvilMenu::handleTick()
|
||||||
void IUIScene_AnvilMenu::updateItemName()
|
void IUIScene_AnvilMenu::updateItemName()
|
||||||
{
|
{
|
||||||
Slot *slot = m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT);
|
Slot *slot = m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT);
|
||||||
if (slot != NULL && slot->hasItem())
|
if (slot != nullptr && slot->hasItem())
|
||||||
{
|
{
|
||||||
if (!slot->getItem()->hasCustomHoverName() && m_itemName.compare(slot->getItem()->getHoverName())==0)
|
if (!slot->getItem()->hasCustomHoverName() && m_itemName.compare(slot->getItem()->getHoverName())==0)
|
||||||
{
|
{
|
||||||
|
|
@ -257,10 +257,10 @@ void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotI
|
||||||
{
|
{
|
||||||
if (slotIndex == AnvilMenu::INPUT_SLOT)
|
if (slotIndex == AnvilMenu::INPUT_SLOT)
|
||||||
{
|
{
|
||||||
m_itemName = item == NULL ? L"" : item->getHoverName();
|
m_itemName = item == nullptr ? L"" : item->getHoverName();
|
||||||
setEditNameValue(m_itemName);
|
setEditNameValue(m_itemName);
|
||||||
setEditNameEditable(item != NULL);
|
setEditNameEditable(item != nullptr);
|
||||||
if (item != NULL)
|
if (item != nullptr)
|
||||||
{
|
{
|
||||||
updateItemName();
|
updateItemName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection, i
|
||||||
{
|
{
|
||||||
case eSectionBeaconConfirm:
|
case eSectionBeaconConfirm:
|
||||||
{
|
{
|
||||||
if( (m_beacon->getItem(0) == NULL) || (m_beacon->getPrimaryPower() <= 0) ) return;
|
if( (m_beacon->getItem(0) == nullptr) || (m_beacon->getPrimaryPower() <= 0) ) return;
|
||||||
ByteArrayOutputStream baos;
|
ByteArrayOutputStream baos;
|
||||||
DataOutputStream dos(&baos);
|
DataOutputStream dos(&baos);
|
||||||
dos.writeInt(m_beacon->getPrimaryPower());
|
dos.writeInt(m_beacon->getPrimaryPower());
|
||||||
|
|
@ -286,7 +286,7 @@ void IUIScene_BeaconMenu::handleTick()
|
||||||
|
|
||||||
for (int c = 0; c < count; c++)
|
for (int c = 0; c < count; c++)
|
||||||
{
|
{
|
||||||
if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue;
|
if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue;
|
||||||
|
|
||||||
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
|
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
|
||||||
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();
|
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();
|
||||||
|
|
@ -315,7 +315,7 @@ void IUIScene_BeaconMenu::handleTick()
|
||||||
|
|
||||||
for (int c = 0; c < count - 1; c++)
|
for (int c = 0; c < count - 1; c++)
|
||||||
{
|
{
|
||||||
if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue;
|
if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue;
|
||||||
|
|
||||||
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
|
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
|
||||||
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();
|
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();
|
||||||
|
|
@ -355,7 +355,7 @@ void IUIScene_BeaconMenu::handleTick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetConfirmButtonEnabled( (m_beacon->getItem(0) != NULL) && (m_beacon->getPrimaryPower() > 0) );
|
SetConfirmButtonEnabled( (m_beacon->getItem(0) != nullptr) && (m_beacon->getPrimaryPower() > 0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int IUIScene_BeaconMenu::GetId(int tier, int effectId)
|
int IUIScene_BeaconMenu::GetId(int tier, int effectId)
|
||||||
|
|
@ -365,7 +365,7 @@ int IUIScene_BeaconMenu::GetId(int tier, int effectId)
|
||||||
|
|
||||||
vector<HtmlString> *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSection)
|
vector<HtmlString> *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSection)
|
||||||
{
|
{
|
||||||
vector<HtmlString> *desc = NULL;
|
vector<HtmlString> *desc = nullptr;
|
||||||
switch(eSection)
|
switch(eSection)
|
||||||
{
|
{
|
||||||
case eSectionBeaconSecondaryTwo:
|
case eSectionBeaconSecondaryTwo:
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue