More nullptrs

This commit is contained in:
Alexander Batalov 2024-01-16 17:15:00 +03:00
parent 250203ec4c
commit 73669d78d2
13 changed files with 40 additions and 40 deletions

View File

@ -15,7 +15,7 @@ namespace fallout {
bool autorunMutexCreate()
{
#ifdef _WIN32
gInterplayGenericAutorunMutex = CreateMutexA(NULL, FALSE, "InterplayGenericAutorunMutex");
gInterplayGenericAutorunMutex = CreateMutexA(nullptr, FALSE, "InterplayGenericAutorunMutex");
if (GetLastError() == ERROR_ALREADY_EXISTS) {
CloseHandle(gInterplayGenericAutorunMutex);
return false;
@ -29,7 +29,7 @@ bool autorunMutexCreate()
void autorunMutexClose()
{
#ifdef _WIN32
if (gInterplayGenericAutorunMutex != NULL) {
if (gInterplayGenericAutorunMutex != nullptr) {
CloseHandle(gInterplayGenericAutorunMutex);
}
#endif

View File

@ -4130,7 +4130,7 @@ static int characterEditorShowOptions()
getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 609));
strcpy(string5, getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 610));
if (showDialogBox(string4, dialogBody, 1, 169, 126, _colorTable[32328], NULL, _colorTable[32328], DIALOG_BOX_YES_NO) != 0) {
if (showDialogBox(string4, dialogBody, 1, 169, 126, _colorTable[32328], nullptr, _colorTable[32328], DIALOG_BOX_YES_NO) != 0) {
shouldSave = true;
} else {
shouldSave = false;

View File

@ -2365,7 +2365,7 @@ Object* _combat_whose_turn()
if (isInCombat()) {
return _combat_turn_obj;
} else {
return NULL;
return nullptr;
}
}

View File

@ -1294,9 +1294,9 @@ static int _compare_nearer(const void* a1, const void* a2)
if (object1 == nullptr && object2 == nullptr) {
return 0;
} else if (object1 != NULL && object2 == NULL) {
} else if (object1 != nullptr && object2 == nullptr) {
return -1;
} else if (object1 == NULL && object2 != NULL) {
} else if (object1 == nullptr && object2 != nullptr) {
return 1;
}
@ -1331,9 +1331,9 @@ static int _compare_strength(const void* a1, const void* a2)
if (object1 == nullptr && object2 == nullptr) {
return 0;
} else if (object1 != NULL && object2 == NULL) {
} else if (object1 != nullptr && object2 == nullptr) {
return -1;
} else if (object1 == NULL && object2 != NULL) {
} else if (object1 == nullptr && object2 != nullptr) {
return 1;
}
@ -1367,9 +1367,9 @@ static int _compare_weakness(const void* a1, const void* a2)
if (object1 == nullptr && object2 == nullptr) {
return 0;
} else if (object1 != NULL && object2 == NULL) {
} else if (object1 != nullptr && object2 == nullptr) {
return -1;
} else if (object1 == NULL && object2 != NULL) {
} else if (object1 == nullptr && object2 != nullptr) {
return 1;
}

View File

@ -770,7 +770,7 @@ char* killTypeGetName(int killType)
MessageListItem messageListItem;
return getmsg(&gProtoMessageList, &messageListItem, 1450 + killType);
} else {
return NULL;
return nullptr;
}
} else {
return byte_501494;
@ -785,7 +785,7 @@ char* killTypeGetDescription(int killType)
MessageListItem messageListItem;
return getmsg(&gProtoMessageList, &messageListItem, 1469 + killType);
} else {
return NULL;
return nullptr;
}
} else {
return byte_501494;

View File

@ -5188,7 +5188,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
if (keyCode >= 1000 && keyCode <= 1000 + gInventorySlotsCount) {
if (gInventoryCursor == INVENTORY_WINDOW_CURSOR_ARROW) {
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, playerTable, NULL, -1);
inventoryWindowRenderInnerInventories(win, playerTable, nullptr, -1);
} else {
int slotIndex = keyCode - 1000;
if (slotIndex + _stack_offset[_curr_stack] < _pud->length) {
@ -5197,7 +5197,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
_barter_move_inventory(inventoryItem->item, inventoryItem->quantity, slotIndex, stackOffset, barterer, playerTable, true);
_display_target_inventory(_target_stack_offset[_target_curr_stack], -1, _target_pud, INVENTORY_WINDOW_TYPE_TRADE);
_display_inventory(_stack_offset[_curr_stack], -1, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, playerTable, NULL, -1);
inventoryWindowRenderInnerInventories(win, playerTable, nullptr, -1);
}
}
@ -5205,7 +5205,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
} else if (keyCode >= 2000 && keyCode <= 2000 + gInventorySlotsCount) {
if (gInventoryCursor == INVENTORY_WINDOW_CURSOR_ARROW) {
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, NULL, bartererTable, -1);
inventoryWindowRenderInnerInventories(win, nullptr, bartererTable, -1);
} else {
int slotIndex = keyCode - 2000;
if (slotIndex + _target_stack_offset[_target_curr_stack] < _target_pud->length) {
@ -5214,7 +5214,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
_barter_move_inventory(inventoryItem->item, inventoryItem->quantity, slotIndex, stackOffset, barterer, bartererTable, false);
_display_target_inventory(_target_stack_offset[_target_curr_stack], -1, _target_pud, INVENTORY_WINDOW_TYPE_TRADE);
_display_inventory(_stack_offset[_curr_stack], -1, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, NULL, bartererTable, -1);
inventoryWindowRenderInnerInventories(win, nullptr, bartererTable, -1);
}
}
@ -5222,7 +5222,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
} else if (keyCode >= 2300 && keyCode <= 2300 + gInventorySlotsCount) {
if (gInventoryCursor == INVENTORY_WINDOW_CURSOR_ARROW) {
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, playerTable, NULL, -1);
inventoryWindowRenderInnerInventories(win, playerTable, nullptr, -1);
} else {
int itemIndex = keyCode - 2300;
if (itemIndex < _ptable_pud->length) {
@ -5230,7 +5230,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
_barter_move_from_table_inventory(inventoryItem->item, inventoryItem->quantity, itemIndex, barterer, playerTable, true);
_display_target_inventory(_target_stack_offset[_target_curr_stack], -1, _target_pud, INVENTORY_WINDOW_TYPE_TRADE);
_display_inventory(_stack_offset[_curr_stack], -1, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, playerTable, NULL, -1);
inventoryWindowRenderInnerInventories(win, playerTable, nullptr, -1);
}
}
@ -5238,7 +5238,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
} else if (keyCode >= 2400 && keyCode <= 2400 + gInventorySlotsCount) {
if (gInventoryCursor == INVENTORY_WINDOW_CURSOR_ARROW) {
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, NULL, bartererTable, -1);
inventoryWindowRenderInnerInventories(win, nullptr, bartererTable, -1);
} else {
int v45 = keyCode - 2400;
if (v45 < _btable_pud->length) {
@ -5246,7 +5246,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
_barter_move_from_table_inventory(inventoryItem->item, inventoryItem->quantity, v45, barterer, bartererTable, false);
_display_target_inventory(_target_stack_offset[_target_curr_stack], -1, _target_pud, INVENTORY_WINDOW_TYPE_TRADE);
_display_inventory(_stack_offset[_curr_stack], -1, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, NULL, bartererTable, -1);
inventoryWindowRenderInnerInventories(win, nullptr, bartererTable, -1);
}
}

