mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use nullptr instead of NULL in C++
This commit is contained in:
parent
2c8528798f
commit
77c4fa00bc
|
@ -475,7 +475,7 @@ const translucent_window_palette TranslucentWindowPalettes[COLOUR_COUNT] = {
|
|||
};
|
||||
|
||||
void (*mask_fn)(sint32 width, sint32 height, const uint8 * RESTRICT maskSrc, const uint8 * RESTRICT colourSrc,
|
||||
uint8 * RESTRICT dst, sint32 maskWrap, sint32 colourWrap, sint32 dstWrap) = NULL;
|
||||
uint8 * RESTRICT dst, sint32 maskWrap, sint32 colourWrap, sint32 dstWrap) = nullptr;
|
||||
|
||||
void mask_init()
|
||||
{
|
||||
|
@ -510,7 +510,7 @@ void gfx_filter_pixel(rct_drawpixelinfo *dpi, sint32 x, sint32 y, FILTER_PALETTE
|
|||
void gfx_transpose_palette(sint32 pal, uint8 product)
|
||||
{
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(pal);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
sint32 width = g1->width;
|
||||
sint32 x = g1->x_offset;
|
||||
|
@ -542,13 +542,13 @@ void load_palette()
|
|||
|
||||
uint32 palette = 0x5FC;
|
||||
|
||||
if (water_type != NULL) {
|
||||
if (water_type != nullptr) {
|
||||
openrct2_assert(water_type->image_id != (uint32)-1, "Failed to load water palette");
|
||||
palette = water_type->image_id;
|
||||
}
|
||||
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(palette);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
sint32 width = g1->width;
|
||||
sint32 x = g1->x_offset;
|
||||
|
@ -640,7 +640,7 @@ void gfx_invalidate_pickedup_peep()
|
|||
if (sprite != UINT32_MAX)
|
||||
{
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(sprite & 0x7FFFF);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
sint32 left = gPickupPeepX + g1->x_offset;
|
||||
sint32 top = gPickupPeepY + g1->y_offset;
|
||||
|
|
|
@ -45,7 +45,7 @@ void font_sprite_initialise_characters()
|
|||
sint32 glyphOffset = fontSize * FONT_SPRITE_GLYPH_COUNT;
|
||||
for (uint8 glyphIndex = 0; glyphIndex < FONT_SPRITE_GLYPH_COUNT; glyphIndex++) {
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(glyphIndex + SPR_CHAR_START + glyphOffset);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
sint32 width = g1->width + 2 * g1->x_offset;
|
||||
width += fontSize == FONT_SIZE_BIG ? 1 : -1;
|
||||
|
@ -250,7 +250,7 @@ bool font_supports_string_ttf(const utf8 *text, sint32 fontSize)
|
|||
#ifndef NO_TTF
|
||||
const utf8 *src = text;
|
||||
const TTF_Font *font = gCurrentTTFFontSet->size[fontSize].font;
|
||||
if (font == NULL) {
|
||||
if (font == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ static uint8 _bakedLightTexture_spot_3[256 * 256];
|
|||
static rct_drawpixelinfo _pixelInfo;
|
||||
static bool _lightfxAvailable = false;
|
||||
|
||||
static void* _light_rendered_buffer_back = NULL;
|
||||
static void* _light_rendered_buffer_front = NULL;
|
||||
static void* _light_rendered_buffer_back = nullptr;
|
||||
static void* _light_rendered_buffer_front = nullptr;
|
||||
|
||||
static uint32 _lightPolution_back = 0;
|
||||
static uint32 _lightPolution_front = 0;
|
||||
|
@ -279,12 +279,12 @@ void lightfx_prepare_light_list()
|
|||
for (sint32 pat = startSamplePoint; pat < totalSamplePoints; pat++) {
|
||||
LocationXY16 mapCoord = { 0 };
|
||||
|
||||
rct_tile_element *tileElement = 0;
|
||||
rct_tile_element *tileElement = nullptr;
|
||||
|
||||
sint32 interactionType = 0;
|
||||
|
||||
rct_window *w = window_get_main();
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
// get_map_coordinates_from_pos(entry->x + offsetPattern[pat*2] / mapFrontDiv, entry->y + offsetPattern[pat*2+1] / mapFrontDiv, VIEWPORT_INTERACTION_MASK_NONE, &mapCoord.x, &mapCoord.y, &interactionType, &tileElement, NULL);
|
||||
|
||||
#ifdef LIGHTFX_UNKNOWN_PART_1
|
||||
|
@ -465,7 +465,7 @@ void lightfx_update_viewport_settings()
|
|||
|
||||
void lightfx_render_lights_to_frontbuffer()
|
||||
{
|
||||
if (_light_rendered_buffer_front == NULL) {
|
||||
if (_light_rendered_buffer_front == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ void lightfx_render_lights_to_frontbuffer()
|
|||
// log_warning("%i lights", LightListCurrentCountFront);
|
||||
|
||||
for (uint32 light = 0; light < LightListCurrentCountFront; light++) {
|
||||
const uint8 *bufReadBase = 0;
|
||||
const uint8 *bufReadBase = nullptr;
|
||||
uint8 *bufWriteBase = (uint8 *)_light_rendered_buffer_front;
|
||||
uint32 bufReadWidth, bufReadHeight;
|
||||
sint32 bufWriteX, bufWriteY;
|
||||
|
@ -990,7 +990,7 @@ void lightfx_render_to_texture(
|
|||
lightfx_render_lights_to_frontbuffer();
|
||||
|
||||
uint8 * lightBits = (uint8 *)lightfx_get_front_buffer();
|
||||
if (lightBits == NULL) {
|
||||
if (lightBits == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void scrolling_text_initialise_bitmaps()
|
|||
{
|
||||
sint32 imageId = SPR_SCROLLING_TEXT_START + i;
|
||||
const rct_g1_element * g1original = gfx_get_g1_element(imageId);
|
||||
if (g1original != NULL)
|
||||
if (g1original != nullptr)
|
||||
{
|
||||
rct_g1_element g1 = *g1original;
|
||||
g1.offset = _drawScrollTextList[i].bitmap;
|
||||
|
@ -1492,7 +1492,7 @@ static void scrolling_text_set_bitmap_for_sprite(utf8 *text, sint32 scroll, uint
|
|||
if (codepoint <= FORMAT_COLOUR_CODE_END && codepoint >= FORMAT_COLOUR_CODE_START){
|
||||
codepoint -= FORMAT_COLOUR_CODE_START;
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(SPR_TEXT_PALETTE);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
characterColour = g1->offset[codepoint * 4];
|
||||
}
|
||||
|
@ -1531,7 +1531,7 @@ static void scrolling_text_set_bitmap_for_ttf(utf8 *text, sint32 scroll, uint8 *
|
|||
{
|
||||
#ifndef NO_TTF
|
||||
TTFFontDescriptor *fontDesc = ttf_get_font_from_sprite_base(FONT_SPRITE_BASE_TINY);
|
||||
if (fontDesc->font == NULL) {
|
||||
if (fontDesc->font == nullptr) {
|
||||
scrolling_text_set_bitmap_for_sprite(text, scroll, bitmap, scrollPositionOffsets);
|
||||
return;
|
||||
}
|
||||
|
@ -1557,14 +1557,14 @@ static void scrolling_text_set_bitmap_for_ttf(utf8 *text, sint32 scroll, uint8 *
|
|||
colour = scrolling_text_get_colour(gCommonFormatArgs[7]);
|
||||
} else {
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(SPR_TEXT_PALETTE);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
colour = g1->offset[(colour - FORMAT_COLOUR_CODE_START) * 4];
|
||||
}
|
||||
}
|
||||
|
||||
TTFSurface * surface = ttf_surface_cache_get_or_add(fontDesc->font, text);
|
||||
if (surface == NULL) {
|
||||
if (surface == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ sint32 gfx_wrap_string(utf8 *text, sint32 width, sint32 *outNumLines, sint32 *ou
|
|||
*outNumLines = 0;
|
||||
|
||||
// Pointer to the start of the current word
|
||||
utf8 *currentWord = NULL;
|
||||
utf8 *currentWord = nullptr;
|
||||
|
||||
// Width of line up to current word
|
||||
sint32 currentWidth = 0;
|
||||
|
@ -171,7 +171,7 @@ sint32 gfx_wrap_string(utf8 *text, sint32 width, sint32 *outNumLines, sint32 *ou
|
|||
maxWidth = std::max(maxWidth, lineWidth);
|
||||
(*outNumLines)++;
|
||||
lineWidth = 0;
|
||||
currentWord = NULL;
|
||||
currentWord = nullptr;
|
||||
firstCh = ch;
|
||||
numCharactersOnLine = 0;
|
||||
continue;
|
||||
|
@ -189,13 +189,13 @@ sint32 gfx_wrap_string(utf8 *text, sint32 width, sint32 *outNumLines, sint32 *ou
|
|||
if (lineWidth <= width || numCharactersOnLine == 0) {
|
||||
ch = nextCh;
|
||||
numCharactersOnLine++;
|
||||
} else if (currentWord == NULL) {
|
||||
} else if (currentWord == nullptr) {
|
||||
// Single word is longer than line, insert null terminator
|
||||
ch += utf8_insert_codepoint(ch, 0);
|
||||
maxWidth = std::max(maxWidth, lineWidth);
|
||||
(*outNumLines)++;
|
||||
lineWidth = 0;
|
||||
currentWord = NULL;
|
||||
currentWord = nullptr;
|
||||
firstCh = ch;
|
||||
numCharactersOnLine = 0;
|
||||
} else {
|
||||
|
@ -205,7 +205,7 @@ sint32 gfx_wrap_string(utf8 *text, sint32 width, sint32 *outNumLines, sint32 *ou
|
|||
maxWidth = std::max(maxWidth, currentWidth);
|
||||
(*outNumLines)++;
|
||||
lineWidth = 0;
|
||||
currentWord = NULL;
|
||||
currentWord = nullptr;
|
||||
firstCh = ch;
|
||||
numCharactersOnLine = 0;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static void colour_char(uint8 colour, uint16* current_font_flags, uint8* palette
|
|||
|
||||
sint32 colour32 = 0;
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(SPR_TEXT_PALETTE);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
colour32 = ((uint32 *)g1->offset)[colour & 0xFF];
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ void draw_string_centred_raw(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32
|
|||
gfx_draw_string(dpi, text, TEXT_COLOUR_254, x - (width / 2), y);
|
||||
|
||||
const utf8 *ch = text;
|
||||
const utf8 *nextCh = 0;
|
||||
const utf8 *nextCh = nullptr;
|
||||
|
||||
while ((utf8_get_next(ch, &nextCh)) != 0) {
|
||||
ch = nextCh;
|
||||
|
@ -474,7 +474,7 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
|
|||
return;
|
||||
|
||||
TTFFontDescriptor *fontDesc = ttf_get_font_from_sprite_base(info->font_sprite_base);
|
||||
if (fontDesc->font == NULL) {
|
||||
if (fontDesc->font == nullptr) {
|
||||
ttf_draw_string_raw_sprite(dpi, text, info);
|
||||
return;
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
|
|||
} else {
|
||||
uint8 colour = info->palette[1];
|
||||
TTFSurface * surface = ttf_surface_cache_get_or_add(fontDesc->font, text);
|
||||
if (surface == NULL)
|
||||
if (surface == nullptr)
|
||||
return;
|
||||
|
||||
sint32 drawX = info->x + fontDesc->offset_x;
|
||||
|
@ -610,7 +610,7 @@ static const utf8 *ttf_process_format_code(rct_drawpixelinfo *dpi, const utf8 *t
|
|||
{
|
||||
uint16 eax = palette_to_g1_offset[(uint8)*nextCh++];
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(eax);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
uint32 ebx = g1->offset[249] + 256;
|
||||
if (!(info->flags & TEXT_DRAW_FLAG_OUTLINE)) {
|
||||
|
@ -679,7 +679,7 @@ static const utf8 *ttf_process_format_code(rct_drawpixelinfo *dpi, const utf8 *t
|
|||
{
|
||||
uint32 imageId = *((uint32*)(nextCh));
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(imageId & 0x7FFFF);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) {
|
||||
gfx_draw_sprite(dpi, imageId, info->x, info->y, 0);
|
||||
|
@ -812,7 +812,7 @@ static void ttf_process_initial_colour(sint32 colour, text_draw_info *info)
|
|||
|
||||
void ttf_draw_string(rct_drawpixelinfo *dpi, char *text, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
if (text == NULL) return;
|
||||
if (text == nullptr) return;
|
||||
|
||||
text_draw_info info;
|
||||
info.font_sprite_base = gCurrentFontSpriteBase;
|
||||
|
@ -855,7 +855,7 @@ static sint32 ttf_get_string_width(const utf8 *text)
|
|||
info.flags |= TEXT_DRAW_FLAG_TTF;
|
||||
}
|
||||
|
||||
ttf_process_string(NULL, text, &info);
|
||||
ttf_process_string(nullptr, text, &info);
|
||||
|
||||
return info.maxX;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef struct ttf_getwidth_cache_entry
|
|||
uint32 lastUseTick;
|
||||
} ttf_getwidth_cache_entry;
|
||||
|
||||
static ttf_cache_entry _ttfSurfaceCache[TTF_SURFACE_CACHE_SIZE] = { 0 };
|
||||
static ttf_cache_entry _ttfSurfaceCache[TTF_SURFACE_CACHE_SIZE] = { nullptr };
|
||||
static sint32 _ttfSurfaceCacheCount = 0;
|
||||
static sint32 _ttfSurfaceCacheHitCount = 0;
|
||||
static sint32 _ttfSurfaceCacheMissCount = 0;
|
||||
|
@ -86,7 +86,7 @@ bool ttf_initialise()
|
|||
}
|
||||
|
||||
fontDesc->font = ttf_open_font(fontPath, fontDesc->ptSize);
|
||||
if (fontDesc->font == NULL) {
|
||||
if (fontDesc->font == nullptr) {
|
||||
log_verbose("Unable to load '%s'", fontPath);
|
||||
return false;
|
||||
}
|
||||
|
@ -108,9 +108,9 @@ void ttf_dispose()
|
|||
|
||||
for (sint32 i = 0; i < 4; i++) {
|
||||
TTFFontDescriptor *fontDesc = &(gCurrentTTFFontSet->size[i]);
|
||||
if (fontDesc->font != NULL) {
|
||||
if (fontDesc->font != nullptr) {
|
||||
ttf_close_font(fontDesc->font);
|
||||
fontDesc->font = NULL;
|
||||
fontDesc->font = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,13 +140,13 @@ static uint32 ttf_surface_cache_hash(TTF_Font *font, const utf8 *text)
|
|||
|
||||
static void ttf_surface_cache_dispose(ttf_cache_entry *entry)
|
||||
{
|
||||
if (entry->surface != NULL) {
|
||||
if (entry->surface != nullptr) {
|
||||
ttf_free_surface(entry->surface);
|
||||
free(entry->text);
|
||||
|
||||
entry->surface = NULL;
|
||||
entry->font = NULL;
|
||||
entry->text = NULL;
|
||||
entry->surface = nullptr;
|
||||
entry->font = nullptr;
|
||||
entry->text = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ TTFSurface * ttf_surface_cache_get_or_add(TTF_Font * font, const utf8 * text)
|
|||
entry = &_ttfSurfaceCache[index];
|
||||
|
||||
// Check if entry is a hit
|
||||
if (entry->surface == NULL) break;
|
||||
if (entry->surface == nullptr) break;
|
||||
if (entry->font == font && strcmp(entry->text, text) == 0) {
|
||||
_ttfSurfaceCacheHitCount++;
|
||||
entry->lastUseTick = gCurrentDrawCount;
|
||||
|
@ -208,8 +208,8 @@ TTFSurface * ttf_surface_cache_get_or_add(TTF_Font * font, const utf8 * text)
|
|||
ttf_surface_cache_dispose(entry);
|
||||
|
||||
TTFSurface * surface = ttf_render(font, text);
|
||||
if (surface == NULL) {
|
||||
return NULL;
|
||||
if (surface == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_ttfSurfaceCacheMissCount++;
|
||||
|
@ -225,12 +225,12 @@ TTFSurface * ttf_surface_cache_get_or_add(TTF_Font * font, const utf8 * text)
|
|||
|
||||
static void ttf_getwidth_cache_dispose(ttf_getwidth_cache_entry *entry)
|
||||
{
|
||||
if (entry->text != NULL) {
|
||||
if (entry->text != nullptr) {
|
||||
free(entry->text);
|
||||
|
||||
entry->width = 0;
|
||||
entry->font = NULL;
|
||||
entry->text = NULL;
|
||||
entry->font = nullptr;
|
||||
entry->text = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ uint32 ttf_getwidth_cache_get_or_add(TTF_Font * font, const utf8 * text)
|
|||
entry = &_ttfGetWidthCache[index];
|
||||
|
||||
// Check if entry is a hit
|
||||
if (entry->text == NULL) break;
|
||||
if (entry->text == nullptr) break;
|
||||
if (entry->font == font && strcmp(entry->text, text) == 0) {
|
||||
_ttfGetWidthCacheHitCount++;
|
||||
entry->lastUseTick = gCurrentDrawCount;
|
||||
|
|
|
@ -46,7 +46,7 @@ void colours_init_maps()
|
|||
for (sint32 i = 0; i < COLOUR_COUNT; i++)
|
||||
{
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(SPR_PALETTE_2_START + i);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
ColourMapA[i].colour_0 = g1->offset[INDEX_COLOUR_0];
|
||||
ColourMapA[i].colour_1 = g1->offset[INDEX_COLOUR_1];
|
||||
|
|
|
@ -146,9 +146,9 @@ void console_update()
|
|||
if (gConsoleOpen) {
|
||||
// When scrolling the map, the console pixels get copied... therefore invalidate the screen
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
if (mainWindow != nullptr) {
|
||||
rct_viewport *mainViewport = mainWindow->viewport;
|
||||
if (mainViewport != NULL) {
|
||||
if (mainViewport != nullptr) {
|
||||
if (_lastMainViewportX != mainViewport->view_x || _lastMainViewportY != mainViewport->view_y) {
|
||||
_lastMainViewportX = mainViewport->view_x;
|
||||
_lastMainViewportY = mainViewport->view_y;
|
||||
|
@ -498,7 +498,7 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc)
|
|||
for (sint32 i = 0; i < RIDE_MODE_COUNT; i++) {
|
||||
char mode_name[128] = { 0 };
|
||||
rct_string_id mode_string_id = RideModeNames[i];
|
||||
format_string(mode_name, 128, mode_string_id, 0);
|
||||
format_string(mode_name, 128, mode_string_id, nullptr);
|
||||
console_printf("%02d - %s", i, mode_name);
|
||||
}
|
||||
|
||||
|
@ -541,7 +541,7 @@ static sint32 cc_rides(const utf8 **argv, sint32 argc)
|
|||
if (mode <= 0 || mode > (RIDE_MODE_COUNT - 1)) {
|
||||
console_printf("Invalid ride mode.");
|
||||
}
|
||||
else if (ride == NULL || ride->type == RIDE_TYPE_NULL) {
|
||||
else if (ride == nullptr || ride->type == RIDE_TYPE_NULL) {
|
||||
console_printf("No ride found with index %d", ride_index);
|
||||
}
|
||||
else {
|
||||
|
@ -691,7 +691,7 @@ static sint32 cc_staff(const utf8 **argv, sint32 argc)
|
|||
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
|
||||
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
|
||||
|
||||
if (int_valid[0] && int_valid[1] && ((GET_PEEP(int_val[0])) != NULL)) {
|
||||
if (int_valid[0] && int_valid[1] && ((GET_PEEP(int_val[0])) != nullptr)) {
|
||||
rct_peep *peep = GET_PEEP(int_val[0]);
|
||||
|
||||
peep->energy = int_val[1];
|
||||
|
@ -702,13 +702,13 @@ static sint32 cc_staff(const utf8 **argv, sint32 argc)
|
|||
bool int_valid[2] = { 0 };
|
||||
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
|
||||
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
|
||||
rct_peep *peep = NULL;
|
||||
rct_peep *peep = nullptr;
|
||||
if (!int_valid[0]) {
|
||||
console_writeline_error("Invalid staff ID");
|
||||
return 1;
|
||||
}
|
||||
peep = GET_PEEP(int_val[0]);
|
||||
bool is_entertainer = peep != NULL && peep->type == PEEP_TYPE_STAFF && peep->staff_type == STAFF_TYPE_ENTERTAINER;
|
||||
bool is_entertainer = peep != nullptr && peep->type == PEEP_TYPE_STAFF && peep->staff_type == STAFF_TYPE_ENTERTAINER;
|
||||
if (!is_entertainer) {
|
||||
console_writeline_error("Specified staff is not entertainer");
|
||||
return 1;
|
||||
|
@ -830,11 +830,11 @@ static sint32 cc_get(const utf8 **argv, sint32 argc)
|
|||
}
|
||||
else if (strcmp(argv[0], "location") == 0) {
|
||||
rct_window *w = window_get_main();
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
sint32 interactionType;
|
||||
rct_tile_element *tileElement;
|
||||
LocationXY16 mapCoord = { 0 };
|
||||
get_map_coordinates_from_pos(w->viewport->view_width / 2, w->viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &tileElement, NULL);
|
||||
get_map_coordinates_from_pos(w->viewport->view_width / 2, w->viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &tileElement, nullptr);
|
||||
mapCoord.x -= 16;
|
||||
mapCoord.x /= 32;
|
||||
mapCoord.y -= 16;
|
||||
|
@ -1036,7 +1036,7 @@ static sint32 cc_set(const utf8 **argv, sint32 argc)
|
|||
}
|
||||
else if (strcmp(argv[0], "location") == 0 && invalidArguments(&invalidArgs, int_valid[0] && int_valid[1])) {
|
||||
rct_window *w = window_get_main();
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
sint32 x = (sint16)(int_val[0] * 32 + 16);
|
||||
sint32 y = (sint16)(int_val[1] * 32 + 16);
|
||||
sint32 z = tile_element_height(x, y);
|
||||
|
@ -1149,20 +1149,20 @@ static sint32 cc_load_object(const utf8 **argv, sint32 argc) {
|
|||
}
|
||||
|
||||
const ObjectRepositoryItem * ori = object_repository_find_object_by_name(name);
|
||||
if (ori == NULL) {
|
||||
if (ori == nullptr) {
|
||||
console_writeline_error("Could not find the object.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const rct_object_entry * entry = &ori->ObjectEntry;
|
||||
void * loadedObject = object_manager_get_loaded_object(entry);
|
||||
if (loadedObject != NULL) {
|
||||
if (loadedObject != nullptr) {
|
||||
console_writeline_error("Object is already in scenario.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
loadedObject = object_manager_load_object(entry);
|
||||
if (loadedObject == NULL) {
|
||||
if (loadedObject == nullptr) {
|
||||
console_writeline_error("Unable to load object.");
|
||||
return 1;
|
||||
}
|
||||
|
@ -1213,7 +1213,7 @@ static sint32 cc_object_count(const utf8 **argv, sint32 argc) {
|
|||
|
||||
sint32 entryGroupIndex = 0;
|
||||
for (; entryGroupIndex < object_entry_group_counts[i]; entryGroupIndex++){
|
||||
if (object_entry_groups[i].chunks[entryGroupIndex] == NULL){
|
||||
if (object_entry_groups[i].chunks[entryGroupIndex] == nullptr){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ uint8 gShowConstuctionRightsRefCount;
|
|||
rct_viewport g_viewport_list[MAX_VIEWPORT_COUNT];
|
||||
rct_viewport *g_music_tracking_viewport;
|
||||
|
||||
static rct_tile_element *_interaction_element = NULL;
|
||||
static rct_tile_element *_interaction_element = nullptr;
|
||||
|
||||
sint16 gSavedViewX;
|
||||
sint16 gSavedViewY;
|
||||
|
@ -157,14 +157,14 @@ void centre_2d_coordinates(sint32 x, sint32 y, sint32 z, sint32 * out_x, sint32
|
|||
*/
|
||||
void viewport_create(rct_window *w, sint32 x, sint32 y, sint32 width, sint32 height, sint32 zoom, sint32 centre_x, sint32 centre_y, sint32 centre_z, char flags, sint16 sprite)
|
||||
{
|
||||
rct_viewport* viewport = NULL;
|
||||
rct_viewport* viewport = nullptr;
|
||||
for (sint32 i = 0; i < MAX_VIEWPORT_COUNT; i++) {
|
||||
if (g_viewport_list[i].width == 0) {
|
||||
viewport = &g_viewport_list[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (viewport == NULL) {
|
||||
if (viewport == nullptr) {
|
||||
log_error("No more viewport slots left to allocate.");
|
||||
return;
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ void viewport_update_sprite_follow(rct_window *window)
|
|||
void viewport_update_smart_sprite_follow(rct_window * window)
|
||||
{
|
||||
rct_sprite * sprite = try_get_sprite(window->viewport_smart_follow_sprite);
|
||||
if (sprite == NULL)
|
||||
if (sprite == nullptr)
|
||||
{
|
||||
window->viewport_smart_follow_sprite = SPRITE_INDEX_NULL;
|
||||
window->viewport_target_sprite = SPRITE_INDEX_NULL;
|
||||
|
@ -907,7 +907,7 @@ static void viewport_paint_column(rct_drawpixelinfo * dpi, uint32 viewFlags)
|
|||
viewport_paint_weather_gloom(dpi);
|
||||
}
|
||||
|
||||
if (session->PSStringHead != NULL) {
|
||||
if (session->PSStringHead != nullptr) {
|
||||
paint_draw_money_structs(dpi, session->PSStringHead);
|
||||
}
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ static void viewport_paint_weather_gloom(rct_drawpixelinfo * dpi)
|
|||
*/
|
||||
void screen_pos_to_map_pos(sint16 *x, sint16 *y, sint32 *direction)
|
||||
{
|
||||
screen_get_map_xy(*x, *y, x, y, NULL);
|
||||
screen_get_map_xy(*x, *y, x, y, nullptr);
|
||||
if (*x == LOCATION_NULL)
|
||||
return;
|
||||
|
||||
|
@ -963,7 +963,7 @@ void screen_pos_to_map_pos(sint16 *x, sint16 *y, sint32 *direction)
|
|||
|
||||
*x = *x & ~0x1F;
|
||||
*y = *y & ~0x1F;
|
||||
if (direction != NULL) *direction = my_direction;
|
||||
if (direction != nullptr) *direction = my_direction;
|
||||
}
|
||||
|
||||
LocationXY16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, uint16 y)
|
||||
|
@ -1006,7 +1006,7 @@ void show_gridlines()
|
|||
{
|
||||
if (gShowGridLinesRefCount == 0) {
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
if (mainWindow != nullptr) {
|
||||
if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_GRIDLINES)) {
|
||||
mainWindow->viewport->flags |= VIEWPORT_FLAG_GRIDLINES;
|
||||
window_invalidate(mainWindow);
|
||||
|
@ -1025,7 +1025,7 @@ void hide_gridlines()
|
|||
gShowGridLinesRefCount--;
|
||||
if (gShowGridLinesRefCount == 0) {
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
if (mainWindow != nullptr) {
|
||||
if (!gConfigGeneral.always_show_gridlines) {
|
||||
mainWindow->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES;
|
||||
window_invalidate(mainWindow);
|
||||
|
@ -1042,7 +1042,7 @@ void show_land_rights()
|
|||
{
|
||||
if (gShowLandRightsRefCount == 0) {
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
if (mainWindow != nullptr) {
|
||||
if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_LAND_OWNERSHIP)) {
|
||||
mainWindow->viewport->flags |= VIEWPORT_FLAG_LAND_OWNERSHIP;
|
||||
window_invalidate(mainWindow);
|
||||
|
@ -1061,7 +1061,7 @@ void hide_land_rights()
|
|||
gShowLandRightsRefCount--;
|
||||
if (gShowLandRightsRefCount == 0) {
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
if (mainWindow != nullptr) {
|
||||
if (mainWindow->viewport->flags & VIEWPORT_FLAG_LAND_OWNERSHIP) {
|
||||
mainWindow->viewport->flags &= ~VIEWPORT_FLAG_LAND_OWNERSHIP;
|
||||
window_invalidate(mainWindow);
|
||||
|
@ -1078,7 +1078,7 @@ void show_construction_rights()
|
|||
{
|
||||
if (gShowConstuctionRightsRefCount == 0) {
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
if (mainWindow != nullptr) {
|
||||
if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_CONSTRUCTION_RIGHTS)) {
|
||||
mainWindow->viewport->flags |= VIEWPORT_FLAG_CONSTRUCTION_RIGHTS;
|
||||
window_invalidate(mainWindow);
|
||||
|
@ -1097,7 +1097,7 @@ void hide_construction_rights()
|
|||
gShowConstuctionRightsRefCount--;
|
||||
if (gShowConstuctionRightsRefCount == 0) {
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
if (mainWindow != nullptr) {
|
||||
if (mainWindow->viewport->flags & VIEWPORT_FLAG_CONSTRUCTION_RIGHTS) {
|
||||
mainWindow->viewport->flags &= ~VIEWPORT_FLAG_CONSTRUCTION_RIGHTS;
|
||||
window_invalidate(mainWindow);
|
||||
|
@ -1114,7 +1114,7 @@ void viewport_set_visibility(uint8 mode)
|
|||
{
|
||||
rct_window* window = window_get_main();
|
||||
|
||||
if (window != NULL) {
|
||||
if (window != nullptr) {
|
||||
rct_viewport* edi = window->viewport;
|
||||
uint32 invalidate = 0;
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ static bool is_pixel_present_rle(uint8 *esi, sint16 x_start_point, sint16 y_star
|
|||
static bool sub_679074(rct_drawpixelinfo *dpi, sint32 imageId, sint16 x, sint16 y, const uint8 * palette)
|
||||
{
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(imageId & 0x7FFFF);
|
||||
if (g1 == NULL)
|
||||
if (g1 == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1442,7 +1442,7 @@ static bool sub_679074(rct_drawpixelinfo *dpi, sint32 imageId, sint16 x, sint16
|
|||
*/
|
||||
static bool sub_679023(rct_drawpixelinfo *dpi, sint32 imageId, sint32 x, sint32 y)
|
||||
{
|
||||
const uint8 * palette = NULL;
|
||||
const uint8 * palette = nullptr;
|
||||
imageId &= 0xBFFFFFFF;
|
||||
if (imageId & IMAGE_TYPE_REMAP) {
|
||||
_currentImageType = IMAGE_TYPE_REMAP;
|
||||
|
@ -1452,7 +1452,7 @@ static bool sub_679023(rct_drawpixelinfo *dpi, sint32 imageId, sint32 x, sint32
|
|||
}
|
||||
sint32 g1Index = palette_to_g1_offset[index];
|
||||
const rct_g1_element * g1 = gfx_get_g1_element(g1Index);
|
||||
if (g1 != NULL)
|
||||
if (g1 != nullptr)
|
||||
{
|
||||
palette = g1->offset;
|
||||
}
|
||||
|
@ -1468,10 +1468,10 @@ static bool sub_679023(rct_drawpixelinfo *dpi, sint32 imageId, sint32 x, sint32
|
|||
*/
|
||||
void sub_68862C(rct_drawpixelinfo * dpi, paint_struct * ps)
|
||||
{
|
||||
while ((ps = ps->next_quadrant_ps) != NULL) {
|
||||
while ((ps = ps->next_quadrant_ps) != nullptr) {
|
||||
paint_struct * old_ps = ps;
|
||||
paint_struct * next_ps = ps;
|
||||
while (next_ps != NULL) {
|
||||
while (next_ps != nullptr) {
|
||||
ps = next_ps;
|
||||
if (sub_679023(dpi, ps->image_id, ps->x, ps->y))
|
||||
store_interaction_info(ps);
|
||||
|
@ -1479,7 +1479,7 @@ void sub_68862C(rct_drawpixelinfo * dpi, paint_struct * ps)
|
|||
next_ps = ps->var_20;
|
||||
}
|
||||
|
||||
for (attached_paint_struct *attached_ps = ps->attached_ps; attached_ps != NULL; attached_ps = attached_ps->next) {
|
||||
for (attached_paint_struct *attached_ps = ps->attached_ps; attached_ps != nullptr; attached_ps = attached_ps->next) {
|
||||
if (sub_679023(
|
||||
dpi,
|
||||
attached_ps->image_id,
|
||||
|
@ -1517,7 +1517,7 @@ void get_map_coordinates_from_pos_window(rct_window * window, sint32 screenX, si
|
|||
{
|
||||
_unk9AC154 = flags & 0xFFFF;
|
||||
_interactionSpriteType = 0;
|
||||
if (window != NULL && window->viewport != NULL)
|
||||
if (window != nullptr && window->viewport != nullptr)
|
||||
{
|
||||
rct_viewport* myviewport = window->viewport;
|
||||
screenX -= (sint32)myviewport->x;
|
||||
|
@ -1546,12 +1546,12 @@ void get_map_coordinates_from_pos_window(rct_window * window, sint32 screenX, si
|
|||
sub_68862C(dpi, &ps);
|
||||
paint_session_free(session);
|
||||
}
|
||||
if (viewport != NULL) *viewport = myviewport;
|
||||
if (viewport != nullptr) *viewport = myviewport;
|
||||
}
|
||||
if (interactionType != NULL) *interactionType = _interactionSpriteType;
|
||||
if (x != NULL) *x = _interactionMapX;
|
||||
if (y != NULL) *y = _interactionMapY;
|
||||
if (tileElement != NULL) *tileElement = _interaction_element;
|
||||
if (interactionType != nullptr) *interactionType = _interactionSpriteType;
|
||||
if (x != nullptr) *x = _interactionMapX;
|
||||
if (y != nullptr) *y = _interactionMapY;
|
||||
if (tileElement != nullptr) *tileElement = _interaction_element;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1564,7 +1564,7 @@ void viewport_invalidate(rct_viewport *viewport, sint32 left, sint32 top, sint32
|
|||
{
|
||||
for (rct_window *w = g_window_list; w < gWindowNextSlot; w++)
|
||||
{
|
||||
if (w->classification != WC_MAIN_WINDOW && w->viewport != NULL && w->viewport == viewport)
|
||||
if (w->classification != WC_MAIN_WINDOW && w->viewport != nullptr && w->viewport == viewport)
|
||||
{
|
||||
// note, window_is_visible will update viewport->visibility, so this should have a low hit count
|
||||
if (!window_is_visible(w)) {
|
||||
|
@ -1606,17 +1606,17 @@ void viewport_invalidate(rct_viewport *viewport, sint32 left, sint32 top, sint32
|
|||
static rct_viewport *viewport_find_from_point(sint32 screenX, sint32 screenY)
|
||||
{
|
||||
rct_window *w = window_find_from_point(screenX, screenY);
|
||||
if (w == NULL)
|
||||
return NULL;
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
||||
rct_viewport *viewport = w->viewport;
|
||||
if (viewport == NULL)
|
||||
return NULL;
|
||||
if (viewport == nullptr)
|
||||
return nullptr;
|
||||
|
||||
if (screenX < viewport->x || screenY < viewport->y)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (screenX >= viewport->x + viewport->width || screenY >= viewport->y + viewport->height)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return viewport;
|
||||
}
|
||||
|
@ -1636,8 +1636,8 @@ static rct_viewport *viewport_find_from_point(sint32 screenX, sint32 screenY)
|
|||
void screen_get_map_xy(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, rct_viewport **viewport) {
|
||||
sint16 my_x, my_y;
|
||||
sint32 interactionType;
|
||||
rct_viewport *myViewport = NULL;
|
||||
get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_TERRAIN, &my_x, &my_y, &interactionType, NULL, &myViewport);
|
||||
rct_viewport *myViewport = nullptr;
|
||||
get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_TERRAIN, &my_x, &my_y, &interactionType, nullptr, &myViewport);
|
||||
if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE) {
|
||||
*x = LOCATION_NULL;
|
||||
return;
|
||||
|
@ -1656,7 +1656,7 @@ void screen_get_map_xy(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, rct
|
|||
*x = map_pos.x;
|
||||
*y = map_pos.y;
|
||||
|
||||
if (viewport != NULL) *viewport = myViewport;
|
||||
if (viewport != nullptr) *viewport = myViewport;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1666,7 +1666,7 @@ void screen_get_map_xy(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, rct
|
|||
void screen_get_map_xy_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY)
|
||||
{
|
||||
rct_viewport *viewport = viewport_find_from_point(screenX, screenY);
|
||||
if (viewport == NULL) {
|
||||
if (viewport == nullptr) {
|
||||
*mapX = LOCATION_NULL;
|
||||
return;
|
||||
}
|
||||
|
@ -1690,7 +1690,7 @@ void screen_get_map_xy_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *
|
|||
*/
|
||||
void screen_get_map_xy_quadrant(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *quadrant)
|
||||
{
|
||||
screen_get_map_xy(screenX, screenY, mapX, mapY, NULL);
|
||||
screen_get_map_xy(screenX, screenY, mapX, mapY, nullptr);
|
||||
if (*mapX == LOCATION_NULL)
|
||||
return;
|
||||
|
||||
|
@ -1720,7 +1720,7 @@ void screen_get_map_xy_quadrant_with_z(sint16 screenX, sint16 screenY, sint16 z,
|
|||
*/
|
||||
void screen_get_map_xy_side(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *side)
|
||||
{
|
||||
screen_get_map_xy(screenX, screenY, mapX, mapY, NULL);
|
||||
screen_get_map_xy(screenX, screenY, mapX, mapY, nullptr);
|
||||
if (*mapX == LOCATION_NULL)
|
||||
return;
|
||||
|
||||
|
@ -1781,7 +1781,7 @@ sint16 get_height_marker_offset()
|
|||
void viewport_set_saved_view()
|
||||
{
|
||||
rct_window * w = window_get_main();
|
||||
if (w != NULL)
|
||||
if (w != nullptr)
|
||||
{
|
||||
rct_viewport *viewport = w->viewport;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ sint32 viewport_interaction_get_item_left(sint32 x, sint32 y, viewport_interacti
|
|||
return info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
||||
LocationXY16 mapCoord = { 0 };
|
||||
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_SPRITE & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK, &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, NULL);
|
||||
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_SPRITE & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK, &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, nullptr);
|
||||
info->x = mapCoord.x;
|
||||
info->y = mapCoord.y;
|
||||
tileElement = info->tileElement;
|
||||
|
@ -100,7 +100,7 @@ sint32 viewport_interaction_get_item_left(sint32 x, sint32 y, viewport_interacti
|
|||
// If nothing is under cursor, find a close by peep
|
||||
if (info->type == VIEWPORT_INTERACTION_ITEM_NONE) {
|
||||
info->peep = viewport_interaction_get_closest_peep(x, y, 32);
|
||||
if (info->peep == NULL)
|
||||
if (info->peep == nullptr)
|
||||
return VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
||||
info->type = VIEWPORT_INTERACTION_ITEM_SPRITE;
|
||||
|
@ -200,7 +200,7 @@ sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interact
|
|||
return info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
||||
LocationXY16 mapCoord = { 0 };
|
||||
get_map_coordinates_from_pos(x, y, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER), &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, NULL);
|
||||
get_map_coordinates_from_pos(x, y, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER), &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, nullptr);
|
||||
info->x = mapCoord.x;
|
||||
info->y = mapCoord.y;
|
||||
tileElement = info->tileElement;
|
||||
|
@ -305,7 +305,7 @@ sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interact
|
|||
}
|
||||
|
||||
if (!(input_test_flag(INPUT_FLAG_6)) || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) {
|
||||
if (window_find_by_class(WC_RIDE_CONSTRUCTION) == NULL && window_find_by_class(WC_FOOTPATH) == NULL) {
|
||||
if (window_find_by_class(WC_RIDE_CONSTRUCTION) == nullptr && window_find_by_class(WC_FOOTPATH) == nullptr) {
|
||||
return info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ static void viewport_interaction_remove_footpath(rct_tile_element *tileElement,
|
|||
z = tileElement->base_height;
|
||||
|
||||
w = window_find_by_class(WC_FOOTPATH);
|
||||
if (w != NULL)
|
||||
if (w != nullptr)
|
||||
footpath_provisional_update();
|
||||
|
||||
tileElement2 = map_get_first_element_at(x / 32, y / 32);
|
||||
|
@ -565,17 +565,17 @@ static rct_peep *viewport_interaction_get_closest_peep(sint32 x, sint32 y, sint3
|
|||
rct_peep *peep, *closestPeep;
|
||||
|
||||
w = window_find_from_point(x, y);
|
||||
if (w == NULL)
|
||||
return 0;
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
||||
viewport = w->viewport;
|
||||
if (viewport == NULL || viewport->zoom >= 2)
|
||||
return 0;
|
||||
if (viewport == nullptr || viewport->zoom >= 2)
|
||||
return nullptr;
|
||||
|
||||
x = ((x - viewport->x) << viewport->zoom) + viewport->view_x;
|
||||
y = ((y - viewport->y) << viewport->zoom) + viewport->view_y;
|
||||
|
||||
closestPeep = NULL;
|
||||
closestPeep = nullptr;
|
||||
closestDistance = 0xFFFF;
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (peep->sprite_left == LOCATION_NULL)
|
||||
|
@ -651,8 +651,8 @@ void sub_68A15E(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, sint32 *di
|
|||
|
||||
*x = map_pos.x & ~0x1F;
|
||||
*y = map_pos.y & ~0x1F;
|
||||
if (direction != NULL) *direction = myDirection;
|
||||
if (tileElement != NULL) *tileElement = myTileElement;
|
||||
if (direction != nullptr) *direction = myDirection;
|
||||
if (tileElement != nullptr) *tileElement = myTileElement;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1054,7 +1054,7 @@ static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widg
|
|||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
gCurrentFontFlags = 0;
|
||||
|
||||
if (!active || gTextInput == NULL) {
|
||||
if (!active || gTextInput == nullptr) {
|
||||
|
||||
if (w->widgets[widgetIndex].text != 0) {
|
||||
safe_strcpy(wrapped_string, w->widgets[widgetIndex].string, 512);
|
||||
|
|
|
@ -49,7 +49,7 @@ extern "C"
|
|||
|
||||
rct_window g_window_list[WINDOW_LIMIT_MAX + WINDOW_LIMIT_RESERVED];
|
||||
rct_window * gWindowFirst;
|
||||
rct_window * gWindowNextSlot = NULL;
|
||||
rct_window * gWindowNextSlot = nullptr;
|
||||
rct_window * gWindowAudioExclusive;
|
||||
|
||||
uint16 TextInputDescriptionArgs[4];
|
||||
|
@ -132,7 +132,7 @@ static rct_widget *window_get_scroll_widget(rct_window *w, sint32 scrollIndex)
|
|||
scrollIndex--;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ void window_dispatch_update_all()
|
|||
void window_update_all_viewports()
|
||||
{
|
||||
for (rct_window *w = g_window_list; w < RCT2_NEW_WINDOW; w++)
|
||||
if (w->viewport != NULL && window_is_visible(w))
|
||||
if (w->viewport != nullptr && window_is_visible(w))
|
||||
viewport_update_position(w);
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ static void window_all_wheel_input()
|
|||
// Check window cursor is over
|
||||
if (!(input_test_flag(INPUT_FLAG_5))) {
|
||||
rct_window *w = window_find_from_point(cursorState->x, cursorState->y);
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
// Check if main window
|
||||
if (w->classification == WC_MAIN_WINDOW || w->classification == WC_VIEWPORT) {
|
||||
window_viewport_wheel_input(w, relative_wheel);
|
||||
|
@ -351,14 +351,14 @@ static void window_close_surplus(sint32 cap, sint8 avoid_classification)
|
|||
//difference between amount open and cap = amount to close
|
||||
diff = count - WINDOW_LIMIT_RESERVED - cap;
|
||||
for (i = 0; i < diff; i++) {
|
||||
rct_window *w = NULL;
|
||||
rct_window *w = nullptr;
|
||||
//iterates through the list until it finds the newest window, or a window that can be closed
|
||||
for (w = g_window_list; w < RCT2_NEW_WINDOW; w++) {
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
|
||||
break;
|
||||
}
|
||||
//skip window if window matches specified rct_windowclass (as user may be modifying via options)
|
||||
if (avoid_classification != -1 && w != NULL && w->classification == avoid_classification) {
|
||||
if (avoid_classification != -1 && w != nullptr && w->classification == avoid_classification) {
|
||||
continue;
|
||||
}
|
||||
window_close(w);
|
||||
|
@ -398,7 +398,7 @@ rct_window *window_create(sint32 x, sint32 y, sint32 width, sint32 height, rct_w
|
|||
// Check if there are any window slots left
|
||||
// include WINDOW_LIMIT_RESERVED for items such as the main viewport and toolbars to not appear to be counted.
|
||||
if (RCT2_NEW_WINDOW >= &(g_window_list[gConfigGeneral.window_limit + WINDOW_LIMIT_RESERVED])) {
|
||||
rct_window *w = NULL;
|
||||
rct_window *w = nullptr;
|
||||
// Close least recently used window
|
||||
for (w = g_window_list; w < RCT2_NEW_WINDOW; w++)
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
|
||||
|
@ -445,7 +445,7 @@ rct_window *window_create(sint32 x, sint32 y, sint32 width, sint32 height, rct_w
|
|||
w->y = y;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->viewport = NULL;
|
||||
w->viewport = nullptr;
|
||||
w->event_handlers = event_handlers;
|
||||
w->enabled_widgets = 0;
|
||||
w->disabled_widgets = 0;
|
||||
|
@ -691,7 +691,7 @@ void window_close(rct_window* window)
|
|||
{
|
||||
sint32 num_windows;
|
||||
|
||||
if (window == NULL)
|
||||
if (window == nullptr)
|
||||
return;
|
||||
|
||||
// Make a copy of the window class and number in case
|
||||
|
@ -702,13 +702,13 @@ void window_close(rct_window* window)
|
|||
window_event_close_call(window);
|
||||
|
||||
window = window_find_by_number(cls, number);
|
||||
if (window == NULL)
|
||||
if (window == nullptr)
|
||||
return;
|
||||
|
||||
// Remove viewport
|
||||
if (window->viewport != NULL) {
|
||||
if (window->viewport != nullptr) {
|
||||
window->viewport->width = 0;
|
||||
window->viewport = NULL;
|
||||
window->viewport = nullptr;
|
||||
}
|
||||
|
||||
// Invalidate the window (area)
|
||||
|
@ -770,7 +770,7 @@ rct_window *window_find_by_class(rct_windowclass cls)
|
|||
if (w->classification == cls)
|
||||
return w;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -788,7 +788,7 @@ rct_window *window_find_by_number(rct_windowclass cls, rct_windownumber number)
|
|||
if (w->classification == cls && w->number == number)
|
||||
return w;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -882,7 +882,7 @@ rct_window *window_find_from_point(sint32 x, sint32 y)
|
|||
return w;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -930,7 +930,7 @@ rct_widgetindex window_find_widget_from_point(rct_window *w, sint32 x, sint32 y)
|
|||
*/
|
||||
void window_invalidate(rct_window *window)
|
||||
{
|
||||
if (window != NULL)
|
||||
if (window != nullptr)
|
||||
gfx_set_dirty_blocks(window->x, window->y, window->x + window->width, window->y + window->height);
|
||||
}
|
||||
|
||||
|
@ -1161,7 +1161,7 @@ rct_window *window_bring_to_front(rct_window *w)
|
|||
if (w->x + w->width < 20) {
|
||||
sint32 i = 20 - w->x;
|
||||
w->x += i;
|
||||
if (w->viewport != NULL)
|
||||
if (w->viewport != nullptr)
|
||||
w->viewport->x += i;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
@ -1174,7 +1174,7 @@ rct_window *window_bring_to_front_by_class_with_flags(rct_windowclass cls, uint1
|
|||
rct_window* w;
|
||||
|
||||
w = window_find_by_class(cls);
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
w->flags |= flags;
|
||||
window_invalidate(w);
|
||||
w = window_bring_to_front(w);
|
||||
|
@ -1199,7 +1199,7 @@ rct_window *window_bring_to_front_by_number(rct_windowclass cls, rct_windownumbe
|
|||
rct_window* w;
|
||||
|
||||
w = window_find_by_number(cls, number);
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
window_invalidate(w);
|
||||
w = window_bring_to_front(w);
|
||||
|
@ -1234,7 +1234,7 @@ void window_push_others_right(rct_window* window)
|
|||
uint16 push_amount = window->x + window->width - w->x + 3;
|
||||
w->x += push_amount;
|
||||
window_invalidate(w);
|
||||
if (w->viewport != NULL)
|
||||
if (w->viewport != nullptr)
|
||||
w->viewport->x += push_amount;
|
||||
}
|
||||
}
|
||||
|
@ -1277,7 +1277,7 @@ void window_push_others_below(rct_window *w1)
|
|||
window_invalidate(w2);
|
||||
|
||||
// Update viewport position if necessary
|
||||
if (w2->viewport != NULL)
|
||||
if (w2->viewport != nullptr)
|
||||
w2->viewport->y += push_amount;
|
||||
}
|
||||
}
|
||||
|
@ -1288,14 +1288,14 @@ void window_push_others_below(rct_window *w1)
|
|||
*/
|
||||
rct_window *window_get_main()
|
||||
{
|
||||
rct_window* w = NULL;
|
||||
rct_window* w = nullptr;
|
||||
|
||||
for (w = g_window_list; w < RCT2_NEW_WINDOW; w++)
|
||||
if (w->classification == WC_MAIN_WINDOW)
|
||||
return w;
|
||||
|
||||
openrct2_assert(w != NULL, "Failed to get main window");
|
||||
return NULL;
|
||||
openrct2_assert(w != nullptr, "Failed to get main window");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1308,7 +1308,7 @@ void window_scroll_to_viewport(rct_window *w)
|
|||
rct_window *mainWindow;
|
||||
assert(w != NULL);
|
||||
// In original checked to make sure x and y were not -1 as well.
|
||||
if (w->viewport == NULL || w->viewport_focus_coordinates.y == -1)
|
||||
if (w->viewport == nullptr || w->viewport_focus_coordinates.y == -1)
|
||||
return;
|
||||
|
||||
if (w->viewport_focus_sprite.type & VIEWPORT_FOCUS_TYPE_SPRITE) {
|
||||
|
@ -1323,7 +1323,7 @@ void window_scroll_to_viewport(rct_window *w)
|
|||
}
|
||||
|
||||
mainWindow = window_get_main();
|
||||
if (mainWindow != NULL)
|
||||
if (mainWindow != nullptr)
|
||||
window_scroll_to_location(mainWindow, x, y, z);
|
||||
}
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ static void call_event_viewport_rotate_on_all_windows()
|
|||
void window_rotate_camera(rct_window *w, sint32 direction)
|
||||
{
|
||||
rct_viewport *viewport = w->viewport;
|
||||
if (viewport == NULL)
|
||||
if (viewport == nullptr)
|
||||
return;
|
||||
|
||||
sint16 x = (viewport->width >> 1) + viewport->x;
|
||||
|
@ -1478,7 +1478,7 @@ void window_viewport_get_map_coords_by_cursor(rct_window *w, sint16 *map_x, sint
|
|||
context_get_cursor_position_scaled(&mouse_x, &mouse_y);
|
||||
|
||||
// Compute map coordinate by mouse position.
|
||||
get_map_coordinates_from_pos(mouse_x, mouse_y, VIEWPORT_INTERACTION_MASK_NONE, map_x, map_y, NULL, NULL, NULL);
|
||||
get_map_coordinates_from_pos(mouse_x, mouse_y, VIEWPORT_INTERACTION_MASK_NONE, map_x, map_y, nullptr, nullptr, nullptr);
|
||||
|
||||
// Get viewport coordinates centring around the tile.
|
||||
sint32 base_height = tile_element_height(*map_x, *map_y);
|
||||
|
@ -1584,7 +1584,7 @@ void main_window_zoom(bool zoomIn, bool atCursor) {
|
|||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) {
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL)
|
||||
if (mainWindow != nullptr)
|
||||
window_zoom_set(mainWindow, mainWindow->viewport->zoom + (zoomIn ? -1 : 1), atCursor);
|
||||
}
|
||||
}
|
||||
|
@ -1787,7 +1787,7 @@ void window_move_position(rct_window *w, sint32 dx, sint32 dy)
|
|||
// Translate window and viewport
|
||||
w->x += dx;
|
||||
w->y += dy;
|
||||
if (w->viewport != NULL) {
|
||||
if (w->viewport != nullptr) {
|
||||
w->viewport->x += dx;
|
||||
w->viewport->y += dy;
|
||||
}
|
||||
|
@ -1903,7 +1903,7 @@ void tool_cancel()
|
|||
gCurrentToolWidget.window_classification,
|
||||
gCurrentToolWidget.window_number
|
||||
);
|
||||
if (w != NULL)
|
||||
if (w != nullptr)
|
||||
window_event_tool_abort_call(w, gCurrentToolWidget.widget_index);
|
||||
}
|
||||
}
|
||||
|
@ -1911,141 +1911,141 @@ void tool_cancel()
|
|||
|
||||
void window_event_close_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->close != NULL)
|
||||
if (w->event_handlers->close != nullptr)
|
||||
w->event_handlers->close(w);
|
||||
}
|
||||
|
||||
void window_event_mouse_up_call(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
if (w->event_handlers->mouse_up != NULL)
|
||||
if (w->event_handlers->mouse_up != nullptr)
|
||||
w->event_handlers->mouse_up(w, widgetIndex);
|
||||
}
|
||||
|
||||
void window_event_resize_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->resize != NULL)
|
||||
if (w->event_handlers->resize != nullptr)
|
||||
w->event_handlers->resize(w);
|
||||
}
|
||||
|
||||
void window_event_mouse_down_call(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
if (w->event_handlers->mouse_down != NULL)
|
||||
if (w->event_handlers->mouse_down != nullptr)
|
||||
w->event_handlers->mouse_down(w, widgetIndex, &w->widgets[widgetIndex]);
|
||||
}
|
||||
|
||||
void window_event_dropdown_call(rct_window *w, rct_widgetindex widgetIndex, sint32 dropdownIndex)
|
||||
{
|
||||
if (w->event_handlers->dropdown != NULL)
|
||||
if (w->event_handlers->dropdown != nullptr)
|
||||
w->event_handlers->dropdown(w, widgetIndex, dropdownIndex);
|
||||
}
|
||||
|
||||
void window_event_unknown_05_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->unknown_05 != NULL)
|
||||
if (w->event_handlers->unknown_05 != nullptr)
|
||||
w->event_handlers->unknown_05(w);
|
||||
}
|
||||
|
||||
void window_event_update_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->update != NULL)
|
||||
if (w->event_handlers->update != nullptr)
|
||||
w->event_handlers->update(w);
|
||||
}
|
||||
|
||||
void window_event_unknown_07_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->unknown_07 != NULL)
|
||||
if (w->event_handlers->unknown_07 != nullptr)
|
||||
w->event_handlers->unknown_07(w);
|
||||
}
|
||||
|
||||
void window_event_unknown_08_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->unknown_08 != NULL)
|
||||
if (w->event_handlers->unknown_08 != nullptr)
|
||||
w->event_handlers->unknown_08(w);
|
||||
}
|
||||
|
||||
void window_event_tool_update_call(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_update != NULL)
|
||||
if (w->event_handlers->tool_update != nullptr)
|
||||
w->event_handlers->tool_update(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_down_call(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_down != NULL)
|
||||
if (w->event_handlers->tool_down != nullptr)
|
||||
w->event_handlers->tool_down(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_drag_call(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_drag != NULL)
|
||||
if (w->event_handlers->tool_drag != nullptr)
|
||||
w->event_handlers->tool_drag(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_up_call(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_up != NULL)
|
||||
if (w->event_handlers->tool_up != nullptr)
|
||||
w->event_handlers->tool_up(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_abort_call(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
if (w->event_handlers->tool_abort != NULL)
|
||||
if (w->event_handlers->tool_abort != nullptr)
|
||||
w->event_handlers->tool_abort(w, widgetIndex);
|
||||
}
|
||||
|
||||
void window_event_unknown_0E_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->unknown_0E != NULL)
|
||||
if (w->event_handlers->unknown_0E != nullptr)
|
||||
w->event_handlers->unknown_0E(w);
|
||||
}
|
||||
|
||||
void window_get_scroll_size(rct_window *w, sint32 scrollIndex, sint32 *width, sint32 *height)
|
||||
{
|
||||
if (w->event_handlers->get_scroll_size != NULL) {
|
||||
if (w->event_handlers->get_scroll_size != nullptr) {
|
||||
w->event_handlers->get_scroll_size(w, scrollIndex, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void window_event_scroll_mousedown_call(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->scroll_mousedown != NULL)
|
||||
if (w->event_handlers->scroll_mousedown != nullptr)
|
||||
w->event_handlers->scroll_mousedown(w, scrollIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_scroll_mousedrag_call(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->scroll_mousedrag != NULL)
|
||||
if (w->event_handlers->scroll_mousedrag != nullptr)
|
||||
w->event_handlers->scroll_mousedrag(w, scrollIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_scroll_mouseover_call(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->scroll_mouseover != NULL)
|
||||
if (w->event_handlers->scroll_mouseover != nullptr)
|
||||
w->event_handlers->scroll_mouseover(w, scrollIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_textinput_call(rct_window *w, rct_widgetindex widgetIndex, char *text)
|
||||
{
|
||||
if (w->event_handlers->text_input != NULL)
|
||||
if (w->event_handlers->text_input != nullptr)
|
||||
w->event_handlers->text_input(w, widgetIndex, text);
|
||||
}
|
||||
|
||||
void window_event_viewport_rotate_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->viewport_rotate != NULL)
|
||||
if (w->event_handlers->viewport_rotate != nullptr)
|
||||
w->event_handlers->viewport_rotate(w);
|
||||
}
|
||||
|
||||
void window_event_unknown_15_call(rct_window *w, sint32 scrollIndex, sint32 scrollAreaType)
|
||||
{
|
||||
if (w->event_handlers->unknown_15 != NULL)
|
||||
if (w->event_handlers->unknown_15 != nullptr)
|
||||
w->event_handlers->unknown_15(w, scrollIndex, scrollAreaType);
|
||||
}
|
||||
|
||||
rct_string_id window_event_tooltip_call(rct_window *w, rct_widgetindex widgetIndex)
|
||||
{
|
||||
rct_string_id result = 0;
|
||||
if (w->event_handlers->tooltip != NULL)
|
||||
if (w->event_handlers->tooltip != nullptr)
|
||||
w->event_handlers->tooltip(w, widgetIndex, &result);
|
||||
return result;
|
||||
}
|
||||
|
@ -2053,32 +2053,32 @@ rct_string_id window_event_tooltip_call(rct_window *w, rct_widgetindex widgetInd
|
|||
sint32 window_event_cursor_call(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
sint32 cursorId = CURSOR_ARROW;
|
||||
if (w->event_handlers->cursor != NULL)
|
||||
if (w->event_handlers->cursor != nullptr)
|
||||
w->event_handlers->cursor(w, widgetIndex, x, y, &cursorId);
|
||||
return cursorId;
|
||||
}
|
||||
|
||||
void window_event_moved_call(rct_window *w, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->moved != NULL)
|
||||
if (w->event_handlers->moved != nullptr)
|
||||
w->event_handlers->moved(w, x, y);
|
||||
}
|
||||
|
||||
void window_event_invalidate_call(rct_window *w)
|
||||
{
|
||||
if (w->event_handlers->invalidate != NULL)
|
||||
if (w->event_handlers->invalidate != nullptr)
|
||||
w->event_handlers->invalidate(w);
|
||||
}
|
||||
|
||||
void window_event_paint_call(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
if (w->event_handlers->paint != NULL)
|
||||
if (w->event_handlers->paint != nullptr)
|
||||
w->event_handlers->paint(w, dpi);
|
||||
}
|
||||
|
||||
void window_event_scroll_paint_call(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex)
|
||||
{
|
||||
if (w->event_handlers->scroll_paint != NULL)
|
||||
if (w->event_handlers->scroll_paint != nullptr)
|
||||
w->event_handlers->scroll_paint(w, dpi, scrollIndex);
|
||||
}
|
||||
|
||||
|
@ -2138,7 +2138,7 @@ void window_resize_gui(sint32 width, sint32 height)
|
|||
return;
|
||||
}
|
||||
rct_window *mainWind = window_get_main();
|
||||
if (mainWind != NULL) {
|
||||
if (mainWind != nullptr) {
|
||||
rct_viewport* viewport = mainWind->viewport;
|
||||
mainWind->width = width;
|
||||
mainWind->height = height;
|
||||
|
@ -2146,37 +2146,37 @@ void window_resize_gui(sint32 width, sint32 height)
|
|||
viewport->height = height;
|
||||
viewport->view_width = width << viewport->zoom;
|
||||
viewport->view_height = height << viewport->zoom;
|
||||
if (mainWind->widgets != NULL && mainWind->widgets[WC_MAIN_WINDOW__0].type == WWT_VIEWPORT){
|
||||
if (mainWind->widgets != nullptr && mainWind->widgets[WC_MAIN_WINDOW__0].type == WWT_VIEWPORT){
|
||||
mainWind->widgets[WC_MAIN_WINDOW__0].right = width;
|
||||
mainWind->widgets[WC_MAIN_WINDOW__0].bottom = height;
|
||||
}
|
||||
}
|
||||
|
||||
rct_window *topWind = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (topWind != NULL) {
|
||||
if (topWind != nullptr) {
|
||||
topWind->width = std::max(640, width);
|
||||
}
|
||||
|
||||
rct_window *bottomWind = window_find_by_class(WC_BOTTOM_TOOLBAR);
|
||||
if (bottomWind != NULL) {
|
||||
if (bottomWind != nullptr) {
|
||||
bottomWind->y = height - 32;
|
||||
bottomWind->width = std::max(640, width);
|
||||
}
|
||||
|
||||
rct_window *titleWind = window_find_by_class(WC_TITLE_MENU);
|
||||
if (titleWind != NULL) {
|
||||
if (titleWind != nullptr) {
|
||||
titleWind->x = (width - titleWind->width) / 2;
|
||||
titleWind->y = height - 142;
|
||||
}
|
||||
|
||||
rct_window *exitWind = window_find_by_class(WC_TITLE_EXIT);
|
||||
if (exitWind != NULL) {
|
||||
if (exitWind != nullptr) {
|
||||
exitWind->x = width - 40;
|
||||
exitWind->y = height - 64;
|
||||
}
|
||||
|
||||
rct_window *optionsWind = window_find_by_class(WC_TITLE_OPTIONS);
|
||||
if (optionsWind != NULL) {
|
||||
if (optionsWind != nullptr) {
|
||||
optionsWind->x = width - 80;
|
||||
}
|
||||
|
||||
|
@ -2197,19 +2197,19 @@ void window_resize_gui_scenario_editor(sint32 width, sint32 height)
|
|||
viewport->height = height;
|
||||
viewport->view_width = width << viewport->zoom;
|
||||
viewport->view_height = height << viewport->zoom;
|
||||
if (mainWind->widgets != NULL && mainWind->widgets[WC_MAIN_WINDOW__0].type == WWT_VIEWPORT){
|
||||
if (mainWind->widgets != nullptr && mainWind->widgets[WC_MAIN_WINDOW__0].type == WWT_VIEWPORT){
|
||||
mainWind->widgets[WC_MAIN_WINDOW__0].right = width;
|
||||
mainWind->widgets[WC_MAIN_WINDOW__0].bottom = height;
|
||||
}
|
||||
}
|
||||
|
||||
rct_window *topWind = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (topWind != NULL) {
|
||||
if (topWind != nullptr) {
|
||||
topWind->width = std::max(640, width);
|
||||
}
|
||||
|
||||
rct_window *bottomWind = window_find_by_class(WC_BOTTOM_TOOLBAR);
|
||||
if (bottomWind != NULL) {
|
||||
if (bottomWind != nullptr) {
|
||||
bottomWind->y = height - 32;
|
||||
bottomWind->width = std::max(640, width);
|
||||
}
|
||||
|
@ -2285,11 +2285,11 @@ void window_update_viewport_ride_music()
|
|||
rct_window *w;
|
||||
|
||||
gRideMusicParamsListEnd = &gRideMusicParamsList[0];
|
||||
g_music_tracking_viewport = NULL;
|
||||
g_music_tracking_viewport = nullptr;
|
||||
|
||||
for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--) {
|
||||
viewport = w->viewport;
|
||||
if (viewport == NULL || !(viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
||||
if (viewport == nullptr || !(viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
||||
continue;
|
||||
|
||||
g_music_tracking_viewport = viewport;
|
||||
|
@ -2522,7 +2522,7 @@ void window_cancel_textbox()
|
|||
gCurrentTextBox.window.classification,
|
||||
gCurrentTextBox.window.number
|
||||
);
|
||||
window_event_textinput_call(w, gCurrentTextBox.widget_index, NULL);
|
||||
window_event_textinput_call(w, gCurrentTextBox.widget_index, nullptr);
|
||||
gCurrentTextBox.window.classification = WC_NULL;
|
||||
gCurrentTextBox.window.number = 0;
|
||||
context_stop_text_input();
|
||||
|
@ -2555,14 +2555,14 @@ void window_update_textbox()
|
|||
bool window_is_visible(rct_window* w)
|
||||
{
|
||||
// w->visibility is used to prevent repeat calculations within an iteration by caching the result
|
||||
if (w == NULL)
|
||||
if (w == nullptr)
|
||||
return false;
|
||||
|
||||
if (w->visibility == VC_VISIBLE) return true;
|
||||
if (w->visibility == VC_COVERED) return false;
|
||||
|
||||
// only consider viewports, consider the main window always visible
|
||||
if (w->viewport == NULL || w->classification == WC_MAIN_WINDOW)
|
||||
if (w->viewport == nullptr || w->classification == WC_MAIN_WINDOW)
|
||||
{
|
||||
// default to previous behaviour
|
||||
w->visibility = VC_VISIBLE;
|
||||
|
@ -2620,12 +2620,12 @@ void window_draw_all(rct_drawpixelinfo *dpi, sint16 left, sint16 top, sint16 rig
|
|||
|
||||
rct_viewport * window_get_previous_viewport(rct_viewport * current)
|
||||
{
|
||||
bool foundPrevious = (current == NULL);
|
||||
bool foundPrevious = (current == nullptr);
|
||||
rct_window * window = gWindowNextSlot;
|
||||
|
||||
if (window == NULL)
|
||||
if (window == nullptr)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
while (true)
|
||||
|
@ -2636,7 +2636,7 @@ rct_viewport * window_get_previous_viewport(rct_viewport * current)
|
|||
break;
|
||||
}
|
||||
|
||||
if (window->viewport == NULL)
|
||||
if (window->viewport == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2652,7 +2652,7 @@ rct_viewport * window_get_previous_viewport(rct_viewport * current)
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void window_reset_visibilities()
|
||||
|
@ -2661,7 +2661,7 @@ void window_reset_visibilities()
|
|||
for (rct_window * w = g_window_list; w < gWindowNextSlot; w++)
|
||||
{
|
||||
w->visibility = VC_UNKNOWN;
|
||||
if (w->viewport != NULL)
|
||||
if (w->viewport != nullptr)
|
||||
{
|
||||
w->viewport->visibility = VC_UNKNOWN;
|
||||
}
|
||||
|
@ -2670,7 +2670,7 @@ void window_reset_visibilities()
|
|||
|
||||
void window_init_all()
|
||||
{
|
||||
if (gWindowNextSlot != NULL)
|
||||
if (gWindowNextSlot != nullptr)
|
||||
{
|
||||
window_close_all();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ static sint32 encoding_search_compare(const void *pKey, const void *pEntry)
|
|||
static wchar_t encoding_convert_x_to_unicode(wchar_t code, const encoding_convert_entry *table, size_t count)
|
||||
{
|
||||
encoding_convert_entry * entry = (encoding_convert_entry *)bsearch(&code, table, count, sizeof(encoding_convert_entry), encoding_search_compare);
|
||||
if (entry == NULL) return code;
|
||||
if (entry == nullptr) return code;
|
||||
else return entry->unicode;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void currency_load_custom_currency_config()
|
|||
{
|
||||
CurrencyDescriptors[CURRENCY_CUSTOM].rate = gConfigGeneral.custom_currency_rate;
|
||||
CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode = gConfigGeneral.custom_currency_affix;
|
||||
if (gConfigGeneral.custom_currency_symbol != NULL)
|
||||
if (gConfigGeneral.custom_currency_symbol != nullptr)
|
||||
{
|
||||
safe_strcpy(CurrencyDescriptors[CURRENCY_CUSTOM].symbol_unicode, gConfigGeneral.custom_currency_symbol, CURRENCY_SYMBOL_MAX_SIZE);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ void date_update()
|
|||
|
||||
void date_update_real_time_of_day()
|
||||
{
|
||||
time_t timestamp = time(0);
|
||||
time_t timestamp = time(nullptr);
|
||||
struct tm *now = localtime(×tamp);
|
||||
|
||||
gRealTimeOfDay.second = now->tm_sec;
|
||||
|
|
|
@ -117,7 +117,7 @@ const char *format_get_token(uint32 code)
|
|||
if (code == format_code_tokens[i].code)
|
||||
return format_code_tokens[i].token;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool utf8_should_use_sprite_for_codepoint(sint32 codepoint)
|
||||
|
|
|
@ -433,7 +433,7 @@ static void format_comma_separated_integer(char **dest, size_t *size, sint64 val
|
|||
char *nbegin, *nend, *ncur;
|
||||
char tmp;
|
||||
const char *commaMark = language_get_string(STR_LOCALE_THOUSANDS_SEPARATOR);
|
||||
const char *ch = NULL;
|
||||
const char *ch = nullptr;
|
||||
|
||||
if ((*size) == 0) return;
|
||||
|
||||
|
@ -459,9 +459,9 @@ static void format_comma_separated_integer(char **dest, size_t *size, sint64 val
|
|||
ch = commaMark;
|
||||
}
|
||||
|
||||
if (ch != NULL ) {
|
||||
if (ch != nullptr ) {
|
||||
format_push_char_safe(*ch++);
|
||||
if (*ch == '\0') ch = NULL;
|
||||
if (*ch == '\0') ch = nullptr;
|
||||
} else {
|
||||
digit = value % 10;
|
||||
value /= 10;
|
||||
|
@ -481,9 +481,9 @@ static void format_comma_separated_integer(char **dest, size_t *size, sint64 val
|
|||
ch = commaMark;
|
||||
}
|
||||
|
||||
if (ch != NULL ) {
|
||||
if (ch != nullptr ) {
|
||||
format_push_wrap(*ch++);
|
||||
if (*ch == '\0') ch = NULL;
|
||||
if (*ch == '\0') ch = nullptr;
|
||||
} else {
|
||||
digit = value % 10;
|
||||
value /= 10;
|
||||
|
@ -517,7 +517,7 @@ static void format_comma_separated_fixed_1dp(char **dest, size_t *size, sint64 v
|
|||
char tmp;
|
||||
const char *commaMark = language_get_string(STR_LOCALE_THOUSANDS_SEPARATOR);
|
||||
const char *decimalMark = language_get_string(STR_LOCALE_DECIMAL_POINT);
|
||||
const char *ch = NULL;
|
||||
const char *ch = nullptr;
|
||||
sint32 zeroNeeded = 1;
|
||||
|
||||
if ((*size) == 0) return;
|
||||
|
@ -550,9 +550,9 @@ static void format_comma_separated_fixed_1dp(char **dest, size_t *size, sint64 v
|
|||
ch = commaMark;
|
||||
}
|
||||
|
||||
if (ch != NULL ) {
|
||||
if (ch != nullptr ) {
|
||||
format_push_char_safe(*ch++);
|
||||
if (*ch == '\0') ch = NULL;
|
||||
if (*ch == '\0') ch = nullptr;
|
||||
} else {
|
||||
zeroNeeded = 0;
|
||||
digit = value % 10;
|
||||
|
@ -573,9 +573,9 @@ static void format_comma_separated_fixed_1dp(char **dest, size_t *size, sint64 v
|
|||
ch = commaMark;
|
||||
}
|
||||
|
||||
if (ch != NULL ) {
|
||||
if (ch != nullptr ) {
|
||||
format_push_wrap(*ch++);
|
||||
if (*ch == '\0') ch = NULL;
|
||||
if (*ch == '\0') ch = nullptr;
|
||||
} else {
|
||||
zeroNeeded = 0;
|
||||
digit = value % 10;
|
||||
|
@ -610,7 +610,7 @@ static void format_comma_separated_fixed_2dp(char **dest, size_t *size, sint64 v
|
|||
char tmp;
|
||||
const char *commaMark = language_get_string(STR_LOCALE_THOUSANDS_SEPARATOR);
|
||||
const char *decimalMark = language_get_string(STR_LOCALE_DECIMAL_POINT);
|
||||
const char *ch = NULL;
|
||||
const char *ch = nullptr;
|
||||
sint32 zeroNeeded = 1;
|
||||
|
||||
if ((*size) == 0) return;
|
||||
|
@ -649,9 +649,9 @@ static void format_comma_separated_fixed_2dp(char **dest, size_t *size, sint64 v
|
|||
ch = commaMark;
|
||||
}
|
||||
|
||||
if (ch != NULL ) {
|
||||
if (ch != nullptr ) {
|
||||
format_push_char_safe(*ch++);
|
||||
if (*ch == '\0') ch = NULL;
|
||||
if (*ch == '\0') ch = nullptr;
|
||||
} else {
|
||||
zeroNeeded = 0;
|
||||
digit = value % 10;
|
||||
|
@ -672,9 +672,9 @@ static void format_comma_separated_fixed_2dp(char **dest, size_t *size, sint64 v
|
|||
ch = commaMark;
|
||||
}
|
||||
|
||||
if (ch != NULL ) {
|
||||
if (ch != nullptr ) {
|
||||
format_push_wrap(*ch++);
|
||||
if (*ch == '\0') ch = NULL;
|
||||
if (*ch == '\0') ch = nullptr;
|
||||
} else {
|
||||
zeroNeeded = 0;
|
||||
digit = value % 10;
|
||||
|
@ -1271,16 +1271,16 @@ money32 string_to_money(char * string_to_monetise)
|
|||
}
|
||||
|
||||
int number = 0, decimal = 0;
|
||||
if (strstr(buffer, decimal_char) == NULL) {
|
||||
if (strstr(buffer, decimal_char) == nullptr) {
|
||||
// If decimal char does not exist, no tokenising is needed.
|
||||
number = atoi(buffer);
|
||||
}
|
||||
else {
|
||||
char *numberText = strtok(buffer, decimal_char);
|
||||
char *decimalText = strtok(NULL, decimal_char);
|
||||
char *decimalText = strtok(nullptr, decimal_char);
|
||||
|
||||
if (numberText != NULL) number = atoi(numberText);
|
||||
if (decimalText != NULL) decimal = atoi(decimalText);
|
||||
if (numberText != nullptr) number = atoi(numberText);
|
||||
if (decimalText != nullptr) decimal = atoi(decimalText);
|
||||
|
||||
// The second parameter in MONEY must be two digits in length, while the game only ever uses
|
||||
// the first of the two digits.
|
||||
|
|
|
@ -40,7 +40,7 @@ uint32 utf8_get_next(const utf8 *char_ptr, const utf8 **nextchar_ptr)
|
|||
numBytes = 1;
|
||||
}
|
||||
|
||||
if (nextchar_ptr != NULL)
|
||||
if (nextchar_ptr != nullptr)
|
||||
*nextchar_ptr = char_ptr + numBytes;
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue