diff --git a/src/autorun.cc b/src/autorun.cc index 97aabd7..ce97847 100644 --- a/src/autorun.cc +++ b/src/autorun.cc @@ -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 diff --git a/src/character_editor.cc b/src/character_editor.cc index f58882c..49e0124 100644 --- a/src/character_editor.cc +++ b/src/character_editor.cc @@ -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; diff --git a/src/combat.cc b/src/combat.cc index c7881a3..5ee50c5 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -2365,7 +2365,7 @@ Object* _combat_whose_turn() if (isInCombat()) { return _combat_turn_obj; } else { - return NULL; + return nullptr; } } diff --git a/src/combat_ai.cc b/src/combat_ai.cc index 2522b23..ea3e836 100644 --- a/src/combat_ai.cc +++ b/src/combat_ai.cc @@ -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; } diff --git a/src/critter.cc b/src/critter.cc index 8289813..a99af5e 100644 --- a/src/critter.cc +++ b/src/critter.cc @@ -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; diff --git a/src/inventory.cc b/src/inventory.cc index f5ee1de..0fd74d4 100644 --- a/src/inventory.cc +++ b/src/inventory.cc @@ -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); } } diff --git a/src/platform/ios/paths.mm b/src/platform/ios/paths.mm index d396ad8..8a42444 100644 --- a/src/platform/ios/paths.mm +++ b/src/platform/ios/paths.mm @@ -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); diff --git a/src/proto_instance.cc b/src/proto_instance.cc index c93eb5c..9aecded 100644 --- a/src/proto_instance.cc +++ b/src/proto_instance.cc @@ -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; } diff --git a/src/stat.h b/src/stat.h index ade6efe..eb0adff 100644 --- a/src/stat.h +++ b/src/stat.h @@ -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) diff --git a/src/svga.cc b/src/svga.cc index ed1c15f..2930d6a 100644 --- a/src/svga.cc +++ b/src/svga.cc @@ -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; } diff --git a/src/win32.cc b/src/win32.cc index c9b8330..1f86919 100644 --- a/src/win32.cc +++ b/src/win32.cc @@ -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[]) diff --git a/src/window_manager.cc b/src/window_manager.cc index 4941ce2..5b55351 100644 --- a/src/window_manager.cc +++ b/src/window_manager.cc @@ -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; diff --git a/src/worldmap.cc b/src/worldmap.cc index ffc1502..4d2495f 100644 --- a/src/worldmap.cc +++ b/src/worldmap.cc @@ -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;