View File

@ -7,9 +7,9 @@
// Modelled after SDL_AndroidGetExternalStoragePath.
const char* iOSGetDocumentsPath()
{
static char* s_iOSDocumentsPath = NULL;
static char* s_iOSDocumentsPath = nullptr;
if (s_iOSDocumentsPath == NULL) {
if (s_iOSDocumentsPath == nullptr) {
@autoreleasepool {
NSArray* array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
@ -19,7 +19,7 @@ const char* iOSGetDocumentsPath()
if (base) {
const size_t len = SDL_strlen(base) + 2;
s_iOSDocumentsPath = (char*)SDL_malloc(len);
if (s_iOSDocumentsPath == NULL) {
if (s_iOSDocumentsPath == nullptr) {
SDL_OutOfMemory();
} else {
SDL_snprintf(s_iOSDocumentsPath, len, "%s/", base);

View File

@ -1672,7 +1672,7 @@ static int _check_door_state(Object* a1, Object* a2)
CacheEntry* artHandle;
Art* art = artLock(a1->fid, &artHandle);
if (art == NULL) {
if (art == nullptr) {
return -1;
}

View File

@ -37,8 +37,8 @@ char* pcStatGetName(int pcStat);
char* pcStatGetDescription(int pcStat);
int statGetFrmId(int stat);
int statRoll(Object* critter, int stat, int modifier, int* howMuch);
int pcAddExperience(int xp, int* xpGained = NULL);
int pcAddExperienceWithOptions(int xp, bool a2, int* xpGained = NULL);
int pcAddExperience(int xp, int* xpGained = nullptr);
int pcAddExperienceWithOptions(int xp, bool a2, int* xpGained = nullptr);
int pcSetExperience(int a1);
static inline bool statIsValid(int stat)

View File

@ -380,7 +380,7 @@ static bool createRenderer(int width, int height)
}
gSdlTextureSurface = SDL_CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format);
if (gSdlTextureSurface == NULL) {
if (gSdlTextureSurface == nullptr) {
return false;
}

View File

@ -23,7 +23,7 @@ namespace fallout {
bool gProgramIsActive = false;
// GNW95MUTEX
HANDLE _GNW95_mutex = NULL;
HANDLE _GNW95_mutex = nullptr;
// 0x4DE700
int main(int argc, char* argv[])

View File

@ -1329,7 +1329,7 @@ void programWindowSetTitle(const char* title)
#ifdef _WIN32
if (_GNW95_title_mutex == INVALID_HANDLE_VALUE) {
_GNW95_title_mutex = CreateMutexA(NULL, TRUE, title);
_GNW95_title_mutex = CreateMutexA(nullptr, TRUE, title);
if (GetLastError() != ERROR_SUCCESS) {
_GNW95_already_running = true;
return;

View File

@ -2204,7 +2204,7 @@ static int wmParseSubConditional(char** stringPtr, const char* a2, int* typePtr,
*paramPtr = atoi(string);
pch = strstr(string, ")");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
@ -2216,12 +2216,12 @@ static int wmParseSubConditional(char** stringPtr, const char* a2, int* typePtr,
*valuePtr = atoi(string);
pch = strstr(string, ")");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
pch = strstr(string, ",");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
*stringPtr = string;
@ -2239,12 +2239,12 @@ static int wmParseSubConditional(char** stringPtr, const char* a2, int* typePtr,
*valuePtr = atoi(string);
pch = strstr(string, ")");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
pch = strstr(string, ",");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
*stringPtr = string;
@ -2262,12 +2262,12 @@ static int wmParseSubConditional(char** stringPtr, const char* a2, int* typePtr,
*valuePtr = atoi(string);
pch = strstr(string, ")");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
pch = strstr(string, ",");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
*stringPtr = string;
@ -2285,12 +2285,12 @@ static int wmParseSubConditional(char** stringPtr, const char* a2, int* typePtr,
*valuePtr = atoi(string);
pch = strstr(string, ")");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
pch = strstr(string, ",");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
*stringPtr = string;
@ -2308,12 +2308,12 @@ static int wmParseSubConditional(char** stringPtr, const char* a2, int* typePtr,
*valuePtr = atoi(string);
pch = strstr(string, ")");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
pch = strstr(string, ",");
if (pch != NULL) {
if (pch != nullptr) {
string = pch + 1;
}
*stringPtr = string;