mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix many warnings for x64
This commit is contained in:
parent
1f398a69ff
commit
8cf7e87b5c
|
@ -231,11 +231,11 @@ unsigned long Source_SampleStream::Read(unsigned long offset, const uint8** data
|
|||
currentposition = newposition;
|
||||
}
|
||||
*data = buffer;
|
||||
int read = SDL_RWread(rw, buffer, 1, length);
|
||||
if (read == -1) {
|
||||
size_t read = SDL_RWread(rw, buffer, 1, length);
|
||||
if (read == (size_t)-1) {
|
||||
return 0;
|
||||
}
|
||||
return read;
|
||||
return (unsigned long)read;
|
||||
}
|
||||
|
||||
bool Source_SampleStream::LoadWAV(SDL_RWops* rw)
|
||||
|
@ -464,7 +464,7 @@ void Mixer::Init(const char* device)
|
|||
format.channels = have.channels;
|
||||
format.freq = have.freq;
|
||||
const char* filename = get_file_path(PATH_ID_CSS1);
|
||||
for (size_t i = 0; i < Util::CountOf(css1sources); i++) {
|
||||
for (int i = 0; i < (int)Util::CountOf(css1sources); i++) {
|
||||
Source_Sample* source_sample = new Source_Sample;
|
||||
if (source_sample->LoadCSS1(filename, i)) {
|
||||
source_sample->Convert(format); // convert to audio output format, saves some cpu usage but requires a bit more memory, optional
|
||||
|
@ -542,7 +542,7 @@ bool Mixer::LoadMusic(size_t pathId)
|
|||
return false;
|
||||
}
|
||||
if (!musicsources[pathId]) {
|
||||
const char* filename = get_file_path(pathId);
|
||||
const char* filename = get_file_path((int)pathId);
|
||||
Source_Sample* source_sample = new Source_Sample;
|
||||
if (source_sample->LoadWAV(filename)) {
|
||||
musicsources[pathId] = source_sample;
|
||||
|
|
|
@ -317,7 +317,7 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
|
|||
for (unsigned int y = 0; y < height; y++) {
|
||||
rle_code *previousCode, *currentCode;
|
||||
|
||||
yOffsets[y] = (dst - buffer);
|
||||
yOffsets[y] = (uint16)(dst - buffer);
|
||||
|
||||
previousCode = NULL;
|
||||
currentCode = (rle_code*)dst;
|
||||
|
@ -537,9 +537,9 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
int numbers = (int)floor(log(maxIndex));
|
||||
|
||||
safe_strcpy(outputPath, argv[2], MAX_PATH);
|
||||
int pathLen = strlen(outputPath);
|
||||
size_t pathLen = strlen(outputPath);
|
||||
|
||||
if (pathLen >= MAX_PATH - numbers - 5){
|
||||
if (pathLen >= (size_t)(MAX_PATH - numbers - 5)) {
|
||||
fprintf(stderr, "Path too long.\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
const char *spriteFilePath = argv[1];
|
||||
const char *resourcePath = argv[2];
|
||||
char imagePath[MAX_PATH];
|
||||
int resourceLength = strlen(resourcePath);
|
||||
size_t resourceLength = strlen(resourcePath);
|
||||
|
||||
bool silent = (argc >= 4 && strcmp(argv[3], "silent") == 0);
|
||||
SDL_RWops *file;
|
||||
|
|
14
src/config.c
14
src/config.c
|
@ -648,7 +648,7 @@ static bool config_get_section(const utf8string line, const utf8 **sectionName,
|
|||
if (c == ']') break;
|
||||
}
|
||||
|
||||
*sectionNameSize = ch - *sectionName - 1;
|
||||
*sectionNameSize = (int)(ch - *sectionName - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -668,7 +668,7 @@ static bool config_get_property_name_value(const utf8string line, utf8 **propert
|
|||
while ((c = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
|
||||
if (isspace(c) || c == '=') {
|
||||
if (c == '=') equals = true;
|
||||
*propertyNameSize = ch - *propertyName - 1;
|
||||
*propertyNameSize = (int)(ch - *propertyName - 1);
|
||||
break;
|
||||
} else if (c == '#') {
|
||||
return false;
|
||||
|
@ -699,8 +699,8 @@ static bool config_get_property_name_value(const utf8string line, utf8 **propert
|
|||
if (c != ' ') clast = ch;
|
||||
}
|
||||
}
|
||||
if (!quotes) *valueSize = clast - *value;
|
||||
else *valueSize = ch - *value - 1;
|
||||
if (!quotes) *valueSize = (int)(clast - *value);
|
||||
else *valueSize = (int)(ch - *value - 1);
|
||||
if (quotes) (*valueSize)--;
|
||||
return true;
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ static config_section_definition *config_get_section_def(const utf8 *name, int s
|
|||
|
||||
for (i = 0; i < countof(_sectionDefinitions); i++) {
|
||||
const_utf8string sectionName = _sectionDefinitions[i].section_name;
|
||||
const int sectionNameSize = strnlen(sectionName, size);
|
||||
int sectionNameSize = (int)strnlen(sectionName, size);
|
||||
if (sectionNameSize == size && sectionName[size] == 0 && _strnicmp(sectionName, name, size) == 0)
|
||||
return &_sectionDefinitions[i];
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ static config_property_definition *config_get_property_def(config_section_defini
|
|||
|
||||
for (i = 0; i < section->property_definitions_count; i++) {
|
||||
const_utf8string propertyName = section->property_definitions[i].property_name;
|
||||
const int propertyNameSize = strnlen(propertyName, size);
|
||||
int propertyNameSize = (int)strnlen(propertyName, size);
|
||||
if (propertyNameSize == size && propertyName[size] == 0 && _strnicmp(propertyName, name, size) == 0)
|
||||
{
|
||||
return §ion->property_definitions[i];
|
||||
|
@ -764,7 +764,7 @@ static void config_set_property(const config_section_definition *section, const
|
|||
value_union *destValue = (value_union*)((size_t)section->base_address + (size_t)property->offset);
|
||||
|
||||
if (property->enum_definitions != NULL)
|
||||
if (config_read_enum(destValue, _configValueTypeSize[property->type], value, valueSize, property->enum_definitions))
|
||||
if (config_read_enum(destValue, (int)_configValueTypeSize[property->type], value, valueSize, property->enum_definitions))
|
||||
return;
|
||||
|
||||
switch (property->type) {
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace Path
|
|||
#ifdef __WINDOWS__
|
||||
wchar_t * relativePathW = utf8_to_widechar(relativePath);
|
||||
wchar_t absolutePathW[MAX_PATH];
|
||||
DWORD length = GetFullPathNameW(relativePathW, Util::CountOf(absolutePathW), absolutePathW, NULL);
|
||||
DWORD length = GetFullPathNameW(relativePathW, (DWORD)Util::CountOf(absolutePathW), absolutePathW, NULL);
|
||||
Memory::Free(relativePathW);
|
||||
if (length == 0)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
*/
|
||||
void Append(codepoint_t codepoint)
|
||||
{
|
||||
codepoint_t codepointLength = String::GetCodepointLength(codepoint);
|
||||
size_t codepointLength = String::GetCodepointLength(codepoint);
|
||||
EnsureCapacity(_length + codepointLength + 1);
|
||||
String::WriteCodepoint(_buffer + _length, codepoint);
|
||||
_length += codepointLength;
|
||||
|
|
|
@ -114,7 +114,7 @@ void DrawImageShader::DrawInstances(const std::vector<DrawImageInstance>& instan
|
|||
glBindBuffer(GL_ARRAY_BUFFER, _vboInstances);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(instances[0]) * instances.size(), instances.data(), GL_STREAM_DRAW);
|
||||
|
||||
glDrawArraysInstanced(GL_TRIANGLES, 0, 6, instances.size());
|
||||
glDrawArraysInstanced(GL_TRIANGLES, 0, 6, (GLsizei)instances.size());
|
||||
}
|
||||
|
||||
#endif /* DISABLE_OPENGL */
|
||||
|
|
|
@ -973,8 +973,8 @@ void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo * dpi)
|
|||
|
||||
assert(bitsOffset < bitsSize);
|
||||
|
||||
_clipLeft = bitsOffset % (screenDPI->width + screenDPI->pitch);
|
||||
_clipTop = bitsOffset / (screenDPI->width + screenDPI->pitch);
|
||||
_clipLeft = (sint32)(bitsOffset % (screenDPI->width + screenDPI->pitch));
|
||||
_clipTop = (sint32)(bitsOffset / (screenDPI->width + screenDPI->pitch));
|
||||
|
||||
_clipRight = _clipLeft + dpi->width;
|
||||
_clipBottom = _clipTop + dpi->height;
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
_freeSlots.resize(_cols * _rows);
|
||||
for (size_t i = 0; i < _freeSlots.size(); i++)
|
||||
{
|
||||
_freeSlots[i] = i;
|
||||
_freeSlots[i] = (GLuint)i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -578,7 +578,8 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
source_pointer = g1_source->offset;
|
||||
uint8* new_source_pointer_start = malloc(total_no_pixels);
|
||||
uint8* new_source_pointer = new_source_pointer_start;// 0x9E3D28;
|
||||
intptr_t ebx, ecx;
|
||||
intptr_t ebx;
|
||||
int ecx;
|
||||
while (total_no_pixels>0){
|
||||
sint8 no_pixels = *source_pointer;
|
||||
if (no_pixels >= 0){
|
||||
|
@ -592,7 +593,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
ecx = no_pixels;
|
||||
no_pixels &= 0x7;
|
||||
ecx >>= 3;//SAR
|
||||
int eax = ((int)no_pixels)<<8;
|
||||
uintptr_t eax = ((uintptr_t)no_pixels) << 8;
|
||||
ecx = -ecx;//Odd
|
||||
eax = (eax & 0xFF00) + *(source_pointer+1);
|
||||
total_no_pixels -= ecx;
|
||||
|
|
|
@ -701,7 +701,7 @@ void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, int x, int
|
|||
|
||||
static uint32 _ttf_surface_cache_hash(TTF_Font *font, const utf8 *text)
|
||||
{
|
||||
uint32 hash = ((uint32)font * 23) ^ 0xAAAAAAAA;
|
||||
uint32 hash = (uint32)((((uintptr_t)font * 23) ^ 0xAAAAAAAA) & 0xFFFFFFFF);
|
||||
for (const utf8 *ch = text; *ch != 0; ch++) {
|
||||
hash = ror32(hash, 3) ^ (*ch * 13);
|
||||
}
|
||||
|
@ -1176,7 +1176,7 @@ static const utf8 *ttf_process_glyph_run(rct_drawpixelinfo *dpi, const utf8 *tex
|
|||
ttf_draw_string_raw(dpi, text, info);
|
||||
return ch;
|
||||
} else {
|
||||
int length = ch - text;
|
||||
size_t length = (size_t)(ch - text);
|
||||
memcpy(buffer, text, length);
|
||||
buffer[length] = 0;
|
||||
ttf_draw_string_raw(dpi, buffer, info);
|
||||
|
@ -1339,7 +1339,7 @@ void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, in
|
|||
|
||||
void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, int availableWidth)
|
||||
{
|
||||
int length = strlen(path);
|
||||
size_t length = strlen(path);
|
||||
|
||||
// Return full string if it fits
|
||||
if (gfx_get_string_width((char*)path) <= availableWidth) {
|
||||
|
@ -1349,7 +1349,7 @@ void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, int availab
|
|||
|
||||
// Count path separators
|
||||
int path_separators = 0;
|
||||
for (int x = 0; x < length; x++) {
|
||||
for (size_t x = 0; x < length; x++) {
|
||||
if (path[x] == platform_get_path_separator()) {
|
||||
path_separators++;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifdef NO_RCT2
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -200,7 +202,7 @@ static void hookfunc(int address, int newaddress, int stacksize, int registerarg
|
|||
data[i++] = 0xC3; // retn
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||
WriteProcessMemory(GetCurrentProcess(), address, data, i, 0);
|
||||
#else
|
||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||
memcpy((void *)address, data, i);
|
||||
|
@ -255,3 +257,5 @@ void addhook(int address, int newaddress, int stacksize, int registerargs[], int
|
|||
hookfunc(hookaddress, newaddress, stacksize, registerargs, registersreturned, eaxDestinationRegister);
|
||||
g_hooktableoffset++;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#ifndef _HOOK_H_
|
||||
#define _HOOK_H_
|
||||
|
||||
#ifndef NO_RCT2
|
||||
|
||||
enum REGISTER_ARGS {
|
||||
EAX = 1 << 0,
|
||||
EBX = 1 << 1,
|
||||
|
@ -31,3 +33,5 @@ enum REGISTER_ARGS {
|
|||
void addhook(int address, int newaddress, int stacksize, int registerargs[], int registersreturned, int eaxDestinationRegister);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -203,7 +203,7 @@ void console_draw(rct_drawpixelinfo *dpi)
|
|||
break;
|
||||
drawLines++;
|
||||
|
||||
int lineLength = min(sizeof(lineBuffer) - (size_t)utf8_get_codepoint_length(FORMAT_WHITE), (size_t)(nextLine - ch));
|
||||
size_t lineLength = min(sizeof(lineBuffer) - (size_t)utf8_get_codepoint_length(FORMAT_WHITE), (size_t)(nextLine - ch));
|
||||
lineCh = lineBuffer;
|
||||
lineCh = utf8_write_codepoint(lineCh, FORMAT_WHITE);
|
||||
strncpy(lineCh, ch, lineLength);
|
||||
|
@ -296,9 +296,9 @@ static void console_write_prompt()
|
|||
|
||||
void console_write(const utf8 *src)
|
||||
{
|
||||
int charactersRemainingInBuffer = CONSOLE_BUFFER_SIZE - (_consoleBufferPointer - _consoleBuffer) - 1;
|
||||
int charactersToWrite = strlen(src);
|
||||
int bufferShift = charactersToWrite - charactersRemainingInBuffer;
|
||||
size_t charactersRemainingInBuffer = CONSOLE_BUFFER_SIZE - (_consoleBufferPointer - _consoleBuffer) - 1;
|
||||
size_t charactersToWrite = strlen(src);
|
||||
size_t bufferShift = charactersToWrite - charactersRemainingInBuffer;
|
||||
if (charactersToWrite > charactersRemainingInBuffer) {
|
||||
memmove(_consoleBuffer, _consoleBuffer + bufferShift, CONSOLE_BUFFER_SIZE - bufferShift);
|
||||
_consoleBufferPointer -= bufferShift;
|
||||
|
@ -1125,7 +1125,7 @@ void console_execute_silent(const utf8 *src)
|
|||
break;
|
||||
end++;
|
||||
}
|
||||
int length = end - start;
|
||||
size_t length = end - start;
|
||||
|
||||
if (length > 0) {
|
||||
utf8 *arg = malloc(length + 1);
|
||||
|
|
|
@ -1273,7 +1273,7 @@ static bool sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
|
|||
ecx = no_pixels;
|
||||
no_pixels &= 0x7;
|
||||
ecx >>= 3;//SAR
|
||||
int eax = ((int) no_pixels) << 8;
|
||||
uintptr_t eax = ((int) no_pixels) << 8;
|
||||
ecx = -ecx;//Odd
|
||||
eax = (eax & 0xFF00) + *(source_pointer + 1);
|
||||
total_no_pixels -= ecx;
|
||||
|
|
|
@ -1108,11 +1108,11 @@ static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
|
|||
gfx_draw_string(dpi, wrapped_string, w->colours[1], l + 2, t);
|
||||
|
||||
|
||||
int string_length = get_string_size(wrapped_string) - 1;
|
||||
size_t string_length = get_string_size(wrapped_string) - 1;
|
||||
|
||||
// Make a copy of the string for measuring the width.
|
||||
char temp_string[512] = { 0 };
|
||||
memcpy(temp_string, wrapped_string, min((size_t)string_length, gTextInput.selection_offset));
|
||||
memcpy(temp_string, wrapped_string, min(string_length, gTextInput.selection_offset));
|
||||
int cur_x = l + gfx_get_string_width(temp_string) + 3;
|
||||
|
||||
int width = 6;
|
||||
|
|
|
@ -719,7 +719,7 @@ void window_close(rct_window* window)
|
|||
|
||||
// Remove window from list and reshift all windows
|
||||
RCT2_NEW_WINDOW--;
|
||||
num_windows = (RCT2_NEW_WINDOW - window);
|
||||
num_windows = (int)(RCT2_NEW_WINDOW - window);
|
||||
if (num_windows > 0)
|
||||
memmove(window, window + 1, num_windows * sizeof(rct_window));
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
~LanguagePack();
|
||||
|
||||
uint16 GetId() const { return _id; }
|
||||
uint32 GetCount() const { return _strings.size(); }
|
||||
uint32 GetCount() const { return (uint32)_strings.size(); }
|
||||
|
||||
const utf8 * GetString(rct_string_id stringId) const;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ int rct2_to_utf8(utf8 *dst, const char *src)
|
|||
dst = utf8_write_codepoint(dst, codepoint);
|
||||
}
|
||||
dst = utf8_write_codepoint(dst, 0);
|
||||
return dst - start;
|
||||
return (int)(dst - start);
|
||||
}
|
||||
|
||||
int utf8_to_rct2(char *dst, const utf8 *src)
|
||||
|
@ -66,7 +66,7 @@ int utf8_to_rct2(char *dst, const utf8 *src)
|
|||
}
|
||||
}
|
||||
*dst++ = 0;
|
||||
return dst - start;
|
||||
return (int)(dst - start);
|
||||
}
|
||||
|
||||
static int encoding_search_compare(const void *pKey, const void *pEntry)
|
||||
|
|
|
@ -288,7 +288,7 @@ static wchar_t convert_specific_language_character_to_unicode(int languageId, wc
|
|||
|
||||
static utf8 *convert_multibyte_charset(const char *src, int languageId)
|
||||
{
|
||||
int reservedLength = (strlen(src) * 4) + 1;
|
||||
size_t reservedLength = (strlen(src) * 4) + 1;
|
||||
utf8 *buffer = (utf8*)malloc(reservedLength);
|
||||
utf8 *dst = buffer;
|
||||
for (const uint8 *ch = (const uint8*)src; *ch != 0;) {
|
||||
|
@ -305,7 +305,7 @@ static utf8 *convert_multibyte_charset(const char *src, int languageId)
|
|||
}
|
||||
}
|
||||
*dst++ = 0;
|
||||
int actualLength = dst - buffer;
|
||||
size_t actualLength = (size_t)(dst - buffer);
|
||||
buffer = (utf8*)realloc(buffer, actualLength);
|
||||
|
||||
return buffer;
|
||||
|
|
|
@ -970,7 +970,7 @@ static void format_string_code(unsigned int format_code, char **dest, char **arg
|
|||
value = *((uint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
format_string_part(dest, value, args);
|
||||
format_string_part(dest, (rct_string_id)value, args);
|
||||
(*dest)--;
|
||||
break;
|
||||
case FORMAT_STRING:
|
||||
|
@ -988,14 +988,14 @@ static void format_string_code(unsigned int format_code, char **dest, char **arg
|
|||
value = *((uint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
format_date(dest, value);
|
||||
format_date(dest, (uint16)value);
|
||||
break;
|
||||
case FORMAT_MONTH:
|
||||
// Pop argument
|
||||
value = *((uint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
strcpy(*dest, language_get_string(DateGameMonthNames[date_get_month(value)]));
|
||||
strcpy(*dest, language_get_string(DateGameMonthNames[date_get_month((int)value)]));
|
||||
*dest += strlen(*dest);
|
||||
break;
|
||||
case FORMAT_VELOCITY:
|
||||
|
@ -1003,7 +1003,7 @@ static void format_string_code(unsigned int format_code, char **dest, char **arg
|
|||
value = *((sint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
format_velocity(dest, value);
|
||||
format_velocity(dest, (uint16)value);
|
||||
break;
|
||||
case FORMAT_POP16:
|
||||
*args += 2;
|
||||
|
@ -1016,21 +1016,21 @@ static void format_string_code(unsigned int format_code, char **dest, char **arg
|
|||
value = *((uint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
format_duration(dest, value);
|
||||
format_duration(dest, (uint16)value);
|
||||
break;
|
||||
case FORMAT_REALTIME:
|
||||
// Pop argument
|
||||
value = *((uint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
format_realtime(dest, value);
|
||||
format_realtime(dest, (uint16)value);
|
||||
break;
|
||||
case FORMAT_LENGTH:
|
||||
// Pop argument
|
||||
value = *((sint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
format_length(dest, value);
|
||||
format_length(dest, (sint16)value);
|
||||
break;
|
||||
case FORMAT_SPRITE:
|
||||
// Pop argument
|
||||
|
@ -1181,7 +1181,7 @@ void generate_string_file()
|
|||
|
||||
for (i = 0; i < 4442; i++) {
|
||||
str = (RCT2_ADDRESS(0x009BF2D4, uint8*) + (i * 4));
|
||||
if (*str == (uint8*)0xFFFFFFFF)
|
||||
if (*str == (uint8*)-1)
|
||||
continue;
|
||||
c = *str;
|
||||
|
||||
|
@ -1248,7 +1248,7 @@ int get_string_length(const utf8 *text)
|
|||
|
||||
utf8 *win1252_to_utf8_alloc(const char *src)
|
||||
{
|
||||
int reservedSpace = (strlen(src) * 4) + 1;
|
||||
size_t reservedSpace = (strlen(src) * 4) + 1;
|
||||
utf8 *result = malloc(reservedSpace);
|
||||
int actualSpace = win1252_to_utf8(result, src, reservedSpace);
|
||||
return (utf8*)realloc(result, actualSpace);
|
||||
|
@ -1271,8 +1271,8 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t maxBufferLength)
|
|||
intermediateBuffer = heapBuffer;
|
||||
}
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, src, -1, intermediateBuffer, bufferCount);
|
||||
int result = WideCharToMultiByte(CP_UTF8, 0, intermediateBuffer, -1, dst, maxBufferLength, NULL, NULL);
|
||||
MultiByteToWideChar(CP_ACP, 0, src, -1, intermediateBuffer, (int)bufferCount);
|
||||
int result = WideCharToMultiByte(CP_UTF8, 0, intermediateBuffer, -1, dst, (int)maxBufferLength, NULL, NULL);
|
||||
|
||||
free(heapBuffer);
|
||||
#else
|
||||
|
|
|
@ -146,6 +146,6 @@ utf8 *widechar_to_utf8(const wchar_t *src)
|
|||
}
|
||||
*dst++ = 0;
|
||||
|
||||
int size = dst - result;
|
||||
size_t size = (size_t)(dst - result);
|
||||
return realloc(result, size);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ int NetworkActions::FindCommand(int command)
|
|||
});
|
||||
if (it != Actions.end())
|
||||
{
|
||||
return it - Actions.begin();
|
||||
return (int)(it - Actions.begin());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ int NetworkActions::FindCommandByPermissionName(const std::string &permission_na
|
|||
});
|
||||
if (it != Actions.end())
|
||||
{
|
||||
return it - Actions.begin();
|
||||
return (int)(it - Actions.begin());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ bool NetworkKey::LoadPrivate(SDL_RWops * file)
|
|||
}
|
||||
char * priv_key = new char[size];
|
||||
file->read(file, priv_key, 1, size);
|
||||
BIO * bio = BIO_new_mem_buf(priv_key, size);
|
||||
BIO * bio = BIO_new_mem_buf(priv_key, (int)size);
|
||||
if (bio == nullptr)
|
||||
{
|
||||
log_error("Failed to initialise OpenSSL's BIO!");
|
||||
|
@ -150,7 +150,7 @@ bool NetworkKey::LoadPublic(SDL_RWops * file)
|
|||
}
|
||||
char * pub_key = new char[size];
|
||||
file->read(file, pub_key, 1, size);
|
||||
BIO * bio = BIO_new_mem_buf(pub_key, size);
|
||||
BIO * bio = BIO_new_mem_buf(pub_key, (int)size);
|
||||
if (bio == nullptr)
|
||||
{
|
||||
log_error("Failed to initialise OpenSSL's BIO!");
|
||||
|
@ -382,7 +382,7 @@ bool NetworkKey::Sign(const uint8 * md, const size_t len, char ** signature, siz
|
|||
|
||||
unsigned char * sig;
|
||||
/* Allocate memory for the signature based on size in slen */
|
||||
if (!(sig = (unsigned char*)OPENSSL_malloc(sizeof(unsigned char) * (*out_size))))
|
||||
if (!(sig = (unsigned char*)OPENSSL_malloc((int)(sizeof(unsigned char) * (*out_size)))))
|
||||
{
|
||||
log_error("Failed to crypto-allocate space fo signature");
|
||||
EVP_MD_CTX_destroy(mdctx);
|
||||
|
|
|
@ -74,7 +74,7 @@ bool NetworkPacket::CommandRequiresAuth()
|
|||
}
|
||||
}
|
||||
|
||||
void NetworkPacket::Write(const uint8 * bytes, uint32 size)
|
||||
void NetworkPacket::Write(const uint8 * bytes, size_t size)
|
||||
{
|
||||
data->insert(data->end(), bytes, bytes + size);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void NetworkPacket::WriteString(const utf8 * string)
|
|||
Write((uint8 *)string, strlen(string) + 1);
|
||||
}
|
||||
|
||||
const uint8 * NetworkPacket::Read(uint32 size)
|
||||
const uint8 * NetworkPacket::Read(size_t size)
|
||||
{
|
||||
if (read + size > NetworkPacket::size)
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ class NetworkPacket
|
|||
public:
|
||||
uint16 size;
|
||||
std::shared_ptr<std::vector<uint8>> data;
|
||||
uint32 transferred;
|
||||
sint32 read;
|
||||
size_t transferred;
|
||||
size_t read;
|
||||
|
||||
static std::unique_ptr<NetworkPacket> Allocate();
|
||||
static std::unique_ptr<NetworkPacket> Duplicate(NetworkPacket& packet);
|
||||
|
@ -40,10 +40,10 @@ public:
|
|||
void Clear();
|
||||
bool CommandRequiresAuth();
|
||||
|
||||
const uint8 * Read(uint32 size);
|
||||
const uint8 * Read(size_t size);
|
||||
const utf8 * ReadString();
|
||||
|
||||
void Write(const uint8 * bytes, uint32 size);
|
||||
void Write(const uint8 * bytes, size_t size);
|
||||
void WriteString(const utf8 * string);
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -272,7 +272,7 @@ public:
|
|||
timeval timeout;
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
if (select(_socket + 1, nullptr, &writeFD, nullptr, &timeout) > 0)
|
||||
if (select((int)(_socket + 1), nullptr, &writeFD, nullptr, &timeout) > 0)
|
||||
{
|
||||
error = 0;
|
||||
socklen_t len = sizeof(error);
|
||||
|
@ -368,7 +368,7 @@ public:
|
|||
throw Exception("Socket not connected.");
|
||||
}
|
||||
|
||||
int readBytes = recv(_socket, (char *)buffer, size, 0);
|
||||
int readBytes = recv(_socket, (char *)buffer, (int)size, 0);
|
||||
if (readBytes == 0)
|
||||
{
|
||||
*sizeReceived = 0;
|
||||
|
@ -439,7 +439,7 @@ private:
|
|||
else
|
||||
{
|
||||
memcpy(ss, result->ai_addr, result->ai_addrlen);
|
||||
*ss_len = result->ai_addrlen;
|
||||
*ss_len = (int)result->ai_addrlen;
|
||||
freeaddrinfo(result);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -41,14 +41,14 @@ void http_dispose() { }
|
|||
|
||||
typedef struct read_buffer {
|
||||
char *ptr;
|
||||
int length;
|
||||
int position;
|
||||
size_t length;
|
||||
size_t position;
|
||||
} read_buffer;
|
||||
|
||||
typedef struct write_buffer {
|
||||
char *ptr;
|
||||
int length;
|
||||
int capacity;
|
||||
size_t length;
|
||||
size_t capacity;
|
||||
} write_buffer;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
@ -94,12 +94,12 @@ static size_t http_request_write_func(void *ptr, size_t size, size_t nmemb, void
|
|||
{
|
||||
write_buffer *writeBuffer = (write_buffer*)userdata;
|
||||
|
||||
int newBytesLength = size * nmemb;
|
||||
size_t newBytesLength = size * nmemb;
|
||||
if (newBytesLength > 0) {
|
||||
int newCapacity = writeBuffer->capacity;
|
||||
int newLength = writeBuffer->length + newBytesLength;
|
||||
size_t newCapacity = writeBuffer->capacity;
|
||||
size_t newLength = writeBuffer->length + newBytesLength;
|
||||
while (newLength > newCapacity) {
|
||||
newCapacity = Math::Max(4096, newCapacity * 2);
|
||||
newCapacity = Math::Max<size_t>(4096, newCapacity * 2);
|
||||
}
|
||||
if (newCapacity != writeBuffer->capacity) {
|
||||
writeBuffer->ptr = (char*)realloc(writeBuffer->ptr, newCapacity);
|
||||
|
@ -140,7 +140,7 @@ http_json_response *http_request_json(const http_json_request *request)
|
|||
headers = curl_slist_append(headers, "Content-Type: " MIME_TYPE_APPLICATION_JSON);
|
||||
|
||||
char contentLengthHeaderValue[64];
|
||||
snprintf(contentLengthHeaderValue, sizeof(contentLengthHeaderValue), "Content-Length: %d", readBuffer.length);
|
||||
snprintf(contentLengthHeaderValue, sizeof(contentLengthHeaderValue), "Content-Length: %zu", readBuffer.length);
|
||||
headers = curl_slist_append(headers, contentLengthHeaderValue);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, readBuffer.ptr);
|
||||
|
|
|
@ -44,6 +44,7 @@ extern "C" {
|
|||
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
|
@ -1050,7 +1051,7 @@ void Network::Server_Send_MAP(NetworkConnection* connection)
|
|||
memcpy(header, &buffer[0], size);
|
||||
}
|
||||
for (size_t i = 0; i < out_size; i += chunksize) {
|
||||
int datasize = (std::min)(chunksize, out_size - i);
|
||||
size_t datasize = Math::Min(chunksize, out_size - i);
|
||||
std::unique_ptr<NetworkPacket> packet = std::move(NetworkPacket::Allocate());
|
||||
*packet << (uint32)NETWORK_COMMAND_MAP << (uint32)out_size << (uint32)i;
|
||||
packet->Write(&header[i], datasize);
|
||||
|
@ -1555,7 +1556,7 @@ void Network::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacket& p
|
|||
connection.AuthStatus = NETWORK_AUTH_VERIFICATIONFAILURE;
|
||||
} else {
|
||||
const char *signature = (const char *)packet.Read(sigsize);
|
||||
SDL_RWops *pubkey_rw = SDL_RWFromConstMem(pubkey, strlen(pubkey));
|
||||
SDL_RWops *pubkey_rw = SDL_RWFromConstMem(pubkey, (int)strlen(pubkey));
|
||||
if (signature == nullptr || pubkey_rw == nullptr) {
|
||||
connection.AuthStatus = NETWORK_AUTH_VERIFICATIONFAILURE;
|
||||
log_verbose("Signature verification failed, invalid data!");
|
||||
|
@ -1617,7 +1618,7 @@ void Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pa
|
|||
{
|
||||
uint32 size, offset;
|
||||
packet >> size >> offset;
|
||||
int chunksize = packet.size - packet.read;
|
||||
int chunksize = (int)(packet.size - packet.read);
|
||||
if (chunksize <= 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1652,7 +1653,7 @@ void Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pa
|
|||
} else {
|
||||
log_verbose("Assuming received map is in plain sv6 format");
|
||||
}
|
||||
SDL_RWops* rw = SDL_RWFromMem(data, data_size);
|
||||
SDL_RWops* rw = SDL_RWFromMem(data, (int)data_size);
|
||||
if (game_load_network(rw)) {
|
||||
game_load_init();
|
||||
game_command_queue.clear();
|
||||
|
@ -2027,7 +2028,7 @@ uint8 network_get_current_player_id()
|
|||
|
||||
int network_get_num_players()
|
||||
{
|
||||
return gNetwork.player_list.size();
|
||||
return (int)gNetwork.player_list.size();
|
||||
}
|
||||
|
||||
const char* network_get_player_name(unsigned int index)
|
||||
|
@ -2097,7 +2098,7 @@ int network_get_player_index(uint8 id)
|
|||
if(it == gNetwork.player_list.end()){
|
||||
return -1;
|
||||
}
|
||||
return gNetwork.GetPlayerIteratorByID(id) - gNetwork.player_list.begin();
|
||||
return (int)(gNetwork.GetPlayerIteratorByID(id) - gNetwork.player_list.begin());
|
||||
}
|
||||
|
||||
uint8 network_get_player_group(unsigned int index)
|
||||
|
@ -2116,7 +2117,7 @@ int network_get_group_index(uint8 id)
|
|||
if(it == gNetwork.group_list.end()){
|
||||
return -1;
|
||||
}
|
||||
return gNetwork.GetGroupIteratorByID(id) - gNetwork.group_list.begin();
|
||||
return (int)(gNetwork.GetGroupIteratorByID(id) - gNetwork.group_list.begin());
|
||||
}
|
||||
|
||||
uint8 network_get_group_id(unsigned int index)
|
||||
|
@ -2126,7 +2127,7 @@ uint8 network_get_group_id(unsigned int index)
|
|||
|
||||
int network_get_num_groups()
|
||||
{
|
||||
return gNetwork.group_list.size();
|
||||
return (int)gNetwork.group_list.size();
|
||||
}
|
||||
|
||||
const char* network_get_group_name(unsigned int index)
|
||||
|
@ -2358,7 +2359,7 @@ uint8 network_get_default_group()
|
|||
|
||||
int network_get_num_actions()
|
||||
{
|
||||
return NetworkActions::Actions.size();
|
||||
return (int)NetworkActions::Actions.size();
|
||||
}
|
||||
|
||||
rct_string_id network_get_action_name_string_id(unsigned int index)
|
||||
|
|
|
@ -39,5 +39,5 @@ public:
|
|||
|
||||
void Read(IReadObjectContext * context, IStream * stream);
|
||||
const rct_g1_element * GetImages() const { return _entries.data(); }
|
||||
uint32 GetCount() const { return _entries.size(); };
|
||||
uint32 GetCount() const { return (uint32)_entries.size(); };
|
||||
};
|
|
@ -360,7 +360,7 @@ private:
|
|||
header.TotalFileSize = _queryDirectoryResult.TotalFileSize;
|
||||
header.FileDateModifiedChecksum = _queryDirectoryResult.FileDateModifiedChecksum;
|
||||
header.PathChecksum = _queryDirectoryResult.PathChecksum;
|
||||
header.NumItems = _items.size();
|
||||
header.NumItems = (uint32)_items.size();
|
||||
fs.WriteValue(header);
|
||||
|
||||
// Write items
|
||||
|
@ -545,7 +545,7 @@ private:
|
|||
uint8 objectType = entry->flags & 0x0F;
|
||||
sawyercoding_chunk_header chunkHeader;
|
||||
chunkHeader.encoding = object_entry_group_encoding[objectType];
|
||||
chunkHeader.length = dataSize;
|
||||
chunkHeader.length = (uint32)dataSize;
|
||||
uint8 * encodedDataBuffer = Memory::Allocate<uint8>(0x600000);
|
||||
size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (uint8 *)data, chunkHeader);
|
||||
|
||||
|
@ -797,7 +797,7 @@ extern "C"
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32 chunkSize = sawyercoding_read_chunk(rw, chunk);
|
||||
size_t chunkSize = sawyercoding_read_chunk(rw, chunk);
|
||||
chunk = Memory::Reallocate(chunk, chunkSize);
|
||||
if (chunk == nullptr)
|
||||
{
|
||||
|
|
|
@ -134,6 +134,6 @@ void SceneryGroupObject::ReadItems(IStream * stream)
|
|||
items.push_back(entry);
|
||||
}
|
||||
|
||||
_numItems = items.size();
|
||||
_numItems = (uint32)items.size();
|
||||
_items = Memory::DuplicateArray(items.data(), items.size());
|
||||
}
|
||||
|
|
|
@ -664,13 +664,14 @@ static void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height,
|
|||
*/
|
||||
void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
|
||||
{
|
||||
#ifndef NO_RCT2
|
||||
if (gUseOriginalRidePaint) {
|
||||
TempForScrollText = true;
|
||||
RCT2_CALLPROC_X(0x6A3590, 0, 0, direction, height, (int) map_element, 0, 0);
|
||||
TempForScrollText = false;
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
|
||||
|
||||
|
|
|
@ -2333,7 +2333,7 @@ static void peep_update_ride_sub_state_0(rct_peep* peep){
|
|||
*car_array_pointer++ = i;
|
||||
}
|
||||
|
||||
car_array_size = car_array_pointer - car_array;
|
||||
car_array_size = (uint8)(car_array_pointer - car_array);
|
||||
|
||||
if (car_array_size == 0)return;
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16
|
|||
|
||||
if ((staff_type == STAFF_TYPE_HANDYMAN) && gConfigGeneral.handymen_mow_default) {
|
||||
uint8 new_orders = newPeep->staff_orders | STAFF_ORDERS_MOWING;
|
||||
game_do_command(newPeep->x, ((int)new_orders << 8) | 1, newPeep->y, newPeep->sprite_index, GAME_COMMAND_SET_STAFF_ORDER, (int)newPeep, 0);
|
||||
game_do_command(newPeep->x, ((int)new_orders << 8) | 1, newPeep->y, newPeep->sprite_index, GAME_COMMAND_SET_STAFF_ORDER, 0, 0);
|
||||
}
|
||||
|
||||
*newPeep_sprite_index = newPeep->sprite_index;
|
||||
|
|
|
@ -536,7 +536,7 @@ void platform_resolve_openrct_data_path()
|
|||
free(customUserDataPathW);
|
||||
|
||||
// Ensure path ends with separator
|
||||
int len = strlen(_userDataDirectoryPath);
|
||||
size_t len = strlen(_userDataDirectoryPath);
|
||||
if (_userDataDirectoryPath[len - 1] != separator[0]) {
|
||||
strcat(_userDataDirectoryPath, separator);
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ void platform_resolve_user_data_path()
|
|||
free(customUserDataPathW);
|
||||
|
||||
// Ensure path ends with separator
|
||||
int len = strlen(_userDataDirectoryPath);
|
||||
size_t len = strlen(_userDataDirectoryPath);
|
||||
if (_userDataDirectoryPath[len - 1] != separator[0]) {
|
||||
strcat(_userDataDirectoryPath, separator);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
bool rct1_read_sc4(const char *path, rct1_s4 *s4)
|
||||
{
|
||||
uint8 *buffer, *decodedBuffer;
|
||||
long length, decodedLength;
|
||||
size_t length, decodedLength;
|
||||
bool success;
|
||||
|
||||
if (!readentirefile(path, (void**)&buffer, (int*)&length)) {
|
||||
|
@ -55,7 +55,7 @@ bool rct1_read_sc4(const char *path, rct1_s4 *s4)
|
|||
bool rct1_read_sv4(const char *path, rct1_s4 *s4)
|
||||
{
|
||||
uint8 *buffer, *decodedBuffer;
|
||||
long length, decodedLength;
|
||||
size_t length, decodedLength;
|
||||
bool success;
|
||||
|
||||
if (!readentirefile(path, (void**)&buffer, (int*)&length)) {
|
||||
|
|
|
@ -103,7 +103,7 @@ void S6Exporter::Save(SDL_RWops * rw, bool isScenario)
|
|||
}
|
||||
|
||||
sawyercoding_chunk_header chunkHeader;
|
||||
int encodedLength;
|
||||
size_t encodedLength;
|
||||
|
||||
// 0: Write header chunk
|
||||
chunkHeader.encoding = CHUNK_ENCODING_ROTATE;
|
||||
|
@ -232,7 +232,7 @@ void S6Exporter::Export()
|
|||
{
|
||||
const rct_object_entry * entry = get_loaded_object_entry(i);
|
||||
void * entryData = get_loaded_object_chunk(i);
|
||||
if (entryData == (void *)0xFFFFFFFF)
|
||||
if (entryData == (void *)-1)
|
||||
{
|
||||
Memory::Set(&_s6.objects[i], 0xFF, sizeof(rct_object_entry));
|
||||
}
|
||||
|
|
|
@ -3072,7 +3072,7 @@ static int ride_get_unused_preset_vehicle_colour(uint8 ride_type, uint8 ride_sub
|
|||
return 0;
|
||||
}
|
||||
rct_ride_entry *rideEntry = get_ride_entry(ride_sub_type);
|
||||
if (rideEntry == (rct_ride_entry *)0xFFFFFFFF)
|
||||
if (rideEntry == (rct_ride_entry *)-1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -5980,7 +5980,7 @@ foundRideEntry:
|
|||
|
||||
ride = get_ride(rideIndex);
|
||||
rideEntry = get_ride_entry(rideEntryIndex);
|
||||
if (rideEntry == (rct_ride_entry *)0xFFFFFFFF)
|
||||
if (rideEntry == (rct_ride_entry *)-1)
|
||||
{
|
||||
log_warning("Invalid request for ride %u", rideIndex);
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -6595,7 +6595,7 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es
|
|||
price = *edi;
|
||||
secondary_price = (*edx >> 8);
|
||||
|
||||
if (rideEntry == (rct_ride_entry *)0xFFFFFFFF)
|
||||
if (rideEntry == (rct_ride_entry *)-1)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", ride_number);
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
|
|
|
@ -922,7 +922,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
|
|||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
rct_ride_entry *rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == (rct_ride_entry *)0xFFFFFFFF || rideEntry == NULL)
|
||||
if (rideEntry == (rct_ride_entry *)-1 || rideEntry == NULL)
|
||||
{
|
||||
log_warning("Invalid ride type for track placement, rideIndex = %d", rideIndex);
|
||||
return MONEY32_UNDEFINED;
|
||||
|
|
|
@ -157,7 +157,7 @@ static rct_track_td6 *track_design_open_from_buffer(uint8 *src, size_t srcLength
|
|||
free(td6);
|
||||
return NULL;
|
||||
}
|
||||
copy(elementData, &readPtr, elementDataLength);
|
||||
copy(elementData, &readPtr, (int)elementDataLength);
|
||||
td6->elements = elementData;
|
||||
td6->elementsSize = elementDataLength;
|
||||
|
||||
|
|
|
@ -220,13 +220,13 @@ static int map_element_get_total_element_count(rct_map_element *mapElement)
|
|||
*/
|
||||
static bool track_design_save_can_add_map_element(rct_map_element *mapElement)
|
||||
{
|
||||
int newElementCount = map_element_get_total_element_count(mapElement);
|
||||
size_t newElementCount = map_element_get_total_element_count(mapElement);
|
||||
if (newElementCount == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get number of spare elements left
|
||||
int spareSavedElements = TRACK_MAX_SAVED_MAP_ELEMENTS - _trackSavedMapElementsCount;
|
||||
size_t spareSavedElements = TRACK_MAX_SAVED_MAP_ELEMENTS - _trackSavedMapElementsCount;
|
||||
if (newElementCount > spareSavedElements) {
|
||||
// No more spare saved elements left
|
||||
return false;
|
||||
|
@ -1264,7 +1264,7 @@ bool track_design_save_to_file(const utf8 *path)
|
|||
// Encode TD6 data
|
||||
uint8 *encodedData = malloc(0x8000);
|
||||
assert(td6Buffer.ptr != NULL);
|
||||
int encodedDataLength = sawyercoding_encode_td6((uint8*)td6Buffer.ptr, encodedData, td6Buffer.length);
|
||||
size_t encodedDataLength = sawyercoding_encode_td6((uint8*)td6Buffer.ptr, encodedData, td6Buffer.length);
|
||||
|
||||
// Save encoded TD6 data to file
|
||||
bool result;
|
||||
|
|
|
@ -1264,6 +1264,7 @@ void track_paint(uint8 direction, int height, rct_map_element *mapElement)
|
|||
}
|
||||
|
||||
int rideType = ride->type;
|
||||
#ifndef NO_RCT2
|
||||
if (rideType == RIDE_TYPE_JUNIOR_ROLLER_COASTER && gUseOriginalRidePaint) {
|
||||
switch (trackType) {
|
||||
case TRACK_ELEM_60_DEG_UP:
|
||||
|
@ -1288,9 +1289,14 @@ void track_paint(uint8 direction, int height, rct_map_element *mapElement)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool useOriginalRidePaint = false;
|
||||
#ifndef NO_RCT2
|
||||
useOriginalRidePaint = gUseOriginalRidePaint;
|
||||
#endif
|
||||
TRACK_PAINT_FUNCTION_GETTER paintFunctionGetter = RideTypeTrackPaintFunctions[rideType];
|
||||
if (paintFunctionGetter != NULL && !gUseOriginalRidePaint) {
|
||||
if (paintFunctionGetter != NULL && !useOriginalRidePaint) {
|
||||
TRACK_PAINT_FUNCTION paintFunction = paintFunctionGetter(trackType, direction);
|
||||
if (paintFunction != NULL) {
|
||||
paintFunction(rideIndex, trackSequence, direction, height, mapElement);
|
||||
|
|
|
@ -2359,7 +2359,7 @@ void vehicle_paint(rct_vehicle *vehicle, int imageDirection)
|
|||
}
|
||||
}
|
||||
|
||||
uint32 rct2VehiclePtrFormat = ((uint32)vehicleEntry) - offsetof(rct_ride_entry, vehicles);
|
||||
uint32 rct2VehiclePtrFormat = (uint32)((uintptr_t)vehicleEntry - (uintptr_t)offsetof(rct_ride_entry, vehicles));
|
||||
RCT2_GLOBAL(0x00F64DFC, uint32) = rct2VehiclePtrFormat;
|
||||
switch (vehicleEntry->car_visual) {
|
||||
case VEHICLE_VISUAL_DEFAULT: vehicle_visual_default(x, imageDirection, y, z, vehicle, vehicleEntry); break;
|
||||
|
|
|
@ -122,7 +122,7 @@ int scenario_load_and_play_from_path(const char *path)
|
|||
reset_sprite_spatial_index();
|
||||
reset_all_sprite_quadrant_placements();
|
||||
|
||||
int len = strnlen(path, MAX_PATH) + 1;
|
||||
size_t len = strnlen(path, MAX_PATH) + 1;
|
||||
safe_strcpy(_scenarioPath, path, len);
|
||||
if (len - 1 == MAX_PATH)
|
||||
{
|
||||
|
@ -705,7 +705,7 @@ int scenario_get_num_packed_objects_to_write()
|
|||
for (int i = 0; i < OBJECT_ENTRY_COUNT; i++) {
|
||||
const rct_object_entry *entry = get_loaded_object_entry(i);
|
||||
void *entryData = get_loaded_object_chunk(i);
|
||||
if (entryData != (void*)0xFFFFFFFF && !(entry->flags & 0xF0)) {
|
||||
if (entryData != (void*)-1 && !(entry->flags & 0xF0)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ int scenario_write_packed_objects(SDL_RWops* rw)
|
|||
for (int i = 0; i < OBJECT_ENTRY_COUNT; i++) {
|
||||
const rct_object_entry *entry = get_loaded_object_entry(i);
|
||||
void *entryData = get_loaded_object_chunk(i);
|
||||
if (entryData != (void*)0xFFFFFFFF && !(entry->flags & 0xF0)) {
|
||||
if (entryData != (void*)-1 && !(entry->flags & 0xF0)) {
|
||||
if (!object_saved_packed(rw, entry)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -736,20 +736,16 @@ int scenario_write_packed_objects(SDL_RWops* rw)
|
|||
*/
|
||||
static int scenario_write_available_objects(FILE *file)
|
||||
{
|
||||
uint8 *buffer, *dstBuffer;
|
||||
int i, encodedLength;
|
||||
sawyercoding_chunk_header chunkHeader;
|
||||
|
||||
const int totalEntries = OBJECT_ENTRY_COUNT;
|
||||
const int bufferLength = totalEntries * sizeof(rct_object_entry);
|
||||
|
||||
// Initialise buffers
|
||||
buffer = malloc(bufferLength);
|
||||
uint8 *buffer = malloc(bufferLength);
|
||||
if (buffer == NULL) {
|
||||
log_error("out of memory");
|
||||
return 0;
|
||||
}
|
||||
dstBuffer = malloc(bufferLength + sizeof(sawyercoding_chunk_header));
|
||||
uint8 *dstBuffer = malloc(bufferLength + sizeof(sawyercoding_chunk_header));
|
||||
if (dstBuffer == NULL) {
|
||||
free(buffer);
|
||||
log_error("out of memory");
|
||||
|
@ -758,9 +754,9 @@ static int scenario_write_available_objects(FILE *file)
|
|||
|
||||
// Write entries
|
||||
rct_object_entry *dstEntry = (rct_object_entry*)buffer;
|
||||
for (i = 0; i < OBJECT_ENTRY_COUNT; i++) {
|
||||
for (int i = 0; i < OBJECT_ENTRY_COUNT; i++) {
|
||||
void *entryData = get_loaded_object_chunk(i);
|
||||
if (entryData == (void*)0xFFFFFFFF) {
|
||||
if (entryData == (void*)-1) {
|
||||
memset(dstEntry, 0xFF, sizeof(rct_object_entry));
|
||||
} else {
|
||||
*dstEntry = *get_loaded_object_entry(i);
|
||||
|
@ -769,9 +765,10 @@ static int scenario_write_available_objects(FILE *file)
|
|||
}
|
||||
|
||||
// Write chunk
|
||||
sawyercoding_chunk_header chunkHeader;
|
||||
chunkHeader.encoding = CHUNK_ENCODING_ROTATE;
|
||||
chunkHeader.length = bufferLength;
|
||||
encodedLength = sawyercoding_write_chunk_buffer(dstBuffer, buffer, chunkHeader);
|
||||
size_t encodedLength = sawyercoding_write_chunk_buffer(dstBuffer, buffer, chunkHeader);
|
||||
fwrite(dstBuffer, encodedLength, 1, file);
|
||||
|
||||
// Free buffers
|
||||
|
|
|
@ -140,11 +140,11 @@ size_t sawyercoding_read_chunk(SDL_RWops* rw, uint8 *buffer)
|
|||
memcpy(buffer, src_buffer, chunkHeader.length);
|
||||
break;
|
||||
case CHUNK_ENCODING_RLE:
|
||||
chunkHeader.length = decode_chunk_rle(src_buffer, buffer, chunkHeader.length);
|
||||
chunkHeader.length = (uint32)decode_chunk_rle(src_buffer, buffer, chunkHeader.length);
|
||||
break;
|
||||
case CHUNK_ENCODING_RLECOMPRESSED:
|
||||
chunkHeader.length = decode_chunk_rle(src_buffer, buffer, chunkHeader.length);
|
||||
chunkHeader.length = decode_chunk_repeat(buffer, chunkHeader.length);
|
||||
chunkHeader.length = (uint32)decode_chunk_rle(src_buffer, buffer, chunkHeader.length);
|
||||
chunkHeader.length = (uint32)decode_chunk_repeat(buffer, chunkHeader.length);
|
||||
break;
|
||||
case CHUNK_ENCODING_ROTATE:
|
||||
memcpy(buffer, src_buffer, chunkHeader.length);
|
||||
|
@ -190,11 +190,11 @@ size_t sawyercoding_read_chunk_with_size(SDL_RWops* rw, uint8 *buffer, const siz
|
|||
memcpy(buffer, src_buffer, chunkHeader.length);
|
||||
break;
|
||||
case CHUNK_ENCODING_RLE:
|
||||
chunkHeader.length = decode_chunk_rle_with_size(src_buffer, buffer, chunkHeader.length, buffer_size);
|
||||
chunkHeader.length = (uint32)decode_chunk_rle_with_size(src_buffer, buffer, chunkHeader.length, buffer_size);
|
||||
break;
|
||||
case CHUNK_ENCODING_RLECOMPRESSED:
|
||||
chunkHeader.length = decode_chunk_rle_with_size(src_buffer, buffer, chunkHeader.length, buffer_size);
|
||||
chunkHeader.length = decode_chunk_repeat(buffer, chunkHeader.length);
|
||||
chunkHeader.length = (uint32)decode_chunk_rle_with_size(src_buffer, buffer, chunkHeader.length, buffer_size);
|
||||
chunkHeader.length = (uint32)decode_chunk_repeat(buffer, chunkHeader.length);
|
||||
break;
|
||||
case CHUNK_ENCODING_ROTATE:
|
||||
memcpy(buffer, src_buffer, chunkHeader.length);
|
||||
|
@ -228,7 +228,7 @@ size_t sawyercoding_write_chunk_buffer(uint8 *dst_file, uint8* buffer, sawyercod
|
|||
break;
|
||||
case CHUNK_ENCODING_RLE:
|
||||
encode_buffer = malloc(0x600000);
|
||||
chunkHeader.length = encode_chunk_rle(buffer, encode_buffer, chunkHeader.length);
|
||||
chunkHeader.length = (uint32)encode_chunk_rle(buffer, encode_buffer, chunkHeader.length);
|
||||
memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
dst_file += sizeof(sawyercoding_chunk_header);
|
||||
memcpy(dst_file, encode_buffer, chunkHeader.length);
|
||||
|
@ -238,8 +238,8 @@ size_t sawyercoding_write_chunk_buffer(uint8 *dst_file, uint8* buffer, sawyercod
|
|||
case CHUNK_ENCODING_RLECOMPRESSED:
|
||||
encode_buffer = malloc(chunkHeader.length * 2);
|
||||
encode_buffer2 = malloc(0x600000);
|
||||
chunkHeader.length = encode_chunk_repeat(buffer, encode_buffer, chunkHeader.length);
|
||||
chunkHeader.length = encode_chunk_rle(encode_buffer, encode_buffer2, chunkHeader.length);
|
||||
chunkHeader.length = (uint32)encode_chunk_repeat(buffer, encode_buffer, chunkHeader.length);
|
||||
chunkHeader.length = (uint32)encode_chunk_rle(encode_buffer, encode_buffer2, chunkHeader.length);
|
||||
memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
dst_file += sizeof(sawyercoding_chunk_header);
|
||||
memcpy(dst_file, encode_buffer2, chunkHeader.length);
|
||||
|
|
|
@ -403,15 +403,15 @@ uint32 util_rand() {
|
|||
unsigned char *util_zlib_inflate(unsigned char *data, size_t data_in_size, size_t *data_out_size)
|
||||
{
|
||||
int ret = Z_OK;
|
||||
uLongf out_size = *data_out_size;
|
||||
uLongf out_size = (uLong)*data_out_size;
|
||||
if (out_size == 0)
|
||||
{
|
||||
// Try to guesstimate the size needed for output data by applying the
|
||||
// same ratio it would take to compress data_in_size.
|
||||
out_size = data_in_size * data_in_size / compressBound(data_in_size);
|
||||
out_size = (uLong)data_in_size * (uLong)data_in_size / compressBound((uLong)data_in_size);
|
||||
out_size = min(MAX_ZLIB_REALLOC, out_size);
|
||||
}
|
||||
size_t buffer_size = out_size;
|
||||
uLongf buffer_size = out_size;
|
||||
unsigned char *buffer = malloc(buffer_size);
|
||||
do {
|
||||
if (ret == Z_BUF_ERROR)
|
||||
|
@ -428,7 +428,7 @@ unsigned char *util_zlib_inflate(unsigned char *data, size_t data_in_size, size_
|
|||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
ret = uncompress(buffer, &out_size, data, data_in_size);
|
||||
ret = uncompress(buffer, &out_size, data, (uLong)data_in_size);
|
||||
} while (ret != Z_OK);
|
||||
buffer = realloc(buffer, out_size);
|
||||
*data_out_size = out_size;
|
||||
|
@ -446,8 +446,8 @@ unsigned char *util_zlib_inflate(unsigned char *data, size_t data_in_size, size_
|
|||
unsigned char *util_zlib_deflate(unsigned char *data, size_t data_in_size, size_t *data_out_size)
|
||||
{
|
||||
int ret = Z_OK;
|
||||
uLongf out_size = *data_out_size;
|
||||
size_t buffer_size = compressBound(data_in_size);
|
||||
uLongf out_size = (uLongf)*data_out_size;
|
||||
uLong buffer_size = compressBound((uLong)data_in_size);
|
||||
unsigned char *buffer = malloc(buffer_size);
|
||||
do {
|
||||
if (ret == Z_BUF_ERROR)
|
||||
|
@ -460,7 +460,7 @@ unsigned char *util_zlib_deflate(unsigned char *data, size_t data_in_size, size_
|
|||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
ret = compress(buffer, &out_size, data, data_in_size);
|
||||
ret = compress(buffer, &out_size, data, (uLong)data_in_size);
|
||||
} while (ret != Z_OK);
|
||||
*data_out_size = out_size;
|
||||
buffer = realloc(buffer, *data_out_size);
|
||||
|
|
|
@ -321,14 +321,14 @@ static rct_string_id research_item_get_name(uint32 researchItem)
|
|||
|
||||
if (researchItem < 0x10000) {
|
||||
sceneryEntry = get_scenery_group_entry(researchItem & 0xFF);
|
||||
if (sceneryEntry == NULL || sceneryEntry == (rct_scenery_set_entry*)0xFFFFFFFF)
|
||||
if (sceneryEntry == NULL || sceneryEntry == (rct_scenery_set_entry*)-1)
|
||||
return 0;
|
||||
|
||||
return sceneryEntry->name;
|
||||
}
|
||||
|
||||
rideEntry = get_ride_entry(researchItem & 0xFF);
|
||||
if (rideEntry == NULL || rideEntry == (rct_ride_entry*)0xFFFFFFFF)
|
||||
if (rideEntry == NULL || rideEntry == (rct_ride_entry*)-1)
|
||||
return 0;
|
||||
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)
|
||||
|
@ -792,7 +792,7 @@ static void window_editor_inventions_list_paint(rct_window *w, rct_drawpixelinfo
|
|||
|
||||
void *chunk = object_entry_groups[objectEntryType].chunks[researchItem->entryIndex & 0xFF];
|
||||
|
||||
if (chunk == NULL || chunk == (void*)0xFFFFFFFF)
|
||||
if (chunk == NULL || chunk == (void*)-1)
|
||||
return;
|
||||
|
||||
rct_object_entry * entry = &object_entry_groups[objectEntryType].entries[researchItem->entryIndex & 0xFF].entry;
|
||||
|
|
|
@ -465,7 +465,7 @@ void window_editor_object_selection_open()
|
|||
window->var_4AE = 0;
|
||||
window->selected_tab = 0;
|
||||
window->selected_list_item = -1;
|
||||
window->object_entry = (rct_object_entry *) 0xFFFFFFFF;
|
||||
window->object_entry = (rct_object_entry *)-1;
|
||||
window->min_width = 600;
|
||||
window->min_height = 400;
|
||||
window->max_width = 1200;
|
||||
|
@ -482,7 +482,7 @@ static void setup_track_manager_objects()
|
|||
{
|
||||
uint8 ride_list[128] = { 0 };
|
||||
|
||||
int numObjects = object_repository_get_items_count();
|
||||
int numObjects = (int)object_repository_get_items_count();
|
||||
const ObjectRepositoryItem * items = object_repository_get_items();
|
||||
for (int i = 0; i < numObjects; i++) {
|
||||
uint8 * selectionFlags = &_objectSelectionFlags[i];
|
||||
|
@ -508,7 +508,7 @@ static void setup_track_manager_objects()
|
|||
*/
|
||||
static void setup_track_designer_objects()
|
||||
{
|
||||
int numObjects = object_repository_get_items_count();
|
||||
int numObjects = (int)object_repository_get_items_count();
|
||||
const ObjectRepositoryItem * items = object_repository_get_items();
|
||||
for (int i = 0; i < numObjects; i++) {
|
||||
uint8 * selectionFlags = &_objectSelectionFlags[i];
|
||||
|
@ -544,7 +544,7 @@ static void setup_in_use_selection_flags()
|
|||
|
||||
for (uint8 object_type = 0; object_type < 11; object_type++){
|
||||
for (uint16 i = 0; i < object_entry_group_counts[object_type]; i++){
|
||||
if (object_entry_groups[object_type].chunks[i] != (uint8*)0xFFFFFFFF){
|
||||
if (object_entry_groups[object_type].chunks[i] != (uint8*)-1) {
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[object_type][i] |= (1 << 1);
|
||||
}
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ static void remove_selected_objects_from_research(const rct_object_entry* instal
|
|||
*/
|
||||
static void unload_unselected_objects()
|
||||
{
|
||||
int numItems = object_repository_get_items_count();
|
||||
int numItems = (int)object_repository_get_items_count();
|
||||
const ObjectRepositoryItem * items = object_repository_get_items();
|
||||
|
||||
size_t numObjectsToUnload = 0;
|
||||
|
@ -808,7 +808,7 @@ static void window_editor_object_selection_mouseup(rct_window *w, int widgetInde
|
|||
visible_list_refresh(w);
|
||||
|
||||
w->selected_list_item = -1;
|
||||
w->object_entry = (rct_object_entry *) 0xFFFFFFFF;
|
||||
w->object_entry = (rct_object_entry *)-1;
|
||||
w->scrolls[0].v_top = 0;
|
||||
window_invalidate(w);
|
||||
break;
|
||||
|
@ -827,7 +827,7 @@ static void window_editor_object_selection_mouseup(rct_window *w, int widgetInde
|
|||
visible_list_refresh(w);
|
||||
|
||||
w->selected_list_item = -1;
|
||||
w->object_entry = (rct_object_entry *) 0xFFFFFFFF;
|
||||
w->object_entry = (rct_object_entry *)-1;
|
||||
w->scrolls[0].v_top = 0;
|
||||
window_invalidate(w);
|
||||
break;
|
||||
|
@ -1476,7 +1476,7 @@ static void window_editor_object_set_page(rct_window *w, int page)
|
|||
|
||||
w->selected_tab = page;
|
||||
w->selected_list_item = -1;
|
||||
w->object_entry = (rct_object_entry *)0xFFFFFFFF;
|
||||
w->object_entry = (rct_object_entry *)-1;
|
||||
w->scrolls[0].v_top = 0;
|
||||
|
||||
if (page == WINDOW_OBJECT_SELECTION_PAGE_RIDE_VEHICLES_ATTRACTIONS) {
|
||||
|
|
|
@ -834,7 +834,7 @@ static void window_editor_objective_options_main_invalidate(rct_window *w)
|
|||
colour_scheme_update(w);
|
||||
|
||||
stex = g_stexEntries[0];
|
||||
if (stex == (rct_stex_entry*)0xFFFFFFFF)
|
||||
if (stex == (rct_stex_entry*)-1)
|
||||
stex = NULL;
|
||||
|
||||
widgets = window_editor_objective_options_widgets[w->page];
|
||||
|
@ -904,7 +904,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
|
|||
window_editor_objective_options_draw_tab_images(w, dpi);
|
||||
|
||||
stex = g_stexEntries[0];
|
||||
if (stex == (rct_stex_entry*)0xFFFFFFFF)
|
||||
if (stex == (rct_stex_entry*)-1)
|
||||
stex = NULL;
|
||||
|
||||
// Objective label
|
||||
|
|
|
@ -858,7 +858,7 @@ static int get_num_track_designs(ride_list_item item)
|
|||
}
|
||||
}
|
||||
|
||||
return track_design_index_get_count_for_ride(item.type, entryPtr);
|
||||
return (int)track_design_index_get_count_for_ride(item.type, entryPtr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1074,7 +1074,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||
widget->right - widget->left - 3
|
||||
);
|
||||
|
||||
dropdown_set_checked(theme_manager_get_active_available_theme_index(), true);
|
||||
dropdown_set_checked((int)theme_manager_get_active_available_theme_index(), true);
|
||||
widget_invalidate(w, WIDX_THEMES_DROPDOWN);
|
||||
break;
|
||||
|
||||
|
@ -1529,7 +1529,7 @@ static void window_options_invalidate(rct_window *w)
|
|||
#endif // __LINUX__
|
||||
set_format_arg(0, uint16, STR_STRING);
|
||||
|
||||
set_format_arg(2, uint32, (uint32)gAudioDevices[gAudioCurrentDevice].name);
|
||||
set_format_arg(2, char , (char*)gAudioDevices[gAudioCurrentDevice].name);
|
||||
}
|
||||
|
||||
// music: on/off
|
||||
|
@ -1770,7 +1770,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE:
|
||||
gfx_draw_string_left(dpi, STR_SHOW_TOOLBAR_BUTTONS_FOR, w, w->colours[1], w->x + 10, w->y + window_options_controls_and_interface_widgets[WIDX_TOOLBAR_BUTTONS_GROUP].top + 15);
|
||||
|
||||
int activeAvailableThemeIndex = theme_manager_get_active_available_theme_index();
|
||||
size_t activeAvailableThemeIndex = theme_manager_get_active_available_theme_index();
|
||||
const utf8 * activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex);
|
||||
set_format_arg(0, uintptr_t, (uintptr_t)activeThemeName);
|
||||
|
||||
|
|
|
@ -718,13 +718,13 @@ static void join_server(char *address)
|
|||
|
||||
char *colon = strrchr(address, ':');
|
||||
if (colon != NULL && (endbracket != NULL || dot != NULL)) {
|
||||
address = substr(address, colon - address);
|
||||
address = substr(address, (int)(colon - address));
|
||||
sscanf(colon + 1, "%d", &port);
|
||||
addresscopied = true;
|
||||
}
|
||||
|
||||
if (startbracket && endbracket) {
|
||||
address = substr(startbracket + 1, endbracket - startbracket - 1);
|
||||
address = substr(startbracket + 1, (int)(endbracket - startbracket - 1));
|
||||
addresscopied = true;
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ static void fetch_servers_callback(http_json_response* response)
|
|||
return;
|
||||
}
|
||||
|
||||
int count = json_array_size(jsonServers);
|
||||
int count = (int)json_array_size(jsonServers);
|
||||
for (int i = 0; i < count; i++) {
|
||||
json_t *server = json_array_get(jsonServers, i);
|
||||
if (!json_is_object(server)) {
|
||||
|
|
|
@ -613,7 +613,7 @@ static void window_staff_set_order(rct_window* w, int order_id)
|
|||
int ax = peep->staff_orders ^ (1 << order_id);
|
||||
int flags = (ax << 8) | 1;
|
||||
|
||||
game_do_command(peep->x, flags, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, (int)peep, 0);
|
||||
game_do_command(peep->x, flags, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1396,5 +1396,5 @@ void window_staff_options_dropdown(rct_window *w, int widgetIndex, int dropdownI
|
|||
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
int costume = (RCT2_ADDRESS(0xF4391B, uint8)[dropdownIndex] - 4) | 0x80;
|
||||
game_do_command(peep->x, (costume << 8) | 1, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, (int)peep, 0);
|
||||
game_do_command(peep->x, (costume << 8) | 1, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, 0, 0);
|
||||
}
|
||||
|
|
|
@ -280,16 +280,16 @@ static void window_text_input_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
y += 1;
|
||||
|
||||
char* wrap_pointer = wrapped_string;
|
||||
int char_count = 0;
|
||||
size_t char_count = 0;
|
||||
uint8 cur_drawn = 0;
|
||||
|
||||
int cursorX, cursorY;
|
||||
for (int line = 0; line <= no_lines; line++) {
|
||||
gfx_draw_string(dpi, wrap_pointer, w->colours[1], w->x + 12, y);
|
||||
|
||||
int string_length = get_string_size(wrap_pointer) - 1;
|
||||
size_t string_length = get_string_size(wrap_pointer) - 1;
|
||||
|
||||
if (!cur_drawn && (gTextInput.selection_offset <= (size_t)(char_count + string_length))) {
|
||||
if (!cur_drawn && (gTextInput.selection_offset <= char_count + string_length)) {
|
||||
// Make a copy of the string for measuring the width.
|
||||
char temp_string[512] = { 0 };
|
||||
memcpy(temp_string, wrap_pointer, gTextInput.selection_offset - char_count);
|
||||
|
|
|
@ -359,7 +359,7 @@ void window_themes_open()
|
|||
|
||||
static void window_themes_mouseup(rct_window *w, int widgetIndex)
|
||||
{
|
||||
int activeAvailableThemeIndex;
|
||||
size_t activeAvailableThemeIndex;
|
||||
const utf8 * activeThemeName;
|
||||
|
||||
switch (widgetIndex) {
|
||||
|
@ -507,7 +507,7 @@ static void window_themes_mousedown(int widgetIndex, rct_window* w, rct_widget*
|
|||
widget->right - widget->left - 3
|
||||
);
|
||||
|
||||
dropdown_set_checked(theme_manager_get_active_available_theme_index(), true);
|
||||
dropdown_set_checked((int)theme_manager_get_active_available_theme_index(), true);
|
||||
break;
|
||||
case WIDX_THEMES_RCT1_RIDE_LIGHTS:
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
|
||||
|
@ -765,7 +765,7 @@ void window_themes_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
window_themes_draw_tab_images(dpi, w);
|
||||
|
||||
if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) {
|
||||
int activeAvailableThemeIndex = theme_manager_get_active_available_theme_index();
|
||||
size_t activeAvailableThemeIndex = theme_manager_get_active_available_theme_index();
|
||||
const utf8 * activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex);
|
||||
set_format_arg(0, uintptr_t, (uintptr_t)activeThemeName);
|
||||
gfx_draw_string_left(dpi, STR_THEMES_LABEL_CURRENT_THEME, NULL, w->colours[1], w->x + 10, w->y + window_themes_widgets[WIDX_THEMES_PRESETS].top + 1);
|
||||
|
|
|
@ -216,7 +216,7 @@ static void window_track_list_select(rct_window *w, int index)
|
|||
|
||||
static int window_track_list_get_list_item_index_from_position(int x, int y)
|
||||
{
|
||||
int maxItems = _trackDesignsCount;
|
||||
int maxItems = (int)_trackDesignsCount;
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||
// Extra item: custom design
|
||||
maxItems++;
|
||||
|
|
|
@ -765,7 +765,7 @@ void game_command_remove_scenery(int* eax, int* ebx, int* ecx, int* edx, int* es
|
|||
money32 cost;
|
||||
|
||||
rct_scenery_entry *entry = get_small_scenery_entry(scenery_type);
|
||||
if (entry == (rct_scenery_entry *)0xFFFFFFFF)
|
||||
if (entry == (rct_scenery_entry *)-1)
|
||||
{
|
||||
log_warning("Invalid game command for scenery removal, scenery_type = %u", scenery_type);
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
|
@ -3684,7 +3684,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in
|
|||
}
|
||||
|
||||
rct_scenery_entry *scenery_entry = get_large_scenery_entry(entry_index);
|
||||
if (scenery_entry == (rct_scenery_entry *)0xFFFFFFFF)
|
||||
if (scenery_entry == (rct_scenery_entry *)-1)
|
||||
{
|
||||
log_warning("Invalid game command for scenery placement, entry_index = %u", entry_index);
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
|
@ -4034,13 +4034,13 @@ void map_reorganise_elements()
|
|||
rct_map_element *endElement = startElement;
|
||||
while (!map_element_is_last_for_tile(endElement++));
|
||||
|
||||
num_elements = endElement - startElement;
|
||||
num_elements = (uint32)(endElement - startElement);
|
||||
memcpy(new_elements_pointer, startElement, num_elements * sizeof(rct_map_element));
|
||||
new_elements_pointer += num_elements;
|
||||
}
|
||||
}
|
||||
|
||||
num_elements = (new_elements_pointer - new_map_elements);
|
||||
num_elements = (uint32)(new_elements_pointer - new_map_elements);
|
||||
memcpy(gMapElements, new_map_elements, num_elements * sizeof(rct_map_element));
|
||||
memset(gMapElements + num_elements, 0, (0x30000 - num_elements) * sizeof(rct_map_element));
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ static void mapgen_place_trees()
|
|||
rct_scenery_entry *sceneryEntry = get_small_scenery_entry(i);
|
||||
rct_object_entry_extended *entry = &object_entry_groups[OBJECT_TYPE_SMALL_SCENERY].entries[i];
|
||||
|
||||
if (sceneryEntry == (rct_scenery_entry*)0xFFFFFFFF || sceneryEntry == NULL)
|
||||
if (sceneryEntry == (rct_scenery_entry*)-1 || sceneryEntry == NULL)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < countof(GrassTrees); j++)
|
||||
|
|
Loading…
Reference in New Issue