mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-19 02:28:08 +00:00
refactor: replace NULL with nullptr across C++ codebase
Excludes vendored C libs (zlib, Miles, DirectXMath, boost, Iggy).
This commit is contained in:
@@ -338,15 +338,15 @@ intArray Textures::loadTexturePixels(TEXTURE_NAME texId,
|
||||
intArray id = pixelsMap[resourceName];
|
||||
// 4J - if resourceName isn't in the map, it should add an element and
|
||||
// as that will use the default constructor, its internal data pointer
|
||||
// will be NULL
|
||||
if (id.data != NULL) return id;
|
||||
// will be nullptr
|
||||
if (id.data != nullptr) return id;
|
||||
}
|
||||
|
||||
// 4J - removed try/catch
|
||||
// try {
|
||||
intArray res;
|
||||
// wstring in = skin->getResource(resourceName);
|
||||
if (false) // 4J - removed - was ( in == NULL)
|
||||
if (false) // 4J - removed - was ( in == nullptr)
|
||||
{
|
||||
res = loadTexturePixels(missingNo);
|
||||
} else {
|
||||
@@ -616,7 +616,7 @@ int Textures::loadTexture(TEXTURE_NAME texId,
|
||||
if (clamp) pathName = resourceName.substr(7);
|
||||
|
||||
// wstring in = skins->getSelected()->getResource(pathName);
|
||||
if (false) // 4J - removed was ( in == NULL)
|
||||
if (false) // 4J - removed was ( in == nullptr)
|
||||
{
|
||||
loadTexture(missingNo, id, blur, clamp);
|
||||
} else {
|
||||
@@ -701,7 +701,7 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) {
|
||||
intArray rawPixels(w * h);
|
||||
img->getRGB(0, 0, w, h, rawPixels, 0, w);
|
||||
|
||||
if (options != NULL && options->anaglyph3d) {
|
||||
if (options != nullptr && options->anaglyph3d) {
|
||||
rawPixels = anaglyph(rawPixels);
|
||||
}
|
||||
|
||||
@@ -841,7 +841,7 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
if (options != NULL && options->anaglyph3d) {
|
||||
if (options != nullptr && options->anaglyph3d) {
|
||||
rawPixels = anaglyph(rawPixels);
|
||||
}
|
||||
|
||||
@@ -852,7 +852,7 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) {
|
||||
int g = (rawPixels[i] >> 8) & 0xff;
|
||||
int b = (rawPixels[i]) & 0xff;
|
||||
|
||||
if (options != NULL && options->anaglyph3d) {
|
||||
if (options != nullptr && options->anaglyph3d) {
|
||||
int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||
int gg = (r * 30 + g * 70) / (100);
|
||||
int bb = (r * 30 + b * 70) / (100);
|
||||
@@ -928,8 +928,8 @@ void Textures::releaseTexture(int id) {
|
||||
int Textures::loadHttpTexture(const std::wstring& url,
|
||||
const std::wstring& backup) {
|
||||
HttpTexture* texture = httpTextures[url];
|
||||
if (texture != NULL) {
|
||||
if (texture->loadedImage != NULL && !texture->isLoaded) {
|
||||
if (texture != nullptr) {
|
||||
if (texture->loadedImage != nullptr && !texture->isLoaded) {
|
||||
if (texture->id < 0) {
|
||||
texture->id = getTexture(texture->loadedImage);
|
||||
} else {
|
||||
@@ -938,7 +938,7 @@ int Textures::loadHttpTexture(const std::wstring& url,
|
||||
texture->isLoaded = true;
|
||||
}
|
||||
}
|
||||
if (texture == NULL || texture->id < 0) {
|
||||
if (texture == nullptr || texture->id < 0) {
|
||||
if (backup.empty()) return -1;
|
||||
return loadTexture(TN_COUNT, backup);
|
||||
}
|
||||
@@ -947,8 +947,8 @@ int Textures::loadHttpTexture(const std::wstring& url,
|
||||
|
||||
int Textures::loadHttpTexture(const std::wstring& url, int backup) {
|
||||
HttpTexture* texture = httpTextures[url];
|
||||
if (texture != NULL) {
|
||||
if (texture->loadedImage != NULL && !texture->isLoaded) {
|
||||
if (texture != nullptr) {
|
||||
if (texture->loadedImage != nullptr && !texture->isLoaded) {
|
||||
if (texture->id < 0) {
|
||||
texture->id = getTexture(texture->loadedImage);
|
||||
} else {
|
||||
@@ -957,7 +957,7 @@ int Textures::loadHttpTexture(const std::wstring& url, int backup) {
|
||||
texture->isLoaded = true;
|
||||
}
|
||||
}
|
||||
if (texture == NULL || texture->id < 0) {
|
||||
if (texture == nullptr || texture->id < 0) {
|
||||
return loadTexture(backup);
|
||||
}
|
||||
return texture->id;
|
||||
@@ -970,7 +970,7 @@ bool Textures::hasHttpTexture(const std::wstring& url) {
|
||||
HttpTexture* Textures::addHttpTexture(const std::wstring& url,
|
||||
HttpTextureProcessor* processor) {
|
||||
HttpTexture* texture = httpTextures[url];
|
||||
if (texture == NULL) {
|
||||
if (texture == nullptr) {
|
||||
httpTextures[url] = new HttpTexture(url, processor);
|
||||
} else {
|
||||
texture->count++;
|
||||
@@ -980,7 +980,7 @@ HttpTexture* Textures::addHttpTexture(const std::wstring& url,
|
||||
|
||||
void Textures::removeHttpTexture(const std::wstring& url) {
|
||||
HttpTexture* texture = httpTextures[url];
|
||||
if (texture != NULL) {
|
||||
if (texture != nullptr) {
|
||||
texture->count--;
|
||||
if (texture->count == 0) {
|
||||
if (texture->id >= 0) releaseTexture(texture->id);
|
||||
@@ -992,17 +992,17 @@ void Textures::removeHttpTexture(const std::wstring& url) {
|
||||
// 4J-PB - adding for texture in memory (from global title storage)
|
||||
int Textures::loadMemTexture(const std::wstring& url,
|
||||
const std::wstring& backup) {
|
||||
MemTexture* texture = NULL;
|
||||
MemTexture* texture = nullptr;
|
||||
AUTO_VAR(it, memTextures.find(url));
|
||||
if (it != memTextures.end()) {
|
||||
texture = (*it).second;
|
||||
}
|
||||
if (texture == NULL && app.IsFileInMemoryTextures(url)) {
|
||||
if (texture == nullptr && app.IsFileInMemoryTextures(url)) {
|
||||
// If we haven't loaded it yet, but we have the data for it then add it
|
||||
texture = addMemTexture(url, new MobSkinMemTextureProcessor());
|
||||
}
|
||||
if (texture != NULL) {
|
||||
if (texture->loadedImage != NULL && !texture->isLoaded) {
|
||||
if (texture != nullptr) {
|
||||
if (texture->loadedImage != nullptr && !texture->isLoaded) {
|
||||
// 4J - Disable mipmapping in general for skins & capes. Have seen
|
||||
// problems with edge-on polys for some eg mumbo jumbo
|
||||
if ((url.substr(0, 7) == L"dlcskin") ||
|
||||
@@ -1021,7 +1021,7 @@ int Textures::loadMemTexture(const std::wstring& url,
|
||||
MIPMAP = true;
|
||||
}
|
||||
}
|
||||
if (texture == NULL || texture->id < 0) {
|
||||
if (texture == nullptr || texture->id < 0) {
|
||||
if (backup.empty()) return -1;
|
||||
return loadTexture(TN_COUNT, backup);
|
||||
}
|
||||
@@ -1029,18 +1029,18 @@ int Textures::loadMemTexture(const std::wstring& url,
|
||||
}
|
||||
|
||||
int Textures::loadMemTexture(const std::wstring& url, int backup) {
|
||||
MemTexture* texture = NULL;
|
||||
MemTexture* texture = nullptr;
|
||||
AUTO_VAR(it, memTextures.find(url));
|
||||
if (it != memTextures.end()) {
|
||||
texture = (*it).second;
|
||||
}
|
||||
if (texture == NULL && app.IsFileInMemoryTextures(url)) {
|
||||
if (texture == nullptr && app.IsFileInMemoryTextures(url)) {
|
||||
// If we haven't loaded it yet, but we have the data for it then add it
|
||||
texture = addMemTexture(url, new MobSkinMemTextureProcessor());
|
||||
}
|
||||
if (texture != NULL) {
|
||||
if (texture != nullptr) {
|
||||
texture->ticksSinceLastUse = 0;
|
||||
if (texture->loadedImage != NULL && !texture->isLoaded) {
|
||||
if (texture->loadedImage != nullptr && !texture->isLoaded) {
|
||||
// 4J - Disable mipmapping in general for skins & capes. Have seen
|
||||
// problems with edge-on polys for some eg mumbo jumbo
|
||||
if ((url.substr(0, 7) == L"dlcskin") ||
|
||||
@@ -1058,7 +1058,7 @@ int Textures::loadMemTexture(const std::wstring& url, int backup) {
|
||||
MIPMAP = true;
|
||||
}
|
||||
}
|
||||
if (texture == NULL || texture->id < 0) {
|
||||
if (texture == nullptr || texture->id < 0) {
|
||||
return loadTexture(backup);
|
||||
}
|
||||
return texture->id;
|
||||
@@ -1066,14 +1066,14 @@ int Textures::loadMemTexture(const std::wstring& url, int backup) {
|
||||
|
||||
MemTexture* Textures::addMemTexture(const std::wstring& name,
|
||||
MemTextureProcessor* processor) {
|
||||
MemTexture* texture = NULL;
|
||||
MemTexture* texture = nullptr;
|
||||
AUTO_VAR(it, memTextures.find(name));
|
||||
if (it != memTextures.end()) {
|
||||
texture = (*it).second;
|
||||
}
|
||||
if (texture == NULL) {
|
||||
if (texture == nullptr) {
|
||||
// can we find it in the app mem files?
|
||||
std::uint8_t* pbData = NULL;
|
||||
std::uint8_t* pbData = nullptr;
|
||||
unsigned int dwBytes = 0;
|
||||
app.GetMemFileDetails(name, &pbData, &dwBytes);
|
||||
|
||||
@@ -1083,7 +1083,7 @@ MemTexture* Textures::addMemTexture(const std::wstring& name,
|
||||
} else {
|
||||
// 4J Stu - Make an entry for this anyway and we can populate it
|
||||
// later
|
||||
memTextures[name] = NULL;
|
||||
memTextures[name] = nullptr;
|
||||
}
|
||||
} else {
|
||||
texture->count++;
|
||||
@@ -1098,7 +1098,7 @@ MemTexture* Textures::addMemTexture(const std::wstring& name,
|
||||
// *processor)
|
||||
// {
|
||||
// MemTexture *texture = memTextures[url];
|
||||
// if (texture != NULL)
|
||||
// if (texture != nullptr)
|
||||
// {
|
||||
// texture->count++;
|
||||
// }
|
||||
@@ -1106,15 +1106,15 @@ MemTexture* Textures::addMemTexture(const std::wstring& name,
|
||||
// }
|
||||
|
||||
void Textures::removeMemTexture(const std::wstring& url) {
|
||||
MemTexture* texture = NULL;
|
||||
MemTexture* texture = nullptr;
|
||||
AUTO_VAR(it, memTextures.find(url));
|
||||
if (it != memTextures.end()) {
|
||||
texture = (*it).second;
|
||||
|
||||
// If it's NULL then we should just remove the entry
|
||||
if (texture == NULL) memTextures.erase(url);
|
||||
// If it's nullptr then we should just remove the entry
|
||||
if (texture == nullptr) memTextures.erase(url);
|
||||
}
|
||||
if (texture != NULL) {
|
||||
if (texture != nullptr) {
|
||||
texture->count--;
|
||||
if (texture->count == 0) {
|
||||
if (texture->id >= 0) releaseTexture(texture->id);
|
||||
@@ -1214,7 +1214,7 @@ Icon* Textures::getMissingIcon(int type) {
|
||||
BufferedImage* Textures::readImage(
|
||||
TEXTURE_NAME texId, const std::wstring& name) // 4J was InputStream *in
|
||||
{
|
||||
BufferedImage* img = NULL;
|
||||
BufferedImage* img = nullptr;
|
||||
MemSect(32);
|
||||
// is this image one of the Title Update ones?
|
||||
bool isTu = IsTUImage(texId, name);
|
||||
|
||||
Reference in New Issue
Block a user