mirror of https://github.com/OpenRCT2/OpenRCT2.git
commit
31d4f79dc5
|
@ -67,4 +67,3 @@ IDI_ICON ICON "logo\\icon.ico"
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
|
|
@ -229,7 +229,6 @@ unsigned long Source_SampleStream::Read(unsigned long offset, const uint8** data
|
|||
if (newposition == -1) {
|
||||
return 0;
|
||||
}
|
||||
currentposition = newposition;
|
||||
}
|
||||
*data = buffer;
|
||||
size_t read = SDL_RWread(rw, buffer, 1, length);
|
||||
|
@ -439,8 +438,6 @@ void Channel::SetGroup(int group)
|
|||
|
||||
Mixer::Mixer()
|
||||
{
|
||||
effectbuffer = 0;
|
||||
volume = 1;
|
||||
for (size_t i = 0; i < Util::CountOf(css1sources); i++) {
|
||||
css1sources[i] = 0;
|
||||
}
|
||||
|
@ -565,7 +562,7 @@ void Mixer::SetVolume(float volume)
|
|||
|
||||
void SDLCALL Mixer::Callback(void* arg, uint8* stream, int length)
|
||||
{
|
||||
Mixer* mixer = (Mixer*)arg;
|
||||
Mixer* mixer = static_cast<Mixer*>(arg);
|
||||
memset(stream, 0, length);
|
||||
std::list<Channel*>::iterator i = mixer->channels.begin();
|
||||
while (i != mixer->channels.end()) {
|
||||
|
@ -574,7 +571,7 @@ void SDLCALL Mixer::Callback(void* arg, uint8* stream, int length)
|
|||
delete (*i);
|
||||
i = mixer->channels.erase(i);
|
||||
} else {
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -845,7 +842,7 @@ void Mixer_Stop_Channel(void* channel)
|
|||
{
|
||||
if (gOpenRCT2Headless) return;
|
||||
|
||||
gMixer.Stop(*(Channel*)channel);
|
||||
gMixer.Stop(*static_cast<Channel*>(channel));
|
||||
}
|
||||
|
||||
void Mixer_Channel_Volume(void* channel, int volume)
|
||||
|
@ -853,7 +850,7 @@ void Mixer_Channel_Volume(void* channel, int volume)
|
|||
if (gOpenRCT2Headless) return;
|
||||
|
||||
gMixer.Lock();
|
||||
((Channel*)channel)->SetVolume(volume);
|
||||
static_cast<Channel*>(channel)->SetVolume(volume);
|
||||
gMixer.Unlock();
|
||||
}
|
||||
|
||||
|
@ -862,7 +859,7 @@ void Mixer_Channel_Pan(void* channel, float pan)
|
|||
if (gOpenRCT2Headless) return;
|
||||
|
||||
gMixer.Lock();
|
||||
((Channel*)channel)->SetPan(pan);
|
||||
static_cast<Channel*>(channel)->SetPan(pan);
|
||||
gMixer.Unlock();
|
||||
}
|
||||
|
||||
|
@ -871,7 +868,7 @@ void Mixer_Channel_Rate(void* channel, double rate)
|
|||
if (gOpenRCT2Headless) return;
|
||||
|
||||
gMixer.Lock();
|
||||
((Channel*)channel)->SetRate(rate);
|
||||
static_cast<Channel*>(channel)->SetRate(rate);
|
||||
gMixer.Unlock();
|
||||
}
|
||||
|
||||
|
@ -879,28 +876,28 @@ int Mixer_Channel_IsPlaying(void* channel)
|
|||
{
|
||||
if (gOpenRCT2Headless) return false;
|
||||
|
||||
return ((Channel*)channel)->IsPlaying();
|
||||
return static_cast<Channel*>(channel)->IsPlaying();
|
||||
}
|
||||
|
||||
unsigned long Mixer_Channel_GetOffset(void* channel)
|
||||
{
|
||||
if (gOpenRCT2Headless) return 0;
|
||||
|
||||
return ((Channel*)channel)->GetOffset();
|
||||
return static_cast<Channel*>(channel)->GetOffset();
|
||||
}
|
||||
|
||||
int Mixer_Channel_SetOffset(void* channel, unsigned long offset)
|
||||
{
|
||||
if (gOpenRCT2Headless) return 0;
|
||||
|
||||
return ((Channel*)channel)->SetOffset(offset);
|
||||
return static_cast<Channel*>(channel)->SetOffset(offset);
|
||||
}
|
||||
|
||||
void Mixer_Channel_SetGroup(void* channel, int group)
|
||||
{
|
||||
if (gOpenRCT2Headless) return;
|
||||
|
||||
((Channel*)channel)->SetGroup(group);
|
||||
static_cast<Channel*>(channel)->SetGroup(group);
|
||||
}
|
||||
|
||||
void* Mixer_Play_Music(int pathId, int loop, int streaming)
|
||||
|
|
|
@ -178,12 +178,12 @@ private:
|
|||
void EffectFadeU8(uint8* data, int length, int startvolume, int endvolume);
|
||||
bool MustConvert(Source& source);
|
||||
bool Convert(SDL_AudioCVT& cvt, const uint8* data, unsigned long length, uint8** dataout);
|
||||
SDL_AudioDeviceID deviceid;
|
||||
AudioFormat format;
|
||||
uint8* effectbuffer;
|
||||
SDL_AudioDeviceID deviceid = 0;
|
||||
AudioFormat format = { 0 };
|
||||
uint8* effectbuffer = nullptr;
|
||||
std::list<Channel*> channels;
|
||||
Source_Null source_null;
|
||||
float volume;
|
||||
float volume = 1.0f;
|
||||
};
|
||||
|
||||
extern "C"
|
||||
|
|
|
@ -129,7 +129,7 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator * enumerat
|
|||
scenario_begin();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
return EXITCODE_FAIL;
|
||||
|
|
|
@ -522,7 +522,7 @@ bool config_open(const utf8string path)
|
|||
|
||||
while ((c = rwopsreadc(file)) != EOF) {
|
||||
if (c == '\n' || c == '\r') {
|
||||
lineBuffer[lineLength++] = 0;
|
||||
lineBuffer[lineLength] = 0;
|
||||
config_read_properties(¤tSection, (const_utf8string)lineBuffer);
|
||||
lineLength = 0;
|
||||
} else {
|
||||
|
|
|
@ -25,13 +25,8 @@ class Exception : public std::exception
|
|||
{
|
||||
public:
|
||||
Exception() : Exception("") { }
|
||||
|
||||
Exception(const char * message) : Exception(std::string(message)) { }
|
||||
|
||||
Exception(const std::string &message) : std::exception()
|
||||
{
|
||||
_message = message;
|
||||
}
|
||||
explicit Exception(const char * message) : Exception(std::string(message)) { }
|
||||
explicit Exception(const std::string &message) : std::exception(), _message(message) { }
|
||||
|
||||
virtual ~Exception() { }
|
||||
|
||||
|
|
|
@ -115,6 +115,6 @@ interface IStream
|
|||
class IOException : public Exception
|
||||
{
|
||||
public:
|
||||
IOException(const char * message) : Exception(message) { }
|
||||
IOException(const std::string &message) : Exception(message) { }
|
||||
explicit IOException(const char * message) : Exception(message) { }
|
||||
explicit IOException(const std::string &message) : Exception(message) { }
|
||||
};
|
||||
|
|
|
@ -36,9 +36,9 @@ private:
|
|||
json_error_t _jsonError = { 0 };
|
||||
|
||||
public:
|
||||
JsonException(const char * message) : Exception(message) { }
|
||||
explicit JsonException(const char * message) : Exception(message) { }
|
||||
|
||||
JsonException(const json_error_t * jsonError) : JsonException(jsonError->text)
|
||||
explicit JsonException(const json_error_t * jsonError) : JsonException(jsonError->text)
|
||||
{
|
||||
_jsonError = *jsonError;
|
||||
}
|
||||
|
|
|
@ -109,42 +109,42 @@ extern "C"
|
|||
|
||||
void stopwatch_dispose(stopwatch * stopwatch)
|
||||
{
|
||||
delete ((Stopwatch*)stopwatch->context);
|
||||
delete static_cast<Stopwatch *>(stopwatch->context);
|
||||
}
|
||||
|
||||
uint64 stopwatch_GetElapsedTicks(stopwatch * stopwatch)
|
||||
{
|
||||
Stopwatch * ctx = (Stopwatch*)stopwatch->context;
|
||||
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
|
||||
return ctx->GetElapsedTicks();
|
||||
}
|
||||
|
||||
uint64 stopwatch_GetElapsedMilliseconds(stopwatch * stopwatch)
|
||||
{
|
||||
Stopwatch * ctx = (Stopwatch*)stopwatch->context;
|
||||
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
|
||||
return ctx->GetElapsedMilliseconds();
|
||||
}
|
||||
|
||||
void stopwatch_Reset(stopwatch * stopwatch)
|
||||
{
|
||||
Stopwatch * ctx = (Stopwatch*)stopwatch->context;
|
||||
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
|
||||
return ctx->Reset();
|
||||
}
|
||||
|
||||
void stopwatch_Start(stopwatch * stopwatch)
|
||||
{
|
||||
Stopwatch * ctx = (Stopwatch*)stopwatch->context;
|
||||
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
|
||||
return ctx->Start();
|
||||
}
|
||||
|
||||
void stopwatch_Restart(stopwatch * stopwatch)
|
||||
{
|
||||
Stopwatch * ctx = (Stopwatch*)stopwatch->context;
|
||||
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
|
||||
return ctx->Restart();
|
||||
}
|
||||
|
||||
void stopwatch_Stop(stopwatch * stopwatch)
|
||||
{
|
||||
Stopwatch * ctx = (Stopwatch*)stopwatch->context;
|
||||
Stopwatch * ctx = static_cast<Stopwatch *>(stopwatch->context);
|
||||
return ctx->Stop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,8 +225,6 @@ namespace String
|
|||
|
||||
utf8 * AppendFormat(utf8 * buffer, size_t bufferSize, const utf8 * format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
utf8 * dst = buffer;
|
||||
size_t i;
|
||||
for (i = 0; i < bufferSize; i++)
|
||||
|
@ -237,6 +235,7 @@ namespace String
|
|||
|
||||
if (i < bufferSize - 1)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(dst, bufferSize - i - 1, format, args);
|
||||
va_end(args);
|
||||
|
|
|
@ -29,14 +29,8 @@
|
|||
class StringBuilder final
|
||||
{
|
||||
public:
|
||||
StringBuilder()
|
||||
{
|
||||
_buffer = nullptr;
|
||||
_capacity = 0;
|
||||
_length = 0;
|
||||
}
|
||||
|
||||
StringBuilder(size_t capacity) : StringBuilder()
|
||||
StringBuilder() = default;
|
||||
explicit StringBuilder(size_t capacity)
|
||||
{
|
||||
EnsureCapacity(capacity);
|
||||
}
|
||||
|
@ -170,9 +164,9 @@ public:
|
|||
size_t GetLength() const { return _length; }
|
||||
|
||||
private:
|
||||
utf8 * _buffer;
|
||||
size_t _capacity;
|
||||
size_t _length;
|
||||
utf8 * _buffer = nullptr;
|
||||
size_t _capacity = 0;
|
||||
size_t _length = 0;
|
||||
|
||||
void EnsureCapacity(size_t capacity)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ interface IStringReader
|
|||
class UTF8StringReader final : public IStringReader
|
||||
{
|
||||
public:
|
||||
UTF8StringReader(const utf8 * text)
|
||||
explicit UTF8StringReader(const utf8 * text)
|
||||
{
|
||||
text = String::SkipBOM(text);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ extern "C"
|
|||
_drawingEngine->Initialise(gWindow);
|
||||
_drawingEngine->SetUncappedFrameRate(gConfigGeneral.uncap_fps == 1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
delete _drawingEngine;
|
||||
_drawingEngine = nullptr;
|
||||
|
|
|
@ -44,4 +44,3 @@ void drawing_engine_set_fps_uncapped(bool uncapped);
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ private:
|
|||
rct_drawpixelinfo * _dpi;
|
||||
|
||||
public:
|
||||
SoftwareDrawingContext(SoftwareDrawingEngine * engine);
|
||||
explicit SoftwareDrawingContext(SoftwareDrawingEngine * engine);
|
||||
~SoftwareDrawingContext() override;
|
||||
|
||||
IDrawingEngine * GetEngine() override;
|
||||
|
@ -221,7 +221,7 @@ private:
|
|||
SoftwareDrawingContext * _drawingContext;
|
||||
|
||||
public:
|
||||
SoftwareDrawingEngine(bool hardwareDisplay)
|
||||
explicit SoftwareDrawingEngine(bool hardwareDisplay)
|
||||
{
|
||||
_hardwareDisplay = hardwareDisplay;
|
||||
_drawingContext = new SoftwareDrawingContext(this);
|
||||
|
|
|
@ -46,7 +46,8 @@ private:
|
|||
OpenGLShader * _fragmentShader = nullptr;
|
||||
|
||||
public:
|
||||
OpenGLShaderProgram(const char * name);
|
||||
explicit OpenGLShaderProgram(const char * name);
|
||||
explicit OpenGLShaderProgram(const OpenGLShaderProgram&) = default;
|
||||
virtual ~OpenGLShaderProgram();
|
||||
|
||||
GLuint GetAttributeLocation(const char * name);
|
||||
|
@ -56,4 +57,3 @@ public:
|
|||
private:
|
||||
bool Link();
|
||||
};
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ struct GlyphId
|
|||
{
|
||||
size_t operator()(const GlyphId &k) const
|
||||
{
|
||||
size_t hash = 0x3154A85E;
|
||||
hash = k.Image * 7;
|
||||
size_t hash = k.Image * 7;
|
||||
hash += (k.Palette & 0xFFFFFFFF) * 13;
|
||||
hash += (k.Palette >> 32) * 23;
|
||||
return hash;
|
||||
|
|
|
@ -69,12 +69,9 @@ bool gfx_load_g1()
|
|||
{
|
||||
log_verbose("loading g1 graphics");
|
||||
|
||||
SDL_RWops *file;
|
||||
rct_g1_header header;
|
||||
unsigned int i;
|
||||
|
||||
file = SDL_RWFromFile(get_file_path(PATH_ID_G1), "rb");
|
||||
SDL_RWops *file = SDL_RWFromFile(get_file_path(PATH_ID_G1), "rb");
|
||||
if (file != NULL) {
|
||||
rct_g1_header header;
|
||||
if (SDL_RWread(file, &header, 8, 1) == 1) {
|
||||
/* We need to load in the data file, which has an `offset` field,
|
||||
* which is supposed to hold a pointer, but is only 32 bit long.
|
||||
|
@ -116,7 +113,7 @@ bool gfx_load_g1()
|
|||
SDL_RWclose(file);
|
||||
|
||||
// Fix entry data offsets
|
||||
for (i = 0; i < header.num_entries; i++)
|
||||
for (unsigned int i = 0; i < header.num_entries; i++)
|
||||
g1Elements[i].offset += (uintptr_t)_g1Buffer;
|
||||
|
||||
return true;
|
||||
|
@ -148,14 +145,11 @@ bool gfx_load_g2()
|
|||
{
|
||||
log_verbose("loading g2 graphics");
|
||||
|
||||
SDL_RWops *file;
|
||||
unsigned int i;
|
||||
|
||||
char path[MAX_PATH];
|
||||
|
||||
platform_get_openrct_data_path(path, sizeof(path));
|
||||
safe_strcat_path(path, "g2.dat", MAX_PATH);
|
||||
file = SDL_RWFromFile(path, "rb");
|
||||
SDL_RWops *file = SDL_RWFromFile(path, "rb");
|
||||
if (file != NULL) {
|
||||
if (SDL_RWread(file, &g2.header, 8, 1) == 1) {
|
||||
// Read element headers
|
||||
|
@ -170,7 +164,7 @@ bool gfx_load_g2()
|
|||
SDL_RWclose(file);
|
||||
|
||||
// Fix entry data offsets
|
||||
for (i = 0; i < g2.header.num_entries; i++)
|
||||
for (unsigned int i = 0; i < g2.header.num_entries; i++)
|
||||
g2.elements[i].offset += (uintptr_t)g2.data;
|
||||
|
||||
return true;
|
||||
|
@ -447,7 +441,6 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
if (height <= 0)return;
|
||||
|
||||
dest_start_y >>= zoom_level;
|
||||
dest_end_y >>= zoom_level;
|
||||
|
||||
//This will be the width of the drawn image
|
||||
int width = g1_source->width;
|
||||
|
@ -486,7 +479,6 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
}
|
||||
|
||||
dest_start_x >>= zoom_level;
|
||||
dest_end_x >>= zoom_level;
|
||||
|
||||
uint8* dest_pointer = (uint8*)dpi->bits;
|
||||
//Move the pointer to the start point of the destination
|
||||
|
|
|
@ -468,7 +468,7 @@ int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int eb
|
|||
*/
|
||||
int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
{
|
||||
int cost, flags, insufficientFunds;
|
||||
int cost, flags;
|
||||
int original_ebx, original_edx, original_esi, original_edi, original_ebp;
|
||||
|
||||
*esi = command;
|
||||
|
@ -514,7 +514,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
|
|||
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
// Check funds
|
||||
insufficientFunds = 0;
|
||||
int insufficientFunds = 0;
|
||||
if (gGameCommandNestLevel == 1 && !(flags & GAME_COMMAND_FLAG_2) && !(flags & GAME_COMMAND_FLAG_5) && cost != 0)
|
||||
insufficientFunds = game_check_affordability(cost);
|
||||
|
||||
|
@ -702,8 +702,8 @@ static void utf8_to_rct2_self(char *buffer, size_t length)
|
|||
|
||||
static void rct2_to_utf8_self(char *buffer, size_t length)
|
||||
{
|
||||
char tempBuffer[512];
|
||||
if (length > 0) {
|
||||
char tempBuffer[512];
|
||||
rct2_to_utf8(tempBuffer, buffer);
|
||||
safe_strcpy(buffer, tempBuffer, length);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
std::vector<UIThemeWindowEntry> Entries;
|
||||
uint8 Flags;
|
||||
|
||||
UITheme(const utf8 * name);
|
||||
explicit UITheme(const utf8 * name);
|
||||
UITheme(const UITheme & copy);
|
||||
~UITheme();
|
||||
|
||||
|
@ -394,7 +394,7 @@ bool UITheme::WriteToFile(const utf8 * path) const
|
|||
Json::WriteToFile(path, jsonTheme, JSON_INDENT(4) | JSON_PRESERVE_ORDER);
|
||||
result = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception & ex)
|
||||
{
|
||||
log_error("Unable to save %s: %s", path, ex.GetMessage());
|
||||
result = false;
|
||||
|
@ -445,10 +445,10 @@ UITheme * UITheme::FromJson(const json_t * json)
|
|||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
delete result;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ UITheme * UITheme::FromFile(const utf8 * path)
|
|||
json = Json::ReadFromFile(path);
|
||||
result = UITheme::FromJson(json);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
log_error("Unable to read theme: %s", path);
|
||||
result = nullptr;
|
||||
|
|
|
@ -194,7 +194,7 @@ static void widget_frame_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
|
|||
int b = w->y + widget->bottom;
|
||||
|
||||
//
|
||||
uint8 press = (w->flags & WF_10 ? INSET_RECT_FLAG_FILL_MID_LIGHT : 0);
|
||||
uint8 press = ((w->flags & WF_10) ? INSET_RECT_FLAG_FILL_MID_LIGHT : 0);
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -730,11 +730,11 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
|
|||
|
||||
// Horizontal scrollbar
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE)
|
||||
widget_hscrollbar_draw(dpi, scroll, l, b - 10, (scroll->flags & VSCROLLBAR_VISIBLE ? r - 11 : r), b, colour);
|
||||
widget_hscrollbar_draw(dpi, scroll, l, b - 10, ((scroll->flags & VSCROLLBAR_VISIBLE) ? r - 11 : r), b, colour);
|
||||
|
||||
// Vertical scrollbar
|
||||
if (scroll->flags & VSCROLLBAR_VISIBLE)
|
||||
widget_vscrollbar_draw(dpi, scroll, r - 10, t, r, (scroll->flags & HSCROLLBAR_VISIBLE ? b - 11 : b), colour);
|
||||
widget_vscrollbar_draw(dpi, scroll, r - 10, t, r, ((scroll->flags & HSCROLLBAR_VISIBLE) ? b - 11 : b), colour);
|
||||
|
||||
// Contents
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE)
|
||||
|
@ -780,17 +780,17 @@ static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, i
|
|||
gfx_fill_rect(dpi, l + 10, t + 8, r - 10, t + 8, ColourMapA[colour].lighter);
|
||||
|
||||
// Left button
|
||||
gfx_fill_rect_inset(dpi, l, t, l + 9, b, colour, (scroll->flags & HSCROLLBAR_LEFT_PRESSED ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_fill_rect_inset(dpi, l, t, l + 9, b, colour, ((scroll->flags & HSCROLLBAR_LEFT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_draw_string(dpi, (char*)BlackLeftArrowString, COLOUR_BLACK, l + 1, t);
|
||||
|
||||
// Thumb
|
||||
gfx_fill_rect_inset(dpi,
|
||||
max(l + 10, l + scroll->h_thumb_left - 1), t,
|
||||
min(r - 10, l + scroll->h_thumb_right - 1), b,
|
||||
colour, (scroll->flags & HSCROLLBAR_THUMB_PRESSED ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
colour, ((scroll->flags & HSCROLLBAR_THUMB_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
|
||||
// Right button
|
||||
gfx_fill_rect_inset(dpi, r - 9, t, r, b, colour, (scroll->flags & HSCROLLBAR_RIGHT_PRESSED ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_fill_rect_inset(dpi, r - 9, t, r, b, colour, ((scroll->flags & HSCROLLBAR_RIGHT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_draw_string(dpi, (char*)BlackRightArrowString, COLOUR_BLACK, r - 6, t);
|
||||
}
|
||||
|
||||
|
@ -806,17 +806,17 @@ static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, i
|
|||
gfx_fill_rect(dpi, l + 8, t + 10, l + 8, b - 10, ColourMapA[colour].lighter);
|
||||
|
||||
// Up button
|
||||
gfx_fill_rect_inset(dpi, l, t, r, t + 9, colour, (scroll->flags & VSCROLLBAR_UP_PRESSED ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_fill_rect_inset(dpi, l, t, r, t + 9, colour, ((scroll->flags & VSCROLLBAR_UP_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_draw_string(dpi, (char*)BlackUpArrowString, COLOUR_BLACK, l + 1, t - 1);
|
||||
|
||||
// Thumb
|
||||
gfx_fill_rect_inset(dpi,
|
||||
l, max(t + 10, t + scroll->v_thumb_top - 1),
|
||||
r, min(b - 10, t + scroll->v_thumb_bottom - 1),
|
||||
colour, (scroll->flags & VSCROLLBAR_THUMB_PRESSED ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
colour, ((scroll->flags & VSCROLLBAR_THUMB_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
|
||||
// Down button
|
||||
gfx_fill_rect_inset(dpi, l, b - 9, r, b, colour, (scroll->flags & VSCROLLBAR_DOWN_PRESSED ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_fill_rect_inset(dpi, l, b - 9, r, b, colour, ((scroll->flags & VSCROLLBAR_DOWN_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
|
||||
gfx_draw_string(dpi, (char*)BlackDownArrowString, COLOUR_BLACK, l + 1, b - 9);
|
||||
}
|
||||
|
||||
|
@ -943,13 +943,13 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, int x, int y, int
|
|||
{
|
||||
//horizon scrollbar
|
||||
int rightOffset = 0;
|
||||
int iteratorLeft = widget->left + w->x;
|
||||
int iteratorRight = widget->right + w->x;
|
||||
int iteratorLeft = widget->left + w->x + 10;
|
||||
int iteratorRight = widget->right + w->x - 10;
|
||||
if (w->scrolls[*scroll_id].flags & VSCROLLBAR_VISIBLE)
|
||||
{
|
||||
rightOffset = 11;
|
||||
}
|
||||
if (x <= (iteratorLeft += 10))
|
||||
if (x <= iteratorLeft)
|
||||
{
|
||||
*output_scroll_area = SCROLL_PART_HSCROLLBAR_LEFT;
|
||||
}
|
||||
|
@ -957,7 +957,7 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, int x, int y, int
|
|||
{
|
||||
*output_scroll_area = SCROLL_PART_NONE;
|
||||
}
|
||||
else if (x >= (iteratorRight -= 10))
|
||||
else if (x >= iteratorRight)
|
||||
{
|
||||
*output_scroll_area = SCROLL_PART_HSCROLLBAR_RIGHT;
|
||||
}
|
||||
|
@ -978,21 +978,21 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, int x, int y, int
|
|||
{
|
||||
//vertical scrollbar
|
||||
int bottomOffset = 0;
|
||||
int iteratorTop = widget->top + w->y;
|
||||
int iteratorTop = widget->top + w->y + 10;
|
||||
int iteratorBottom = widget->bottom + w->y;
|
||||
if (w->scrolls[*scroll_id].flags & HSCROLLBAR_VISIBLE)
|
||||
{
|
||||
bottomOffset = 11;
|
||||
}
|
||||
if (y <= (iteratorTop += 10))
|
||||
if (y <= iteratorTop)
|
||||
{
|
||||
*output_scroll_area = SCROLL_PART_VSCROLLBAR_TOP;
|
||||
}
|
||||
else if (y >= (iteratorBottom -= bottomOffset))
|
||||
else if (y >= (iteratorBottom - bottomOffset))
|
||||
{
|
||||
*output_scroll_area = SCROLL_PART_NONE;
|
||||
}
|
||||
else if (y >= (iteratorBottom -= 10))
|
||||
else if (y >= (iteratorBottom - 10))
|
||||
{
|
||||
*output_scroll_area = SCROLL_PART_VSCROLLBAR_BOTTOM;
|
||||
}
|
||||
|
@ -1017,14 +1017,14 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, int x, int y, int
|
|||
*output_y = y - widget->top;
|
||||
*output_x -= w->x;
|
||||
*output_y -= w->y;
|
||||
if (--*output_x < 0 || --*output_y < 0)
|
||||
if (*output_x <= 0 || *output_y <= 0)
|
||||
{
|
||||
*output_scroll_area = SCROLL_PART_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*output_x += w->scrolls[*scroll_id].h_left;
|
||||
*output_y += w->scrolls[*scroll_id].v_top;
|
||||
*output_x += w->scrolls[*scroll_id].h_left - 1;
|
||||
*output_y += w->scrolls[*scroll_id].v_top - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -735,10 +735,12 @@ void window_close(rct_window* window)
|
|||
*/
|
||||
void window_close_by_class(rct_windowclass cls)
|
||||
{
|
||||
for (rct_window *w = g_window_list; w < RCT2_NEW_WINDOW; w++) {
|
||||
for (rct_window *w = g_window_list; w < RCT2_NEW_WINDOW;) {
|
||||
if (w->classification == cls) {
|
||||
window_close(w);
|
||||
w = g_window_list - 1;
|
||||
w = g_window_list;
|
||||
} else {
|
||||
w++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -751,10 +753,12 @@ void window_close_by_class(rct_windowclass cls)
|
|||
*/
|
||||
void window_close_by_number(rct_windowclass cls, rct_windownumber number)
|
||||
{
|
||||
for (rct_window* w = g_window_list; w < RCT2_NEW_WINDOW; w++) {
|
||||
for (rct_window* w = g_window_list; w < RCT2_NEW_WINDOW;) {
|
||||
if (w->classification == cls && w->number == number) {
|
||||
window_close(w);
|
||||
w = g_window_list - 1;
|
||||
w = g_window_list;
|
||||
} else {
|
||||
w++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -883,16 +887,13 @@ rct_window *window_find_from_point(int x, int y)
|
|||
*/
|
||||
int window_find_widget_from_point(rct_window *w, int x, int y)
|
||||
{
|
||||
rct_widget *widget;
|
||||
int i, widget_index;
|
||||
|
||||
// Invalidate the window
|
||||
window_event_invalidate_call(w);
|
||||
|
||||
// Find the widget at point x, y
|
||||
widget_index = -1;
|
||||
for (i = 0;; i++) {
|
||||
widget = &w->widgets[i];
|
||||
int widget_index = -1;
|
||||
for (int i = 0;; i++) {
|
||||
rct_widget *widget = &w->widgets[i];
|
||||
if (widget->type == WWT_LAST) {
|
||||
break;
|
||||
} else if (widget->type != WWT_EMPTY) {
|
||||
|
@ -1129,19 +1130,17 @@ int window_get_scroll_data_index(rct_window *w, int widget_index)
|
|||
*/
|
||||
rct_window *window_bring_to_front(rct_window *w)
|
||||
{
|
||||
int i;
|
||||
rct_window* v, t;
|
||||
|
||||
if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))
|
||||
return w;
|
||||
|
||||
rct_window *v;
|
||||
for (v = RCT2_LAST_WINDOW; v >= g_window_list; v--)
|
||||
if (!(v->flags & WF_STICK_TO_FRONT))
|
||||
break;
|
||||
|
||||
if (v >= g_window_list && w != v) {
|
||||
do {
|
||||
t = *w;
|
||||
rct_window t = *w;
|
||||
*w = *(w + 1);
|
||||
*(w + 1) = t;
|
||||
w++;
|
||||
|
@ -1151,7 +1150,7 @@ rct_window *window_bring_to_front(rct_window *w)
|
|||
}
|
||||
|
||||
if (w->x + w->width < 20) {
|
||||
i = 20 - w->x;
|
||||
int i = 20 - w->x;
|
||||
w->x += i;
|
||||
if (w->viewport != NULL)
|
||||
w->viewport->x += i;
|
||||
|
@ -1843,8 +1842,6 @@ int tool_set(rct_window *w, int widgetIndex, int tool)
|
|||
*/
|
||||
void tool_cancel()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
if (gInputFlags & INPUT_FLAG_TOOL_ACTIVE) {
|
||||
gInputFlags &= ~INPUT_FLAG_TOOL_ACTIVE;
|
||||
|
||||
|
@ -1863,7 +1860,7 @@ void tool_cancel()
|
|||
);
|
||||
|
||||
// Abort tool event
|
||||
w = window_find_by_number(
|
||||
rct_window *w = window_find_by_number(
|
||||
gCurrentToolWidget.window_classification,
|
||||
gCurrentToolWidget.window_number
|
||||
);
|
||||
|
@ -2518,12 +2515,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)
|
||||
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 == NULL || w->viewport == NULL || w->classification == WC_MAIN_WINDOW)
|
||||
if (w->viewport == NULL || w->classification == WC_MAIN_WINDOW)
|
||||
{
|
||||
// default to previous behaviour
|
||||
w->visibility = VC_VISIBLE;
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
fs.Read(fileData, fileLength);
|
||||
fileData[fileLength] = '\0';
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
Memory::Free(fileData);
|
||||
log_error("Unable to open %s: %s", path, ex.GetMessage());
|
||||
|
|
|
@ -1037,9 +1037,8 @@ static void format_string_part_from_raw(utf8 **dest, size_t *size, const utf8 *s
|
|||
}
|
||||
#endif
|
||||
|
||||
unsigned int code;
|
||||
while (*size > 1) {
|
||||
code = utf8_get_next(src, &src);
|
||||
unsigned int code = utf8_get_next(src, &src);
|
||||
if (code < ' ') {
|
||||
if (code == 0) {
|
||||
break;
|
||||
|
|
|
@ -625,14 +625,12 @@ void award_reset()
|
|||
*/
|
||||
void award_update_all()
|
||||
{
|
||||
int i, activeAwardTypes, freeAwardEntryIndex;
|
||||
|
||||
// Only add new awards if park is open
|
||||
if (gParkFlags & PARK_FLAGS_PARK_OPEN) {
|
||||
// Set active award types as flags
|
||||
activeAwardTypes = 0;
|
||||
freeAwardEntryIndex = -1;
|
||||
for (i = 0; i < MAX_AWARDS; i++) {
|
||||
int activeAwardTypes = 0;
|
||||
int freeAwardEntryIndex = -1;
|
||||
for (int i = 0; i < MAX_AWARDS; i++) {
|
||||
if (gCurrentAwards[i].time != 0)
|
||||
activeAwardTypes |= (1 << gCurrentAwards[i].type);
|
||||
else if (freeAwardEntryIndex == -1)
|
||||
|
@ -661,7 +659,7 @@ void award_update_all()
|
|||
}
|
||||
|
||||
// Decrease award times
|
||||
for (i = 0; i < MAX_AWARDS; i++)
|
||||
for (int i = 0; i < MAX_AWARDS; i++)
|
||||
if (gCurrentAwards[i].time != 0)
|
||||
if (--gCurrentAwards[i].time == 0)
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
|
|
|
@ -92,23 +92,18 @@ void research_update_uncompleted_types()
|
|||
*/
|
||||
static void research_calculate_expected_date()
|
||||
{
|
||||
int progress = gResearchProgress;
|
||||
int progressStage = gResearchProgressStage;
|
||||
int researchLevel = gResearchFundingLevel;
|
||||
int expectedDay, expectedMonth, dayQuotient, dayRemainder, progressRemaining, daysRemaining;
|
||||
|
||||
if (progressStage == RESEARCH_STAGE_INITIAL_RESEARCH || researchLevel == RESEARCH_FUNDING_NONE) {
|
||||
if (gResearchProgressStage == RESEARCH_STAGE_INITIAL_RESEARCH || gResearchFundingLevel == RESEARCH_FUNDING_NONE) {
|
||||
gResearchExpectedDay = 255;
|
||||
} else {
|
||||
progressRemaining = progressStage == RESEARCH_STAGE_COMPLETING_DESIGN ? 0x10000 : 0x20000;
|
||||
progressRemaining -= progress;
|
||||
daysRemaining = (progressRemaining / _researchRate[researchLevel]) * 128;
|
||||
int progressRemaining = gResearchProgressStage == RESEARCH_STAGE_COMPLETING_DESIGN ? 0x10000 : 0x20000;
|
||||
progressRemaining -= gResearchProgress;
|
||||
int daysRemaining = (progressRemaining / _researchRate[gResearchFundingLevel]) * 128;
|
||||
|
||||
expectedDay = gDateMonthTicks + (daysRemaining & 0xFFFF);
|
||||
dayQuotient = expectedDay / 0x10000;
|
||||
dayRemainder = expectedDay % 0x10000;
|
||||
int expectedDay = gDateMonthTicks + (daysRemaining & 0xFFFF);
|
||||
int dayQuotient = expectedDay / 0x10000;
|
||||
int dayRemainder = expectedDay % 0x10000;
|
||||
|
||||
expectedMonth = date_get_month(gDateMonthsElapsed + dayQuotient + (daysRemaining >> 16));
|
||||
int expectedMonth = date_get_month(gDateMonthsElapsed + dayQuotient + (daysRemaining >> 16));
|
||||
expectedDay = (dayRemainder * days_in_month[expectedMonth]) >> 16;
|
||||
|
||||
gResearchExpectedDay = expectedDay;
|
||||
|
@ -180,29 +175,29 @@ static void research_next_design()
|
|||
*/
|
||||
void research_finish_item(sint32 entryIndex)
|
||||
{
|
||||
int i, ebx, base_ride_type, rideEntryIndex, subSceneryEntryIndex;
|
||||
rct_ride_entry *rideEntry, *rideEntry2;
|
||||
rct_scenery_set_entry *scenerySetEntry;
|
||||
|
||||
gResearchLastItemSubject = (uint32)entryIndex;
|
||||
research_invalidate_related_windows();
|
||||
|
||||
if (entryIndex >= 0x10000) {
|
||||
// Ride
|
||||
base_ride_type = (entryIndex >> 8) & 0xFF;
|
||||
rideEntryIndex = entryIndex & 0xFF;
|
||||
rideEntry = get_ride_entry(rideEntryIndex);
|
||||
int base_ride_type = (entryIndex >> 8) & 0xFF;
|
||||
int rideEntryIndex = entryIndex & 0xFF;
|
||||
rct_ride_entry *rideEntry = get_ride_entry(rideEntryIndex);
|
||||
ride_type_set_invented(base_ride_type);
|
||||
gResearchedTrackTypesA[base_ride_type] = (RideTypePossibleTrackConfigurations[base_ride_type] ) & 0xFFFFFFFFULL;
|
||||
gResearchedTrackTypesB[base_ride_type] = (RideTypePossibleTrackConfigurations[base_ride_type] >> 32ULL) & 0xFFFFFFFFULL;
|
||||
|
||||
if (RideData4[base_ride_type].flags & RIDE_TYPE_FLAG4_3) {
|
||||
ebx = RideData4[base_ride_type].alternate_type;
|
||||
int ebx = RideData4[base_ride_type].alternate_type;
|
||||
gResearchedTrackTypesA[ebx] = (RideTypePossibleTrackConfigurations[ebx] ) & 0xFFFFFFFFULL;
|
||||
gResearchedTrackTypesB[ebx] = (RideTypePossibleTrackConfigurations[ebx] >> 32ULL) & 0xFFFFFFFFULL;
|
||||
}
|
||||
|
||||
ride_entry_set_invented(rideEntryIndex);
|
||||
|
||||
if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)) {
|
||||
for (i = 0; i < 128; i++) {
|
||||
rideEntry2 = get_ride_entry(i);
|
||||
for (int i = 0; i < 128; i++) {
|
||||
rct_ride_entry *rideEntry2 = get_ride_entry(i);
|
||||
if (rideEntry2 == (rct_ride_entry*)-1)
|
||||
continue;
|
||||
if ((rideEntry2->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE))
|
||||
|
@ -219,6 +214,7 @@ void research_finish_item(sint32 entryIndex)
|
|||
|
||||
set_format_arg(0, rct_string_id, ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) ?
|
||||
rideEntry->name : RideNaming[base_ride_type].name);
|
||||
|
||||
if (!gSilentResearch) {
|
||||
if (gConfigNotifications.ride_researched) {
|
||||
news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE, entryIndex);
|
||||
|
@ -228,13 +224,14 @@ void research_finish_item(sint32 entryIndex)
|
|||
research_invalidate_related_windows();
|
||||
} else {
|
||||
// Scenery
|
||||
scenerySetEntry = get_scenery_group_entry(entryIndex & 0xFFFF);
|
||||
for (i = 0; i < scenerySetEntry->entry_count; i++) {
|
||||
subSceneryEntryIndex = scenerySetEntry->scenery_entries[i];
|
||||
rct_scenery_set_entry *scenerySetEntry = get_scenery_group_entry(entryIndex & 0xFFFF);
|
||||
for (int i = 0; i < scenerySetEntry->entry_count; i++) {
|
||||
int subSceneryEntryIndex = scenerySetEntry->scenery_entries[i];
|
||||
gResearchedSceneryItems[subSceneryEntryIndex >> 5] |= 1UL << (subSceneryEntryIndex & 0x1F);
|
||||
}
|
||||
|
||||
set_format_arg(0, rct_string_id, scenerySetEntry->name);
|
||||
|
||||
if (!gSilentResearch) {
|
||||
if (gConfigNotifications.ride_researched) {
|
||||
news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE, entryIndex);
|
||||
|
@ -489,19 +486,15 @@ void research_insert(int researched, int entryIndex, int category)
|
|||
*/
|
||||
void research_populate_list_random()
|
||||
{
|
||||
rct_ride_entry *rideEntry;
|
||||
rct_scenery_set_entry *scenerySetEntry;
|
||||
int rideType, researched;
|
||||
|
||||
// Rides
|
||||
for (int i = 0; i < 128; i++) {
|
||||
rideEntry = get_ride_entry(i);
|
||||
rct_ride_entry *rideEntry = get_ride_entry(i);
|
||||
if (rideEntry == (rct_ride_entry*)-1)
|
||||
continue;
|
||||
|
||||
researched = (scenario_rand() & 0xFF) > 128;
|
||||
int researched = (scenario_rand() & 0xFF) > 128;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
rideType = rideEntry->ride_type[j];
|
||||
int rideType = rideEntry->ride_type[j];
|
||||
if (rideType != 255)
|
||||
research_insert(researched, 0x10000 | (rideType << 8) | i, rideEntry->category[0]);
|
||||
}
|
||||
|
@ -509,29 +502,25 @@ void research_populate_list_random()
|
|||
|
||||
// Scenery
|
||||
for (int i = 0; i < 19; i++) {
|
||||
scenerySetEntry = get_scenery_group_entry(i);
|
||||
rct_scenery_set_entry *scenerySetEntry = get_scenery_group_entry(i);
|
||||
if (scenerySetEntry == (rct_scenery_set_entry*)-1)
|
||||
continue;
|
||||
|
||||
researched = (scenario_rand() & 0xFF) > 85;
|
||||
int researched = (scenario_rand() & 0xFF) > 85;
|
||||
research_insert(researched, i, RESEARCH_CATEGORY_SCENERYSET);
|
||||
}
|
||||
}
|
||||
|
||||
void research_populate_list_researched()
|
||||
{
|
||||
rct_ride_entry *rideEntry;
|
||||
rct_scenery_set_entry *scenerySetEntry;
|
||||
int rideType;
|
||||
|
||||
// Rides
|
||||
for (int i = 0; i < 128; i++) {
|
||||
rideEntry = get_ride_entry(i);
|
||||
rct_ride_entry *rideEntry = get_ride_entry(i);
|
||||
if (rideEntry == (rct_ride_entry*)-1)
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
rideType = rideEntry->ride_type[j];
|
||||
int rideType = rideEntry->ride_type[j];
|
||||
if (rideType != 255)
|
||||
research_insert(true, 0x10000 | (rideType << 8) | i, rideEntry->category[0]);
|
||||
}
|
||||
|
@ -539,7 +528,7 @@ void research_populate_list_researched()
|
|||
|
||||
// Scenery
|
||||
for (int i = 0; i < 19; i++) {
|
||||
scenerySetEntry = get_scenery_group_entry(i);
|
||||
rct_scenery_set_entry *scenerySetEntry = get_scenery_group_entry(i);
|
||||
if (scenerySetEntry == (rct_scenery_set_entry*)-1)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
#include "NetworkPacket.h"
|
||||
|
||||
NetworkPacket::NetworkPacket()
|
||||
: size(0)
|
||||
, data(std::make_shared<std::vector<uint8>>())
|
||||
, transferred(0)
|
||||
, read(0)
|
||||
{
|
||||
transferred = 0;
|
||||
read = 0;
|
||||
size = 0;
|
||||
data = std::make_shared<std::vector<uint8>>();
|
||||
}
|
||||
|
||||
std::unique_ptr<NetworkPacket> NetworkPacket::Allocate()
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
std::string _key;
|
||||
|
||||
public:
|
||||
NetworkServerAdvertiser(uint16 port)
|
||||
explicit NetworkServerAdvertiser(uint16 port)
|
||||
{
|
||||
_port = port;
|
||||
_key = GenerateAdvertiseKey();
|
||||
|
@ -118,7 +118,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
auto advertiser = (NetworkServerAdvertiser *)response->tag;
|
||||
auto advertiser = static_cast<NetworkServerAdvertiser*>(response->tag);
|
||||
advertiser->OnRegistrationResponse(response->root);
|
||||
http_request_json_dispose(response);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
auto advertiser = (NetworkServerAdvertiser *)response->tag;
|
||||
auto advertiser = static_cast<NetworkServerAdvertiser*>(response->tag);
|
||||
advertiser->OnHeartbeatResponse(response->root);
|
||||
http_request_json_dispose(response);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void NetworkUserManager::Load()
|
|||
}
|
||||
json_decref(jsonUsers);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine("Failed to read %s as JSON. %s", path, ex.GetMessage());
|
||||
}
|
||||
|
@ -130,7 +130,9 @@ void NetworkUserManager::Save()
|
|||
jsonUsers = Json::ReadFromFile(path);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (const Exception &)
|
||||
{
|
||||
}
|
||||
|
||||
if (jsonUsers == nullptr)
|
||||
{
|
||||
|
|
|
@ -69,8 +69,8 @@ class TcpSocket;
|
|||
class SocketException : public Exception
|
||||
{
|
||||
public:
|
||||
SocketException(const char * message) : Exception(message) { }
|
||||
SocketException(const std::string &message) : Exception(message) { }
|
||||
explicit SocketException(const char * message) : Exception(message) { }
|
||||
explicit SocketException(const std::string &message) : Exception(message) { }
|
||||
};
|
||||
|
||||
struct ConnectRequest
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
throw SocketException("Failed to set non-blocking mode.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
CloseSocket();
|
||||
throw;
|
||||
|
@ -309,7 +309,7 @@ public:
|
|||
// Connection request timed out
|
||||
throw SocketException("Connection timed out.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
CloseSocket();
|
||||
throw;
|
||||
|
@ -332,12 +332,12 @@ public:
|
|||
req->Port = port;
|
||||
SDL_CreateThread([](void * pointer) -> int
|
||||
{
|
||||
auto req = (ConnectRequest *)pointer;
|
||||
auto req = static_cast<ConnectRequest *>(pointer);
|
||||
try
|
||||
{
|
||||
req->Socket->Connect(req->Address.c_str(), req->Port);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception & ex)
|
||||
{
|
||||
req->Socket->_error = std::string(ex.GetMessage());
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
TcpSocket(SOCKET socket)
|
||||
explicit TcpSocket(SOCKET socket)
|
||||
{
|
||||
_socket = socket;
|
||||
_status = SOCKET_STATUS_CONNECTED;
|
||||
|
|
|
@ -288,7 +288,7 @@ bool Network::BeginServer(unsigned short port, const char* address)
|
|||
{
|
||||
listening_socket->Listen(address, port);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
Close();
|
||||
|
@ -712,7 +712,7 @@ void Network::SaveGroups()
|
|||
{
|
||||
Json::WriteToFile(path, jsonGroupsCfg, JSON_INDENT(4) | JSON_PRESERVE_ORDER);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
log_error("Unable to save %s: %s", path, ex.GetMessage());
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ void ImageTable::Read(IReadObjectContext * context, IStream * stream)
|
|||
|
||||
// TODO validate the image data to prevent crashes in-game
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_BAD_IMAGE_TABLE, "Bad image table.");
|
||||
throw;
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
bool WasWarning() const { return _wasWarning; }
|
||||
bool WasError() const { return _wasError; }
|
||||
|
||||
ReadObjectContext(const utf8 * objectFileName)
|
||||
explicit ReadObjectContext(const utf8 * objectFileName)
|
||||
{
|
||||
_objectName = String::Duplicate(objectFileName);
|
||||
}
|
||||
|
@ -91,12 +91,12 @@ namespace ObjectFactory
|
|||
{
|
||||
object->ReadLegacy(context, stream);
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (const IOException &)
|
||||
{
|
||||
// TODO check that ex is really EOF and not some other error
|
||||
context->LogError(OBJECT_ERROR_UNEXPECTED_EOF, "Unexpectedly reached end of file.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_UNKNOWN, nullptr);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ private:
|
|||
Object * * _loadedObjects = nullptr;
|
||||
|
||||
public:
|
||||
ObjectManager(IObjectRepository * objectRepository)
|
||||
explicit ObjectManager(IObjectRepository * objectRepository)
|
||||
{
|
||||
Guard::ArgumentNotNull(objectRepository);
|
||||
|
||||
|
@ -562,7 +562,7 @@ extern "C"
|
|||
uint8 object_manager_get_loaded_object_entry_index(const void * loadedObject)
|
||||
{
|
||||
IObjectManager * objectManager = GetObjectManager();
|
||||
const Object * object = (const Object *)loadedObject;
|
||||
const Object * object = static_cast<const Object *>(loadedObject);
|
||||
uint8 entryIndex = objectManager->GetLoadedObjectEntryIndex(object);
|
||||
return entryIndex;
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
SaveObject(path, objectEntry, data, dataSize);
|
||||
ScanObject(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Failed saving object: [%s] to '%s'.", objectName, path);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ private:
|
|||
Console::WriteLine("Object repository is out of date.");
|
||||
return false;
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (const IOException &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ private:
|
|||
WriteItem(&fs, _items[i]);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (const IOException &)
|
||||
{
|
||||
log_error("Unable to write object repository index to '%s'.", path.c_str());
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ private:
|
|||
Memory::Free(newData);
|
||||
Memory::Free(extraBytes);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Memory::Free(newData);
|
||||
Memory::Free(extraBytes);
|
||||
|
@ -558,7 +558,7 @@ private:
|
|||
|
||||
Memory::Free(encodedDataBuffer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Memory::Free(encodedDataBuffer);
|
||||
throw;
|
||||
|
@ -851,7 +851,7 @@ extern "C"
|
|||
{
|
||||
if (object != nullptr)
|
||||
{
|
||||
Object * baseObject = (Object *)object;
|
||||
Object * baseObject = static_cast<Object *>(object);
|
||||
baseObject->Unload();
|
||||
delete baseObject;
|
||||
}
|
||||
|
@ -859,7 +859,7 @@ extern "C"
|
|||
|
||||
const utf8 * object_get_description(const void * object)
|
||||
{
|
||||
const Object * baseObject = (const Object *)object;
|
||||
const Object * baseObject = static_cast<const Object *>(object);
|
||||
switch (baseObject->GetObjectType()) {
|
||||
case OBJECT_TYPE_RIDE:
|
||||
{
|
||||
|
@ -878,7 +878,7 @@ extern "C"
|
|||
|
||||
const utf8 * object_get_capacity(const void * object)
|
||||
{
|
||||
const Object * baseObject = (const Object *)object;
|
||||
const Object * baseObject = static_cast<const Object *>(object);
|
||||
switch (baseObject->GetObjectType()) {
|
||||
case OBJECT_TYPE_RIDE:
|
||||
{
|
||||
|
@ -892,7 +892,7 @@ extern "C"
|
|||
|
||||
void object_draw_preview(const void * object, rct_drawpixelinfo * dpi, sint32 width, sint32 height)
|
||||
{
|
||||
const Object * baseObject = (const Object *)object;
|
||||
const Object * baseObject = static_cast<const Object *>(object);
|
||||
baseObject->DrawPreview(dpi, width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void StringTable::Read(IReadObjectContext * context, IStream * stream, uint8 id)
|
|||
_strings.push_back(entry);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_BAD_STRING_TABLE, "Bad string table.");
|
||||
throw;
|
||||
|
|
|
@ -40,4 +40,4 @@ public:
|
|||
void Read(IReadObjectContext * context, IStream * stream, uint8 id);
|
||||
void Sort();
|
||||
const utf8 * GetString(uint8 id) const;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -210,7 +210,7 @@ static void park_entrance_paint(uint8 direction, int height, rct_map_element* ma
|
|||
// Middle, left, right
|
||||
uint8 part_index = map_element->properties.entrance.index & 0xF;
|
||||
rct_entrance_type* entrance;
|
||||
uint8 di = (direction / 2 + part_index / 2) & 1 ? 0x1A : 0x20;
|
||||
uint8 di = ((direction / 2 + part_index / 2) & 1) ? 0x1A : 0x20;
|
||||
|
||||
switch (part_index){
|
||||
case 0:
|
||||
|
|
|
@ -379,4 +379,3 @@ void fence_paint(uint8 direction, int height, rct_map_element * map_element)
|
|||
|
||||
sub_98199C(scrolling_text_setup(stringId, scroll, scrollingMode), 0, 0, 1, 1, 13, height + 8, boundsOffset.x, boundsOffset.y, boundsOffset.z, get_current_rotation());
|
||||
}
|
||||
|
||||
|
|
|
@ -1018,5 +1018,4 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
|
|||
if (edges & 8) {
|
||||
paint_util_set_segment_support_height(SEGMENT_C8, 0xFFFF, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ static void scenery_multiple_sign_paint_line(const utf8 *str, rct_large_scenery_
|
|||
const utf8 *fitStr = scenery_multiple_sign_fit_text(str, text, false);
|
||||
int width = scenery_multiple_sign_text_width(fitStr, text);
|
||||
int x_offset = text->offset[(direction & 1)].x;
|
||||
int acc = y_offset * (direction & 1 ? -1 : 1);
|
||||
int acc = y_offset * ((direction & 1) ? -1 : 1);
|
||||
if (!(text->var_C & 0x1)) {
|
||||
// sign is horizontal, center text:
|
||||
x_offset -= (width / 2);
|
||||
|
@ -233,9 +233,8 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
|
|||
return;
|
||||
}
|
||||
if (entry->large_scenery.flags & 0x4) {
|
||||
int al;
|
||||
if (entry->large_scenery.tiles[1].x_offset != (sint16)0xFFFF) {
|
||||
al = ((mapElement->properties.surface.terrain >> 2) - 1) & 3;
|
||||
int al = ((mapElement->properties.surface.terrain >> 2) - 1) & 3;
|
||||
if (al != direction) {
|
||||
scenery_multiple_paint_supports(direction, height, mapElement, dword_F4387C, tile);
|
||||
return;
|
||||
|
|
|
@ -419,9 +419,8 @@ static void viewport_surface_smoothen_edge(enum edge edge, struct tile_descripto
|
|||
|
||||
uint32 image_id = maskImageBase + byte_97B444[self.slope];
|
||||
|
||||
attached_paint_struct * out;
|
||||
if (paint_attach_to_previous_ps(image_id, 0, 0)) {
|
||||
out = g_aps_F1AD2C;
|
||||
attached_paint_struct * out = g_aps_F1AD2C;
|
||||
// set content and enable masking
|
||||
out->colour_image_id = dword_97B804[neighbour.terrain] + cl;
|
||||
out->flags |= PAINT_STRUCT_FLAG_IS_MASKED;
|
||||
|
@ -1722,5 +1721,4 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
|||
paint_util_set_segment_support_height(SEGMENT_B4, height + 4 + 6 + 6 + 6 + 6, 0x1E);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,6 +100,4 @@ enum
|
|||
SPR_TERRAIN_PATTERN_ICE = 29007,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //_PAINT_SURFACE_H
|
||||
|
|
|
@ -1073,7 +1073,7 @@ static void sub_68F41A(rct_peep *peep, int index)
|
|||
}
|
||||
}
|
||||
|
||||
if ((scenario_rand() & 0xFFFF) <= (peep->item_standard_flags & PEEP_ITEM_MAP ? 8192U : 2184U)){
|
||||
if ((scenario_rand() & 0xFFFF) <= ((peep->item_standard_flags & PEEP_ITEM_MAP) ? 8192U : 2184U)){
|
||||
peep_pick_ride_to_go_on(peep);
|
||||
}
|
||||
|
||||
|
@ -7358,7 +7358,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
|
|||
*argument_2 = ride->name_arguments;
|
||||
}
|
||||
else{
|
||||
*argument_1 = peep->peep_flags & PEEP_FLAGS_LEAVING_PARK ? STR_LEAVING_PARK : STR_WALKING;
|
||||
*argument_1 = (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) ? STR_LEAVING_PARK : STR_WALKING;
|
||||
*argument_2 = 0;
|
||||
}
|
||||
break;
|
||||
|
@ -7383,7 +7383,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
|
|||
*argument_1 = STR_WATCHING_RIDE | ((uint32)ride->name << 16);
|
||||
}
|
||||
else{
|
||||
*argument_1 = peep->current_seat & 0x1 ? STR_WATCHING_NEW_RIDE_BEING_CONSTRUCTED : STR_LOOKING_AT_SCENERY;
|
||||
*argument_1 = (peep->current_seat & 0x1) ? STR_WATCHING_NEW_RIDE_BEING_CONSTRUCTED : STR_LOOKING_AT_SCENERY;
|
||||
*argument_2 = 0;
|
||||
}
|
||||
break;
|
||||
|
@ -7859,7 +7859,7 @@ static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type){
|
|||
void peep_set_map_tooltip(rct_peep *peep)
|
||||
{
|
||||
if (peep->type == PEEP_TYPE_GUEST) {
|
||||
set_map_tooltip_format_arg(0, rct_string_id, peep->peep_flags & PEEP_FLAGS_TRACKING ? STR_TRACKED_GUEST_MAP_TIP : STR_GUEST_MAP_TIP);
|
||||
set_map_tooltip_format_arg(0, rct_string_id, (peep->peep_flags & PEEP_FLAGS_TRACKING) ? STR_TRACKED_GUEST_MAP_TIP : STR_GUEST_MAP_TIP);
|
||||
set_map_tooltip_format_arg(2, uint32, get_peep_face_sprite_small(peep));
|
||||
set_map_tooltip_format_arg(6, rct_string_id, peep->name_string_idx);
|
||||
set_map_tooltip_format_arg(8, uint32, peep->id);
|
||||
|
|
|
@ -57,14 +57,10 @@ void staff_reset_modes()
|
|||
*/
|
||||
void game_command_update_staff_colour(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
{
|
||||
uint8 staffType, colour;
|
||||
int spriteIndex;
|
||||
rct_peep *peep;
|
||||
|
||||
staffType = (*ebx >> 8) & 0xFF;
|
||||
colour = (*edx >> 8) & 0xFF;
|
||||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
uint8 staffType = (*ebx >> 8) & 0xFF;
|
||||
uint8 colour = (*edx >> 8) & 0xFF;
|
||||
|
||||
// Client may send invalid data
|
||||
bool ok = staff_set_colour(staffType, colour);
|
||||
if (!ok) {
|
||||
|
@ -72,6 +68,8 @@ void game_command_update_staff_colour(int *eax, int *ebx, int *ecx, int *edx, in
|
|||
return;
|
||||
}
|
||||
|
||||
int spriteIndex;
|
||||
rct_peep *peep;
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (peep->type == PEEP_TYPE_STAFF && peep->staff_type == staffType) {
|
||||
peep->tshirt_colour = colour;
|
||||
|
@ -1305,7 +1303,7 @@ static int staff_path_finding_entertainer(rct_peep* peep) {
|
|||
|
||||
invalidate_sprite_2((rct_sprite*)peep);
|
||||
|
||||
peep->action = scenario_rand() & 1 ? PEEP_ACTION_WAVE_2 : PEEP_ACTION_JOY;
|
||||
peep->action = (scenario_rand() & 1) ? PEEP_ACTION_WAVE_2 : PEEP_ACTION_JOY;
|
||||
peep->action_frame = 0;
|
||||
peep->action_sprite_image_offset = 0;
|
||||
|
||||
|
|
|
@ -81,18 +81,13 @@ static int resolution_sort_func(const void *pa, const void *pb)
|
|||
|
||||
void platform_update_fullscreen_resolutions()
|
||||
{
|
||||
int i, displayIndex, numDisplayModes;
|
||||
SDL_DisplayMode mode;
|
||||
resolution *resLook, *resPlace;
|
||||
float desktopAspectRatio, aspectRatio;
|
||||
|
||||
// Query number of display modes
|
||||
displayIndex = SDL_GetWindowDisplayIndex(gWindow);
|
||||
numDisplayModes = SDL_GetNumDisplayModes(displayIndex);
|
||||
int displayIndex = SDL_GetWindowDisplayIndex(gWindow);
|
||||
int numDisplayModes = SDL_GetNumDisplayModes(displayIndex);
|
||||
|
||||
// Get desktop aspect ratio
|
||||
SDL_DisplayMode mode;
|
||||
SDL_GetDesktopDisplayMode(displayIndex, &mode);
|
||||
desktopAspectRatio = (float)mode.w / mode.h;
|
||||
|
||||
if (gResolutions != NULL)
|
||||
free(gResolutions);
|
||||
|
@ -100,12 +95,13 @@ void platform_update_fullscreen_resolutions()
|
|||
// Get resolutions
|
||||
gNumResolutions = numDisplayModes;
|
||||
gResolutions = malloc(gNumResolutions * sizeof(resolution));
|
||||
|
||||
gNumResolutions = 0;
|
||||
for (i = 0; i < numDisplayModes; i++) {
|
||||
|
||||
float desktopAspectRatio = (float)mode.w / mode.h;
|
||||
for (int i = 0; i < numDisplayModes; i++) {
|
||||
SDL_GetDisplayMode(displayIndex, i, &mode);
|
||||
|
||||
aspectRatio = (float)mode.w / mode.h;
|
||||
float aspectRatio = (float)mode.w / mode.h;
|
||||
if (gResolutionsAllowAnyAspectRatio || fabs(desktopAspectRatio - aspectRatio) < 0.0001f) {
|
||||
gResolutions[gNumResolutions].width = mode.w;
|
||||
gResolutions[gNumResolutions].height = mode.h;
|
||||
|
@ -117,9 +113,9 @@ void platform_update_fullscreen_resolutions()
|
|||
qsort(gResolutions, gNumResolutions, sizeof(resolution), resolution_sort_func);
|
||||
|
||||
// Remove duplicates
|
||||
resPlace = &gResolutions[0];
|
||||
resolution *resPlace = &gResolutions[0];
|
||||
for (int i = 1; i < gNumResolutions; i++) {
|
||||
resLook = &gResolutions[i];
|
||||
resolution *resLook = &gResolutions[i];
|
||||
if (resLook->width != resPlace->width || resLook->height != resPlace->height)
|
||||
*++resPlace = *resLook;
|
||||
}
|
||||
|
@ -135,11 +131,11 @@ void platform_update_fullscreen_resolutions()
|
|||
|
||||
void platform_get_closest_resolution(int inWidth, int inHeight, int *outWidth, int *outHeight)
|
||||
{
|
||||
int i, destinationArea, areaDiff, closestAreaDiff, closestWidth = 640, closestHeight = 480;
|
||||
int closestWidth = 640, closestHeight = 480;
|
||||
|
||||
closestAreaDiff = -1;
|
||||
destinationArea = inWidth * inHeight;
|
||||
for (i = 0; i < gNumResolutions; i++) {
|
||||
int closestAreaDiff = -1;
|
||||
int destinationArea = inWidth * inHeight;
|
||||
for (int i = 0; i < gNumResolutions; i++) {
|
||||
// Check if exact match
|
||||
if (gResolutions[i].width == inWidth && gResolutions[i].height == inHeight) {
|
||||
closestWidth = gResolutions[i].width;
|
||||
|
@ -149,7 +145,7 @@ void platform_get_closest_resolution(int inWidth, int inHeight, int *outWidth, i
|
|||
}
|
||||
|
||||
// Check if area is closer to best match
|
||||
areaDiff = abs((gResolutions[i].width * gResolutions[i].height) - destinationArea);
|
||||
int areaDiff = abs((gResolutions[i].width * gResolutions[i].height) - destinationArea);
|
||||
if (closestAreaDiff == -1 || areaDiff < closestAreaDiff) {
|
||||
closestAreaDiff = areaDiff;
|
||||
closestWidth = gResolutions[i].width;
|
||||
|
|
|
@ -1618,7 +1618,7 @@ extern "C"
|
|||
s4Importer->LoadSavedGame(path);
|
||||
s4Importer->Import();
|
||||
result = true;
|
||||
} catch (Exception ex)
|
||||
} catch (const Exception &)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
@ -1636,7 +1636,7 @@ extern "C"
|
|||
s4Importer->LoadScenario(path);
|
||||
s4Importer->Import();
|
||||
result = true;
|
||||
} catch (Exception ex)
|
||||
} catch (const Exception &)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
|
|
@ -470,7 +470,7 @@ int scenario_save_network(SDL_RWops * rw, const std::vector<const ObjectReposito
|
|||
s6exporter->SaveGame(rw);
|
||||
result = true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const Exception &)
|
||||
{
|
||||
}
|
||||
delete s6exporter;
|
||||
|
@ -614,7 +614,7 @@ extern "C"
|
|||
}
|
||||
result = true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const Exception &)
|
||||
{
|
||||
}
|
||||
delete s6exporter;
|
||||
|
|
|
@ -46,7 +46,7 @@ class ObjectLoadException : public Exception
|
|||
{
|
||||
public:
|
||||
ObjectLoadException() : Exception("Unable to load objects.") { }
|
||||
ObjectLoadException(const char * message) : Exception(message) { }
|
||||
explicit ObjectLoadException(const char * message) : Exception(message) { }
|
||||
};
|
||||
|
||||
S6Importer::S6Importer()
|
||||
|
@ -390,10 +390,10 @@ extern "C"
|
|||
sprite_position_tween_reset();
|
||||
result = true;
|
||||
}
|
||||
catch (ObjectLoadException)
|
||||
catch (const ObjectLoadException &)
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const Exception &)
|
||||
{
|
||||
}
|
||||
delete s6Importer;
|
||||
|
@ -417,17 +417,17 @@ extern "C"
|
|||
sprite_position_tween_reset();
|
||||
result = true;
|
||||
}
|
||||
catch (ObjectLoadException)
|
||||
catch (const ObjectLoadException &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||
}
|
||||
catch (IOException)
|
||||
catch (const IOException &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const Exception &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
|
||||
|
@ -492,17 +492,17 @@ extern "C"
|
|||
sprite_position_tween_reset();
|
||||
result = true;
|
||||
}
|
||||
catch (ObjectLoadException)
|
||||
catch (const ObjectLoadException &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||
}
|
||||
catch (IOException)
|
||||
catch (const IOException &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const Exception &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
|
||||
|
@ -526,10 +526,10 @@ extern "C"
|
|||
sprite_position_tween_reset();
|
||||
result = true;
|
||||
}
|
||||
catch (ObjectLoadException)
|
||||
catch (const ObjectLoadException &)
|
||||
{
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const Exception &)
|
||||
{
|
||||
}
|
||||
delete s6Importer;
|
||||
|
|
|
@ -304,7 +304,7 @@ private:
|
|||
result = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to write object repository index.");
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ private:
|
|||
fs.WriteValue(item.Flags);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to write object repository index.");
|
||||
}
|
||||
|
|
|
@ -619,9 +619,9 @@ static void air_powered_vertical_rc_track_vertical_slope_up(uint8 rideIndex, uin
|
|||
floorImageId = SPR_FLOOR_PLANKS | gTrackColours[SCHEME_SUPPORTS];
|
||||
}
|
||||
sub_98197C(floorImageId, 0, 0, 26, 26, 126, height, 3, 3, height, get_current_rotation());
|
||||
sub_98199C_rotated(direction, supportsImageId, 0, 0, isDirection03 ? 26 : 26, 26, 126, height, isDirection03 ? 3 : 3, 3, height);
|
||||
sub_98199C_rotated(direction, supportsImageId, 0, 0, 26, 26, 126, height, 3, 3, height);
|
||||
} else {
|
||||
sub_98197C_rotated(direction, supportsImageId, 0, 0, isDirection03 ? 26 : 26, 26, 126, height, isDirection03 ? 3 : 3, 3, height);
|
||||
sub_98197C_rotated(direction, supportsImageId, 0, 0, 26, 26, 126, height, 3, 3, height);
|
||||
}
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + supportHeights[trackSequence], 0x20);
|
||||
|
|
|
@ -1861,7 +1861,7 @@ void junior_rc_paint_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8
|
|||
paint_util_push_tunnel_rotated(direction, height + tunnel_height[direction], tunnel_type[direction]);
|
||||
|
||||
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
|
||||
int supportType = direction & 1 ? 2 : 1;
|
||||
int supportType = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(supportType, 4, 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -1881,7 +1881,7 @@ void junior_rc_paint_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequenc
|
|||
}
|
||||
|
||||
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
|
||||
int supportType = direction & 1 ? 2 : 1;
|
||||
int supportType = (direction & 1) ? 2 : 1;
|
||||
uint16 ax = (direction == 0) ? 5 : 3;
|
||||
metal_a_supports_paint_setup(supportType, 4, ax, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
@ -1915,7 +1915,7 @@ void junior_rc_paint_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequenc
|
|||
}
|
||||
|
||||
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
|
||||
int supportType = direction & 1 ? 2 : 1;
|
||||
int supportType = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(supportType, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2011,7 +2011,7 @@ static void junior_rc_flat_to_left_bank_paint_setup(uint8 rideIndex, uint8 track
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2051,7 +2051,7 @@ static void junior_rc_flat_to_right_bank_paint_setup(uint8 rideIndex, uint8 trac
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2219,7 +2219,7 @@ static void junior_rc_left_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 3, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2262,7 +2262,7 @@ static void junior_rc_right_bank_to_25_deg_up_paint_setup(uint8 rideIndex, uint8
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 3, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2320,7 +2320,7 @@ static void junior_rc_25_deg_up_to_left_bank_paint_setup(uint8 rideIndex, uint8
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2371,7 +2371,7 @@ static void junior_rc_25_deg_up_to_right_bank_paint_setup(uint8 rideIndex, uint8
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2451,7 +2451,7 @@ static void junior_rc_left_bank_paint_setup(uint8 rideIndex, uint8 trackSequence
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -2594,7 +2594,7 @@ static void junior_rc_s_bend_left_paint_setup(uint8 rideIndex, uint8 trackSequen
|
|||
{32, 20},
|
||||
};
|
||||
|
||||
uint32 imageId = junior_rc_track_pieces_s_bend_left[direction & 1][trackSequence] | gTrackColours[SCHEME_TRACK];
|
||||
uint32 imageId = junior_rc_track_pieces_s_bend_left[(direction & 1)][trackSequence] | gTrackColours[SCHEME_TRACK];
|
||||
rct_xy16 offset = offsetList[trackSequence];
|
||||
rct_xy16 bounds = boundsList[trackSequence];
|
||||
if (direction == 0 || direction == 2) {
|
||||
|
@ -2632,7 +2632,7 @@ static void junior_rc_s_bend_left_paint_setup(uint8 rideIndex, uint8 trackSequen
|
|||
case 2: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; break;
|
||||
case 3: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_C0; break;
|
||||
}
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction & 1), 0xFFFF, 0);
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, (direction & 1)), 0xFFFF, 0);
|
||||
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
}
|
||||
|
@ -2696,7 +2696,7 @@ static void junior_rc_s_bend_right_paint_setup(uint8 rideIndex, uint8 trackSeque
|
|||
case 2: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4; break;
|
||||
case 3: blockedSegments = SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B8; break;
|
||||
}
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, direction & 1), 0xFFFF, 0);
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(blockedSegments, (direction & 1)), 0xFFFF, 0);
|
||||
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
}
|
||||
|
@ -2714,7 +2714,7 @@ static void junior_rc_right_quarter_turn_3_tiles_paint_setup(uint8 rideIndex, ui
|
|||
switch (trackSequence) {
|
||||
case 0:
|
||||
case 3:
|
||||
metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup(supportType[(direction & 1)][trackSequence], 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2831,7 +2831,7 @@ static void junior_rc_right_quarter_turn_3_tiles_bank_paint_setup(uint8 rideInde
|
|||
switch (trackSequence) {
|
||||
case 0:
|
||||
case 3:
|
||||
metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup(supportType[(direction & 1)][trackSequence], 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2894,7 +2894,7 @@ void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_up(uint8 rideIndex,
|
|||
switch (trackSequence) {
|
||||
case 0:
|
||||
case 3:
|
||||
metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup(supportType[(direction & 1)][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2958,7 +2958,7 @@ void junior_rc_paint_track_right_quarter_turn_3_tiles_25_deg_down(uint8 rideInde
|
|||
switch (trackSequence) {
|
||||
case 0:
|
||||
case 3:
|
||||
metal_a_supports_paint_setup(supportType[direction & 1][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup(supportType[(direction & 1)][trackSequence], 4, 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3025,10 +3025,10 @@ static void junior_rc_right_half_banked_helix_up_small_paint_setup(uint8 rideInd
|
|||
track_paint_util_right_helix_up_small_quarter_tiles_paint(thickness, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_right_half_banked_helix_up_small_quarter_tiles, NULL, defaultRightHelixUpSmallQuarterBoundLengths, defaultRightHelixUpSmallQuarterBoundOffsets, get_current_rotation());
|
||||
|
||||
if (trackSequence == 0) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 2, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 2, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
else if ( trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 1 : 2, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
if (direction == 0 && trackSequence == 0) {
|
||||
|
@ -3070,10 +3070,10 @@ static void junior_rc_right_half_banked_helix_down_small_paint_setup(uint8 rideI
|
|||
track_paint_util_right_helix_up_small_quarter_tiles_paint(thickness, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_right_half_banked_helix_down_small_quarter_tiles, NULL, defaultRightHelixUpSmallQuarterBoundLengths, defaultRightHelixUpSmallQuarterBoundOffsets, get_current_rotation());
|
||||
|
||||
if (trackSequence == 0) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 6, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
else if ( trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 1 : 2, 4, 2, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, 2, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
if (direction == 0 && trackSequence == 0) {
|
||||
|
@ -3139,10 +3139,10 @@ static void junior_rc_right_half_banked_helix_up_large_paint_setup(uint8 rideInd
|
|||
track_paint_util_right_helix_up_large_quarter_tiles_paint(thickness, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_right_half_banked_helix_up_large_quarter_tiles, NULL, defaultRightHelixUpLargeQuarterBoundLengths, defaultRightHelixUpLargeQuarterBoundOffsets, get_current_rotation());
|
||||
|
||||
if (trackSequence == 0) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 1, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 1, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
else if ( trackSequence == 6) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 1 : 2, 4, 7, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, 7, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
if (direction == 0 && trackSequence == 0) {
|
||||
|
@ -3185,10 +3185,10 @@ static void junior_rc_right_half_banked_helix_down_large_paint_setup(uint8 rideI
|
|||
track_paint_util_right_helix_up_large_quarter_tiles_paint(thickness, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_right_half_banked_helix_down_large_quarter_tiles, NULL, defaultRightHelixUpLargeQuarterBoundLengths, defaultRightHelixUpLargeQuarterBoundOffsets, get_current_rotation());
|
||||
|
||||
if (trackSequence == 0) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 7, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 7, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
else if ( trackSequence == 6) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 1 : 2, 4, 1, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 1 : 2, 4, 1, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
if (direction == 0 && trackSequence == 0) {
|
||||
|
@ -3263,7 +3263,7 @@ static void junior_rc_brake_paint_setup(uint8 rideIndex, uint8 trackSequence, ui
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -3294,7 +3294,7 @@ static void junior_rc_block_brake_paint_setup(uint8 rideIndex, uint8 trackSequen
|
|||
|
||||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
int edi = direction & 1 ? 2 : 1;
|
||||
int edi = (direction & 1) ? 2 : 1;
|
||||
metal_a_supports_paint_setup(edi, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
|
@ -3309,7 +3309,7 @@ static void junior_rc_left_eighth_to_diag_paint_setup(uint8 rideIndex, uint8 tra
|
|||
|
||||
switch (trackSequence) {
|
||||
case 0:
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
case 4:
|
||||
if (direction == 0) metal_a_supports_paint_setup(2, 3, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
|
@ -3346,7 +3346,7 @@ static void junior_rc_right_eighth_to_diag_paint_setup(uint8 rideIndex, uint8 tr
|
|||
|
||||
switch (trackSequence) {
|
||||
case 0:
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
case 4:
|
||||
if (direction == 0) metal_a_supports_paint_setup(2, 1, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
|
@ -3480,7 +3480,7 @@ static void junior_rc_left_eighth_to_diag_bank_paint_setup(uint8 rideIndex, uint
|
|||
|
||||
switch (trackSequence) {
|
||||
case 0:
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
case 4:
|
||||
if (direction == 0) metal_a_supports_paint_setup(1, 3, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
|
@ -3598,7 +3598,7 @@ static void junior_rc_right_eighth_to_diag_bank_paint_setup(uint8 rideIndex, uin
|
|||
|
||||
switch (trackSequence) {
|
||||
case 0:
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
break;
|
||||
case 4:
|
||||
if (direction == 0) metal_a_supports_paint_setup(1, 1, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
|
@ -3658,7 +3658,7 @@ void junior_rc_paint_track_diag_flat(uint8 rideIndex, uint8 trackSequence, uint8
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3671,7 +3671,7 @@ void junior_rc_paint_track_diag_25_deg_up(uint8 rideIndex, uint8 trackSequence,
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3684,7 +3684,7 @@ void junior_rc_paint_track_diag_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSe
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_25_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3697,7 +3697,7 @@ void junior_rc_paint_track_diag_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSe
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3711,7 +3711,7 @@ void junior_rc_paint_track_diag_25_deg_down(uint8 rideIndex, uint8 trackSequence
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3724,7 +3724,7 @@ void junior_rc_paint_track_diag_flat_to_25_deg_down(uint8 rideIndex, uint8 track
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_flat_to_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3737,7 +3737,7 @@ void junior_rc_paint_track_diag_25_deg_down_to_flat(uint8 rideIndex, uint8 track
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_down_to_flat[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3805,7 +3805,7 @@ static void junior_rc_diag_flat_to_left_bank_paint_setup(uint8 rideIndex, uint8
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3824,7 +3824,7 @@ static void junior_rc_diag_flat_to_right_bank_paint_setup(uint8 rideIndex, uint8
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3843,7 +3843,7 @@ static void junior_rc_diag_left_bank_to_flat_paint_setup(uint8 rideIndex, uint8
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3862,7 +3862,7 @@ static void junior_rc_diag_right_bank_to_flat_paint_setup(uint8 rideIndex, uint8
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 27, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3881,7 +3881,7 @@ static void junior_rc_diag_left_bank_to_25_deg_up_paint_setup(uint8 rideIndex, u
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3900,7 +3900,7 @@ static void junior_rc_diag_right_bank_to_25_deg_up_paint_setup(uint8 rideIndex,
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3919,7 +3919,7 @@ static void junior_rc_diag_25_deg_up_to_left_bank_paint_setup(uint8 rideIndex, u
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3938,7 +3938,7 @@ static void junior_rc_diag_25_deg_up_to_right_bank_paint_setup(uint8 rideIndex,
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3957,7 +3957,7 @@ static void junior_rc_diag_left_bank_to_25_deg_down_paint_setup(uint8 rideIndex,
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3976,7 +3976,7 @@ static void junior_rc_diag_right_bank_to_25_deg_down_paint_setup(uint8 rideIndex
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 4, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -3995,7 +3995,7 @@ static void junior_rc_diag_25_deg_down_to_left_bank_paint_setup(uint8 rideIndex,
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4014,7 +4014,7 @@ static void junior_rc_diag_25_deg_down_to_right_bank_paint_setup(uint8 rideIndex
|
|||
sub_98197C(imageId, -16, -16, 32, 32, 0, height, -16, -16, height + 35, get_current_rotation());
|
||||
}
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4043,7 +4043,7 @@ static void junior_rc_diag_left_bank_paint_setup(uint8 rideIndex, uint8 trackSeq
|
|||
track_paint_util_diag_tiles_paint(thickness, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_left_bank, defaultDiagTileOffsets, defaultDiagBoundLengths, junior_rc_diag_left_bank_bound_offsets, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4058,7 +4058,7 @@ static void junior_rc_diag_right_bank_paint_setup(uint8 rideIndex, uint8 trackSe
|
|||
track_paint_util_diag_tiles_paint(thickness, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_right_bank, defaultDiagTileOffsets, defaultDiagBoundLengths, junior_rc_diag_right_bank_bound_offsets, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4131,7 +4131,7 @@ void junior_rc_paint_track_60_deg_up(uint8 rideIndex, uint8 trackSequence, uint8
|
|||
|
||||
sint8 support[4] = { 35, 29, 25, 32};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0);
|
||||
|
@ -4224,7 +4224,7 @@ void junior_rc_paint_track_25_deg_up_to_60_deg_up(uint8 rideIndex, uint8 trackSe
|
|||
|
||||
sint8 support[4] = { 12, 12, 12, 14};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, support[direction], height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0);
|
||||
|
@ -4295,7 +4295,7 @@ void junior_rc_paint_track_60_deg_up_to_25_deg_up(uint8 rideIndex, uint8 trackSe
|
|||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 20, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 20, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0);
|
||||
|
@ -4317,7 +4317,7 @@ void junior_rc_paint_track_diag_60_deg_up(uint8 rideIndex, uint8 trackSequence,
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 36, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 36, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4330,7 +4330,7 @@ void junior_rc_paint_track_diag_60_deg_down(uint8 rideIndex, uint8 trackSequence
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 28, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 28, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4343,7 +4343,7 @@ void junior_rc_paint_track_diag_25_deg_up_to_60_deg_up(uint8 rideIndex, uint8 tr
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_25_deg_up_to_60_deg_up[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 16, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 16, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4367,7 +4367,7 @@ void junior_rc_paint_track_diag_60_deg_up_to_25_deg_up(uint8 rideIndex, uint8 tr
|
|||
}
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 21, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 21, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4391,7 +4391,7 @@ void junior_rc_paint_track_diag_25_deg_down_to_60_deg_down(uint8 rideIndex, uint
|
|||
}
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 17, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 17, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4404,7 +4404,7 @@ void junior_rc_paint_track_diag_60_deg_down_to_25_deg_down(uint8 rideIndex, uint
|
|||
track_paint_util_diag_tiles_paint(1, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], junior_rc_track_pieces_diag_60_deg_down_to_25_deg_down[chainType], defaultDiagTileOffsets, defaultDiagBoundLengths, 0, get_current_rotation());
|
||||
|
||||
if (trackSequence == 3) {
|
||||
metal_b_supports_paint_setup(direction & 1 ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_b_supports_paint_setup((direction & 1) ? 2 : 1, junior_rc_diag_support_segment[direction], 8, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
int blockedSegments = junior_rc_diag_blocked_segments[trackSequence];
|
||||
|
@ -4540,7 +4540,7 @@ static void junior_rc_flat_to_60_deg_up_paint_setup(uint8 rideIndex, uint8 track
|
|||
|
||||
sint8 support[4] = { 12, 12, 12, 14};
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, support[direction], height - 7, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, support[direction], height - 7, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0);
|
||||
|
@ -4608,7 +4608,7 @@ static void junior_rc_60_deg_up_to_flat_paint_setup(uint8 rideIndex, uint8 track
|
|||
const rct_xy16 pos = {gPaintMapPosition.x, gPaintMapPosition.y};
|
||||
|
||||
if (track_paint_util_should_paint_supports(pos)) {
|
||||
metal_a_supports_paint_setup(direction & 1 ? 2 : 1, 4, 20, height - 5, gTrackColours[SCHEME_SUPPORTS]);
|
||||
metal_a_supports_paint_setup((direction & 1) ? 2 : 1, 4, 20, height - 5, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_D0 | SEGMENT_CC, direction), 0xFFFF, 0);
|
||||
|
|
|
@ -669,7 +669,7 @@ static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8
|
|||
paint_util_push_tunnel_left(height, TUNNEL_6);
|
||||
}
|
||||
|
||||
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
wooden_a_supports_paint_setup((direction & 1), 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
|
@ -752,7 +752,7 @@ static void paint_mini_golf_hole_ab(uint8 trackSequence, uint8 direction, int he
|
|||
{
|
||||
uint32 imageId;
|
||||
|
||||
bool drewSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
bool drewSupports = wooden_a_supports_paint_setup((direction & 1), 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
|
@ -770,7 +770,7 @@ static void paint_mini_golf_hole_ab(uint8 trackSequence, uint8 direction, int he
|
|||
sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 24, get_current_rotation());
|
||||
|
||||
if (drewSupports) {
|
||||
imageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
imageId = ((direction & 1) ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation());
|
||||
|
||||
imageId = sprites[direction][trackSequence][0] | gTrackColours[SCHEME_TRACK];
|
||||
|
@ -798,7 +798,7 @@ static void paint_mini_golf_hole_c(uint8 rideIndex, uint8 trackSequence, uint8 d
|
|||
{
|
||||
uint32 imageId;
|
||||
|
||||
bool drewSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
bool drewSupports = wooden_a_supports_paint_setup((direction & 1), 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
|
@ -829,7 +829,7 @@ static void paint_mini_golf_hole_c(uint8 rideIndex, uint8 trackSequence, uint8 d
|
|||
}
|
||||
|
||||
if (drewSupports) {
|
||||
imageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
imageId = ((direction & 1) ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation());
|
||||
|
||||
imageId = mini_golf_track_sprites_hole_c[direction][trackSequence][0] | gTrackColours[SCHEME_TRACK];
|
||||
|
@ -845,7 +845,7 @@ static void paint_mini_golf_hole_d(uint8 rideIndex, uint8 trackSequence, uint8 d
|
|||
{
|
||||
uint32 imageId;
|
||||
|
||||
int supportType = direction & 1;
|
||||
int supportType = (direction & 1);
|
||||
if (trackSequence == 2) supportType = 1 - supportType;
|
||||
bool drewSupports = wooden_a_supports_paint_setup(supportType, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
|
||||
|
@ -895,7 +895,7 @@ static void paint_mini_golf_hole_d(uint8 rideIndex, uint8 trackSequence, uint8 d
|
|||
}
|
||||
|
||||
if (drewSupports) {
|
||||
imageId = (supportType & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
imageId = ((supportType & 1) ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation());
|
||||
|
||||
imageId = mini_golf_track_sprites_hole_d[direction][trackSequence][0] | gTrackColours[SCHEME_TRACK];
|
||||
|
@ -911,7 +911,7 @@ static void paint_mini_golf_hole_e(uint8 rideIndex, uint8 trackSequence, uint8 d
|
|||
{
|
||||
uint32 imageId;
|
||||
|
||||
int supportType = direction & 1;
|
||||
int supportType = (direction & 1);
|
||||
if (trackSequence == 2) supportType = 1 - supportType;
|
||||
bool drewSupports = wooden_a_supports_paint_setup(supportType, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
|
||||
|
@ -961,7 +961,7 @@ static void paint_mini_golf_hole_e(uint8 rideIndex, uint8 trackSequence, uint8 d
|
|||
}
|
||||
|
||||
if (drewSupports) {
|
||||
imageId = (supportType & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
imageId = ((supportType & 1) ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_SUPPORTS];
|
||||
sub_98197C(imageId, 0, 0, boundBox.x, boundBox.y, 1, height, boundBoxOffset.x, boundBoxOffset.y, height, get_current_rotation());
|
||||
|
||||
imageId = mini_golf_track_sprites_hole_e[direction][trackSequence][0] | gTrackColours[SCHEME_TRACK];
|
||||
|
|
320
src/ride/ride.c
320
src/ride/ride.c
|
@ -420,7 +420,7 @@ static money32 ride_calculate_income_per_hour(rct_ride *ride)
|
|||
priceMinusCost -= get_shop_item_cost(currentShopItem);
|
||||
}
|
||||
|
||||
currentShopItem = ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO ?
|
||||
currentShopItem = (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) ?
|
||||
RidePhotoItems[ride->type] :
|
||||
entry->shop_item_secondary;
|
||||
|
||||
|
@ -913,17 +913,13 @@ int ride_can_have_multiple_circuits(rct_ride *ride)
|
|||
*/
|
||||
void ride_init_all()
|
||||
{
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
rct_ride_measurement *ride_measurement;
|
||||
|
||||
for (i = 0; i < MAX_RIDES; i++) {
|
||||
ride = get_ride(i);
|
||||
for (int i = 0; i < MAX_RIDES; i++) {
|
||||
rct_ride *ride = get_ride(i);
|
||||
ride->type = RIDE_TYPE_NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
ride_measurement = get_ride_measurement(i);
|
||||
for (int i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
rct_ride_measurement *ride_measurement = get_ride_measurement(i);
|
||||
ride_measurement->ride_index = 255;
|
||||
}
|
||||
}
|
||||
|
@ -994,12 +990,11 @@ static int ride_create_ride(ride_list_item listItem)
|
|||
ecx = 0;
|
||||
ebx = GAME_COMMAND_FLAG_APPLY;
|
||||
edi = 0;
|
||||
esi = 0;
|
||||
esi = GAME_COMMAND_CREATE_RIDE;
|
||||
ebp = 0;
|
||||
|
||||
gGameCommandErrorTitle = STR_CANT_CREATE_NEW_RIDE_ATTRACTION;
|
||||
|
||||
esi = GAME_COMMAND_CREATE_RIDE;
|
||||
game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
return ebx == MONEY32_UNDEFINED ? -1 : edi;
|
||||
}
|
||||
|
@ -1021,12 +1016,11 @@ void ride_construct_new(ride_list_item listItem)
|
|||
void ride_construct(int rideIndex)
|
||||
{
|
||||
rct_xy_element trackElement;
|
||||
rct_window *w;
|
||||
|
||||
if (ride_try_get_origin_element(rideIndex, &trackElement)) {
|
||||
ride_find_track_gap(&trackElement, &trackElement);
|
||||
|
||||
w = window_get_main();
|
||||
rct_window *w = window_get_main();
|
||||
if (w != NULL && ride_modify(&trackElement))
|
||||
window_scroll_to_location(w, trackElement.x, trackElement.y, trackElement.element->base_height * 8);
|
||||
} else {
|
||||
|
@ -1040,14 +1034,11 @@ void ride_construct(int rideIndex)
|
|||
*/
|
||||
static void ride_remove_cable_lift(rct_ride *ride)
|
||||
{
|
||||
uint16 spriteIndex;
|
||||
rct_vehicle *vehicle;
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_CABLE_LIFT) {
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_CABLE_LIFT;
|
||||
spriteIndex = ride->cable_lift;
|
||||
uint16 spriteIndex = ride->cable_lift;
|
||||
do {
|
||||
vehicle = GET_VEHICLE(spriteIndex);
|
||||
rct_vehicle *vehicle = GET_VEHICLE(spriteIndex);
|
||||
invalidate_sprite_2((rct_sprite*)vehicle);
|
||||
sprite_remove((rct_sprite*)vehicle);
|
||||
spriteIndex = vehicle->next_vehicle_on_train;
|
||||
|
@ -1061,18 +1052,14 @@ static void ride_remove_cable_lift(rct_ride *ride)
|
|||
*/
|
||||
static void ride_remove_vehicles(rct_ride *ride)
|
||||
{
|
||||
int i;
|
||||
uint16 spriteIndex;
|
||||
rct_vehicle *vehicle;
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) {
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_ON_TRACK;
|
||||
ride->lifecycle_flags &= ~(RIDE_LIFECYCLE_TEST_IN_PROGRESS | RIDE_LIFECYCLE_11);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
spriteIndex = ride->vehicles[i];
|
||||
for (size_t i = 0; i < 32; i++) {
|
||||
uint16 spriteIndex = ride->vehicles[i];
|
||||
while (spriteIndex != SPRITE_INDEX_NULL) {
|
||||
vehicle = GET_VEHICLE(spriteIndex);
|
||||
rct_vehicle *vehicle = GET_VEHICLE(spriteIndex);
|
||||
invalidate_sprite_2((rct_sprite*)vehicle);
|
||||
sprite_remove((rct_sprite*)vehicle);
|
||||
spriteIndex = vehicle->next_vehicle_on_train;
|
||||
|
@ -1081,7 +1068,7 @@ static void ride_remove_vehicles(rct_ride *ride)
|
|||
ride->vehicles[i] = SPRITE_INDEX_NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
ride->train_at_station[i] = 255;
|
||||
}
|
||||
}
|
||||
|
@ -1116,17 +1103,11 @@ void ride_clear_for_construction(int rideIndex)
|
|||
*/
|
||||
static void ride_remove_peeps(int rideIndex)
|
||||
{
|
||||
int i, stationIndex, x, y, z, exitX, exitY, exitZ, exitDirection;
|
||||
uint16 xy, spriteIndex;
|
||||
rct_ride *ride;
|
||||
rct_map_element *mapElement;
|
||||
rct_peep *peep;
|
||||
|
||||
ride = get_ride(rideIndex);
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
// Find first station
|
||||
stationIndex = -1;
|
||||
for (i = 0; i < 4; i++) {
|
||||
int stationIndex = -1;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (ride->station_starts[i] != 0xFFFF) {
|
||||
stationIndex = i;
|
||||
break;
|
||||
|
@ -1134,14 +1115,15 @@ static void ride_remove_peeps(int rideIndex)
|
|||
}
|
||||
|
||||
// Get exit position and direction
|
||||
exitDirection = 255;
|
||||
int exitX, exitY, exitZ;
|
||||
int exitDirection = 255;
|
||||
if (stationIndex != -1) {
|
||||
xy = ride->exits[stationIndex];
|
||||
uint16 xy = ride->exits[stationIndex];
|
||||
if (xy != 0xFFFF) {
|
||||
exitX = xy & 0xFF;
|
||||
exitY = xy >> 8;
|
||||
exitZ = ride->station_heights[stationIndex];
|
||||
mapElement = ride_get_station_exit_element(ride, exitX, exitY, exitZ);
|
||||
rct_map_element *mapElement = ride_get_station_exit_element(ride, exitX, exitY, exitZ);
|
||||
|
||||
exitDirection = (mapElement == NULL ? 0 : mapElement->type & MAP_ELEMENT_DIRECTION_MASK);
|
||||
exitX = (exitX * 32) - (word_981D6C[exitDirection].x * 20) + 16;
|
||||
|
@ -1156,6 +1138,8 @@ static void ride_remove_peeps(int rideIndex)
|
|||
}
|
||||
|
||||
// Place all the peeps at exit
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (
|
||||
peep->state == PEEP_STATE_QUEUING_FRONT ||
|
||||
|
@ -1173,9 +1157,9 @@ static void ride_remove_peeps(int rideIndex)
|
|||
invalidate_sprite_2((rct_sprite*)peep);
|
||||
|
||||
if (exitDirection == 255) {
|
||||
x = peep->next_x + 16;
|
||||
y = peep->next_y + 16;
|
||||
z = peep->next_z * 8;
|
||||
int x = peep->next_x + 16;
|
||||
int y = peep->next_y + 16;
|
||||
int z = peep->next_z * 8;
|
||||
if (peep->next_var_29 & 4)
|
||||
z += 8;
|
||||
z++;
|
||||
|
@ -1648,22 +1632,20 @@ void ride_construction_set_default_next_piece()
|
|||
*/
|
||||
void ride_select_next_section()
|
||||
{
|
||||
int x, y, z, direction, type;
|
||||
rct_map_element *mapElement;
|
||||
rct_xy_element inputElement, outputElement;
|
||||
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED) {
|
||||
sub_6C9627();
|
||||
x = _currentTrackBeginX;
|
||||
y = _currentTrackBeginY;
|
||||
z = _currentTrackBeginZ;
|
||||
direction = _currentTrackPieceDirection;
|
||||
type = _currentTrackPieceType;
|
||||
int x = _currentTrackBeginX;
|
||||
int y = _currentTrackBeginY;
|
||||
int z = _currentTrackBeginZ;
|
||||
int direction = _currentTrackPieceDirection;
|
||||
int type = _currentTrackPieceType;
|
||||
rct_map_element *mapElement;
|
||||
if (sub_6C683D(&x, &y, &z, direction & 3, type, 0, &mapElement, 0)) {
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
sub_6C84CE();
|
||||
return;
|
||||
}
|
||||
rct_xy_element inputElement, outputElement;
|
||||
inputElement.x = x;
|
||||
inputElement.y = y;
|
||||
inputElement.element = mapElement;
|
||||
|
@ -1706,22 +1688,20 @@ void ride_select_next_section()
|
|||
*/
|
||||
void ride_select_previous_section()
|
||||
{
|
||||
int x, y, z, direction, type;
|
||||
rct_map_element *mapElement;
|
||||
track_begin_end trackBeginEnd;
|
||||
|
||||
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED) {
|
||||
sub_6C9627();
|
||||
x = _currentTrackBeginX;
|
||||
y = _currentTrackBeginY;
|
||||
z = _currentTrackBeginZ;
|
||||
direction = _currentTrackPieceDirection;
|
||||
type = _currentTrackPieceType;
|
||||
int x = _currentTrackBeginX;
|
||||
int y = _currentTrackBeginY;
|
||||
int z = _currentTrackBeginZ;
|
||||
int direction = _currentTrackPieceDirection;
|
||||
int type = _currentTrackPieceType;
|
||||
rct_map_element *mapElement;
|
||||
if (sub_6C683D(&x, &y, &z, direction & 3, type, 0, &mapElement, 0)) {
|
||||
_rideConstructionState = RIDE_CONSTRUCTION_STATE_0;
|
||||
sub_6C84CE();
|
||||
return;
|
||||
}
|
||||
track_begin_end trackBeginEnd;
|
||||
if (track_block_get_previous(x, y, mapElement, &trackBeginEnd)) {
|
||||
_currentTrackBeginX = trackBeginEnd.begin_x;
|
||||
_currentTrackBeginY = trackBeginEnd.begin_y;
|
||||
|
@ -2009,7 +1989,6 @@ void ride_update_all()
|
|||
*/
|
||||
static void ride_update(int rideIndex)
|
||||
{
|
||||
int i;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
if (ride->vehicle_change_timeout != 0)
|
||||
|
@ -2019,7 +1998,7 @@ static void ride_update(int rideIndex)
|
|||
|
||||
// Update stations
|
||||
if (ride->type != RIDE_TYPE_MAZE)
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
ride_update_station(ride, i);
|
||||
|
||||
// Update financial statistics
|
||||
|
@ -2170,10 +2149,6 @@ static const rct_xy16 ride_spiral_slide_main_tile_offset[][4] = {
|
|||
*/
|
||||
static void ride_spiral_slide_update(rct_ride *ride)
|
||||
{
|
||||
int i, x, y;
|
||||
rct_map_element *mapElement;
|
||||
rct_peep *peep;
|
||||
|
||||
if (gCurrentTicks & 3)
|
||||
return;
|
||||
if (ride->slide_in_use == 0)
|
||||
|
@ -2183,20 +2158,20 @@ static void ride_spiral_slide_update(rct_ride *ride)
|
|||
if (ride->spiral_slide_progress >= 48) {
|
||||
ride->slide_in_use--;
|
||||
|
||||
peep = GET_PEEP(ride->slide_peep);
|
||||
rct_peep *peep = GET_PEEP(ride->slide_peep);
|
||||
peep->destination_x++;
|
||||
}
|
||||
|
||||
const uint8 current_rotation = get_current_rotation();
|
||||
// Invalidate something related to station start
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (ride->station_starts[i] == 0xFFFF)
|
||||
continue;
|
||||
|
||||
x = ride->station_starts[i] & 0xFF;
|
||||
y = ride->station_starts[i] >> 8;
|
||||
int x = ride->station_starts[i] & 0xFF;
|
||||
int y = ride->station_starts[i] >> 8;
|
||||
|
||||
mapElement = ride_get_station_start_track_element(ride, i);
|
||||
rct_map_element *mapElement = ride_get_station_start_track_element(ride, i);
|
||||
int rotation = map_element_get_direction(mapElement);
|
||||
x *= 32;
|
||||
y *= 32;
|
||||
|
@ -2292,14 +2267,12 @@ static int get_age_penalty(rct_ride *ride) {
|
|||
*/
|
||||
static void ride_breakdown_update(int rideIndex)
|
||||
{
|
||||
int breakdownReason, unreliabilityAccumulator;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
if (gCurrentTicks & 255)
|
||||
return;
|
||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
return;
|
||||
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
|
||||
ride->downtime_history[0]++;
|
||||
|
||||
|
@ -2327,7 +2300,7 @@ static void ride_breakdown_update(int rideIndex)
|
|||
return;
|
||||
|
||||
// Calculate breakdown probability?
|
||||
unreliabilityAccumulator = ride->unreliability_factor + get_age_penalty(ride);
|
||||
int unreliabilityAccumulator = ride->unreliability_factor + get_age_penalty(ride);
|
||||
ride->reliability = max(0, ride->reliability - unreliabilityAccumulator);
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
|
||||
|
@ -2339,7 +2312,7 @@ static void ride_breakdown_update(int rideIndex)
|
|||
// continues.
|
||||
if ((ride->reliability == 0 || (int)(scenario_rand() & 0x2FFFFF) <= 1 + RIDE_INITIAL_RELIABILITY - ride->reliability)
|
||||
&& !gCheatsDisableAllBreakdowns) {
|
||||
breakdownReason = ride_get_new_breakdown_problem(ride);
|
||||
int breakdownReason = ride_get_new_breakdown_problem(ride);
|
||||
if (breakdownReason != -1)
|
||||
ride_prepare_breakdown(rideIndex, breakdownReason);
|
||||
}
|
||||
|
@ -2718,15 +2691,13 @@ rct_peep *find_closest_mechanic(int x, int y, int forInspection)
|
|||
|
||||
rct_peep *ride_get_assigned_mechanic(rct_ride *ride)
|
||||
{
|
||||
rct_peep *peep;
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) {
|
||||
if (
|
||||
ride->mechanic_status == RIDE_MECHANIC_STATUS_HEADING ||
|
||||
ride->mechanic_status == 3 ||
|
||||
ride->mechanic_status == 4
|
||||
) {
|
||||
peep = &(get_sprite(ride->mechanic)->peep);
|
||||
rct_peep *peep = &(get_sprite(ride->mechanic)->peep);
|
||||
if (peep_is_mechanic(peep))
|
||||
return peep;
|
||||
}
|
||||
|
@ -2784,8 +2755,6 @@ uint8 *ride_music_style_tuneids[] = {
|
|||
*/
|
||||
static void ride_music_update(int rideIndex)
|
||||
{
|
||||
int x, y, z;
|
||||
rct_vehicle *vehicle;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
if (
|
||||
|
@ -2801,7 +2770,7 @@ static void ride_music_update(int rideIndex)
|
|||
}
|
||||
|
||||
if (ride->type == RIDE_TYPE_CIRCUS_SHOW) {
|
||||
vehicle = GET_VEHICLE(ride->vehicles[0]);
|
||||
rct_vehicle *vehicle = GET_VEHICLE(ride->vehicles[0]);
|
||||
if (vehicle->status != VEHICLE_STATUS_DOING_CIRCUS_SHOW) {
|
||||
ride->music_tune_id = 255;
|
||||
return;
|
||||
|
@ -2840,9 +2809,9 @@ static void ride_music_update(int rideIndex)
|
|||
return;
|
||||
}
|
||||
|
||||
x = (ride->station_starts[0] & 0xFF) * 32 + 16;
|
||||
y = (ride->station_starts[0] >> 8) * 32 + 16;
|
||||
z = ride->station_heights[0] * 8;
|
||||
int x = (ride->station_starts[0] & 0xFF) * 32 + 16;
|
||||
int y = (ride->station_starts[0] >> 8) * 32 + 16;
|
||||
int z = ride->station_heights[0] * 8;
|
||||
|
||||
int sampleRate = 22050;
|
||||
|
||||
|
@ -2959,22 +2928,16 @@ static void ride_measurement_update(rct_ride_measurement *measurement)
|
|||
*/
|
||||
void ride_measurements_update()
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_ride_measurement *measurement;
|
||||
rct_vehicle *vehicle;
|
||||
int i, j;
|
||||
uint16 spriteIndex;
|
||||
|
||||
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
return;
|
||||
|
||||
// For each ride measurement
|
||||
for (i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
measurement = get_ride_measurement(i);
|
||||
for (int i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
rct_ride_measurement *measurement = get_ride_measurement(i);
|
||||
if (measurement->ride_index == 255)
|
||||
continue;
|
||||
|
||||
ride = get_ride(measurement->ride_index);
|
||||
rct_ride *ride = get_ride(measurement->ride_index);
|
||||
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK))
|
||||
continue;
|
||||
|
||||
|
@ -2982,12 +2945,12 @@ void ride_measurements_update()
|
|||
ride_measurement_update(measurement);
|
||||
} else {
|
||||
// For each vehicle
|
||||
for (j = 0; j < ride->num_vehicles; j++) {
|
||||
spriteIndex = ride->vehicles[j];
|
||||
for (int j = 0; j < ride->num_vehicles; j++) {
|
||||
uint16 spriteIndex = ride->vehicles[j];
|
||||
if (spriteIndex == SPRITE_INDEX_NULL)
|
||||
continue;
|
||||
|
||||
vehicle = GET_VEHICLE(spriteIndex);
|
||||
rct_vehicle *vehicle = GET_VEHICLE(spriteIndex);
|
||||
if (vehicle->status == VEHICLE_STATUS_DEPARTING || vehicle->status == VEHICLE_STATUS_TRAVELLING_CABLE_LIFT) {
|
||||
measurement->vehicle_index = j;
|
||||
measurement->current_station = vehicle->current_station;
|
||||
|
@ -3004,11 +2967,8 @@ void ride_measurements_update()
|
|||
|
||||
static rct_ride_measurement *ride_get_existing_measurement(int rideIndex)
|
||||
{
|
||||
int i;
|
||||
rct_ride_measurement *measurement;
|
||||
|
||||
for (i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
measurement = get_ride_measurement(i);
|
||||
for (int i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
rct_ride_measurement *measurement = get_ride_measurement(i);
|
||||
if (measurement->ride_index == rideIndex)
|
||||
return measurement;
|
||||
}
|
||||
|
@ -3018,11 +2978,8 @@ static rct_ride_measurement *ride_get_existing_measurement(int rideIndex)
|
|||
|
||||
static int ride_get_free_measurement()
|
||||
{
|
||||
int i;
|
||||
rct_ride_measurement *measurement;
|
||||
|
||||
for (i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
measurement = get_ride_measurement(i);
|
||||
for (int i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
rct_ride_measurement *measurement = get_ride_measurement(i);
|
||||
if (measurement->ride_index == 255)
|
||||
return i;
|
||||
}
|
||||
|
@ -3036,12 +2993,7 @@ static int ride_get_free_measurement()
|
|||
*/
|
||||
rct_ride_measurement *ride_get_measurement(int rideIndex, rct_string_id *message)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_ride_measurement *measurement;
|
||||
uint32 lruTicks;
|
||||
int i, lruIndex;
|
||||
|
||||
ride = get_ride(rideIndex);
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
// Check if ride type supports data logging
|
||||
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_DATA_LOGGING)) {
|
||||
|
@ -3050,14 +3002,14 @@ rct_ride_measurement *ride_get_measurement(int rideIndex, rct_string_id *message
|
|||
}
|
||||
|
||||
// Check if a measurement already exists for this ride
|
||||
measurement = ride_get_existing_measurement(rideIndex);
|
||||
rct_ride_measurement *measurement = ride_get_existing_measurement(rideIndex);
|
||||
if (measurement == NULL) {
|
||||
// Find a free measurement
|
||||
i = ride_get_free_measurement();
|
||||
int i = ride_get_free_measurement();
|
||||
if (i == -1) {
|
||||
// Use last recently used measurement for some other ride
|
||||
lruIndex = 0;
|
||||
lruTicks = 0xFFFFFFFF;
|
||||
int lruIndex = 0;
|
||||
uint32 lruTicks = 0xFFFFFFFF;
|
||||
for (i = 0; i < MAX_RIDE_MEASUREMENTS; i++) {
|
||||
measurement = get_ride_measurement(i);
|
||||
|
||||
|
@ -3402,7 +3354,7 @@ static void ride_station_set_map_tooltip(rct_map_element *mapElement)
|
|||
|
||||
static void ride_entrance_set_map_tooltip(rct_map_element *mapElement)
|
||||
{
|
||||
int i, rideIndex, stationIndex, queueLength;
|
||||
int i, rideIndex, stationIndex;
|
||||
rct_ride *ride;
|
||||
|
||||
rideIndex = mapElement->properties.track.ride_index;
|
||||
|
@ -3416,7 +3368,7 @@ static void ride_entrance_set_map_tooltip(rct_map_element *mapElement)
|
|||
|
||||
if (mapElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) {
|
||||
// Get the queue length
|
||||
queueLength = 0;
|
||||
int queueLength = 0;
|
||||
if (ride->entrances[stationIndex] != 0xFFFF)
|
||||
queueLength = ride->queue_length[stationIndex];
|
||||
|
||||
|
@ -4207,24 +4159,20 @@ static int ride_check_block_brakes(rct_xy_element *input, rct_xy_element *output
|
|||
*/
|
||||
static bool ride_check_track_contains_inversions(rct_xy_element *input, rct_xy_element *output)
|
||||
{
|
||||
rct_window *w;
|
||||
rct_ride *ride;
|
||||
int rideIndex, trackType;
|
||||
track_circuit_iterator it;
|
||||
|
||||
rideIndex = input->element->properties.track.ride_index;
|
||||
ride = get_ride(rideIndex);
|
||||
int rideIndex = input->element->properties.track.ride_index;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_MAZE)
|
||||
return true;
|
||||
|
||||
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex) {
|
||||
sub_6C9627();
|
||||
}
|
||||
|
||||
track_circuit_iterator it;
|
||||
track_circuit_iterator_begin(&it, *input);
|
||||
while (track_circuit_iterator_next(&it)) {
|
||||
trackType = it.current.element->properties.track.type;
|
||||
int trackType = it.current.element->properties.track.type;
|
||||
if (TrackFlags[trackType] & TRACK_ELEM_FLAG_4000) {
|
||||
*output = it.current;
|
||||
return true;
|
||||
|
@ -4242,24 +4190,20 @@ static bool ride_check_track_contains_inversions(rct_xy_element *input, rct_xy_e
|
|||
*/
|
||||
static bool ride_check_track_contains_banked(rct_xy_element *input, rct_xy_element *output)
|
||||
{
|
||||
rct_window *w;
|
||||
rct_ride *ride;
|
||||
int rideIndex, trackType;
|
||||
track_circuit_iterator it;
|
||||
|
||||
rideIndex = input->element->properties.track.ride_index;
|
||||
ride = get_ride(rideIndex);
|
||||
int rideIndex = input->element->properties.track.ride_index;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_MAZE)
|
||||
return true;
|
||||
|
||||
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
rct_window *w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != NULL && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && rideIndex == _currentRideIndex) {
|
||||
sub_6C9627();
|
||||
}
|
||||
|
||||
track_circuit_iterator it;
|
||||
track_circuit_iterator_begin(&it, *input);
|
||||
while (track_circuit_iterator_next(&it)) {
|
||||
trackType = output->element->properties.track.type;
|
||||
int trackType = output->element->properties.track.type;
|
||||
if (TrackFlags[trackType] & TRACK_ELEM_FLAG_8000) {
|
||||
*output = it.current;
|
||||
return true;
|
||||
|
@ -4749,11 +4693,10 @@ static void vehicle_create_trains(int rideIndex, int x, int y, int z, rct_map_el
|
|||
|
||||
static void vehicle_unset_var_48_b1(rct_vehicle *head)
|
||||
{
|
||||
uint16 spriteIndex;
|
||||
rct_vehicle *vehicle = head;
|
||||
while (true) {
|
||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_1;
|
||||
spriteIndex = vehicle->next_vehicle_on_train;
|
||||
uint16 spriteIndex = vehicle->next_vehicle_on_train;
|
||||
if (spriteIndex == SPRITE_INDEX_NULL) {
|
||||
break;
|
||||
}
|
||||
|
@ -5141,21 +5084,17 @@ static bool ride_create_cable_lift(int rideIndex, bool isApplying)
|
|||
*/
|
||||
static void loc_6B51C0(int rideIndex)
|
||||
{
|
||||
int i, x, y, z;
|
||||
rct_ride *ride;
|
||||
rct_xy_element trackElement;
|
||||
rct_window *w;
|
||||
|
||||
ride = get_ride(rideIndex);
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
if (gUnk141F568 != gUnk13CA740)
|
||||
return;
|
||||
|
||||
w = window_get_main();
|
||||
rct_window *w = window_get_main();
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
||||
sint8 entranceOrExit = -1;
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (ride->station_starts[i] == 0xFFFF)
|
||||
continue;
|
||||
|
@ -5175,11 +5114,12 @@ static void loc_6B51C0(int rideIndex)
|
|||
return;
|
||||
|
||||
if (ride->type != RIDE_TYPE_MAZE) {
|
||||
x = (ride->station_starts[i] & 0xFF) * 32;
|
||||
y = (ride->station_starts[i] >> 8) * 32;
|
||||
z = ride->station_heights[i] * 8;
|
||||
int x = (ride->station_starts[i] & 0xFF) * 32;
|
||||
int y = (ride->station_starts[i] >> 8) * 32;
|
||||
int z = ride->station_heights[i] * 8;
|
||||
window_scroll_to_location(w, x, y, z);
|
||||
|
||||
rct_xy_element trackElement;
|
||||
ride_try_get_origin_element(rideIndex, &trackElement);
|
||||
ride_find_track_gap(&trackElement, &trackElement);
|
||||
int ok = ride_modify(&trackElement);
|
||||
|
@ -5614,9 +5554,6 @@ void ride_set_name(int rideIndex, const char *name)
|
|||
*/
|
||||
void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
{
|
||||
rct_window *w;
|
||||
rct_ride *ride;
|
||||
rct_string_id newUserStringId;
|
||||
char oldName[128];
|
||||
static char newName[128];
|
||||
|
||||
|
@ -5646,7 +5583,7 @@ void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
return;
|
||||
}
|
||||
|
||||
ride = get_ride(rideIndex);
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", rideIndex);
|
||||
|
@ -5665,7 +5602,7 @@ void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
return;
|
||||
}
|
||||
|
||||
newUserStringId = user_string_allocate(4, newName);
|
||||
rct_string_id newUserStringId = user_string_allocate(4, newName);
|
||||
if (newUserStringId == 0) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
|
@ -5688,7 +5625,7 @@ void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
gfx_invalidate_screen();
|
||||
|
||||
// Force ride list window refresh
|
||||
w = window_find_by_class(WC_RIDE_LIST);
|
||||
rct_window *w = window_find_by_class(WC_RIDE_LIST);
|
||||
if (w != NULL)
|
||||
w->no_list_items = 0;
|
||||
} else {
|
||||
|
@ -5810,9 +5747,8 @@ static void ride_stop_peeps_queuing(int rideIndex)
|
|||
|
||||
static int ride_get_empty_slot()
|
||||
{
|
||||
rct_ride *ride;
|
||||
for (int i = 0; i < MAX_RIDES; i++) {
|
||||
ride = get_ride(i);
|
||||
rct_ride *ride = get_ride(i);
|
||||
if (ride->type == RIDE_TYPE_NULL) {
|
||||
return i;
|
||||
}
|
||||
|
@ -5872,19 +5808,17 @@ static bool ride_name_exists(char *name)
|
|||
*/
|
||||
static int ride_get_random_colour_preset_index(uint8 ride_type)
|
||||
{
|
||||
const track_colour_preset_list *colourPresets;
|
||||
const track_colour *colours;
|
||||
if (ride_type >= 128)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
colourPresets = &RideColourPresets[ride_type];
|
||||
const track_colour_preset_list *colourPresets = &RideColourPresets[ride_type];
|
||||
|
||||
// 200 attempts to find a colour preset that hasn't already been used in the park for this ride type
|
||||
for (int i = 0; i < 200; i++) {
|
||||
int listIndex = util_rand() % colourPresets->count;
|
||||
colours = &colourPresets->list[listIndex];
|
||||
const track_colour *colours = &colourPresets->list[listIndex];
|
||||
|
||||
if (!ride_with_colour_config_exists(ride_type, colours)) {
|
||||
return listIndex;
|
||||
|
@ -6637,31 +6571,24 @@ void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, in
|
|||
*/
|
||||
void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
{
|
||||
uint32 flags, shop_item;
|
||||
uint8 ride_number;
|
||||
money16 price;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideEntry;
|
||||
bool secondary_price;
|
||||
|
||||
flags = *ebx;
|
||||
ride_number = (*edx & 0xFF);
|
||||
uint32 flags = *ebx;
|
||||
uint8 ride_number = (*edx & 0xFF);
|
||||
if (ride_number >= MAX_RIDES)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", ride_number);
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
ride = get_ride(ride_number);
|
||||
rct_ride *ride = get_ride(ride_number);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", ride_number);
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
rideEntry = get_ride_entry(ride->subtype);
|
||||
price = *edi;
|
||||
secondary_price = (*edx >> 8);
|
||||
rct_ride_entry *rideEntry = get_ride_entry(ride->subtype);
|
||||
money16 price = *edi;
|
||||
bool secondary_price = (*edx >> 8);
|
||||
|
||||
if (rideEntry == (rct_ride_entry *)-1)
|
||||
{
|
||||
|
@ -6680,6 +6607,7 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es
|
|||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_PARK_RIDE_TICKETS;
|
||||
if (flags & 0x1) {
|
||||
uint32 shop_item;
|
||||
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
|
@ -7428,13 +7356,10 @@ void ride_fix_breakdown(int rideIndex, int reliabilityIncreaseFactor)
|
|||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST | RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK) {
|
||||
rct_vehicle *vehicle;
|
||||
uint16 spriteIndex;
|
||||
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
spriteIndex = ride->vehicles[i];
|
||||
uint16 spriteIndex = ride->vehicles[i];
|
||||
while (spriteIndex != SPRITE_INDEX_NULL) {
|
||||
vehicle = GET_VEHICLE(spriteIndex);
|
||||
rct_vehicle *vehicle = GET_VEHICLE(spriteIndex);
|
||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_7;
|
||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_BROKEN_CAR;
|
||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_BROKEN_TRAIN;
|
||||
|
@ -7453,22 +7378,19 @@ void ride_fix_breakdown(int rideIndex, int reliabilityIncreaseFactor)
|
|||
*/
|
||||
static void ride_update_vehicle_colours(int rideIndex)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_vehicle *vehicle;
|
||||
rct_vehicle_colour colours = { 0 };
|
||||
uint16 spriteIndex;
|
||||
uint8 coloursExtended = 0;
|
||||
|
||||
ride = get_ride(rideIndex);
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_SPACE_RINGS || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_16)) {
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
int carIndex = 0;
|
||||
spriteIndex = ride->vehicles[i];
|
||||
uint16 spriteIndex = ride->vehicles[i];
|
||||
rct_vehicle_colour colours = { 0 };
|
||||
uint8 coloursExtended = 0;
|
||||
|
||||
while (spriteIndex != SPRITE_INDEX_NULL) {
|
||||
vehicle = GET_VEHICLE(spriteIndex);
|
||||
rct_vehicle *vehicle = GET_VEHICLE(spriteIndex);
|
||||
switch (ride->colour_scheme_type & 3) {
|
||||
case RIDE_COLOUR_SCHEME_ALL_SAME:
|
||||
colours = ride->vehicle_colours[0];
|
||||
|
@ -7604,19 +7526,17 @@ foundTrack:
|
|||
*/
|
||||
void ride_update_max_vehicles(int rideIndex)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideEntry;
|
||||
rct_ride_entry_vehicle *vehicleEntry;
|
||||
uint8 numCarsPerTrain, numVehicles;
|
||||
int trainLength, maxNumTrains;
|
||||
|
||||
ride = get_ride(rideIndex);
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->subtype == 0xFF)
|
||||
return;
|
||||
|
||||
rideEntry = get_ride_entry(ride->subtype);
|
||||
rct_ride_entry *rideEntry = get_ride_entry(ride->subtype);
|
||||
rct_ride_entry_vehicle *vehicleEntry;
|
||||
uint8 numCarsPerTrain, numVehicles;
|
||||
int maxNumTrains;
|
||||
|
||||
if (rideEntry->cars_per_flat_ride == 0xFF) {
|
||||
int trainLength;
|
||||
ride->num_cars_per_train = max(rideEntry->min_cars_in_train, ride->num_cars_per_train);
|
||||
ride->min_max_cars_per_train = rideEntry->max_cars_in_train | (rideEntry->min_cars_in_train << 4);
|
||||
|
||||
|
@ -8511,16 +8431,12 @@ void ride_set_to_default_inspection_interval(int rideIndex)
|
|||
*/
|
||||
void ride_crash(uint8 rideIndex, uint8 vehicleIndex)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_vehicle *vehicle;
|
||||
rct_window *w;
|
||||
|
||||
ride = get_ride(rideIndex);
|
||||
vehicle = GET_VEHICLE(ride->vehicles[vehicleIndex]);
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
rct_vehicle *vehicle = GET_VEHICLE(ride->vehicles[vehicleIndex]);
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) {
|
||||
// Open ride window for crashed vehicle
|
||||
w = window_ride_open_vehicle(vehicle);
|
||||
rct_window *w = window_ride_open_vehicle(vehicle);
|
||||
if (w->viewport != NULL) {
|
||||
w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ static void ride_ratings_score_close_proximity_loops(rct_map_element *inputMapEl
|
|||
if (trackType == TRACK_ELEM_LEFT_VERTICAL_LOOP || trackType == TRACK_ELEM_RIGHT_VERTICAL_LOOP) {
|
||||
int x = gRideRatingsCalcData.proximity_x;
|
||||
int y = gRideRatingsCalcData.proximity_y;
|
||||
ride_ratings_score_close_proximity_loops_helper(inputMapElement, gRideRatingsCalcData.proximity_x, gRideRatingsCalcData.proximity_y);
|
||||
ride_ratings_score_close_proximity_loops_helper(inputMapElement, x, y);
|
||||
|
||||
int direction = inputMapElement->type & MAP_ELEMENT_DIRECTION_MASK;
|
||||
x = gRideRatingsCalcData.proximity_x + TileDirectionDelta[direction].x;
|
||||
|
|
|
@ -45,7 +45,7 @@ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 dir
|
|||
int lengthX = (direction & 1) == 0 ? 28 : 2;
|
||||
int lengthY = (direction & 1) == 0 ? 2 : 28;
|
||||
if (hasSupports) {
|
||||
uint32 foundationImageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_3];
|
||||
uint32 foundationImageId = ((direction & 1) ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_3];
|
||||
sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height, rotation);
|
||||
|
||||
// Door image or base
|
||||
|
|
|
@ -20,5 +20,3 @@
|
|||
#include "../../sprites.h"
|
||||
#include "../../world/map.h"
|
||||
#include "../track_paint.h"
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi
|
|||
imageId += direction;
|
||||
|
||||
if (hasSupports) {
|
||||
uint32 foundationImageId = (direction & 1 ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_3];
|
||||
uint32 foundationImageId = ((direction & 1) ? SPR_FLOOR_PLANKS_90_DEG : SPR_FLOOR_PLANKS) | gTrackColours[SCHEME_3];
|
||||
sub_98197C(foundationImageId, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation());
|
||||
|
||||
sub_98199C(imageId, 0, 0, 28, 28, 45, height, 2, 2, height, get_current_rotation());
|
||||
|
|
|
@ -83,8 +83,6 @@ static void ride_update_station_blocksection(rct_ride *ride, int stationIndex)
|
|||
*/
|
||||
static void ride_update_station_bumpercar(rct_ride *ride, int stationIndex)
|
||||
{
|
||||
int i, dx, dl, dh;
|
||||
rct_vehicle *vehicle;
|
||||
// Change of station depart flag should really call invalidate_station_start
|
||||
// but since bumpercars do not have station lights there is no point.
|
||||
if (
|
||||
|
@ -96,11 +94,11 @@ static void ride_update_station_bumpercar(rct_ride *ride, int stationIndex)
|
|||
}
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING) {
|
||||
dx = ride->time_limit * 32;
|
||||
dl = dx & 0xFF;
|
||||
dh = (dx >> 8) & 0xFF;
|
||||
for (i = 0; i < ride->num_vehicles; i++) {
|
||||
vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
int dx = ride->time_limit * 32;
|
||||
int dl = dx & 0xFF;
|
||||
int dh = (dx >> 8) & 0xFF;
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
rct_vehicle *vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
if (vehicle->var_CE < dh || (vehicle->var_CE < dh && vehicle->sub_state > dl))
|
||||
continue;
|
||||
|
||||
|
@ -114,8 +112,8 @@ static void ride_update_station_bumpercar(rct_ride *ride, int stationIndex)
|
|||
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
|
||||
} else {
|
||||
// Check if all vehicles are ready to go
|
||||
for (i = 0; i < ride->num_vehicles; i++) {
|
||||
vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
rct_vehicle *vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
if (vehicle->status != VEHICLE_STATUS_WAITING_TO_DEPART) {
|
||||
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
|
||||
return;
|
||||
|
@ -167,10 +165,6 @@ static void ride_update_station_normal(rct_ride *ride, int stationIndex)
|
|||
*/
|
||||
static void ride_update_station_race(rct_ride *ride, int stationIndex)
|
||||
{
|
||||
int i, numLaps;
|
||||
rct_vehicle *vehicle;
|
||||
rct_peep *peep;
|
||||
|
||||
if (
|
||||
ride->status == RIDE_STATUS_CLOSED ||
|
||||
(ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
|
||||
|
@ -183,13 +177,13 @@ static void ride_update_station_race(rct_ride *ride, int stationIndex)
|
|||
}
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING) {
|
||||
numLaps = ride->num_laps;
|
||||
for (i = 0; i < ride->num_vehicles; i++) {
|
||||
vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
int numLaps = ride->num_laps;
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
rct_vehicle *vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
if (vehicle->status != VEHICLE_STATUS_WAITING_TO_DEPART && vehicle->num_laps >= numLaps) {
|
||||
// Found a winner
|
||||
if (vehicle->num_peeps != 0) {
|
||||
peep = &(get_sprite(vehicle->peep[0])->peep);
|
||||
rct_peep *peep = &(get_sprite(vehicle->peep[0])->peep);
|
||||
ride->race_winner = peep->sprite_index;
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
}
|
||||
|
@ -208,8 +202,8 @@ static void ride_update_station_race(rct_ride *ride, int stationIndex)
|
|||
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
|
||||
} else {
|
||||
// Check if all vehicles are ready to go
|
||||
for (i = 0; i < ride->num_vehicles; i++) {
|
||||
vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
rct_vehicle *vehicle = &(get_sprite(ride->vehicles[i])->vehicle);
|
||||
if (vehicle->status != VEHICLE_STATUS_WAITING_TO_DEPART && vehicle->status != VEHICLE_STATUS_DEPARTING) {
|
||||
if (ride->station_depart[stationIndex] & STATION_DEPART_FLAG){
|
||||
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
|
||||
|
@ -238,15 +232,11 @@ static void ride_update_station_race(rct_ride *ride, int stationIndex)
|
|||
*/
|
||||
static void ride_race_init_vehicle_speeds(rct_ride *ride)
|
||||
{
|
||||
rct_ride_entry *rideEntry;
|
||||
rct_vehicle *vehicle;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ride->num_vehicles; i++) {
|
||||
vehicle = &get_sprite(ride->vehicles[i])->vehicle;
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
rct_vehicle *vehicle = &get_sprite(ride->vehicles[i])->vehicle;
|
||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_6;
|
||||
|
||||
rideEntry = get_ride_entry(vehicle->ride_subtype);
|
||||
rct_ride_entry *rideEntry = get_ride_entry(vehicle->ride_subtype);
|
||||
|
||||
vehicle->speed = (scenario_rand() & 16) - 8 + rideEntry->vehicles[vehicle->vehicle_type].powered_max_speed;
|
||||
|
||||
|
|
|
@ -121,7 +121,6 @@ static void paint_pirate_ship_structure(rct_ride * ride, uint8 direction, sint8
|
|||
if (dpi->zoom_level <= 1
|
||||
&& ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK
|
||||
&& vehicle != NULL) {
|
||||
int frameNum;
|
||||
int peep = 0;
|
||||
int offset = 1;
|
||||
while (peep < 16) {
|
||||
|
@ -129,7 +128,7 @@ static void paint_pirate_ship_structure(rct_ride * ride, uint8 direction, sint8
|
|||
break;
|
||||
}
|
||||
|
||||
frameNum = offset + (direction >> 1);
|
||||
int frameNum = offset + (direction >> 1);
|
||||
imageColourFlags = vehicle->peep_tshirt_colours[peep] << 19 | vehicle->peep_tshirt_colours[peep + 1] << 24 | 0xA0000000;
|
||||
imageId = (baseImageId + frameNum) | imageColourFlags;
|
||||
sub_98199C(imageId, xOffset, yOffset, bounds.length_x, bounds.length_y, 80, height, bounds.offset_x, bounds.offset_y, height, get_current_rotation());
|
||||
|
|
|
@ -330,7 +330,6 @@ static void td6_reset_trailing_elements(rct_track_td6 * td6)
|
|||
|
||||
static void td6_set_element_helper_pointers(rct_track_td6 * td6)
|
||||
{
|
||||
uintptr_t entranceElementsStart;
|
||||
uintptr_t sceneryElementsStart;
|
||||
if (td6->type == RIDE_TYPE_MAZE) {
|
||||
td6->track_elements = NULL;
|
||||
|
@ -345,7 +344,7 @@ static void td6_set_element_helper_pointers(rct_track_td6 * td6)
|
|||
|
||||
rct_td6_track_element *track = td6->track_elements;
|
||||
for (; track->type != 0xFF; track++) {}
|
||||
entranceElementsStart = (uintptr_t)track + 1;
|
||||
uintptr_t entranceElementsStart = (uintptr_t)track + 1;
|
||||
|
||||
rct_td6_entrance_element *entranceElement = (rct_td6_entrance_element*)entranceElementsStart;
|
||||
td6->entrance_elements = entranceElement;
|
||||
|
@ -1861,9 +1860,8 @@ static void track_design_preview_clear_map()
|
|||
gMapSizeMinus2 = (264 * 32) - 2;
|
||||
gMapSize = 256;
|
||||
|
||||
rct_map_element* map_element;
|
||||
for (int i = 0; i < MAX_TILE_MAP_ELEMENT_POINTERS; i++) {
|
||||
map_element = &gMapElements[i];
|
||||
rct_map_element* map_element = &gMapElements[i];
|
||||
map_element->type = MAP_ELEMENT_TYPE_SURFACE;
|
||||
map_element->flags = MAP_ELEMENT_FLAG_LAST_TILE;
|
||||
map_element->base_height = 2;
|
||||
|
|
|
@ -1786,12 +1786,8 @@ static int pick_ride_type_for_drawing(int rideType, int trackType)
|
|||
*/
|
||||
void track_paint(uint8 direction, int height, rct_map_element *mapElement)
|
||||
{
|
||||
rct_drawpixelinfo *dpi = unk_140E9A8;
|
||||
rct_ride *ride;
|
||||
int rideIndex, trackType, trackColourScheme, trackSequence;
|
||||
|
||||
rideIndex = mapElement->properties.track.ride_index;
|
||||
ride = get_ride(rideIndex);
|
||||
int rideIndex = mapElement->properties.track.ride_index;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL) {
|
||||
log_error("Attempted to paint invalid ride: %d", rideIndex);
|
||||
return;
|
||||
|
@ -1804,10 +1800,12 @@ void track_paint(uint8 direction, int height, rct_map_element *mapElement)
|
|||
ride->entrance_style = RIDE_ENTRANCE_STYLE_PLAIN;
|
||||
}
|
||||
|
||||
rct_drawpixelinfo *dpi = unk_140E9A8;
|
||||
|
||||
if (!gTrackDesignSaveMode || rideIndex == gTrackDesignSaveRideIndex) {
|
||||
trackType = mapElement->properties.track.type;
|
||||
trackSequence = mapElement->properties.track.sequence & 0x0F;
|
||||
trackColourScheme = mapElement->properties.track.colour & 3;
|
||||
int trackType = mapElement->properties.track.type;
|
||||
int trackSequence = mapElement->properties.track.sequence & 0x0F;
|
||||
int trackColourScheme = mapElement->properties.track.colour & 3;
|
||||
|
||||
if ((gCurrentViewportFlags & VIEWPORT_FLAG_TRACK_HEIGHTS) && dpi->zoom_level == 0) {
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
|
|
@ -822,10 +822,9 @@ static const sint8 paint_monorail_eighth_to_diag_index[] = {0, 1, 2, -1, 3};
|
|||
/** rct2: 0x008AE31C */
|
||||
static void paint_monorail_track_left_eighth_to_diag(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
|
||||
{
|
||||
uint32 imageId;
|
||||
sint8 index = paint_monorail_eighth_to_diag_index[trackSequence];
|
||||
if (index >= 0) {
|
||||
imageId = ghost_train_track_pieces_left_eight_to_diag[direction][index] | gTrackColours[SCHEME_TRACK];
|
||||
uint32 imageId = ghost_train_track_pieces_left_eight_to_diag[direction][index] | gTrackColours[SCHEME_TRACK];
|
||||
const rct_xy16 offset = ghost_train_track_pieces_left_eight_to_diag_offset[direction][index];
|
||||
const rct_xy16 bounds = ghost_train_track_pieces_left_eight_to_diag_bounds[direction][index];
|
||||
sub_98197C(imageId, 0, 0, bounds.x, bounds.y, 2, height, offset.x, offset.y, height, get_current_rotation());
|
||||
|
@ -866,10 +865,9 @@ static void paint_monorail_track_left_eighth_to_diag(uint8 rideIndex, uint8 trac
|
|||
/** rct2: 0x008AE32C */
|
||||
static void paint_monorail_track_right_eighth_to_diag(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
|
||||
{
|
||||
uint32 imageId;
|
||||
sint8 index = paint_monorail_eighth_to_diag_index[trackSequence];
|
||||
if (index >= 0) {
|
||||
imageId = ghost_train_track_pieces_right_eight_to_diag[direction][index] | gTrackColours[SCHEME_TRACK];
|
||||
uint32 imageId = ghost_train_track_pieces_right_eight_to_diag[direction][index] | gTrackColours[SCHEME_TRACK];
|
||||
const rct_xy16 offset = ghost_train_track_pieces_right_eight_to_diag_offset[direction][index];
|
||||
const rct_xy16 bounds = ghost_train_track_pieces_right_eight_to_diag_bounds[direction][index];
|
||||
sub_98197C(imageId, 0, 0, bounds.x, bounds.y, 2, height, offset.x, offset.y, height, get_current_rotation());
|
||||
|
|
|
@ -5647,7 +5647,7 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
uint8 direction = vehicle->sprite_direction | 1;
|
||||
|
||||
if (collideSprite != 0xFFFF) {
|
||||
vehicle->var_34 = scenario_rand() & 1 ? 1 : -1;
|
||||
vehicle->var_34 = (scenario_rand() & 1) ? 1 : -1;
|
||||
|
||||
if (oldVelocity >= 131072) {
|
||||
rct_vehicle* collideVehicle = GET_VEHICLE(collideSprite);
|
||||
|
@ -5656,7 +5656,7 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
vehicle->var_34 = scenario_rand() & 1 ? 6 : -6;
|
||||
vehicle->var_34 = (scenario_rand() & 1) ? 6 : -6;
|
||||
|
||||
if (oldVelocity >= 131072) {
|
||||
vehicle->var_C4 = direction ^ (1 << 4);
|
||||
|
@ -8308,8 +8308,6 @@ loc_6DCA9A:
|
|||
vehicle->track_type = (mapElement->properties.track.type << 2) | (direction & 3);
|
||||
vehicle->var_CF = (mapElement->properties.track.colour >> 4) << 1;
|
||||
|
||||
moveInfo = vehicle_get_move_info(vehicle->var_CD, vehicle->track_type, 0);
|
||||
|
||||
// There are two bytes before the move info list
|
||||
regs.ax = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type);
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ private:
|
|||
highscore->timestamp = fs.ReadValue<datetime64>();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Error reading highscores.");
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Error reading legacy scenario scores file: '%s'", path.c_str());
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ private:
|
|||
fs.WriteValue(highscore->timestamp);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (const Exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to save highscores to '%s'", path.c_str());
|
||||
}
|
||||
|
|
|
@ -636,13 +636,10 @@ unsigned int scenario_rand_max(unsigned int max)
|
|||
*/
|
||||
static void scenario_prepare_rides_for_save()
|
||||
{
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
map_element_iterator it;
|
||||
|
||||
int isFiveCoasterObjective = gScenarioObjectiveType == OBJECTIVE_FINISH_5_ROLLERCOASTERS;
|
||||
|
||||
// Set all existing track to be indestructible
|
||||
map_element_iterator it;
|
||||
map_element_iterator_begin(&it);
|
||||
do {
|
||||
if (map_element_get_type(it.element) == MAP_ELEMENT_TYPE_TRACK) {
|
||||
|
@ -654,6 +651,8 @@ static void scenario_prepare_rides_for_save()
|
|||
} while (map_element_iterator_next(&it));
|
||||
|
||||
// Set all existing rides to have indestructible track
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
if (isFiveCoasterObjective)
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK;
|
||||
|
@ -945,14 +944,13 @@ static void scenario_objective_check_10_rollercoasters_length()
|
|||
|
||||
static void scenario_objective_check_finish_5_rollercoasters()
|
||||
{
|
||||
int i;
|
||||
rct_ride* ride;
|
||||
|
||||
money32 objectiveRideExcitement = gScenarioObjectiveCurrency;
|
||||
|
||||
// ORIGINAL BUG?:
|
||||
// This does not check if the rides are even rollercoasters nevermind the right rollercoasters to be finished.
|
||||
// It also did not exclude null rides.
|
||||
int i;
|
||||
rct_ride* ride;
|
||||
int rcs = 0;
|
||||
FOR_ALL_RIDES(i, ride)
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->excitement >= objectiveRideExcitement)
|
||||
|
|
|
@ -46,7 +46,7 @@ uint32 sawyercoding_calculate_checksum(const uint8* buffer, size_t length)
|
|||
*/
|
||||
int sawyercoding_validate_checksum(SDL_RWops* rw)
|
||||
{
|
||||
size_t i, dataSize, bufferSize;
|
||||
size_t i, dataSize;
|
||||
uint32 checksum, fileChecksum;
|
||||
uint8 buffer[1024];
|
||||
|
||||
|
@ -62,7 +62,7 @@ int sawyercoding_validate_checksum(SDL_RWops* rw)
|
|||
SDL_RWseek(rw, 0, RW_SEEK_SET);
|
||||
checksum = 0;
|
||||
do {
|
||||
bufferSize = min(dataSize, 1024);
|
||||
size_t bufferSize = min(dataSize, 1024);
|
||||
if (SDL_RWread(rw, buffer, bufferSize, 1) != 1)
|
||||
return 0;
|
||||
|
||||
|
@ -232,20 +232,17 @@ size_t sawyercoding_decode_sv4(const uint8 *src, uint8 *dst, size_t length, size
|
|||
|
||||
size_t sawyercoding_decode_sc4(const uint8 *src, uint8 *dst, size_t length, size_t bufferLength)
|
||||
{
|
||||
size_t decodedLength, i;
|
||||
uint32 *code;
|
||||
|
||||
// Uncompress
|
||||
decodedLength = decode_chunk_rle_with_size(src, dst, length - 4, bufferLength);
|
||||
size_t decodedLength = decode_chunk_rle_with_size(src, dst, length - 4, bufferLength);
|
||||
|
||||
// Decode
|
||||
for (i = 0x60018; i <= min(decodedLength - 1, 0x1F8353); i++)
|
||||
for (size_t i = 0x60018; i <= min(decodedLength - 1, 0x1F8353); i++)
|
||||
dst[i] = dst[i] ^ 0x9C;
|
||||
|
||||
for (i = 0x60018; i <= min(decodedLength - 1, 0x1F8350); i += 4) {
|
||||
for (size_t i = 0x60018; i <= min(decodedLength - 1, 0x1F8350); i += 4) {
|
||||
dst[i + 1] = ror8(dst[i + 1], 3);
|
||||
|
||||
code = (uint32*)&dst[i];
|
||||
uint32 *code = (uint32*)&dst[i];
|
||||
*code = rol32(*code, 9);
|
||||
}
|
||||
|
||||
|
@ -470,14 +467,10 @@ static size_t encode_chunk_rle(const uint8 *src_buffer, uint8 *dst_buffer, size_
|
|||
|
||||
static size_t encode_chunk_repeat(const uint8 *src_buffer, uint8 *dst_buffer, size_t length)
|
||||
{
|
||||
size_t i, j, outLength;
|
||||
size_t searchIndex, searchEnd, maxRepeatCount;
|
||||
size_t bestRepeatIndex = 0, bestRepeatCount = 0, repeatIndex, repeatCount;
|
||||
|
||||
if (length == 0)
|
||||
return 0;
|
||||
|
||||
outLength = 0;
|
||||
size_t outLength = 0;
|
||||
|
||||
// Need to emit at least one byte, otherwise there is nothing to repeat
|
||||
*dst_buffer++ = 255;
|
||||
|
@ -485,18 +478,19 @@ static size_t encode_chunk_repeat(const uint8 *src_buffer, uint8 *dst_buffer, si
|
|||
outLength += 2;
|
||||
|
||||
// Iterate through remainder of the source buffer
|
||||
for (i = 1; i < length; ) {
|
||||
searchIndex = (i < 32) ? 0 : (i - 32);
|
||||
searchEnd = i - 1;
|
||||
for (size_t i = 1; i < length; ) {
|
||||
size_t searchIndex = (i < 32) ? 0 : (i - 32);
|
||||
size_t searchEnd = i - 1;
|
||||
|
||||
bestRepeatCount = 0;
|
||||
for (repeatIndex = searchIndex; repeatIndex <= searchEnd; repeatIndex++) {
|
||||
repeatCount = 0;
|
||||
maxRepeatCount = min(min(7, searchEnd - repeatIndex), length - i - 1);
|
||||
size_t bestRepeatIndex = 0;
|
||||
size_t bestRepeatCount = 0;
|
||||
for (size_t repeatIndex = searchIndex; repeatIndex <= searchEnd; repeatIndex++) {
|
||||
size_t repeatCount = 0;
|
||||
size_t maxRepeatCount = min(min(7, searchEnd - repeatIndex), length - i - 1);
|
||||
// maxRepeatCount should not exceed length
|
||||
assert(repeatIndex + maxRepeatCount < length);
|
||||
assert(i + maxRepeatCount < length);
|
||||
for (j = 0; j <= maxRepeatCount; j++) {
|
||||
for (size_t j = 0; j <= maxRepeatCount; j++) {
|
||||
if (src_buffer[repeatIndex + j] == src_buffer[i + j]) {
|
||||
repeatCount++;
|
||||
} else {
|
||||
|
|
|
@ -410,7 +410,7 @@ char *safe_strcat_path(char *destination, const char *source, size_t size)
|
|||
|
||||
char *safe_strtrimleft(char *destination, const char *source, size_t size)
|
||||
{
|
||||
while (*source == ' ' && *source != '\0') {
|
||||
while (*source == ' ') {
|
||||
source++;
|
||||
}
|
||||
return safe_strcpy(destination, source, size);
|
||||
|
|
|
@ -212,7 +212,12 @@ static bool window_changelog_read_file()
|
|||
log_error("Unable to read changelog.txt");
|
||||
return false;
|
||||
}
|
||||
_changelogText = realloc(_changelogText, _changelogTextSize + 1);
|
||||
void* new_memory = realloc(_changelogText, _changelogTextSize + 1);
|
||||
if (new_memory == NULL) {
|
||||
log_error("Failed to reallocate memory for changelog text");
|
||||
return false;
|
||||
}
|
||||
_changelogText = (char*)new_memory;
|
||||
_changelogText[_changelogTextSize++] = 0;
|
||||
|
||||
char *start = _changelogText;
|
||||
|
@ -232,7 +237,12 @@ static bool window_changelog_read_file()
|
|||
_changelogNumLines++;
|
||||
if (_changelogNumLines > changelogLinesCapacity) {
|
||||
changelogLinesCapacity *= 2;
|
||||
_changelogLines = realloc(_changelogLines, changelogLinesCapacity * sizeof(char*));
|
||||
new_memory = realloc(_changelogLines, changelogLinesCapacity * sizeof(char*));
|
||||
if (new_memory == NULL) {
|
||||
log_error("Failed to reallocate memory for change log lines");
|
||||
return false;
|
||||
}
|
||||
_changelogLines = (char**)new_memory;
|
||||
}
|
||||
_changelogLines[_changelogNumLines - 1] = ch;
|
||||
} else if (c < 32 || c > 122) {
|
||||
|
@ -243,7 +253,12 @@ static bool window_changelog_read_file()
|
|||
}
|
||||
}
|
||||
|
||||
_changelogLines = realloc(_changelogLines, _changelogNumLines * sizeof(char*));
|
||||
new_memory = realloc(_changelogLines, _changelogNumLines * sizeof(char*));
|
||||
if (new_memory == NULL) {
|
||||
log_error("Failed to reallocate memory for change log lines");
|
||||
return false;
|
||||
}
|
||||
_changelogLines = (char**)new_memory;
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
_changelogLongestLineWidth = 0;
|
||||
|
|
|
@ -819,8 +819,7 @@ static void window_cheats_invalidate(rct_window *w)
|
|||
widget_set_checkbox_value(w, WIDX_DISABLE_LITTERING, gCheatsDisableLittering);
|
||||
break;
|
||||
case WINDOW_CHEATS_PAGE_MISC:
|
||||
w->widgets[WIDX_OPEN_CLOSE_PARK].text = gParkFlags & PARK_FLAGS_PARK_OPEN ?
|
||||
STR_CHEAT_CLOSE_PARK : STR_CHEAT_OPEN_PARK;
|
||||
w->widgets[WIDX_OPEN_CLOSE_PARK].text = (gParkFlags & PARK_FLAGS_PARK_OPEN) ? STR_CHEAT_CLOSE_PARK : STR_CHEAT_OPEN_PARK;
|
||||
widget_set_checkbox_value(w, WIDX_UNLOCK_ALL_PRICES, gCheatsUnlockAllPrices);
|
||||
widget_set_checkbox_value(w, WIDX_FORCE_PARK_RATING, get_forced_park_rating() >= 0);
|
||||
w->widgets[WIDX_SANDBOX_MODE].text = gCheatsSandboxMode ? STR_CHEAT_SANDBOX_MODE_DISABLE : STR_CHEAT_SANDBOX_MODE;
|
||||
|
|
|
@ -316,18 +316,15 @@ static void research_remove_flags()
|
|||
*/
|
||||
static rct_string_id research_item_get_name(uint32 researchItem)
|
||||
{
|
||||
rct_ride_entry *rideEntry;
|
||||
rct_scenery_set_entry *sceneryEntry;
|
||||
|
||||
if (researchItem < 0x10000) {
|
||||
sceneryEntry = get_scenery_group_entry(researchItem & 0xFF);
|
||||
rct_scenery_set_entry *sceneryEntry = get_scenery_group_entry(researchItem & 0xFF);
|
||||
if (sceneryEntry == NULL || sceneryEntry == (rct_scenery_set_entry*)-1)
|
||||
return 0;
|
||||
|
||||
return sceneryEntry->name;
|
||||
}
|
||||
|
||||
rideEntry = get_ride_entry(researchItem & 0xFF);
|
||||
rct_ride_entry *rideEntry = get_ride_entry(researchItem & 0xFF);
|
||||
if (rideEntry == NULL || rideEntry == (rct_ride_entry*)-1)
|
||||
return 0;
|
||||
|
||||
|
@ -344,7 +341,7 @@ static rct_string_id research_item_get_name(uint32 researchItem)
|
|||
static void research_items_shuffle()
|
||||
{
|
||||
rct_research_item *researchItem, *researchOrderBase, researchItemTemp;
|
||||
int i, ri, numNonResearchedItems;
|
||||
int i, numNonResearchedItems;
|
||||
|
||||
// Skip pre-researched items
|
||||
for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) {}
|
||||
|
@ -358,7 +355,7 @@ static void research_items_shuffle()
|
|||
|
||||
// Shuffle list
|
||||
for (i = 0; i < numNonResearchedItems; i++) {
|
||||
ri = util_rand() % numNonResearchedItems;
|
||||
int ri = util_rand() % numNonResearchedItems;
|
||||
if (ri == i)
|
||||
continue;
|
||||
|
||||
|
@ -503,22 +500,18 @@ static rct_research_item *window_editor_inventions_list_get_item_from_scroll_y_i
|
|||
|
||||
static rct_research_item *get_research_item_at(int x, int y)
|
||||
{
|
||||
rct_window *w;
|
||||
rct_widget *widget;
|
||||
int scrollY, outX, outY, outScrollArea, outScrollId;
|
||||
short widgetIndex;
|
||||
|
||||
w = window_find_by_class(WC_EDITOR_INVENTION_LIST);
|
||||
rct_window *w = window_find_by_class(WC_EDITOR_INVENTION_LIST);
|
||||
if (w != NULL && w->x <= x && w->y < y && w->x + w->width > x && w->y + w->height > y) {
|
||||
widgetIndex = window_find_widget_from_point(w, x, y);
|
||||
widget = &w->widgets[widgetIndex];
|
||||
short widgetIndex = window_find_widget_from_point(w, x, y);
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL) {
|
||||
gPressedWidget.widget_index = widgetIndex;
|
||||
int outX, outY, outScrollArea, outScrollId;
|
||||
widget_scroll_get_part(w, widget, x, y, &outX, &outY, &outScrollArea, &outScrollId);
|
||||
if (outScrollArea == SCROLL_PART_VIEW) {
|
||||
outScrollId = outScrollId == 0 ? 0 : 1;
|
||||
|
||||
scrollY = y - (w->y + widget->top) + w->scrolls[outScrollId].v_top + 5;
|
||||
int scrollY = y - (w->y + widget->top) + w->scrolls[outScrollId].v_top + 5;
|
||||
return window_editor_inventions_list_get_item_from_scroll_y_include_seps(outScrollId, scrollY);
|
||||
}
|
||||
}
|
||||
|
@ -951,12 +944,9 @@ static void window_editor_inventions_list_drag_open(rct_research_item *researchI
|
|||
*/
|
||||
static void window_editor_inventions_list_drag_cursor(rct_window *w, int widgetIndex, int x, int y, int *cursorId)
|
||||
{
|
||||
rct_window *inventionListWindow;
|
||||
rct_research_item *researchItem;
|
||||
|
||||
inventionListWindow = window_find_by_class(WC_EDITOR_INVENTION_LIST);
|
||||
rct_window *inventionListWindow = window_find_by_class(WC_EDITOR_INVENTION_LIST);
|
||||
if (inventionListWindow != NULL) {
|
||||
researchItem = get_research_item_at(x, y);
|
||||
rct_research_item *researchItem = get_research_item_at(x, y);
|
||||
if (researchItem != inventionListWindow->research_item) {
|
||||
inventionListWindow = (rct_window *)researchItem;
|
||||
window_invalidate(inventionListWindow);
|
||||
|
|
|
@ -388,7 +388,12 @@ static void visible_list_refresh(rct_window *w)
|
|||
}
|
||||
}
|
||||
|
||||
_listItems = realloc(_listItems, _numListItems * sizeof(list_item));
|
||||
void *new_memory = realloc(_listItems, _numListItems * sizeof(list_item));
|
||||
if (new_memory == NULL) {
|
||||
log_error("Unable to reallocate list items");
|
||||
return;
|
||||
}
|
||||
_listItems = (list_item*)new_memory;
|
||||
|
||||
sortFunc sortFunc = NULL;
|
||||
switch (_listSortType) {
|
||||
|
@ -1009,7 +1014,7 @@ static void window_editor_object_selection_scroll_mousedown(rct_window *w, int s
|
|||
|
||||
_maxObjectsWasHit = false;
|
||||
if (!window_editor_object_selection_select_object(0, ebx, listItem->entry)) {
|
||||
rct_string_id error_title = ebx & 1 ?
|
||||
rct_string_id error_title = (ebx & 1) ?
|
||||
STR_UNABLE_TO_SELECT_THIS_OBJECT :
|
||||
STR_UNABLE_TO_DE_SELECT_THIS_OBJECT;
|
||||
|
||||
|
@ -1092,9 +1097,6 @@ static void window_editor_object_selection_tooltip(rct_window* w, int widgetInde
|
|||
*/
|
||||
static void window_editor_object_selection_invalidate(rct_window *w)
|
||||
{
|
||||
int i, x;
|
||||
rct_widget *widget;
|
||||
|
||||
colour_scheme_update(w);
|
||||
|
||||
// Resize widgets
|
||||
|
@ -1138,9 +1140,9 @@ static void window_editor_object_selection_invalidate(rct_window *w)
|
|||
}
|
||||
|
||||
// Align tabs, hide advanced ones
|
||||
x = 3;
|
||||
for (i = 0; i < WINDOW_OBJECT_SELECTION_PAGE_COUNT; i++) {
|
||||
widget = &w->widgets[WIDX_TAB_1 + i];
|
||||
int x = 3;
|
||||
for (int i = 0; i < WINDOW_OBJECT_SELECTION_PAGE_COUNT; i++) {
|
||||
rct_widget *widget = &w->widgets[WIDX_TAB_1 + i];
|
||||
|
||||
if (!(w->list_information_type & 1) && ((1 << i) & 0x5E)) {
|
||||
widget->type = WWT_EMPTY;
|
||||
|
@ -1154,7 +1156,7 @@ static void window_editor_object_selection_invalidate(rct_window *w)
|
|||
|
||||
if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TRACK_DESIGNER)) {
|
||||
w->widgets[WIDX_ADVANCED].type = WWT_EMPTY;
|
||||
for (i = 1; i < WINDOW_OBJECT_SELECTION_PAGE_COUNT; i++)
|
||||
for (int i = 1; i < WINDOW_OBJECT_SELECTION_PAGE_COUNT; i++)
|
||||
w->widgets[WIDX_TAB_1 + i].type = WWT_EMPTY;
|
||||
x = 150;
|
||||
} else {
|
||||
|
@ -1182,7 +1184,7 @@ static void window_editor_object_selection_invalidate(rct_window *w)
|
|||
w->enabled_widgets |= (1 << WIDX_FILTER_RIDE_TAB_ALL) | (1 << WIDX_FILTER_RIDE_TAB_TRANSPORT) |
|
||||
(1 << WIDX_FILTER_RIDE_TAB_GENTLE) | (1 << WIDX_FILTER_RIDE_TAB_COASTER) | (1 << WIDX_FILTER_RIDE_TAB_THRILL) |
|
||||
(1 << WIDX_FILTER_RIDE_TAB_WATER) | (1 << WIDX_FILTER_RIDE_TAB_STALL);
|
||||
for (i = 0; i < 7; i++)
|
||||
for (int i = 0; i < 7; i++)
|
||||
w->pressed_widgets &= ~(1 << (WIDX_FILTER_RIDE_TAB_ALL + i));
|
||||
if ((_filter_flags & 0x7E0) == 0x7E0)
|
||||
w->pressed_widgets |= (1 << WIDX_FILTER_RIDE_TAB_ALL);
|
||||
|
@ -1222,7 +1224,7 @@ static void window_editor_object_selection_invalidate(rct_window *w)
|
|||
*/
|
||||
static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
int i, x, y, width, numSelected, totalSelectable, type;
|
||||
int i, x, y, width, type;
|
||||
rct_widget *widget;
|
||||
rct_object_entry *highlightedEntry;
|
||||
rct_string_id stringId;
|
||||
|
@ -1294,8 +1296,8 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf
|
|||
x = w->x + 3;
|
||||
y = w->y + w->height - 13;
|
||||
|
||||
numSelected = _numSelectedObjectsForType[w->selected_tab];
|
||||
totalSelectable = object_entry_group_counts[w->selected_tab];
|
||||
int numSelected = _numSelectedObjectsForType[w->selected_tab];
|
||||
int totalSelectable = object_entry_group_counts[w->selected_tab];
|
||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
totalSelectable = 4;
|
||||
|
||||
|
|
|
@ -878,7 +878,7 @@ static void window_editor_objective_options_main_invalidate(rct_window *w)
|
|||
}
|
||||
|
||||
window_editor_objective_options_main_widgets[WIDX_CLOSE].type =
|
||||
gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
|
||||
window_editor_objective_options_anchor_border_widgets(w);
|
||||
}
|
||||
|
@ -1168,8 +1168,7 @@ static void window_editor_objective_options_rides_invalidate(rct_window *w)
|
|||
|
||||
window_editor_objective_options_set_pressed_tab(w);
|
||||
|
||||
window_editor_objective_options_main_widgets[WIDX_CLOSE].type =
|
||||
gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
window_editor_objective_options_main_widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
|
||||
window_editor_objective_options_anchor_border_widgets(w);
|
||||
}
|
||||
|
@ -1192,15 +1191,14 @@ static void window_editor_objective_options_rides_paint(rct_window *w, rct_drawp
|
|||
*/
|
||||
static void window_editor_objective_options_rides_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
|
||||
{
|
||||
int i, y, colour;
|
||||
rct_string_id stringId;
|
||||
rct_ride *ride;
|
||||
|
||||
colour = ColourMapA[w->colours[1]].mid_light;
|
||||
int colour = ColourMapA[w->colours[1]].mid_light;
|
||||
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, colour);
|
||||
|
||||
for (i = 0; i < w->no_list_items; i++) {
|
||||
y = i * 12;
|
||||
for (int i = 0; i < w->no_list_items; i++) {
|
||||
int y = i * 12;
|
||||
|
||||
if (y + 12 < dpi->y || y >= dpi->y + dpi->height)
|
||||
continue;
|
||||
|
|
|
@ -580,12 +580,9 @@ static void window_editor_scenario_options_financial_update(rct_window *w)
|
|||
*/
|
||||
static void window_editor_scenario_options_financial_invalidate(rct_window *w)
|
||||
{
|
||||
rct_widget *widgets;
|
||||
int i;
|
||||
|
||||
colour_scheme_update(w);
|
||||
|
||||
widgets = window_editor_scenario_options_widgets[w->page];
|
||||
rct_widget *widgets = window_editor_scenario_options_widgets[w->page];
|
||||
if (w->widgets != widgets) {
|
||||
w->widgets = widgets;
|
||||
window_init_scroll_widgets(w);
|
||||
|
@ -596,7 +593,7 @@ static void window_editor_scenario_options_financial_invalidate(rct_window *w)
|
|||
if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO)) ||
|
||||
(!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY))) {
|
||||
w->pressed_widgets |= (1 << WIDX_NO_MONEY);
|
||||
for (i = WIDX_INITIAL_CASH; i <= WIDX_FORBID_MARKETING; i++)
|
||||
for (int i = WIDX_INITIAL_CASH; i <= WIDX_FORBID_MARKETING; i++)
|
||||
w->widgets[i].type = WWT_EMPTY;
|
||||
} else {
|
||||
w->pressed_widgets &= ~(1 << WIDX_NO_MONEY);
|
||||
|
@ -620,8 +617,7 @@ static void window_editor_scenario_options_financial_invalidate(rct_window *w)
|
|||
else
|
||||
w->pressed_widgets &= ~(1 << WIDX_FORBID_MARKETING);
|
||||
|
||||
w->widgets[WIDX_CLOSE].type =
|
||||
gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
w->widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
|
||||
window_editor_scenario_options_anchor_border_widgets(w);
|
||||
}
|
||||
|
@ -845,8 +841,7 @@ static void window_editor_scenario_options_guests_invalidate(rct_window *w)
|
|||
else
|
||||
w->pressed_widgets &= ~(1 << WIDX_GUEST_PREFER_MORE_INTENSE_RIDES);
|
||||
|
||||
w->widgets[WIDX_CLOSE].type =
|
||||
gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
w->widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
|
||||
window_editor_scenario_options_anchor_border_widgets(w);
|
||||
}
|
||||
|
@ -1094,13 +1089,11 @@ static void window_editor_scenario_options_park_update(rct_window *w)
|
|||
*/
|
||||
static void window_editor_scenario_options_park_invalidate(rct_window *w)
|
||||
{
|
||||
rct_widget *widgets;
|
||||
int i;
|
||||
uint64 pressedWidgets;
|
||||
|
||||
colour_scheme_update(w);
|
||||
|
||||
widgets = window_editor_scenario_options_widgets[w->page];
|
||||
rct_widget *widgets = window_editor_scenario_options_widgets[w->page];
|
||||
if (w->widgets != widgets) {
|
||||
w->widgets = widgets;
|
||||
window_init_scroll_widgets(w);
|
||||
|
@ -1110,7 +1103,7 @@ static void window_editor_scenario_options_park_invalidate(rct_window *w)
|
|||
|
||||
if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO)) ||
|
||||
(!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && (gParkFlags & PARK_FLAGS_NO_MONEY))) {
|
||||
for (i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++)
|
||||
for (int i = WIDX_LAND_COST; i <= WIDX_ENTRY_PRICE_DECREASE; i++)
|
||||
w->widgets[i].type = WWT_EMPTY;
|
||||
} else {
|
||||
w->widgets[WIDX_LAND_COST].type = WWT_SPINNER;
|
||||
|
@ -1154,8 +1147,7 @@ static void window_editor_scenario_options_park_invalidate(rct_window *w)
|
|||
|
||||
w->pressed_widgets = pressedWidgets;
|
||||
|
||||
w->widgets[WIDX_CLOSE].type =
|
||||
gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
w->widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WWT_EMPTY : WWT_CLOSEBOX;
|
||||
|
||||
window_editor_scenario_options_anchor_border_widgets(w);
|
||||
}
|
||||
|
|
|
@ -373,9 +373,6 @@ static void window_footpath_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||
*/
|
||||
static void window_footpath_dropdown(rct_window *w, int widgetIndex, int dropdownIndex)
|
||||
{
|
||||
int i, j, pathId;
|
||||
rct_footpath_entry *pathType;
|
||||
|
||||
if (widgetIndex == WIDX_FOOTPATH_TYPE)
|
||||
gFootpathSelectedType = SELECTED_PATH_TYPE_NORMAL;
|
||||
else if (widgetIndex == WIDX_QUEUELINE_TYPE)
|
||||
|
@ -384,7 +381,7 @@ static void window_footpath_dropdown(rct_window *w, int widgetIndex, int dropdow
|
|||
return;
|
||||
|
||||
// Get path id
|
||||
pathId = dropdownIndex;
|
||||
int pathId = dropdownIndex;
|
||||
if (pathId == -1) {
|
||||
pathId = gFootpathSelectedId;
|
||||
} else {
|
||||
|
@ -392,9 +389,9 @@ static void window_footpath_dropdown(rct_window *w, int widgetIndex, int dropdow
|
|||
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode)
|
||||
flags = 0;
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < 16; i++) {
|
||||
pathType = get_footpath_entry(i);
|
||||
int i = 0, j = 0;
|
||||
for (; i < 16; i++) {
|
||||
rct_footpath_entry *pathType = get_footpath_entry(i);
|
||||
if (pathType == (rct_footpath_entry*)-1)
|
||||
continue;
|
||||
if (pathType->flags & flags)
|
||||
|
@ -589,9 +586,6 @@ static void window_footpath_invalidate(rct_window *w)
|
|||
*/
|
||||
static void window_footpath_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
int x, y, image, selectedPath;
|
||||
rct_footpath_entry *pathType;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
|
||||
if (!(w->disabled_widgets & (1 << WIDX_CONSTRUCT))) {
|
||||
|
@ -602,17 +596,17 @@ static void window_footpath_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
slope = 1;
|
||||
else if (gFootpathConstructSlope == 6)
|
||||
slope = 2;
|
||||
image = footpath_construction_preview_images[slope][direction];
|
||||
int image = footpath_construction_preview_images[slope][direction];
|
||||
|
||||
selectedPath = gFootpathSelectedId;
|
||||
pathType = get_footpath_entry(selectedPath);
|
||||
int selectedPath = gFootpathSelectedId;
|
||||
rct_footpath_entry *pathType = get_footpath_entry(selectedPath);
|
||||
image += pathType->image;
|
||||
if (gFootpathSelectedType != SELECTED_PATH_TYPE_NORMAL)
|
||||
image += 51;
|
||||
|
||||
// Draw construction image
|
||||
x = w->x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
|
||||
y = w->y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60;
|
||||
int x = w->x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
|
||||
int y = w->y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60;
|
||||
gfx_draw_sprite(dpi, image, x, y, 0);
|
||||
|
||||
// Draw build this... label
|
||||
|
@ -622,8 +616,8 @@ static void window_footpath_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
}
|
||||
|
||||
// Draw cost
|
||||
x = w->x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
|
||||
y = w->y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12;
|
||||
int x = w->x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
|
||||
int y = w->y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12;
|
||||
if (_window_footpath_cost != MONEY32_UNDEFINED)
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
gfx_draw_string_centred(dpi, STR_COST_LABEL, x, y, COLOUR_BLACK, &_window_footpath_cost);
|
||||
|
@ -701,12 +695,11 @@ static void window_footpath_mousedown_slope(int slope)
|
|||
*/
|
||||
static void window_footpath_set_provisional_path_at_point(int x, int y)
|
||||
{
|
||||
int slope, pathType, interactionType;
|
||||
rct_map_element *mapElement;
|
||||
|
||||
map_invalidate_selection_rect();
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
|
||||
int interactionType;
|
||||
rct_map_element *mapElement;
|
||||
rct_xy16 mapCoord = { 0 };
|
||||
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, NULL);
|
||||
x = mapCoord.x;
|
||||
|
@ -737,10 +730,10 @@ static void window_footpath_set_provisional_path_at_point(int x, int y)
|
|||
footpath_provisional_update();
|
||||
|
||||
// Set provisional path
|
||||
slope = default_path_slope[mapElement->properties.surface.slope & 0x1F];
|
||||
int slope = default_path_slope[mapElement->properties.surface.slope & 0x1F];
|
||||
if (interactionType == VIEWPORT_INTERACTION_ITEM_FOOTPATH)
|
||||
slope = mapElement->properties.surface.slope & 7;
|
||||
pathType = (gFootpathSelectedType << 7) + (gFootpathSelectedId & 0xFF);
|
||||
int pathType = (gFootpathSelectedType << 7) + (gFootpathSelectedId & 0xFF);
|
||||
|
||||
_window_footpath_cost = footpath_provisional_set(pathType, x, y, mapElement->base_height, slope);
|
||||
window_invalidate_by_class(WC_FOOTPATH);
|
||||
|
@ -901,7 +894,7 @@ static void window_footpath_construct()
|
|||
if (cost != MONEY32_UNDEFINED) {
|
||||
// It is possible, let's remove walls between the old and new piece of path
|
||||
uint8 direction = gFootpathConstructDirection;
|
||||
map_remove_intersecting_walls(x, y, z, z + 4 + (slope & 0xf ? 2 : 0), direction ^ 2);
|
||||
map_remove_intersecting_walls(x, y, z, z + 4 + ((slope & 0xf) ? 2 : 0), direction ^ 2);
|
||||
map_remove_intersecting_walls(
|
||||
x - TileDirectionDelta[direction].x,
|
||||
y - TileDirectionDelta[direction].y,
|
||||
|
@ -1058,11 +1051,7 @@ static void window_footpath_remove()
|
|||
*/
|
||||
static void window_footpath_set_enabled_and_pressed_widgets()
|
||||
{
|
||||
rct_window *w;
|
||||
uint64 pressedWidgets, disabledWidgets;
|
||||
int currentRotation, direction, slope;
|
||||
|
||||
w = window_find_by_class(WC_FOOTPATH);
|
||||
rct_window *w = window_find_by_class(WC_FOOTPATH);
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1071,23 +1060,23 @@ static void window_footpath_set_enabled_and_pressed_widgets()
|
|||
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
gMapSelectFlags |= MAP_SELECT_FLAG_GREEN;
|
||||
|
||||
direction = gFootpathConstructDirection;
|
||||
int direction = gFootpathConstructDirection;
|
||||
gMapSelectionTiles[0].x = gFootpathConstructFromPosition.x + TileDirectionDelta[direction].x;
|
||||
gMapSelectionTiles[0].y = gFootpathConstructFromPosition.y + TileDirectionDelta[direction].y;
|
||||
gMapSelectionTiles[1].x = -1;
|
||||
map_invalidate_map_selection_tiles();
|
||||
}
|
||||
|
||||
pressedWidgets = w->pressed_widgets & 0xFFFF887F;
|
||||
disabledWidgets = 0;
|
||||
currentRotation = get_current_rotation();
|
||||
uint64 pressedWidgets = w->pressed_widgets & 0xFFFF887F;
|
||||
uint64 disabledWidgets = 0;
|
||||
int currentRotation = get_current_rotation();
|
||||
if (gFootpathConstructionMode >= PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) {
|
||||
// Set pressed directional widget
|
||||
direction = (gFootpathConstructDirection + currentRotation) & 3;
|
||||
int direction = (gFootpathConstructDirection + currentRotation) & 3;
|
||||
pressedWidgets |= (1LL << (WIDX_DIRECTION_NW + direction));
|
||||
|
||||
// Set pressed slope widget
|
||||
slope = gFootpathConstructSlope;
|
||||
int slope = gFootpathConstructSlope;
|
||||
if (slope == 6)
|
||||
pressedWidgets |= (1 << WIDX_SLOPEDOWN);
|
||||
else if (slope == 0)
|
||||
|
|
|
@ -164,7 +164,6 @@ void window_game_bottom_toolbar_open()
|
|||
*/
|
||||
static void window_game_bottom_toolbar_mouseup(rct_window *w, int widgetIndex)
|
||||
{
|
||||
rct_window *mainWindow;
|
||||
rct_news_item *newsItem;
|
||||
|
||||
switch (widgetIndex) {
|
||||
|
@ -200,7 +199,8 @@ static void window_game_bottom_toolbar_mouseup(rct_window *w, int widgetIndex)
|
|||
if (x == SPRITE_LOCATION_NULL)
|
||||
break;
|
||||
|
||||
if ((mainWindow = window_get_main()) != NULL)
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL)
|
||||
window_scroll_to_location(mainWindow, x, y, z);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -970,10 +970,9 @@ static void window_guest_list_find_groups()
|
|||
int argument_1 = _window_guest_list_groups_argument_1[groupIndex];
|
||||
int argument_2 = _window_guest_list_groups_argument_2[groupIndex];
|
||||
int bl = _window_guest_list_group_index[groupIndex];
|
||||
int temp;
|
||||
|
||||
do {
|
||||
temp = curr_num_guests;
|
||||
int temp = curr_num_guests;
|
||||
curr_num_guests = _window_guest_list_groups_num_guests[swap_position];
|
||||
_window_guest_list_groups_num_guests[swap_position] = temp;
|
||||
|
||||
|
|
|
@ -350,7 +350,6 @@ static void window_install_track_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
|
||||
if (td6->cost != 0) {
|
||||
gfx_draw_string_left(dpi, STR_TRACK_LIST_COST_AROUND, &td6->cost, COLOUR_BLACK, x, y);
|
||||
y += 14;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,6 @@ static void window_land_rights_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
if (gLandToolSize > 7) {
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
|
||||
}
|
||||
y = w->y + window_land_rights_widgets[WIDX_PREVIEW].bottom + 5;
|
||||
|
||||
// Draw cost amount
|
||||
x = (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
|
|
|
@ -492,20 +492,17 @@ static void window_loadsave_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
|
||||
static void window_loadsave_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
|
||||
{
|
||||
int i, y;
|
||||
rct_string_id stringId;
|
||||
|
||||
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ColourMapA[w->colours[1]].mid_light);
|
||||
|
||||
for (i = 0; i < w->no_list_items; i++) {
|
||||
y = i * 10;
|
||||
for (int i = 0; i < w->no_list_items; i++) {
|
||||
int y = i * 10;
|
||||
if (y > dpi->y + dpi->height)
|
||||
break;
|
||||
|
||||
if (y + 10 < dpi->y)
|
||||
continue;
|
||||
|
||||
stringId = STR_BLACK_STRING;
|
||||
rct_string_id stringId = STR_BLACK_STRING;
|
||||
if (i == w->selected_list_item) {
|
||||
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
gfx_filter_rect(dpi, 0, y, 800, y + 9, PALETTE_DARKEN_1);
|
||||
|
@ -574,7 +571,12 @@ static void window_loadsave_populate_list(rct_window *w, int includeNewItem, con
|
|||
for (int x = 0; x < 26; x++){
|
||||
if (listItemCapacity <= _listItemsCount) {
|
||||
listItemCapacity *= 2;
|
||||
_listItems = realloc(_listItems, listItemCapacity * sizeof(loadsave_list_item));
|
||||
void *new_memory = realloc(_listItems, listItemCapacity * sizeof(loadsave_list_item));
|
||||
if (new_memory == NULL) {
|
||||
log_error("Failed to reallocate memory for loadsave list");
|
||||
return;
|
||||
}
|
||||
_listItems = (loadsave_list_item*)new_memory;
|
||||
}
|
||||
|
||||
if (drives & (1 << x)){
|
||||
|
|
|
@ -813,13 +813,11 @@ static void window_map_invalidate(rct_window *w)
|
|||
*/
|
||||
static void window_map_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
int i, x, y;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
window_map_draw_tab_images(w, dpi);
|
||||
|
||||
x = w->x + (window_map_widgets[WIDX_LAND_TOOL].left + window_map_widgets[WIDX_LAND_TOOL].right) / 2;
|
||||
y = w->y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2;
|
||||
int x = w->x + (window_map_widgets[WIDX_LAND_TOOL].left + window_map_widgets[WIDX_LAND_TOOL].right) / 2;
|
||||
int y = w->y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2;
|
||||
|
||||
// Draw land tool size
|
||||
if (widget_is_active_tool(w, WIDX_SET_LAND_RIGHTS) && gLandToolSize > 7) {
|
||||
|
@ -851,7 +849,7 @@ static void window_map_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
STR_MAP_TOILET,
|
||||
};
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
gfx_fill_rect(dpi, x, y + 2, x + 6, y + 8, RideKeyColours[i]);
|
||||
gfx_draw_string_left(dpi, mapLabels[i], w, COLOUR_BLACK, x + 10, y);
|
||||
y += 10;
|
||||
|
|
|
@ -882,11 +882,10 @@ static void window_multiplayer_groups_scrollpaint(rct_window *w, rct_drawpixelin
|
|||
|
||||
if (y + 11 >= dpi->y) {
|
||||
char buffer[300] = {0};
|
||||
char* lineCh;
|
||||
int groupindex = network_get_group_index(_selectedGroup);
|
||||
if (groupindex != -1){
|
||||
if (network_can_perform_action(groupindex, i)) {
|
||||
lineCh = buffer;
|
||||
char* lineCh = buffer;
|
||||
lineCh = utf8_write_codepoint(lineCh, FORMAT_WINDOW_COLOUR_2);
|
||||
lineCh = utf8_write_codepoint(lineCh, FORMAT_TICK);
|
||||
gfx_draw_string(dpi, buffer, COLOUR_BLACK, 0, y - 1);
|
||||
|
|
|
@ -441,16 +441,12 @@ rct_window *window_new_ride_open()
|
|||
(1 << 14) |
|
||||
(1 << 15);
|
||||
window_init_scroll_widgets(w);
|
||||
|
||||
w->frame_no = 0;
|
||||
|
||||
w->new_ride.selected_ride_id = -1;
|
||||
w->new_ride.highlighted_ride_id = -1;
|
||||
_lastTrackDesignCountRideType.type = 255;
|
||||
_lastTrackDesignCountRideType.entry_index = 255;
|
||||
|
||||
window_new_ride_populate_list();
|
||||
|
||||
w->frame_no = 0;
|
||||
w->new_ride.selected_ride_id = -1;
|
||||
_lastTrackDesignCountRideType.type = 255;
|
||||
_lastTrackDesignCountRideType.entry_index = 255;
|
||||
w->new_ride.highlighted_ride_id = _windowNewRideHighlightedItem[_windowNewRideCurrentTab].ride_type_and_entry;
|
||||
if (w->new_ride.highlighted_ride_id == -1)
|
||||
w->new_ride.highlighted_ride_id = _windowNewRideListItems[0].ride_type_and_entry;
|
||||
|
|
|
@ -1671,9 +1671,8 @@ static void window_options_update(rct_window *w)
|
|||
w->frame_no++;
|
||||
widget_invalidate(w, WIDX_TAB_1 + w->page);
|
||||
|
||||
rct_widget *widget;
|
||||
if (w->page == WINDOW_OPTIONS_PAGE_AUDIO) {
|
||||
widget = &window_options_audio_widgets[WIDX_SOUND_VOLUME];
|
||||
rct_widget *widget = &window_options_audio_widgets[WIDX_SOUND_VOLUME];
|
||||
uint8 sound_volume = (uint8)(((float)w->scrolls[0].h_left / (w->scrolls[0].h_right - ((widget->right - widget->left) - 1))) * 100);
|
||||
widget = &window_options_audio_widgets[WIDX_MUSIC_VOLUME];
|
||||
uint8 ride_music_volume = (uint8)(((float)w->scrolls[1].h_left / (w->scrolls[1].h_right - ((widget->right - widget->left) - 1))) * 100);
|
||||
|
|
|
@ -1087,7 +1087,6 @@ static void window_park_init_viewport(rct_window *w)
|
|||
int i, x, y, z, r, xy, zr, viewportFlags;
|
||||
x = y = z = r = xy = zr = 0;
|
||||
rct_viewport *viewport;
|
||||
rct_widget *viewportWidget;
|
||||
|
||||
if (w->page != WINDOW_PARK_PAGE_ENTRANCE)
|
||||
return;
|
||||
|
@ -1130,7 +1129,7 @@ static void window_park_init_viewport(rct_window *w)
|
|||
if (zr != 0xFFFF) {
|
||||
// Create viewport
|
||||
if (w->viewport == NULL) {
|
||||
viewportWidget = &window_park_entrance_widgets[WIDX_VIEWPORT];
|
||||
rct_widget *viewportWidget = &window_park_entrance_widgets[WIDX_VIEWPORT];
|
||||
viewport_create(
|
||||
w,
|
||||
w->x + viewportWidget->left + 1,
|
||||
|
@ -1903,18 +1902,14 @@ static void window_park_awards_invalidate(rct_window *w)
|
|||
*/
|
||||
static void window_park_awards_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
int i, count, x, y;
|
||||
rct_award *award;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
window_park_draw_tab_images(dpi, w);
|
||||
|
||||
x = w->x + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
||||
y = w->y + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < MAX_AWARDS; i++) {
|
||||
award = &gCurrentAwards[i];
|
||||
int x = w->x + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
||||
int y = w->y + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
||||
int count = 0;
|
||||
for (int i = 0; i < MAX_AWARDS; i++) {
|
||||
rct_award *award = &gCurrentAwards[i];
|
||||
if (award->time == 0)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1325,20 +1325,14 @@ static void window_ride_draw_tab_main(rct_drawpixelinfo *dpi, rct_window *w)
|
|||
*/
|
||||
static void window_ride_draw_tab_vehicle(rct_drawpixelinfo *dpi, rct_window *w)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_widget *widget;
|
||||
int widgetIndex, spriteIndex, x, y, width, height;
|
||||
rct_ride_entry *rideEntry;
|
||||
vehicle_colour vehicleColour;
|
||||
|
||||
widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_VEHICLE;
|
||||
widget = &w->widgets[widgetIndex];
|
||||
int widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_VEHICLE;
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
if (!(w->disabled_widgets & (1LL << widgetIndex))) {
|
||||
x = widget->left + 1;
|
||||
y = widget->top + 1;
|
||||
width = widget->right - x;
|
||||
height = widget->bottom - 3 - y;
|
||||
int x = widget->left + 1;
|
||||
int y = widget->top + 1;
|
||||
int width = widget->right - x;
|
||||
int height = widget->bottom - 3 - y;
|
||||
if (w->page == WINDOW_RIDE_PAGE_VEHICLE)
|
||||
height += 4;
|
||||
|
||||
|
@ -1353,9 +1347,9 @@ static void window_ride_draw_tab_vehicle(rct_drawpixelinfo *dpi, rct_window *w)
|
|||
x = (widget->right - widget->left) / 2;
|
||||
y = (widget->bottom - widget->top) - 12;
|
||||
|
||||
ride = get_ride(w->number);
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
|
||||
rideEntry = get_ride_entry_by_ride(ride);
|
||||
rct_ride_entry *rideEntry = get_ride_entry_by_ride(ride);
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_0) {
|
||||
clipDPI.zoom_level = 1;
|
||||
clipDPI.width *= 2;
|
||||
|
@ -1368,11 +1362,9 @@ static void window_ride_draw_tab_vehicle(rct_drawpixelinfo *dpi, rct_window *w)
|
|||
|
||||
const uint8 vehicle = ride_entry_get_vehicle_at_position(ride->subtype, ride->num_cars_per_train, rideEntry->tab_vehicle);
|
||||
rct_ride_entry_vehicle* rideVehicleEntry = &rideEntry->vehicles[vehicle];
|
||||
height += rideVehicleEntry->tab_height;
|
||||
|
||||
vehicleColour = ride_get_vehicle_colour(ride, 0);
|
||||
|
||||
spriteIndex = 32;
|
||||
vehicle_colour vehicleColour = ride_get_vehicle_colour(ride, 0);
|
||||
int spriteIndex = 32;
|
||||
if (w->page == WINDOW_RIDE_PAGE_VEHICLE)
|
||||
spriteIndex += w->frame_no;
|
||||
spriteIndex /= (rideVehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_11) ? 4 : 2;
|
||||
|
@ -1392,12 +1384,11 @@ static void window_ride_draw_tab_vehicle(rct_drawpixelinfo *dpi, rct_window *w)
|
|||
*/
|
||||
static void window_ride_draw_tab_customer(rct_drawpixelinfo *dpi, rct_window *w)
|
||||
{
|
||||
int spriteIndex;
|
||||
int widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_CUSTOMER;
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
if (!(w->disabled_widgets & (1LL << widgetIndex))) {
|
||||
spriteIndex = 0;
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
int spriteIndex = 0;
|
||||
if (w->page == WINDOW_RIDE_PAGE_CUSTOMER)
|
||||
spriteIndex = w->var_492 & ~3;
|
||||
|
||||
|
@ -1682,20 +1673,14 @@ rct_window *window_ride_open_track(rct_map_element *mapElement)
|
|||
*/
|
||||
rct_window *window_ride_open_vehicle(rct_vehicle *vehicle)
|
||||
{
|
||||
int i, rideIndex, view, numPeepsLeft, openedPeepWindow;
|
||||
uint16 headVehicleSpriteIndex, peepSpriteIndex;
|
||||
rct_ride *ride;
|
||||
rct_vehicle *headVehicle;
|
||||
rct_window *w, *w2;
|
||||
|
||||
headVehicle = vehicle_get_head(vehicle);
|
||||
headVehicleSpriteIndex = headVehicle->sprite_index;
|
||||
rideIndex = headVehicle->ride;
|
||||
ride = get_ride(rideIndex);
|
||||
rct_vehicle *headVehicle = vehicle_get_head(vehicle);
|
||||
uint16 headVehicleSpriteIndex = headVehicle->sprite_index;
|
||||
int rideIndex = headVehicle->ride;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
// Get view index
|
||||
view = 1;
|
||||
for (i = 0; i < 32; i++) {
|
||||
int view = 1;
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (ride->vehicles[i] == headVehicleSpriteIndex)
|
||||
break;
|
||||
|
||||
|
@ -1703,7 +1688,7 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle)
|
|||
}
|
||||
|
||||
|
||||
w = window_find_by_number(WC_RIDE, rideIndex);
|
||||
rct_window *w = window_find_by_number(WC_RIDE, rideIndex);
|
||||
if (w != NULL) {
|
||||
window_invalidate(w);
|
||||
|
||||
|
@ -1715,16 +1700,16 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle)
|
|||
tool_cancel();
|
||||
}
|
||||
|
||||
openedPeepWindow = 0;
|
||||
int openedPeepWindow = 0;
|
||||
if (w->ride.view == view) {
|
||||
numPeepsLeft = vehicle->num_peeps;
|
||||
for (i = 0; i < 32 && numPeepsLeft > 0; i++) {
|
||||
peepSpriteIndex = vehicle->peep[i];
|
||||
int numPeepsLeft = vehicle->num_peeps;
|
||||
for (int i = 0; i < 32 && numPeepsLeft > 0; i++) {
|
||||
uint16 peepSpriteIndex = vehicle->peep[i];
|
||||
if (peepSpriteIndex == SPRITE_INDEX_NULL)
|
||||
continue;
|
||||
|
||||
numPeepsLeft--;
|
||||
w2 = window_find_by_number(WC_PEEP, peepSpriteIndex);
|
||||
rct_window *w2 = window_find_by_number(WC_PEEP, peepSpriteIndex);
|
||||
if (w2 == NULL) {
|
||||
rct_peep *peep = &(get_sprite(peepSpriteIndex)->peep);
|
||||
window_guest_open(peep);
|
||||
|
@ -2068,14 +2053,10 @@ static void window_ride_main_resize(rct_window *w)
|
|||
*/
|
||||
static void window_ride_show_view_dropdown(rct_window *w, rct_widget *widget)
|
||||
{
|
||||
rct_widget *dropdownWidget;
|
||||
rct_ride *ride;
|
||||
int numItems, currentItem, i, j, name;
|
||||
rct_widget *dropdownWidget = widget - 1;
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
|
||||
dropdownWidget = widget - 1;
|
||||
ride = get_ride(w->number);
|
||||
|
||||
numItems = 1;
|
||||
int numItems = 1;
|
||||
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13)) {
|
||||
numItems += ride->num_stations;
|
||||
numItems += ride->num_vehicles;
|
||||
|
@ -2094,11 +2075,11 @@ static void window_ride_show_view_dropdown(rct_window *w, rct_widget *widget)
|
|||
// First item
|
||||
gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[0] = STR_OVERALL_VIEW;
|
||||
currentItem = 1;
|
||||
int currentItem = 1;
|
||||
|
||||
// Vehicles
|
||||
name = RideComponentNames[RideNameConvention[ride->type].vehicle].number;
|
||||
for (i = 1; i <= ride->num_vehicles; i++) {
|
||||
int name = RideComponentNames[RideNameConvention[ride->type].vehicle].number;
|
||||
for (int i = 1; i <= ride->num_vehicles; i++) {
|
||||
gDropdownItemsFormat[currentItem] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[currentItem] = name | (currentItem << 16);
|
||||
currentItem++;
|
||||
|
@ -2106,7 +2087,7 @@ static void window_ride_show_view_dropdown(rct_window *w, rct_widget *widget)
|
|||
|
||||
// Stations
|
||||
name = RideComponentNames[RideNameConvention[ride->type].station].number;
|
||||
for (i = 1; i <= ride->num_stations; i++) {
|
||||
for (int i = 1; i <= ride->num_stations; i++) {
|
||||
gDropdownItemsFormat[currentItem] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[currentItem] = name | (i << 16);
|
||||
currentItem++;
|
||||
|
@ -2114,8 +2095,8 @@ static void window_ride_show_view_dropdown(rct_window *w, rct_widget *widget)
|
|||
|
||||
// Set highlighted item
|
||||
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) {
|
||||
j = 2;
|
||||
for (i = 0; i < ride->num_vehicles; i++) {
|
||||
int j = 2;
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
gDropdownItemsDisabled |= j;
|
||||
j <<= 1;
|
||||
}
|
||||
|
@ -2301,29 +2282,24 @@ static void window_ride_main_dropdown(rct_window *w, int widgetIndex, int dropdo
|
|||
*/
|
||||
static void window_ride_main_update(rct_window *w)
|
||||
{
|
||||
rct_ride *ride;
|
||||
int vehicleIndex;
|
||||
uint16 vehicleSpriteIndex;
|
||||
rct_vehicle *vehicle;
|
||||
|
||||
// Update tab animation
|
||||
w->frame_no++;
|
||||
window_event_invalidate_call(w);
|
||||
widget_invalidate(w, WIDX_TAB_1);
|
||||
|
||||
// Update status
|
||||
ride = get_ride(w->number);
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
if (!(ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAIN)) {
|
||||
if (w->ride.view == 0)
|
||||
return;
|
||||
|
||||
if (w->ride.view <= ride->num_vehicles) {
|
||||
vehicleIndex = w->ride.view - 1;
|
||||
vehicleSpriteIndex = ride->vehicles[vehicleIndex];
|
||||
int vehicleIndex = w->ride.view - 1;
|
||||
uint16 vehicleSpriteIndex = ride->vehicles[vehicleIndex];
|
||||
if (vehicleSpriteIndex == 0xFFFF)
|
||||
return;
|
||||
|
||||
vehicle = &(get_sprite(vehicleSpriteIndex)->vehicle);
|
||||
rct_vehicle *vehicle = &(get_sprite(vehicleSpriteIndex)->vehicle);
|
||||
if (
|
||||
vehicle->status != 4 &&
|
||||
vehicle->status != 22 &&
|
||||
|
@ -2558,22 +2534,17 @@ static rct_string_id window_ride_get_status_vehicle(rct_window *w, void *argumen
|
|||
*/
|
||||
static rct_string_id window_ride_get_status_station(rct_window *w, void *arguments)
|
||||
{
|
||||
rct_ride *ride;
|
||||
int stationIndex, count, queueLength;
|
||||
rct_string_id stringId;
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
int count = w->ride.view - ride->num_vehicles - 1;
|
||||
int stationIndex = -1;
|
||||
rct_string_id stringId = 0;
|
||||
|
||||
ride = get_ride(w->number);
|
||||
|
||||
count = w->ride.view - ride->num_vehicles - 1;
|
||||
stationIndex = -1;
|
||||
do {
|
||||
stationIndex++;
|
||||
if (ride->station_starts[stationIndex] != 0xFFFF)
|
||||
count--;
|
||||
} while (count >= 0);
|
||||
|
||||
stringId = 0;
|
||||
|
||||
// Entrance / exit
|
||||
if (ride->status == RIDE_STATUS_CLOSED) {
|
||||
if (ride->entrances[stationIndex] == 0xFFFF)
|
||||
|
@ -2587,7 +2558,7 @@ static rct_string_id window_ride_get_status_station(rct_window *w, void *argumen
|
|||
|
||||
// Queue length
|
||||
if (stringId == 0) {
|
||||
queueLength = ride->queue_length[stationIndex];
|
||||
int queueLength = ride->queue_length[stationIndex];
|
||||
set_format_arg_body(arguments, 2, (uintptr_t)queueLength, sizeof(uint16));
|
||||
stringId = STR_QUEUE_EMPTY;
|
||||
if (queueLength == 1)
|
||||
|
@ -2970,28 +2941,28 @@ static void window_ride_vehicle_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
set_format_arg(2, utf8 *, capacity);
|
||||
gfx_draw_string_left(dpi, STR_CAPACITY, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
||||
}
|
||||
y += 15;
|
||||
y += 5;
|
||||
|
||||
if ((!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(rideEntry)) && w->var_496 > 1) {
|
||||
// Excitement Factor
|
||||
factor = rideEntry->excitement_multipler;
|
||||
if (factor > 0) {
|
||||
gfx_draw_string_left(dpi, STR_EXCITEMENT_FACTOR, &factor, COLOUR_BLACK, x, y);
|
||||
y += 10;
|
||||
gfx_draw_string_left(dpi, STR_EXCITEMENT_FACTOR, &factor, COLOUR_BLACK, x, y);
|
||||
}
|
||||
|
||||
// Intensity Factor
|
||||
factor = rideEntry->intensity_multipler;
|
||||
if (factor > 0) {
|
||||
gfx_draw_string_left(dpi, STR_INTENSITY_FACTOR, &factor, COLOUR_BLACK, x, y);
|
||||
y += 10;
|
||||
gfx_draw_string_left(dpi, STR_INTENSITY_FACTOR, &factor, COLOUR_BLACK, x, y);
|
||||
}
|
||||
|
||||
// Nausea Factor
|
||||
factor = rideEntry->nausea_multipler;
|
||||
if (factor > 0) {
|
||||
gfx_draw_string_left(dpi, STR_NAUSEA_FACTOR, &factor, COLOUR_BLACK, x, y);
|
||||
y += 10;
|
||||
gfx_draw_string_left(dpi, STR_NAUSEA_FACTOR, &factor, COLOUR_BLACK, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3011,39 +2982,33 @@ rct_vehichle_paintinfo _sprites_to_draw[144];
|
|||
*/
|
||||
static void window_ride_vehicle_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideEntry;
|
||||
rct_widget *widget;
|
||||
int x, y, startX, startY, i, j, vehicleColourIndex = 0, spriteIndex;
|
||||
rct_vehichle_paintinfo *nextSpriteToDraw, *current, tmp;
|
||||
vehicle_colour vehicleColour;
|
||||
|
||||
ride = get_ride(w->number);
|
||||
rideEntry = get_ride_entry_by_ride(ride);
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
rct_ride_entry *rideEntry = get_ride_entry_by_ride(ride);
|
||||
|
||||
// Background
|
||||
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height, 12);
|
||||
|
||||
widget = &window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_PREVIEW];
|
||||
startX = max(2, ((widget->right - widget->left) - ((ride->num_vehicles - 1) * 36)) / 2 - 25);
|
||||
startY = widget->bottom - widget->top - 4;
|
||||
rct_widget *widget = &window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_PREVIEW];
|
||||
int startX = max(2, ((widget->right - widget->left) - ((ride->num_vehicles - 1) * 36)) / 2 - 25);
|
||||
int startY = widget->bottom - widget->top - 4;
|
||||
|
||||
rct_ride_entry_vehicle* rideVehicleEntry = &rideEntry->vehicles[ride_entry_get_vehicle_at_position(ride->subtype, ride->num_cars_per_train, 0)];
|
||||
startY += rideVehicleEntry->tab_height;
|
||||
|
||||
// For each train
|
||||
for (i = 0; i < ride->num_vehicles; i++) {
|
||||
nextSpriteToDraw = _sprites_to_draw;
|
||||
x = startX;
|
||||
y = startY;
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
rct_vehichle_paintinfo *nextSpriteToDraw = _sprites_to_draw;
|
||||
int x = startX;
|
||||
int y = startY;
|
||||
|
||||
// For each car in train
|
||||
for (j = 0; j < ride->num_cars_per_train; j++) {
|
||||
for (int j = 0; j < ride->num_cars_per_train; j++) {
|
||||
rct_ride_entry_vehicle* rideVehicleEntry = &rideEntry->vehicles[ride_entry_get_vehicle_at_position(ride->subtype, ride->num_cars_per_train, j)];
|
||||
x += rideVehicleEntry->spacing / 17432;
|
||||
y -= (rideVehicleEntry->spacing / 2) / 17432;
|
||||
|
||||
// Get colour of vehicle
|
||||
int vehicleColourIndex = 0;
|
||||
switch (ride->colour_scheme_type & 3) {
|
||||
case VEHICLE_COLOUR_SCHEME_SAME:
|
||||
vehicleColourIndex = 0;
|
||||
|
@ -3055,9 +3020,9 @@ static void window_ride_vehicle_scrollpaint(rct_window *w, rct_drawpixelinfo *dp
|
|||
vehicleColourIndex = j;
|
||||
break;
|
||||
}
|
||||
vehicleColour = ride_get_vehicle_colour(ride, vehicleColourIndex);
|
||||
vehicle_colour vehicleColour = ride_get_vehicle_colour(ride, vehicleColourIndex);
|
||||
|
||||
spriteIndex = 16;
|
||||
int spriteIndex = 16;
|
||||
if (rideVehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_11)
|
||||
spriteIndex /= 2;
|
||||
|
||||
|
@ -3078,12 +3043,12 @@ static void window_ride_vehicle_scrollpaint(rct_window *w, rct_drawpixelinfo *dp
|
|||
}
|
||||
|
||||
if (ride->type == RIDE_TYPE_REVERSER_ROLLER_COASTER) {
|
||||
tmp = *(nextSpriteToDraw - 1);
|
||||
rct_vehichle_paintinfo tmp = *(nextSpriteToDraw - 1);
|
||||
*(nextSpriteToDraw - 1) = *(nextSpriteToDraw - 2);
|
||||
*(nextSpriteToDraw - 2) = tmp;
|
||||
}
|
||||
|
||||
current = nextSpriteToDraw;
|
||||
rct_vehichle_paintinfo *current = nextSpriteToDraw;
|
||||
while (--current >= _sprites_to_draw)
|
||||
gfx_draw_sprite(dpi, current->sprite_index, current->x, current->y, current->tertiary_colour);
|
||||
|
||||
|
@ -3752,24 +3717,19 @@ static void window_ride_maintenance_resize(rct_window *w)
|
|||
*/
|
||||
static void window_ride_maintenance_mousedown(int widgetIndex, rct_window *w, rct_widget *widget)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *ride_type;
|
||||
rct_widget *dropdownWidget;
|
||||
int i, j, num_items;
|
||||
uint8 breakdownReason;
|
||||
|
||||
dropdownWidget = widget;
|
||||
|
||||
ride = get_ride(w->number);
|
||||
ride_type = get_ride_entry(ride->subtype);
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
rct_ride_entry *ride_type = get_ride_entry(ride->subtype);
|
||||
if (ride_type == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
rct_widget *dropdownWidget = widget;
|
||||
int j, num_items;
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_INSPECTION_INTERVAL_DROPDOWN:
|
||||
dropdownWidget--;
|
||||
for (i = 0; i < 7; i++) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[i] = RideInspectionIntervalNames[i];
|
||||
}
|
||||
|
@ -3794,7 +3754,7 @@ static void window_ride_maintenance_mousedown(int widgetIndex, rct_window *w, rc
|
|||
}
|
||||
gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[0] = STR_DEBUG_FIX_RIDE;
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (RideAvailableBreakdowns[ride_type->ride_type[j]] & (uint8)(1 << i)) {
|
||||
if (i == BREAKDOWN_BRAKES_FAILURE && (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) {
|
||||
if (ride->num_vehicles != 1)
|
||||
|
@ -3819,9 +3779,9 @@ static void window_ride_maintenance_mousedown(int widgetIndex, rct_window *w, rc
|
|||
);
|
||||
|
||||
num_items = 1;
|
||||
breakdownReason = ride->breakdown_reason_pending;
|
||||
int breakdownReason = ride->breakdown_reason_pending;
|
||||
if (breakdownReason != BREAKDOWN_NONE && (ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING)) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (RideAvailableBreakdowns[ride_type->ride_type[j]] & (uint8)(1 << i)) {
|
||||
if (i == BREAKDOWN_BRAKES_FAILURE && (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) {
|
||||
if (ride->num_vehicles != 1)
|
||||
|
@ -3853,16 +3813,12 @@ static void window_ride_maintenance_mousedown(int widgetIndex, rct_window *w, rc
|
|||
*/
|
||||
static void window_ride_maintenance_dropdown(rct_window *w, int widgetIndex, int dropdownIndex)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *ride_type;
|
||||
rct_vehicle *vehicle;
|
||||
int i, j, num_items;
|
||||
|
||||
if (dropdownIndex == -1)
|
||||
return;
|
||||
|
||||
ride = get_ride(w->number);
|
||||
ride_type = get_ride_entry(ride->subtype);
|
||||
rct_vehicle *vehicle;
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
rct_ride_entry *ride_type = get_ride_entry(ride->subtype);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_INSPECTION_INTERVAL_DROPDOWN:
|
||||
|
@ -3911,11 +3867,13 @@ static void window_ride_maintenance_dropdown(rct_window *w, int widgetIndex, int
|
|||
window_error_open(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED);
|
||||
}
|
||||
else {
|
||||
num_items = 1;
|
||||
int j;
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (ride_type->ride_type[j] != 0xFF)
|
||||
break;
|
||||
}
|
||||
int i;
|
||||
int num_items = 1;
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (RideAvailableBreakdowns[ride_type->ride_type[j]] & (uint8)(1 << i)) {
|
||||
if (i == BREAKDOWN_BRAKES_FAILURE && (ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) {
|
||||
|
@ -3995,22 +3953,15 @@ static void window_ride_maintenance_invalidate(rct_window *w)
|
|||
*/
|
||||
static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_widget *widget;
|
||||
rct_peep *mechanicSprite;
|
||||
int x, y;
|
||||
uint16 reliability, downTime, lastInspection;
|
||||
rct_string_id stringId, breakdownMessage;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
window_ride_draw_tab_images(dpi, w);
|
||||
|
||||
ride = get_ride(w->number);
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
|
||||
// Locate mechanic button image
|
||||
widget = &window_ride_maintenance_widgets[WIDX_LOCATE_MECHANIC];
|
||||
x = w->x + widget->left;
|
||||
y = w->y + widget->top;
|
||||
rct_widget *widget = &window_ride_maintenance_widgets[WIDX_LOCATE_MECHANIC];
|
||||
int x = w->x + widget->left;
|
||||
int y = w->y + widget->top;
|
||||
gfx_draw_sprite(dpi, (gStaffMechanicColour << 24) | 0xA0000000 | SPR_MECHANIC, x, y, 0);
|
||||
|
||||
// Inspection label
|
||||
|
@ -4024,20 +3975,21 @@ static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
x = w->x + widget->left + 4;
|
||||
y = w->y + widget->top + 4;
|
||||
|
||||
reliability = ride->reliability >> 8;
|
||||
uint16 reliability = ride->reliability >> 8;
|
||||
gfx_draw_string_left(dpi, STR_RELIABILITY_LABEL_1757, &reliability, COLOUR_BLACK, x, y);
|
||||
window_ride_maintenance_draw_bar(w, dpi, x + 103, y, max(10, reliability), COLOUR_BRIGHT_GREEN);
|
||||
y += 11;
|
||||
|
||||
downTime = ride->downtime;
|
||||
uint16 downTime = ride->downtime;
|
||||
gfx_draw_string_left(dpi, STR_DOWN_TIME_LABEL_1889, &downTime, COLOUR_BLACK, x, y);
|
||||
window_ride_maintenance_draw_bar(w, dpi, x + 103, y, downTime, COLOUR_BRIGHT_RED);
|
||||
y += 26;
|
||||
|
||||
// Last inspection
|
||||
lastInspection = ride->last_inspection;
|
||||
uint16 lastInspection = ride->last_inspection;
|
||||
|
||||
// Use singular form for 1 minute of time or less
|
||||
rct_string_id stringId;
|
||||
if (lastInspection <= 1)
|
||||
stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTE;
|
||||
else if (lastInspection <= 240)
|
||||
|
@ -4055,7 +4007,7 @@ static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
stringId = (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) ?
|
||||
STR_CURRENT_BREAKDOWN :
|
||||
STR_LAST_BREAKDOWN;
|
||||
breakdownMessage = RideBreakdownReasonNames[ride->breakdown_reason];
|
||||
rct_string_id breakdownMessage = RideBreakdownReasonNames[ride->breakdown_reason];
|
||||
gfx_draw_string_left(dpi, stringId, &breakdownMessage, COLOUR_BLACK, x, y);
|
||||
y += 10;
|
||||
|
||||
|
@ -4081,7 +4033,7 @@ static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
if (stringId == STR_CALLING_MECHANIC) {
|
||||
gfx_draw_string_left_wrapped(dpi, NULL, x + 4, y, 280, stringId, COLOUR_BLACK);
|
||||
} else {
|
||||
mechanicSprite = &(get_sprite(ride->mechanic)->peep);
|
||||
rct_peep *mechanicSprite = &(get_sprite(ride->mechanic)->peep);
|
||||
if (peep_is_mechanic(mechanicSprite)) {
|
||||
set_format_arg(0, rct_string_id, mechanicSprite->name_string_idx);
|
||||
set_format_arg(2, uint32, mechanicSprite->id);
|
||||
|
@ -4446,7 +4398,6 @@ static void window_ride_colour_invalidate(rct_window *w)
|
|||
rct_ride *ride;
|
||||
track_colour trackColour;
|
||||
vehicle_colour vehicleColour;
|
||||
int vehicleColourSchemeType;
|
||||
|
||||
colour_scheme_update(w);
|
||||
|
||||
|
@ -4534,7 +4485,7 @@ static void window_ride_colour_invalidate(rct_window *w)
|
|||
|
||||
// Vehicle colours
|
||||
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13) && ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_26)) {
|
||||
vehicleColourSchemeType = ride->colour_scheme_type & 3;
|
||||
int vehicleColourSchemeType = ride->colour_scheme_type & 3;
|
||||
if (vehicleColourSchemeType == 0)
|
||||
w->var_48C = 0;
|
||||
|
||||
|
@ -4618,8 +4569,6 @@ static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
rct_widget *widget;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideEntry;
|
||||
int x, y, spriteIndex, terniaryColour;
|
||||
track_colour trackColour;
|
||||
|
||||
ride = get_ride(w->number);
|
||||
rideEntry = get_ride_entry_by_ride(ride);
|
||||
|
@ -4632,19 +4581,19 @@ static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
if (widget->type != WWT_EMPTY)
|
||||
gfx_fill_rect(dpi, w->x + widget->left + 1, w->y + widget->top + 1, w->x + widget->right - 1, w->y + widget->bottom - 1, 12);
|
||||
|
||||
trackColour = ride_get_track_colour(ride, w->ride_colour);
|
||||
track_colour trackColour = ride_get_track_colour(ride, w->ride_colour);
|
||||
|
||||
//
|
||||
if (rideEntry->shop_item == 0xFF) {
|
||||
x = w->x + widget->left;
|
||||
y = w->y + widget->top;
|
||||
int x = w->x + widget->left;
|
||||
int y = w->y + widget->top;
|
||||
|
||||
// Track
|
||||
if (ride->type == RIDE_TYPE_MAZE) {
|
||||
spriteIndex = MazeOptions[trackColour.supports].sprite;
|
||||
int spriteIndex = MazeOptions[trackColour.supports].sprite;
|
||||
gfx_draw_sprite(dpi, spriteIndex, x, y, 0);
|
||||
} else {
|
||||
spriteIndex = TrackColourPreviews[ride->type].track;
|
||||
int spriteIndex = TrackColourPreviews[ride->type].track;
|
||||
if (spriteIndex != 0) {
|
||||
spriteIndex |= (trackColour.additional << 24) | (trackColour.main << 19);
|
||||
spriteIndex |= 0xA0000000;
|
||||
|
@ -4660,11 +4609,11 @@ static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
x = w->x + (widget->left + widget->right) / 2 - 8;
|
||||
y = w->y + (widget->bottom + widget->top) / 2 - 6;
|
||||
int x = w->x + (widget->left + widget->right) / 2 - 8;
|
||||
int y = w->y + (widget->bottom + widget->top) / 2 - 6;
|
||||
|
||||
uint8 shopItem = rideEntry->shop_item_secondary == 255 ? rideEntry->shop_item : rideEntry->shop_item_secondary;
|
||||
spriteIndex = ShopItemImage[shopItem];
|
||||
int spriteIndex = ShopItemImage[shopItem];
|
||||
spriteIndex |= ride->track_colour_main[0] << 19;
|
||||
spriteIndex |= 0x20000000;
|
||||
|
||||
|
@ -4688,12 +4637,12 @@ static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
if (ride->entrance_style != RIDE_ENTRANCE_STYLE_NONE) {
|
||||
const rct_ride_entrance_definition *entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
|
||||
|
||||
terniaryColour = 0;
|
||||
int terniaryColour = 0;
|
||||
if (entranceStyle->base_image_id & 0x40000000) {
|
||||
terniaryColour = 0x40000000 | (GlassPaletteIds[trackColour.main] << 19);
|
||||
}
|
||||
|
||||
spriteIndex = (trackColour.additional << 24) | (trackColour.main << 19);
|
||||
int spriteIndex = (trackColour.additional << 24) | (trackColour.main << 19);
|
||||
spriteIndex |= 0xA0000000;
|
||||
spriteIndex += RideEntranceDefinitions[ride->entrance_style].sprite_index;
|
||||
|
||||
|
@ -4744,7 +4693,7 @@ static void window_ride_colour_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
y += rideVehicleEntry->tab_height;
|
||||
|
||||
// Draw the coloured spinning vehicle
|
||||
spriteIndex = rideVehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_11 ? w->frame_no / 4 : w->frame_no / 2;
|
||||
spriteIndex = (rideVehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_11) ? w->frame_no / 4 : w->frame_no / 2;
|
||||
spriteIndex &= rideVehicleEntry->rotation_frame_mask;
|
||||
spriteIndex *= rideVehicleEntry->var_16;
|
||||
spriteIndex += rideVehicleEntry->base_image_id;
|
||||
|
@ -5258,10 +5207,6 @@ static void window_ride_measurements_invalidate(rct_window *w)
|
|||
*/
|
||||
static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
rct_widget *widget;
|
||||
rct_ride *ride;
|
||||
rct_string_id stringId;
|
||||
int x, y, i, numTimes, numLengths;
|
||||
sint16 holes, maxSpeed, averageSpeed, drops, highestDropHeight, inversions, time;
|
||||
sint32 maxPositiveVerticalGs, maxNegativeVerticalGs, maxLateralGs, totalAirTime, length;
|
||||
|
||||
|
@ -5269,26 +5214,25 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
window_ride_draw_tab_images(dpi, w);
|
||||
|
||||
if (window_ride_measurements_widgets[WIDX_SAVE_DESIGN].type == WWT_DROPDOWN_BUTTON) {
|
||||
widget = &window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND];
|
||||
rct_widget *widget = &window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND];
|
||||
|
||||
x = w->x + (widget->right - widget->left) / 2;
|
||||
y = w->y + widget->top + 40;
|
||||
int x = w->x + (widget->right - widget->left) / 2;
|
||||
int y = w->y + widget->top + 40;
|
||||
gfx_draw_string_centred_wrapped(dpi, NULL, x, y, w->width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, COLOUR_BLACK);
|
||||
|
||||
x = w->x + 4;
|
||||
y = w->y + window_ride_measurements_widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17;
|
||||
gfx_fill_rect_inset(dpi, x, y, w->x + 312, y + 1, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
||||
} else {
|
||||
ride = get_ride(w->number);
|
||||
|
||||
x = w->x + window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
||||
y = w->y + window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
int x = w->x + window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
||||
int y = w->y + window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) {
|
||||
// Excitement
|
||||
set_format_arg(0, uint32, ride->excitement);
|
||||
set_format_arg(4, rct_string_id, RatingNames[min(ride->excitement >> 8, 5)]);
|
||||
stringId = ride->excitement == -1 ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE : STR_EXCITEMENT_RATING;
|
||||
rct_string_id stringId = ride->excitement == -1 ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE : STR_EXCITEMENT_RATING;
|
||||
gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
||||
y += 10;
|
||||
|
||||
|
@ -5333,8 +5277,8 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
y += 10;
|
||||
|
||||
// Ride time
|
||||
numTimes = 0;
|
||||
for (i = 0; i < ride->num_stations; i++) {
|
||||
int numTimes = 0;
|
||||
for (int i = 0; i < ride->num_stations; i++) {
|
||||
time = ride->time[numTimes];
|
||||
if (time != 0) {
|
||||
set_format_arg(0 + (numTimes * 4), uint16, STR_RIDE_TIME_ENTRY_WITH_SEPARATOR);
|
||||
|
@ -5360,8 +5304,8 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
}
|
||||
|
||||
// Ride length
|
||||
numLengths = 0;
|
||||
for (i = 0; i < ride->num_stations; i++) {
|
||||
int numLengths = 0;
|
||||
for (int i = 0; i < ride->num_stations; i++) {
|
||||
length = ride->length[numLengths];
|
||||
if (length != 0) {
|
||||
length >>= 16;
|
||||
|
@ -5586,16 +5530,13 @@ static void window_ride_graphs_15(rct_window *w, int scrollIndex, int scrollArea
|
|||
*/
|
||||
static void window_ride_graphs_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId)
|
||||
{
|
||||
rct_ride *ride;
|
||||
rct_ride_measurement *measurement;
|
||||
rct_string_id message;
|
||||
|
||||
if (widgetIndex == WIDX_GRAPH) {
|
||||
set_format_arg(0, rct_string_id, STR_GRAPH);
|
||||
measurement = ride_get_measurement(w->number, &message);
|
||||
rct_string_id message;
|
||||
rct_ride_measurement *measurement = ride_get_measurement(w->number, &message);
|
||||
if (measurement != NULL && (measurement->flags & RIDE_MEASUREMENT_FLAG_RUNNING)) {
|
||||
set_format_arg(4, uint16, measurement->vehicle_index + 1);
|
||||
ride = get_ride(w->number);
|
||||
rct_ride *ride = get_ride(w->number);
|
||||
set_format_arg(2, rct_string_id, RideComponentNames[RideNameConvention[ride->type].vehicle].count);
|
||||
} else {
|
||||
*stringId = message;
|
||||
|
@ -5683,21 +5624,16 @@ static void window_ride_graphs_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
*/
|
||||
static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
|
||||
{
|
||||
rct_ride_measurement *measurement;
|
||||
rct_widget *widget;
|
||||
int x, y, width, time, listType, colour, top, bottom, tmp;
|
||||
rct_string_id stringId;
|
||||
|
||||
gfx_clear(dpi, ColourMapA[COLOUR_SATURATED_GREEN].darker);
|
||||
|
||||
widget = &window_ride_graphs_widgets[WIDX_GRAPH];
|
||||
listType = w->list_information_type & 0xFF;
|
||||
measurement = ride_get_measurement(w->number, &stringId);
|
||||
rct_widget *widget = &window_ride_graphs_widgets[WIDX_GRAPH];
|
||||
rct_string_id stringId;
|
||||
rct_ride_measurement *measurement = ride_get_measurement(w->number, &stringId);
|
||||
if (measurement == NULL) {
|
||||
// No measurement message
|
||||
x = (widget->right - widget->left) / 2;
|
||||
y = (widget->bottom - widget->top) / 2 - 5;
|
||||
width = widget->right - widget->left - 2;
|
||||
int x = (widget->right - widget->left) / 2;
|
||||
int y = (widget->bottom - widget->top) / 2 - 5;
|
||||
int width = widget->right - widget->left - 2;
|
||||
gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, width, stringId, COLOUR_BLACK);
|
||||
return;
|
||||
}
|
||||
|
@ -5706,8 +5642,8 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
const uint8 lightColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_light;
|
||||
const uint8 darkColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_dark;
|
||||
|
||||
time = 0;
|
||||
for (x = 0; x < dpi->x + dpi->width; x += 80) {
|
||||
int time = 0;
|
||||
for (int x = 0; x < dpi->x + dpi->width; x += 80) {
|
||||
if (x + 80 >= dpi->x) {
|
||||
gfx_fill_rect(dpi, x + 0, dpi->y, x + 0, dpi->y + dpi->height - 1, lightColour);
|
||||
gfx_fill_rect(dpi, x + 16, dpi->y, x + 16, dpi->y + dpi->height - 1, darkColour);
|
||||
|
@ -5719,7 +5655,7 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
}
|
||||
|
||||
// Horizontal grid lines
|
||||
y = widget->bottom - widget->top - 13;
|
||||
int listType = w->list_information_type & 0xFF;
|
||||
short yUnit = window_graphs_y_axi[listType].unit;
|
||||
rct_string_id stringID = window_graphs_y_axi[listType].label;
|
||||
short yUnitInterval = window_graphs_y_axi[listType].unit_interval;
|
||||
|
@ -5730,9 +5666,9 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
yUnit -= gMapBaseZ * 3;
|
||||
}
|
||||
|
||||
for (y = widget->bottom - widget->top - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval) {
|
||||
for (int y = widget->bottom - widget->top - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval) {
|
||||
// Minor / major line
|
||||
colour = yUnit == 0 ? lightColour : darkColour;
|
||||
int colour = yUnit == 0 ? lightColour : darkColour;
|
||||
gfx_fill_rect(dpi, dpi->x, y, dpi->x + dpi->width - 1, y, colour);
|
||||
|
||||
sint16 scaled_yUnit = yUnit;
|
||||
|
@ -5744,17 +5680,17 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
}
|
||||
|
||||
// Time marks
|
||||
x = 0;
|
||||
time = 0;
|
||||
for (x = 0; x < dpi->x + dpi->width; x += 80) {
|
||||
for (int x = 0; x < dpi->x + dpi->width; x += 80) {
|
||||
if (x + 80 >= dpi->x)
|
||||
gfx_draw_string_left(dpi, STR_RIDE_STATS_TIME, &time, COLOUR_BLACK, x + 2, 1);
|
||||
time += 5;
|
||||
}
|
||||
|
||||
// Plot
|
||||
x = dpi->x;
|
||||
for (width = 0; width < dpi->width; width++, x++) {
|
||||
int x = dpi->x;
|
||||
int top, bottom;
|
||||
for (int width = 0; width < dpi->width; width++, x++) {
|
||||
if (x < 0 || x >= measurement->num_items - 1)
|
||||
continue;
|
||||
|
||||
|
@ -5783,7 +5719,7 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
|
|||
top = widget->bottom - widget->top - top - 13;
|
||||
bottom = widget->bottom - widget->top - bottom - 13;
|
||||
if (top > bottom) {
|
||||
tmp = top;
|
||||
int tmp = top;
|
||||
top = bottom;
|
||||
bottom = tmp;
|
||||
}
|
||||
|
@ -6394,7 +6330,7 @@ static void window_ride_customer_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
}
|
||||
|
||||
// Secondary shop items sold / on-ride photos sold
|
||||
shopItem = ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO ?
|
||||
shopItem = (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) ?
|
||||
RidePhotoItems[ride->type] :
|
||||
get_ride_entry_by_ride(ride)->shop_item_secondary;
|
||||
if (shopItem != SHOP_ITEM_NONE) {
|
||||
|
|
|
@ -526,7 +526,7 @@ static bool is_track_enabled(int trackFlagIndex)
|
|||
|
||||
static int ride_get_alternative_type(rct_ride *ride)
|
||||
{
|
||||
return _currentTrackCovered & 2 ?
|
||||
return (_currentTrackCovered & 2) ?
|
||||
RideData4[ride->type].alternate_type :
|
||||
ride->type;
|
||||
}
|
||||
|
@ -1838,7 +1838,6 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
|
|||
|
||||
void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, int direction, int type)
|
||||
{
|
||||
int slope, slopeEnd, b2, bankEnd, bankStart, b5, b4;
|
||||
if (gGotoStartPlacementMode) {
|
||||
z &= 0xFFF0;
|
||||
_currentTrackBeginZ = z;
|
||||
|
@ -1846,13 +1845,13 @@ void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, i
|
|||
_currentTrackSelectionFlags = 0;
|
||||
_rideConstructionArrowPulseTime = 0;
|
||||
direction = _currentTrackPieceDirection;
|
||||
slope = _currentTrackCurve;
|
||||
slopeEnd = _previousTrackSlopeEnd;
|
||||
b2 = _currentTrackSlopeEnd;
|
||||
bankEnd = _previousTrackBankEnd;
|
||||
bankStart = _currentTrackBankEnd;
|
||||
b5 = _currentTrackCovered;
|
||||
b4 = _currentTrackLiftHill;
|
||||
int slope = _currentTrackCurve;
|
||||
int slopeEnd = _previousTrackSlopeEnd;
|
||||
int b2 = _currentTrackSlopeEnd;
|
||||
int bankEnd = _previousTrackBankEnd;
|
||||
int bankStart = _currentTrackBankEnd;
|
||||
int b5 = _currentTrackCovered;
|
||||
int b4 = _currentTrackLiftHill;
|
||||
ride_construction_set_default_next_piece();
|
||||
sub_6C84CE();
|
||||
if (!ride_try_get_origin_element(_currentRideIndex, NULL)) {
|
||||
|
@ -2304,7 +2303,7 @@ static void sub_6CBCE2(
|
|||
rct_ride *ride;
|
||||
const rct_preview_track *trackBlock;
|
||||
int preserve_current_viewport_flags;
|
||||
int x, y, baseZ, clearanceZ, offsetX, offsetY;
|
||||
int offsetX, offsetY;
|
||||
|
||||
preserve_current_viewport_flags = gCurrentViewportFlags;
|
||||
gCurrentViewportFlags = 0;
|
||||
|
@ -2364,10 +2363,10 @@ static void sub_6CBCE2(
|
|||
bl |= bh;
|
||||
break;
|
||||
}
|
||||
x = originX + offsetX;
|
||||
y = originY + offsetY;
|
||||
baseZ = (originZ + trackBlock->z) >> 3;
|
||||
clearanceZ = ((trackBlock->var_07 + RideData5[ride->type].clearance_height) >> 3) + baseZ + 4;
|
||||
int x = originX + offsetX;
|
||||
int y = originY + offsetY;
|
||||
int baseZ = (originZ + trackBlock->z) >> 3;
|
||||
int clearanceZ = ((trackBlock->var_07 + RideData5[ride->type].clearance_height) >> 3) + baseZ + 4;
|
||||
|
||||
int tileX = x >> 5;
|
||||
int tileY = y >> 5;
|
||||
|
@ -2385,13 +2384,13 @@ static void sub_6CBCE2(
|
|||
map_set_tile_elements(tileX + 0, tileY - 1, &_tempSideTrackMapElement);
|
||||
|
||||
// Set the temporary track element
|
||||
_tempTrackMapElement.type = trackDirection | MAP_ELEMENT_TYPE_TRACK | (edx & 0x10000 ? 0x80 : 0);
|
||||
_tempTrackMapElement.type = trackDirection | MAP_ELEMENT_TYPE_TRACK | ((edx & 0x10000) ? 0x80 : 0);
|
||||
_tempTrackMapElement.flags = (bl & 0x0F) | MAP_ELEMENT_FLAG_LAST_TILE;
|
||||
_tempTrackMapElement.base_height = baseZ;
|
||||
_tempTrackMapElement.clearance_height = clearanceZ;
|
||||
_tempTrackMapElement.properties.track.type = trackType;
|
||||
_tempTrackMapElement.properties.track.sequence = trackBlock->index;
|
||||
_tempTrackMapElement.properties.track.colour = (edx & 0x20000 ? 4 : 0);
|
||||
_tempTrackMapElement.properties.track.colour = (edx & 0x20000) ? 4 : 0;
|
||||
_tempTrackMapElement.properties.track.ride_index = rideIndex;
|
||||
|
||||
// Draw this map tile
|
||||
|
@ -2697,7 +2696,7 @@ static void window_ride_construction_update_enabled_track_pieces()
|
|||
if (rideEntry == NULL)
|
||||
return;
|
||||
|
||||
int rideType = _currentTrackCovered & 2 ? RideData4[ride->type].alternate_type : ride->type;
|
||||
int rideType = (_currentTrackCovered & 2) ? RideData4[ride->type].alternate_type : ride->type;
|
||||
_enabledRidePieces.a = rideEntry->enabledTrackPiecesA & gResearchedTrackTypesA[rideType];
|
||||
_enabledRidePieces.b = rideEntry->enabledTrackPiecesB & gResearchedTrackTypesB[rideType];
|
||||
}
|
||||
|
@ -2723,7 +2722,7 @@ money32 sub_6CA162(int rideIndex, int trackType, int trackDirection, int edxRS16
|
|||
_unkF440C5.z = z;
|
||||
_unkF440C5.direction = trackDirection;
|
||||
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
||||
viewport_set_visibility(gTrackGroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND ? 1 : 3);
|
||||
viewport_set_visibility((gTrackGroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND) ? 1 : 3);
|
||||
if (_currentTrackSlopeEnd != 0)
|
||||
viewport_set_visibility(2);
|
||||
|
||||
|
@ -2742,7 +2741,7 @@ money32 sub_6CA162(int rideIndex, int trackType, int trackDirection, int edxRS16
|
|||
_unkF440C5.z = z;
|
||||
_unkF440C5.direction = trackDirection;
|
||||
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
||||
viewport_set_visibility(gTrackGroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND ? 1 : 3);
|
||||
viewport_set_visibility((gTrackGroundFlags & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND) ? 1 : 3);
|
||||
if (_currentTrackSlopeEnd != 0)
|
||||
viewport_set_visibility(2);
|
||||
|
||||
|
@ -2898,7 +2897,7 @@ static void window_ride_construction_update_possible_ride_configurations()
|
|||
{
|
||||
rct_ride *ride;
|
||||
int trackType;
|
||||
int edx, edi;
|
||||
int edi;
|
||||
|
||||
ride = get_ride(_currentRideIndex);
|
||||
|
||||
|
@ -2911,7 +2910,7 @@ static void window_ride_construction_update_possible_ride_configurations()
|
|||
int currentPossibleRideConfigurationIndex = 0;
|
||||
_numCurrentPossibleSpecialTrackPieces = 0;
|
||||
for (trackType = 0; trackType < 256; trackType++) {
|
||||
edx = ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE) ?
|
||||
int edx = ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE) ?
|
||||
FlatRideTrackDefinitions[trackType].type :
|
||||
TrackDefinitions[trackType].type;
|
||||
|
||||
|
@ -3576,7 +3575,7 @@ static void ride_construction_set_brakes_speed(int brakesSpeed)
|
|||
*/
|
||||
void ride_construction_toolupdate_construct(int screenX, int screenY)
|
||||
{
|
||||
int x, y, z, highestZ;
|
||||
int x, y, z;
|
||||
rct_ride *ride;
|
||||
const rct_preview_track *trackBlock;
|
||||
|
||||
|
@ -3623,8 +3622,8 @@ void ride_construction_toolupdate_construct(int screenX, int screenY)
|
|||
gMapSelectArrowPosition.z = z;
|
||||
if (_trackPlaceZ == 0) {
|
||||
// Raise z above all slopes and water
|
||||
highestZ = 0;
|
||||
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT) {
|
||||
int highestZ = 0;
|
||||
rct_xy16 *selectedTile = gMapSelectionTiles;
|
||||
while (selectedTile->x != -1) {
|
||||
if (selectedTile->x < (256 * 32) && selectedTile->y < (256 * 32)) {
|
||||
|
|
|
@ -445,15 +445,13 @@ static void window_ride_list_tooltip(rct_window* w, int widgetIndex, rct_string_
|
|||
*/
|
||||
static void window_ride_list_invalidate(rct_window *w)
|
||||
{
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
|
||||
colour_scheme_update(w);
|
||||
|
||||
window_ride_list_widgets[WIDX_CURRENT_INFORMATION_TYPE].text = ride_info_type_string_mapping[_window_ride_list_information_type];
|
||||
|
||||
// Set correct active tab
|
||||
for (i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; i++)
|
||||
w->pressed_widgets &= ~(1 << (WIDX_TAB_1 + i));
|
||||
w->pressed_widgets |= 1LL << (WIDX_TAB_1 + w->page);
|
||||
|
||||
|
@ -482,6 +480,8 @@ static void window_ride_list_invalidate(rct_window *w)
|
|||
|
||||
sint8 allClosed = -1;
|
||||
sint8 allOpen = -1;
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
if (w->page != gRideClassifications[ride->type])
|
||||
continue;
|
||||
|
|
|
@ -506,13 +506,23 @@ static char *freadstralloc(SDL_RWops *file)
|
|||
|
||||
if (length >= capacity) {
|
||||
capacity *= 2;
|
||||
buffer = realloc(buffer, capacity);
|
||||
void *new_memory = realloc(buffer, capacity);
|
||||
if (new_memory == NULL) {
|
||||
log_error("Failed to reallocate memory for file buffer");
|
||||
return NULL;
|
||||
}
|
||||
buffer = (char*)new_memory;
|
||||
}
|
||||
buffer[length] = c;
|
||||
length++;
|
||||
}
|
||||
|
||||
buffer = realloc(buffer, length + 1);
|
||||
void *new_memory = realloc(buffer, length + 1);
|
||||
if (new_memory == NULL) {
|
||||
log_error("Failed to reallocate memory for file buffer");
|
||||
return NULL;
|
||||
}
|
||||
buffer = (char*)new_memory;
|
||||
buffer[length] = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -301,13 +301,12 @@ static void window_staff_list_dropdown(rct_window *w, int widgetIndex, int dropd
|
|||
*/
|
||||
void window_staff_list_update(rct_window *w)
|
||||
{
|
||||
int spriteIndex;
|
||||
rct_peep *peep;
|
||||
|
||||
w->list_information_type++;
|
||||
if (w->list_information_type >= 24) {
|
||||
w->list_information_type = 0;
|
||||
} else {
|
||||
int spriteIndex;
|
||||
rct_peep *peep;
|
||||
widget_invalidate(w, WIDX_STAFF_LIST_HANDYMEN_TAB + _windowStaffListSelectedTab);
|
||||
gWindowMapFlashingFlags |= (1 << 2);
|
||||
FOR_ALL_STAFF(spriteIndex, peep) {
|
||||
|
@ -326,22 +325,20 @@ void window_staff_list_update(rct_window *w)
|
|||
*/
|
||||
static void window_staff_list_tooldown(rct_window *w, int widgetIndex, int x, int y)
|
||||
{
|
||||
int direction, distance, closestPeepDistance, selectedPeepType;
|
||||
rct_map_element *mapElement;
|
||||
rct_peep *peep, *closestPeep;
|
||||
uint16 spriteIndex;
|
||||
|
||||
if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) {
|
||||
selectedPeepType = _windowStaffListSelectedTab;
|
||||
int selectedPeepType = _windowStaffListSelectedTab;
|
||||
|
||||
int direction;
|
||||
rct_map_element *mapElement;
|
||||
footpath_get_coordinates_from_pos(x, y, &x, &y, &direction, &mapElement);
|
||||
if (x == 0x8000)
|
||||
return;
|
||||
|
||||
bool isPatrolAreaSet = staff_is_patrol_area_set(200 + selectedPeepType, x, y);
|
||||
|
||||
closestPeep = NULL;
|
||||
closestPeepDistance = INT_MAX;
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep, *closestPeep = NULL;
|
||||
int closestPeepDistance = INT_MAX;
|
||||
FOR_ALL_STAFF(spriteIndex, peep) {
|
||||
if (peep->staff_type != selectedPeepType)
|
||||
continue;
|
||||
|
@ -359,7 +356,7 @@ static void window_staff_list_tooldown(rct_window *w, int widgetIndex, int x, in
|
|||
continue;
|
||||
}
|
||||
|
||||
distance = abs(x - peep->x) + abs(y - peep->y);
|
||||
int distance = abs(x - peep->x) + abs(y - peep->y);
|
||||
if (distance < closestPeepDistance) {
|
||||
closestPeepDistance = distance;
|
||||
closestPeep = peep;
|
||||
|
|
|
@ -302,10 +302,8 @@ static int get_colour_scheme_tab_count()
|
|||
|
||||
static void window_themes_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w)
|
||||
{
|
||||
int sprite_idx;
|
||||
|
||||
for (int i = 0; i < WINDOW_THEMES_TAB_COUNT; i++) {
|
||||
sprite_idx = window_themes_tab_sprites[i];
|
||||
int sprite_idx = window_themes_tab_sprites[i];
|
||||
if (_selected_tab == i)
|
||||
sprite_idx += w->frame_no / window_themes_tab_animation_divisor[_selected_tab];
|
||||
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_THEMES_SETTINGS_TAB + i].left, w->y + w->widgets[WIDX_THEMES_SETTINGS_TAB + i].top, 0);
|
||||
|
|
|
@ -2150,7 +2150,6 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
|
||||
static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
|
||||
{
|
||||
int x = 3;
|
||||
int y = LIST_ITEM_HEIGHT * (windowTileInspectorElementCount - 1);
|
||||
int i = 0;
|
||||
char buffer[256];
|
||||
|
@ -2224,7 +2223,7 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *
|
|||
}
|
||||
|
||||
// Undo relative scroll offset, but keep the 3 pixel padding
|
||||
x = -w->widgets[WIDX_LIST].left;
|
||||
int x = -w->widgets[WIDX_LIST].left;
|
||||
const bool ghost = (mapElement->flags & MAP_ELEMENT_FLAG_GHOST) != 0;
|
||||
const bool broken = (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN) != 0;
|
||||
const bool last = (mapElement->flags & MAP_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||
|
|
|
@ -741,7 +741,7 @@ static void window_title_editor_invalidate(rct_window *w)
|
|||
window_title_editor_widgets[WIDX_TITLE_EDITOR_SKIP].top = w->height - 32;
|
||||
window_title_editor_widgets[WIDX_TITLE_EDITOR_SKIP].bottom = w->height - 16;
|
||||
|
||||
if (!gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) {
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) {
|
||||
w->disabled_widgets |= (1 << WIDX_TITLE_EDITOR_PLAY);
|
||||
} else {
|
||||
w->disabled_widgets &= ~(1 << WIDX_TITLE_EDITOR_PLAY);
|
||||
|
|
|
@ -363,8 +363,7 @@ static void window_scenarioselect_invalidate(rct_window *w)
|
|||
|
||||
static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
int i, x, y, format;
|
||||
rct_widget *widget;
|
||||
int format;
|
||||
const scenario_index_entry *scenario;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
|
@ -372,13 +371,13 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_SMALL_WINDOW_COLOUR_2_STRINGID : STR_WINDOW_COLOUR_2_STRINGID;
|
||||
|
||||
// Text for each tab
|
||||
for (i = 0; i < 8; i++) {
|
||||
widget = &window_scenarioselect_widgets[WIDX_TAB1 + i];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
rct_widget *widget = &window_scenarioselect_widgets[WIDX_TAB1 + i];
|
||||
if (widget->type == WWT_EMPTY)
|
||||
continue;
|
||||
|
||||
x = (widget->left + widget->right) / 2 + w->x;
|
||||
y = (widget->top + widget->bottom) / 2 + w->y - 3;
|
||||
int x = (widget->left + widget->right) / 2 + w->x;
|
||||
int y = (widget->top + widget->bottom) / 2 + w->y - 3;
|
||||
|
||||
if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) {
|
||||
set_format_arg(0, rct_string_id, ScenarioOriginStringIds[i]);
|
||||
|
@ -393,8 +392,8 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
if (scenario == NULL) {
|
||||
if (_showLockedInformation) {
|
||||
// Show locked information
|
||||
x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
|
||||
y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
|
||||
int x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
|
||||
int y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
|
||||
gfx_draw_string_centred_clipped(dpi, STR_SCENARIO_LOCKED, NULL, COLOUR_BLACK, x + 85, y, 170);
|
||||
y += 15;
|
||||
y += gfx_draw_string_left_wrapped(dpi, NULL, x, y, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK) + 5;
|
||||
|
@ -414,8 +413,8 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
}
|
||||
|
||||
// Scenario name
|
||||
x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
|
||||
y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
|
||||
int x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
|
||||
int y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
|
||||
set_format_arg(0, rct_string_id, STR_STRING);
|
||||
set_format_arg(2, const char *, scenario->name);
|
||||
gfx_draw_string_centred_clipped(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x + 85, y, 170);
|
||||
|
@ -596,6 +595,7 @@ static void initialise_list_items(rct_window *w)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (headingStringId != STR_NONE) {
|
||||
// Ensure list capacity
|
||||
if (length == capacity) {
|
||||
|
|
|
@ -2557,7 +2557,7 @@ static void window_top_toolbar_tool_down(rct_window* w, int widgetIndex, int x,
|
|||
{
|
||||
switch (widgetIndex){
|
||||
case WIDX_CLEAR_SCENERY:
|
||||
if (!gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)
|
||||
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||
break;
|
||||
|
||||
gGameCommandErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
||||
|
@ -2760,7 +2760,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, int widgetIndex, int x,
|
|||
if (window_find_by_class(WC_ERROR) != NULL)
|
||||
break;
|
||||
|
||||
if (!gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)
|
||||
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||
break;
|
||||
|
||||
gGameCommandErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
||||
|
|
|
@ -546,7 +546,6 @@ static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
|
||||
if (td6->cost != 0) {
|
||||
gfx_draw_string_left(dpi, STR_TRACK_LIST_COST_AROUND, &td6->cost, COLOUR_BLACK, x, y);
|
||||
y += 14;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,10 +245,7 @@ static void window_track_place_update(rct_window *w)
|
|||
*/
|
||||
static void window_track_place_toolupdate(rct_window* w, int widgetIndex, int x, int y)
|
||||
{
|
||||
int i;
|
||||
short mapX, mapY, mapZ;
|
||||
money32 cost;
|
||||
uint8 rideIndex;
|
||||
|
||||
map_invalidate_map_selection_tiles();
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||
|
@ -268,7 +265,7 @@ static void window_track_place_toolupdate(rct_window* w, int widgetIndex, int x,
|
|||
return;
|
||||
}
|
||||
|
||||
cost = MONEY32_UNDEFINED;
|
||||
money32 cost = MONEY32_UNDEFINED;
|
||||
|
||||
// Get base Z position
|
||||
mapZ = window_track_place_get_base_z(mapX, mapY);
|
||||
|
@ -276,7 +273,8 @@ static void window_track_place_toolupdate(rct_window* w, int widgetIndex, int x,
|
|||
window_track_place_clear_provisional();
|
||||
|
||||
// Try increasing Z until a feasible placement is found
|
||||
for (i = 0; i < 7; i++) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
uint8 rideIndex;
|
||||
window_track_place_attempt_placement(_trackDesign, mapX, mapY, mapZ, 105, &cost, &rideIndex);
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
_window_track_place_ride_index = rideIndex;
|
||||
|
@ -532,7 +530,7 @@ static void window_track_place_draw_mini_preview_track(rct_track_td6 *td6, int p
|
|||
bits = (bits & 0x0F) | ((bits & 0xF0) >> 4);
|
||||
|
||||
// Station track is a lighter colour
|
||||
uint8 colour = TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN ? PALETTE_INDEX_PRIMARY_LIGHTEST : PALETTE_INDEX_PRIMARY_MID_DARK;
|
||||
uint8 colour = (TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_ORIGIN) ? PALETTE_INDEX_PRIMARY_LIGHTEST : PALETTE_INDEX_PRIMARY_MID_DARK;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (bits & 1) pixel[338 + i] = colour; // x + 2, y + 2
|
||||
|
|
|
@ -96,11 +96,7 @@ static int _viewportNumber = 1;
|
|||
*/
|
||||
void window_viewport_open()
|
||||
{
|
||||
rct_window *w, *mainWindow;
|
||||
rct_viewport *mainViewport;
|
||||
int x, y;
|
||||
|
||||
w = window_create_auto_pos(
|
||||
rct_window *w = window_create_auto_pos(
|
||||
INITIAL_WIDTH, INITIAL_HEIGHT,
|
||||
&window_viewport_events,
|
||||
WC_VIEWPORT,
|
||||
|
@ -116,11 +112,11 @@ void window_viewport_open()
|
|||
|
||||
// Create viewport
|
||||
viewport_create(w, w->x, w->y, w->width, w->height, 0, 128 * 32, 128 * 32, 0, 1, -1);
|
||||
mainWindow = window_get_main();
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
mainViewport = mainWindow->viewport;
|
||||
x = mainViewport->view_x + (mainViewport->view_width / 2);
|
||||
y = mainViewport->view_y + (mainViewport->view_height / 2);
|
||||
rct_viewport *mainViewport = mainWindow->viewport;
|
||||
int x = mainViewport->view_x + (mainViewport->view_width / 2);
|
||||
int y = mainViewport->view_y + (mainViewport->view_height / 2);
|
||||
w->saved_view_x = x - (w->viewport->view_width / 2);
|
||||
w->saved_view_y = y - (w->viewport->view_height / 2);
|
||||
}
|
||||
|
|
|
@ -229,8 +229,6 @@ static void window_water_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
if (gLandToolSize > 7) {
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
|
||||
}
|
||||
y = w->y + window_water_widgets[WIDX_PREVIEW].bottom + 5;
|
||||
|
||||
|
||||
// Draw raise cost amount
|
||||
x = (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
|
|
|
@ -108,16 +108,15 @@ void game_command_balloon_press(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
|||
if (!(flags & GAME_COMMAND_FLAG_APPLY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (balloon_num >= MAX_SPRITES) {
|
||||
log_error("Tried getting invalid sprite for balloon: %u", balloon_num);
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
rct_sprite* sprite = get_sprite(balloon_num);
|
||||
if (!sprite) {
|
||||
return;
|
||||
}
|
||||
if (sprite->balloon.sprite_identifier == SPRITE_IDENTIFIER_MISC && sprite->balloon.misc_identifier == SPRITE_MISC_BALLOON) {
|
||||
if (sprite != NULL && sprite->balloon.sprite_identifier == SPRITE_IDENTIFIER_MISC && sprite->balloon.misc_identifier == SPRITE_MISC_BALLOON) {
|
||||
balloon_press(&sprite->balloon);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue