mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-27 16:05:50 +00:00
refactor: replace NULL with nullptr across C++ codebase
Excludes vendored C libs (zlib, Miles, DirectXMath, boost, Iggy).
This commit is contained in:
@@ -107,7 +107,7 @@ std::shared_ptr<ItemInstance> SynchedEntityData::getItemInstance(int id) {
|
||||
|
||||
Pos* SynchedEntityData::getPos(int id) {
|
||||
assert(false); // 4J - not currently implemented
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SynchedEntityData::set(int id, int value) {
|
||||
@@ -187,7 +187,7 @@ void SynchedEntityData::pack(
|
||||
std::vector<std::shared_ptr<DataItem> >* items,
|
||||
DataOutputStream* output) // TODO throws IOException
|
||||
{
|
||||
if (items != NULL) {
|
||||
if (items != nullptr) {
|
||||
AUTO_VAR(itEnd, items->end());
|
||||
for (AUTO_VAR(it, items->begin()); it != itEnd; it++) {
|
||||
std::shared_ptr<DataItem> dataItem = *it;
|
||||
@@ -201,15 +201,15 @@ void SynchedEntityData::pack(
|
||||
|
||||
std::vector<std::shared_ptr<SynchedEntityData::DataItem> >*
|
||||
SynchedEntityData::packDirty() {
|
||||
std::vector<std::shared_ptr<DataItem> >* result = NULL;
|
||||
std::vector<std::shared_ptr<DataItem> >* result = nullptr;
|
||||
|
||||
if (m_isDirty) {
|
||||
for (int i = 0; i <= MAX_ID_VALUE; i++) {
|
||||
std::shared_ptr<DataItem> dataItem = itemsById[i];
|
||||
if ((dataItem != NULL) && dataItem->isDirty()) {
|
||||
if ((dataItem != nullptr) && dataItem->isDirty()) {
|
||||
dataItem->setDirty(false);
|
||||
|
||||
if (result == NULL) {
|
||||
if (result == nullptr) {
|
||||
result = new std::vector<std::shared_ptr<DataItem> >();
|
||||
}
|
||||
result->push_back(dataItem);
|
||||
@@ -225,7 +225,7 @@ void SynchedEntityData::packAll(DataOutputStream* output) // throws IOException
|
||||
{
|
||||
for (int i = 0; i <= MAX_ID_VALUE; i++) {
|
||||
std::shared_ptr<DataItem> dataItem = itemsById[i];
|
||||
if (dataItem != NULL) {
|
||||
if (dataItem != nullptr) {
|
||||
writeDataItem(output, dataItem);
|
||||
}
|
||||
}
|
||||
@@ -236,12 +236,12 @@ void SynchedEntityData::packAll(DataOutputStream* output) // throws IOException
|
||||
|
||||
std::vector<std::shared_ptr<SynchedEntityData::DataItem> >*
|
||||
SynchedEntityData::getAll() {
|
||||
std::vector<std::shared_ptr<DataItem> >* result = NULL;
|
||||
std::vector<std::shared_ptr<DataItem> >* result = nullptr;
|
||||
|
||||
for (int i = 0; i <= MAX_ID_VALUE; i++) {
|
||||
std::shared_ptr<DataItem> dataItem = itemsById[i];
|
||||
if (dataItem != NULL) {
|
||||
if (result == NULL) {
|
||||
if (dataItem != nullptr) {
|
||||
if (result == nullptr) {
|
||||
result = new std::vector<std::shared_ptr<DataItem> >();
|
||||
}
|
||||
result->push_back(dataItem);
|
||||
@@ -294,12 +294,12 @@ void SynchedEntityData::writeDataItem(
|
||||
std::vector<std::shared_ptr<SynchedEntityData::DataItem> >*
|
||||
SynchedEntityData::unpack(DataInputStream* input) // throws IOException
|
||||
{
|
||||
std::vector<std::shared_ptr<DataItem> >* result = NULL;
|
||||
std::vector<std::shared_ptr<DataItem> >* result = nullptr;
|
||||
|
||||
int currentHeader = input->readByte();
|
||||
|
||||
while (currentHeader != EOF_MARKER) {
|
||||
if (result == NULL) {
|
||||
if (result == nullptr) {
|
||||
result = new std::vector<std::shared_ptr<DataItem> >();
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ SynchedEntityData::unpack(DataInputStream* input) // throws IOException
|
||||
" ------ garbage data, or early end of stream due to an "
|
||||
"incomplete packet\n");
|
||||
delete result;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
break;
|
||||
}
|
||||
result->push_back(item);
|
||||
@@ -368,7 +368,7 @@ void SynchedEntityData::assignValues(
|
||||
std::shared_ptr<DataItem> item = *it;
|
||||
|
||||
std::shared_ptr<DataItem> itemFromId = itemsById[item->getId()];
|
||||
if (itemFromId != NULL) {
|
||||
if (itemFromId != nullptr) {
|
||||
switch (item->getType()) {
|
||||
case TYPE_BYTE:
|
||||
itemFromId->setValue(item->getValue_byte());
|
||||
@@ -408,7 +408,7 @@ int SynchedEntityData::getSizeInBytes() {
|
||||
|
||||
for (int i = 0; i <= MAX_ID_VALUE; i++) {
|
||||
std::shared_ptr<DataItem> dataItem = itemsById[i];
|
||||
if (dataItem != NULL) {
|
||||
if (dataItem != nullptr) {
|
||||
size += 1;
|
||||
|
||||
// write value
|
||||
|
||||
Reference in New Issue
Block a user