mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge branch 'develop' into new-save-format
This commit is contained in:
commit
d93309d065
|
@ -204,8 +204,7 @@ namespace OpenRCT2::Ui
|
|||
ShowMessageBox(window, msg);
|
||||
return ShowFileDialog(window, desc);
|
||||
}
|
||||
else if (
|
||||
desc.Type == FILE_DIALOG_TYPE::SAVE && access(result.c_str(), F_OK) != -1 && dtype == DIALOG_TYPE::KDIALOG)
|
||||
if (desc.Type == FILE_DIALOG_TYPE::SAVE && access(result.c_str(), F_OK) != -1 && dtype == DIALOG_TYPE::KDIALOG)
|
||||
{
|
||||
std::string cmd = String::StdFormat("%s --yesno \"Overwrite %s?\"", executablePath.c_str(), result.c_str());
|
||||
if (Platform::Execute(cmd) != 0)
|
||||
|
|
|
@ -156,10 +156,7 @@ public:
|
|||
{
|
||||
return this->OpenWindow(WC_RESEARCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
return window_new_ride_open_research();
|
||||
}
|
||||
return window_new_ride_open_research();
|
||||
case WV_MAZE_CONSTRUCTION:
|
||||
return window_maze_construction_open();
|
||||
case WV_NETWORK_PASSWORD:
|
||||
|
|
|
@ -88,11 +88,9 @@ static Image ReadBitmap(std::istream& istream, IMAGE_FORMAT format)
|
|||
|
||||
return image;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_FreeSurface(bitmap);
|
||||
throw std::runtime_error("Unable to lock surface.");
|
||||
}
|
||||
|
||||
SDL_FreeSurface(bitmap);
|
||||
throw std::runtime_error("Unable to lock surface.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -57,8 +57,8 @@ static inline SweepLine CreateXList(const RectCommandBatch& transparent)
|
|||
std::sort(x_sweep.begin(), x_sweep.end(), [](const XData& a, const XData& b) -> bool {
|
||||
if (a.xposition != b.xposition)
|
||||
return a.xposition < b.xposition;
|
||||
else
|
||||
return !a.begin && b.begin;
|
||||
|
||||
return !a.begin && b.begin;
|
||||
});
|
||||
|
||||
return x_sweep;
|
||||
|
|
|
@ -188,28 +188,28 @@ void InputManager::Process(const InputEvent& e)
|
|||
}
|
||||
return;
|
||||
}
|
||||
else if (gChatOpen)
|
||||
|
||||
if (gChatOpen)
|
||||
{
|
||||
ProcessChat(e);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
if (e.DeviceKind == InputDeviceKind::Keyboard)
|
||||
{
|
||||
if (e.DeviceKind == InputDeviceKind::Keyboard)
|
||||
auto w = window_find_by_class(WC_TEXTINPUT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto w = window_find_by_class(WC_TEXTINPUT);
|
||||
if (w != nullptr)
|
||||
if (e.State == InputEventState::Release)
|
||||
{
|
||||
if (e.State == InputEventState::Release)
|
||||
{
|
||||
window_text_input_key(w, e.Button);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (gUsingWidgetTextBox)
|
||||
{
|
||||
return;
|
||||
window_text_input_key(w, e.Button);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (gUsingWidgetTextBox)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,12 +145,10 @@ static MouseState GameGetNextInput(ScreenCoordsXY& screenCoords)
|
|||
screenCoords = cursorState->position;
|
||||
return MouseState::Released;
|
||||
}
|
||||
else
|
||||
{
|
||||
screenCoords.x = input->x;
|
||||
screenCoords.y = input->y;
|
||||
return input->state;
|
||||
}
|
||||
|
||||
screenCoords.x = input->x;
|
||||
screenCoords.y = input->y;
|
||||
return input->state;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,12 +162,10 @@ static RCTMouseData* GetMouseInput()
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
RCTMouseData* result = &_mouseInputQueue[_mouseInputQueueReadIndex];
|
||||
_mouseInputQueueReadIndex = (_mouseInputQueueReadIndex + 1) % std::size(_mouseInputQueue);
|
||||
return result;
|
||||
}
|
||||
|
||||
RCTMouseData* result = &_mouseInputQueue[_mouseInputQueueReadIndex];
|
||||
_mouseInputQueueReadIndex = (_mouseInputQueueReadIndex + 1) % std::size(_mouseInputQueue);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,54 +27,52 @@ static uint32_t ParseModifier(std::string_view text)
|
|||
{
|
||||
return KMOD_CTRL;
|
||||
}
|
||||
else if (String::Equals(text, "LCTRL", true))
|
||||
if (String::Equals(text, "LCTRL", true))
|
||||
{
|
||||
return KMOD_LCTRL;
|
||||
}
|
||||
else if (String::Equals(text, "RCTRL", true))
|
||||
if (String::Equals(text, "RCTRL", true))
|
||||
{
|
||||
return KMOD_RCTRL;
|
||||
}
|
||||
else if (String::Equals(text, "SHIFT", true))
|
||||
if (String::Equals(text, "SHIFT", true))
|
||||
{
|
||||
return KMOD_SHIFT;
|
||||
}
|
||||
else if (String::Equals(text, "LSHIFT", true))
|
||||
if (String::Equals(text, "LSHIFT", true))
|
||||
{
|
||||
return KMOD_LSHIFT;
|
||||
}
|
||||
else if (String::Equals(text, "RSHIFT", true))
|
||||
if (String::Equals(text, "RSHIFT", true))
|
||||
{
|
||||
return KMOD_RSHIFT;
|
||||
}
|
||||
else if (String::Equals(text, "ALT", true))
|
||||
if (String::Equals(text, "ALT", true))
|
||||
{
|
||||
return KMOD_ALT;
|
||||
}
|
||||
else if (String::Equals(text, "LALT", true))
|
||||
if (String::Equals(text, "LALT", true))
|
||||
{
|
||||
return KMOD_LALT;
|
||||
}
|
||||
else if (String::Equals(text, "RALT", true))
|
||||
if (String::Equals(text, "RALT", true))
|
||||
{
|
||||
return KMOD_RALT;
|
||||
}
|
||||
else if (String::Equals(text, "GUI", true))
|
||||
if (String::Equals(text, "GUI", true))
|
||||
{
|
||||
return KMOD_GUI;
|
||||
}
|
||||
else if (String::Equals(text, "LCTRL", true))
|
||||
if (String::Equals(text, "LCTRL", true))
|
||||
{
|
||||
return KMOD_LGUI;
|
||||
}
|
||||
else if (String::Equals(text, "RGUI", true))
|
||||
if (String::Equals(text, "RGUI", true))
|
||||
{
|
||||
return KMOD_RGUI;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t ParseKey(std::string_view text)
|
||||
|
@ -99,10 +97,8 @@ static size_t FindPlus(std::string_view s, size_t index)
|
|||
index++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
@ -209,15 +205,11 @@ std::string_view ShortcutInput::GetModifierName(uint32_t key, bool localised)
|
|||
{
|
||||
return language_get_string(r->second.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
return r->second.first;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return {};
|
||||
|
||||
return r->second.first;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string_view ShortcutInput::GetLocalisedKeyName(uint32_t key)
|
||||
|
@ -260,10 +252,8 @@ std::string_view ShortcutInput::GetLocalisedKeyName(uint32_t key)
|
|||
{
|
||||
return language_get_string(r->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string ShortcutInput::ToString() const
|
||||
|
@ -350,13 +340,13 @@ bool ShortcutInput::AppendModifier(std::string& s, uint32_t left, uint32_t right
|
|||
s += "+";
|
||||
return true;
|
||||
}
|
||||
else if (Modifiers & left)
|
||||
if (Modifiers & left)
|
||||
{
|
||||
s += GetModifierName(left, localised);
|
||||
s += "+";
|
||||
return true;
|
||||
}
|
||||
else if (Modifiers & right)
|
||||
if (Modifiers & right)
|
||||
{
|
||||
s += GetModifierName(right, localised);
|
||||
s += "+";
|
||||
|
@ -379,7 +369,7 @@ static bool HasModifier(uint32_t shortcut, uint32_t actual, uint32_t left, uint3
|
|||
}
|
||||
return false;
|
||||
}
|
||||
else if (actual & (left | right))
|
||||
if (actual & (left | right))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -50,10 +50,8 @@ uint32_t LandTool::SizeToSpriteIndex(uint16_t size)
|
|||
{
|
||||
return toolSizeSpriteIndices[size];
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void LandTool::ShowSurfaceStyleDropdown(rct_window* w, rct_widget* widget, ObjectEntryIndex currentSurfaceType)
|
||||
|
|
|
@ -743,10 +743,8 @@ uint8_t ThemeGetColour(rct_windowclass wc, uint8_t index)
|
|||
}
|
||||
return desc->DefaultTheme.Colours[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return entry->Theme.Colours[index];
|
||||
}
|
||||
|
||||
return entry->Theme.Colours[index];
|
||||
}
|
||||
|
||||
void ThemeSetColour(rct_windowclass wc, uint8_t index, colour_t colour)
|
||||
|
|
|
@ -79,11 +79,9 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
|
|||
{
|
||||
if (info.SpriteType == ViewportInteractionItem::Entity && (sprite->Is<Balloon>() || sprite->Is<Duck>()))
|
||||
return info;
|
||||
else
|
||||
{
|
||||
info.SpriteType = ViewportInteractionItem::None;
|
||||
return info;
|
||||
}
|
||||
|
||||
info.SpriteType = ViewportInteractionItem::None;
|
||||
return info;
|
||||
}
|
||||
|
||||
switch (info.SpriteType)
|
||||
|
|
|
@ -354,17 +354,15 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
return &Desc.Widgets[widgetDescIndex];
|
||||
}
|
||||
else
|
||||
|
||||
auto page = static_cast<size_t>(w->page);
|
||||
if (Desc.Tabs.size() > page)
|
||||
{
|
||||
auto page = static_cast<size_t>(w->page);
|
||||
if (Desc.Tabs.size() > page)
|
||||
auto& widgets = Desc.Tabs[page].Widgets;
|
||||
auto tabWidgetIndex = widgetDescIndex - Desc.Widgets.size();
|
||||
if (tabWidgetIndex < widgets.size())
|
||||
{
|
||||
auto& widgets = Desc.Tabs[page].Widgets;
|
||||
auto tabWidgetIndex = widgetDescIndex - Desc.Widgets.size();
|
||||
if (tabWidgetIndex < widgets.size())
|
||||
{
|
||||
return &widgets[widgetDescIndex];
|
||||
}
|
||||
return &widgets[widgetDescIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,29 +152,27 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
return ToDuk(_ctx, undefined);
|
||||
}
|
||||
|
||||
DukObject obj(_ctx);
|
||||
obj.Set("id", id);
|
||||
obj.Set("offset", ToDuk<ScreenCoordsXY>(_ctx, { g1->x_offset, g1->y_offset }));
|
||||
obj.Set("width", g1->width);
|
||||
obj.Set("height", g1->height);
|
||||
|
||||
obj.Set("isBMP", (g1->flags & G1_FLAG_BMP) != 0);
|
||||
obj.Set("isRLE", (g1->flags & G1_FLAG_RLE_COMPRESSION) != 0);
|
||||
obj.Set("isPalette", (g1->flags & G1_FLAG_PALETTE) != 0);
|
||||
obj.Set("noZoom", (g1->flags & G1_FLAG_NO_ZOOM_DRAW) != 0);
|
||||
|
||||
if (g1->flags & G1_FLAG_HAS_ZOOM_SPRITE)
|
||||
{
|
||||
obj.Set("nextZoomId", id - g1->zoomed_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
DukObject obj(_ctx);
|
||||
obj.Set("id", id);
|
||||
obj.Set("offset", ToDuk<ScreenCoordsXY>(_ctx, { g1->x_offset, g1->y_offset }));
|
||||
obj.Set("width", g1->width);
|
||||
obj.Set("height", g1->height);
|
||||
|
||||
obj.Set("isBMP", (g1->flags & G1_FLAG_BMP) != 0);
|
||||
obj.Set("isRLE", (g1->flags & G1_FLAG_RLE_COMPRESSION) != 0);
|
||||
obj.Set("isPalette", (g1->flags & G1_FLAG_PALETTE) != 0);
|
||||
obj.Set("noZoom", (g1->flags & G1_FLAG_NO_ZOOM_DRAW) != 0);
|
||||
|
||||
if (g1->flags & G1_FLAG_HAS_ZOOM_SPRITE)
|
||||
{
|
||||
obj.Set("nextZoomId", id - g1->zoomed_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.Set("nextZoomId", undefined);
|
||||
}
|
||||
return obj.Take();
|
||||
obj.Set("nextZoomId", undefined);
|
||||
}
|
||||
return obj.Take();
|
||||
}
|
||||
|
||||
DukValue measureText(const std::string& text)
|
||||
|
|
|
@ -45,11 +45,9 @@ namespace OpenRCT2::Scripting
|
|||
range.Set("rightBottom", rightBottom.Take());
|
||||
return range.Take();
|
||||
}
|
||||
else
|
||||
{
|
||||
duk_push_null(_ctx);
|
||||
return DukValue::take_from_stack(_ctx);
|
||||
}
|
||||
|
||||
duk_push_null(_ctx);
|
||||
return DukValue::take_from_stack(_ctx);
|
||||
}
|
||||
|
||||
void range_set(DukValue value)
|
||||
|
|
|
@ -245,8 +245,8 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
if (_class == WC_MAIN_WINDOW)
|
||||
return window_get_main();
|
||||
else
|
||||
return window_find_by_number(_class, _number);
|
||||
|
||||
return window_find_by_number(_class, _number);
|
||||
}
|
||||
|
||||
rct_viewport* GetViewport() const
|
||||
|
@ -292,11 +292,9 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
return CoordsXYZ(x, y, dukZ.as_int());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto z = tile_element_height(CoordsXY(x, y));
|
||||
return CoordsXYZ(x, y, z);
|
||||
}
|
||||
|
||||
auto z = tile_element_height(CoordsXY(x, y));
|
||||
return CoordsXYZ(x, y, z);
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
|
|
|
@ -386,8 +386,8 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
if (_class == WC_MAIN_WINDOW)
|
||||
return window_get_main();
|
||||
else
|
||||
return window_find_by_number(_class, _number);
|
||||
|
||||
return window_find_by_number(_class, _number);
|
||||
}
|
||||
|
||||
rct_widget* GetWidget() const
|
||||
|
|
|
@ -1003,11 +1003,12 @@ private:
|
|||
{
|
||||
return;
|
||||
}
|
||||
else if (widgetIndex == WIDX_WEATHER_DROPDOWN_BUTTON)
|
||||
|
||||
if (widgetIndex == WIDX_WEATHER_DROPDOWN_BUTTON)
|
||||
{
|
||||
CheatsSet(CheatType::ForceWeather, dropdownIndex);
|
||||
}
|
||||
else if (widgetIndex == WIDX_STAFF_SPEED_DROPDOWN_BUTTON)
|
||||
if (widgetIndex == WIDX_STAFF_SPEED_DROPDOWN_BUTTON)
|
||||
{
|
||||
int32_t speed = CHEATS_STAFF_FAST_SPEED;
|
||||
switch (dropdownIndex)
|
||||
|
|
|
@ -1450,14 +1450,12 @@ static bool filter_selected(uint8_t objectFlag)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if (_FILTER_NONSELECTED && !(objectFlag & OBJECT_SELECTION_FLAG_SELECTED))
|
||||
if (_FILTER_NONSELECTED && !(objectFlag & OBJECT_SELECTION_FLAG_SELECTED))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool filter_string(const ObjectRepositoryItem* item)
|
||||
|
|
|
@ -1215,7 +1215,7 @@ static TileElement* footpath_get_tile_element_to_remove()
|
|||
|
||||
return tileElement;
|
||||
}
|
||||
else if (tileElement->GetBaseZ() == zLow)
|
||||
if (tileElement->GetBaseZ() == zLow)
|
||||
{
|
||||
if (!tileElement->AsPath()->IsSloped())
|
||||
{
|
||||
|
@ -1478,11 +1478,9 @@ static bool FootpathSelectDefault()
|
|||
// No surfaces or legacy paths available
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No surfaces available, so default to legacy path
|
||||
gFootpathSelection.LegacyPath = legacyPathIndex;
|
||||
}
|
||||
|
||||
// No surfaces available, so default to legacy path
|
||||
gFootpathSelection.LegacyPath = legacyPathIndex;
|
||||
}
|
||||
|
||||
gFootpathSelection.NormalSurface = surfaceIndex;
|
||||
|
|
|
@ -821,8 +821,8 @@ static void window_new_ride_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i
|
|||
{
|
||||
if (rideEntry->ride_type[i] == listItem->Type)
|
||||
break;
|
||||
else
|
||||
imageId++;
|
||||
|
||||
imageId++;
|
||||
}
|
||||
|
||||
gfx_draw_sprite_raw_masked(dpi, coords + ScreenCoordsXY{ 2, 2 }, SPR_NEW_RIDE_MASK, imageId);
|
||||
|
|
|
@ -139,12 +139,12 @@ public:
|
|||
buttonIndex = 0;
|
||||
break;
|
||||
}
|
||||
else if (mutableScreenCoords.x < 351 && newsItem.TypeHasSubject())
|
||||
if (mutableScreenCoords.x < 351 && newsItem.TypeHasSubject())
|
||||
{
|
||||
buttonIndex = 1;
|
||||
break;
|
||||
}
|
||||
else if (mutableScreenCoords.x < 376 && newsItem.TypeHasLocation())
|
||||
if (mutableScreenCoords.x < 376 && newsItem.TypeHasLocation())
|
||||
{
|
||||
buttonIndex = 2;
|
||||
break;
|
||||
|
|
|
@ -2172,12 +2172,10 @@ static OpenRCT2String window_options_advanced_tooltip(
|
|||
// No tooltip if the path is empty
|
||||
return { STR_NONE, {} };
|
||||
}
|
||||
else
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<utf8*>(gConfigGeneral.rct1_path);
|
||||
return { fallback, ft };
|
||||
}
|
||||
|
||||
auto ft = Formatter();
|
||||
ft.Add<utf8*>(gConfigGeneral.rct1_path);
|
||||
return { fallback, ft };
|
||||
}
|
||||
return { fallback, {} };
|
||||
}
|
||||
|
|
|
@ -1911,14 +1911,11 @@ static RideStatus window_ride_get_next_default_status(const Ride* ride)
|
|||
{
|
||||
return RideStatus::Closed;
|
||||
}
|
||||
else if (ride->SupportsStatus(RideStatus::Testing) && !(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
||||
if (ride->SupportsStatus(RideStatus::Testing) && !(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
||||
{
|
||||
return RideStatus::Testing;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RideStatus::Open;
|
||||
}
|
||||
return RideStatus::Open;
|
||||
case RideStatus::Simulating:
|
||||
return RideStatus::Testing;
|
||||
case RideStatus::Testing:
|
||||
|
@ -6023,10 +6020,8 @@ static OpenRCT2String window_ride_graphs_tooltip(rct_window* w, const rct_widget
|
|||
ft.Add<uint16_t>(measurement->vehicle_index + 1);
|
||||
return { fallback, ft };
|
||||
}
|
||||
else
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1315,21 +1315,21 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightHalfBankedHelixDownLarge | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::LeftHalfBankedHelixDownSmall | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT_SMALL && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT_SMALL && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightHalfBankedHelixDownSmall | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
|
@ -1346,7 +1346,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeDown | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
|
@ -1365,7 +1365,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightQuarterHelixLargeDown | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
|
@ -1447,21 +1447,21 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightHalfBankedHelixUpLarge | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_LEFT_SMALL && _currentTrackBankEnd == TRACK_BANK_LEFT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::LeftHalfBankedHelixUpSmall | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT_SMALL && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT_SMALL && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightHalfBankedHelixUpSmall | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
|
@ -1478,7 +1478,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT && _currentTrackBankEnd == TRACK_BANK_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightQuarterBankedHelixLargeUp | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
|
@ -1497,7 +1497,7 @@ static void window_ride_construction_mousedown(rct_window* w, rct_widgetindex wi
|
|||
window_ride_construction_update_active_elements();
|
||||
break;
|
||||
}
|
||||
else if (_currentTrackCurve == TRACK_CURVE_RIGHT)
|
||||
if (_currentTrackCurve == TRACK_CURVE_RIGHT)
|
||||
{
|
||||
_currentTrackCurve = TrackElemType::RightQuarterHelixLargeUp | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||
|
|
|
@ -208,38 +208,36 @@ static void window_save_prompt_mouseup(rct_window* w, rct_widgetindex widgetInde
|
|||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_SAVE:
|
||||
{
|
||||
Intent* intent;
|
||||
|
||||
if (gScreenFlags & (SCREEN_FLAGS_EDITOR))
|
||||
{
|
||||
intent = new Intent(WC_LOADSAVE);
|
||||
intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE);
|
||||
intent->putExtra(INTENT_EXTRA_PATH, gScenarioName);
|
||||
}
|
||||
else
|
||||
{
|
||||
intent = static_cast<Intent*>(create_save_game_as_intent());
|
||||
}
|
||||
window_close(w);
|
||||
intent->putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<void*>(window_save_prompt_callback));
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
break;
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_SAVE:
|
||||
{
|
||||
Intent* intent;
|
||||
|
||||
if (gScreenFlags & (SCREEN_FLAGS_EDITOR))
|
||||
{
|
||||
intent = new Intent(WC_LOADSAVE);
|
||||
intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE);
|
||||
intent->putExtra(INTENT_EXTRA_PATH, gScenarioName);
|
||||
}
|
||||
case WIDX_DONT_SAVE:
|
||||
game_load_or_quit_no_save_prompt();
|
||||
return;
|
||||
case WIDX_CLOSE:
|
||||
case WIDX_CANCEL:
|
||||
window_close(w);
|
||||
return;
|
||||
else
|
||||
{
|
||||
intent = static_cast<Intent*>(create_save_game_as_intent());
|
||||
}
|
||||
window_close(w);
|
||||
intent->putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<void*>(window_save_prompt_callback));
|
||||
context_open_intent(intent);
|
||||
delete intent;
|
||||
break;
|
||||
}
|
||||
case WIDX_DONT_SAVE:
|
||||
game_load_or_quit_no_save_prompt();
|
||||
return;
|
||||
case WIDX_CLOSE:
|
||||
case WIDX_CANCEL:
|
||||
window_close(w);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ static int32_t ScenarioSelectGetWindowWidth()
|
|||
// Shrink the window if we're showing scenarios by difficulty level.
|
||||
if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_DIFFICULTY && !_titleEditor)
|
||||
return 610;
|
||||
else
|
||||
return WW;
|
||||
|
||||
return WW;
|
||||
}
|
||||
|
||||
rct_window* window_scenarioselect_open(scenarioselect_callback callback, bool titleEditor)
|
||||
|
|
|
@ -238,7 +238,7 @@ static void window_scenery_sort_tabs()
|
|||
|
||||
if (a.SceneryGroupIndex == OBJECT_ENTRY_INDEX_NULL)
|
||||
return false;
|
||||
else if (b.SceneryGroupIndex == OBJECT_ENTRY_INDEX_NULL)
|
||||
if (b.SceneryGroupIndex == OBJECT_ENTRY_INDEX_NULL)
|
||||
return true;
|
||||
|
||||
auto entryA = a.GetSceneryGroupEntry();
|
||||
|
@ -916,15 +916,13 @@ OpenRCT2String window_scenery_tooltip(rct_window* w, const rct_widgetindex widge
|
|||
ft.Add<rct_string_id>(STR_MISCELLANEOUS);
|
||||
return { fallback, ft };
|
||||
}
|
||||
else
|
||||
|
||||
auto sceneryEntry = tabInfo.GetSceneryGroupEntry();
|
||||
if (sceneryEntry != nullptr)
|
||||
{
|
||||
auto sceneryEntry = tabInfo.GetSceneryGroupEntry();
|
||||
if (sceneryEntry != nullptr)
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(sceneryEntry->name);
|
||||
return { fallback, ft };
|
||||
}
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(sceneryEntry->name);
|
||||
return { fallback, ft };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -350,10 +350,8 @@ private:
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return group == groupFilter;
|
||||
}
|
||||
|
||||
return group == groupFilter;
|
||||
}
|
||||
|
||||
void InitialiseList()
|
||||
|
|
|
@ -1706,7 +1706,8 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
repaint_scenery_tool_down(windowPos, widgetIndex);
|
||||
return;
|
||||
}
|
||||
else if (gWindowSceneryEyedropperEnabled)
|
||||
|
||||
if (gWindowSceneryEyedropperEnabled)
|
||||
{
|
||||
scenery_eyedropper_tool_down(windowPos, widgetIndex);
|
||||
return;
|
||||
|
@ -3012,16 +3013,14 @@ static money64 selection_raise_land(uint8_t flags)
|
|||
: GameActions::Query(&landSmoothAction);
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto landRaiseAction = LandRaiseAction(
|
||||
{ centreX, centreY },
|
||||
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
|
||||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction)
|
||||
: GameActions::Query(&landRaiseAction);
|
||||
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED;
|
||||
}
|
||||
auto landRaiseAction = LandRaiseAction(
|
||||
{ centreX, centreY }, { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
|
||||
gMapSelectType);
|
||||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction)
|
||||
: GameActions::Query(&landRaiseAction);
|
||||
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3045,16 +3044,14 @@ static money64 selection_lower_land(uint8_t flags)
|
|||
: GameActions::Query(&landSmoothAction);
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto landLowerAction = LandLowerAction(
|
||||
{ centreX, centreY },
|
||||
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
|
||||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction)
|
||||
: GameActions::Query(&landLowerAction);
|
||||
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED;
|
||||
}
|
||||
auto landLowerAction = LandLowerAction(
|
||||
{ centreX, centreY }, { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
|
||||
gMapSelectType);
|
||||
auto res = (flags & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction)
|
||||
: GameActions::Query(&landLowerAction);
|
||||
|
||||
return res->Error == GameActions::Status::Ok ? res->Cost : MONEY64_UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -267,7 +267,8 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
fprintf(stdout, "usage: sprite details <spritefile> [idx]\n");
|
||||
return -1;
|
||||
}
|
||||
else if (argc == 2)
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
const char* spriteFilePath = argv[1];
|
||||
auto spriteFile = SpriteFile::Open(spriteFilePath);
|
||||
|
@ -281,33 +282,32 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
printf("data size: %u\n", spriteFile->Header.total_size);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
const char* spriteFilePath = argv[1];
|
||||
int32_t spriteIndex = atoi(argv[2]);
|
||||
auto spriteFile = SpriteFile::Open(spriteFilePath);
|
||||
if (!spriteFile.has_value())
|
||||
{
|
||||
const char* spriteFilePath = argv[1];
|
||||
int32_t spriteIndex = atoi(argv[2]);
|
||||
auto spriteFile = SpriteFile::Open(spriteFilePath);
|
||||
if (!spriteFile.has_value())
|
||||
{
|
||||
fprintf(stderr, "Unable to open input sprite file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (spriteIndex < 0 || spriteIndex >= static_cast<int32_t>(spriteFile->Header.num_entries))
|
||||
{
|
||||
fprintf(stderr, "Sprite #%d does not exist in sprite file.\n", spriteIndex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rct_g1_element* g1 = &spriteFile->Entries[spriteIndex];
|
||||
printf("width: %d\n", g1->width);
|
||||
printf("height: %d\n", g1->height);
|
||||
printf("x offset: %d\n", g1->x_offset);
|
||||
printf("y offset: %d\n", g1->y_offset);
|
||||
printf("data offset: %p\n", g1->offset);
|
||||
return 1;
|
||||
fprintf(stderr, "Unable to open input sprite file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (spriteIndex < 0 || spriteIndex >= static_cast<int32_t>(spriteFile->Header.num_entries))
|
||||
{
|
||||
fprintf(stderr, "Sprite #%d does not exist in sprite file.\n", spriteIndex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rct_g1_element* g1 = &spriteFile->Entries[spriteIndex];
|
||||
printf("width: %d\n", g1->width);
|
||||
printf("height: %d\n", g1->height);
|
||||
printf("x offset: %d\n", g1->x_offset);
|
||||
printf("y offset: %d\n", g1->y_offset);
|
||||
printf("data offset: %p\n", g1->offset);
|
||||
return 1;
|
||||
}
|
||||
else if (_strcmpi(argv[0], "export") == 0)
|
||||
|
||||
if (_strcmpi(argv[0], "export") == 0)
|
||||
{
|
||||
if (argc < 4)
|
||||
{
|
||||
|
@ -339,7 +339,8 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
else if (_strcmpi(argv[0], "exportall") == 0)
|
||||
|
||||
if (_strcmpi(argv[0], "exportall") == 0)
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
|
@ -409,7 +410,8 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
else if (_strcmpi(argv[0], "exportalldat") == 0)
|
||||
|
||||
if (_strcmpi(argv[0], "exportalldat") == 0)
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
|
@ -498,7 +500,8 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
else if (_strcmpi(argv[0], "create") == 0)
|
||||
|
||||
if (_strcmpi(argv[0], "create") == 0)
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
|
@ -512,7 +515,8 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
spriteFile.Save(spriteFilePath);
|
||||
return 1;
|
||||
}
|
||||
else if (_strcmpi(argv[0], "append") == 0)
|
||||
|
||||
if (_strcmpi(argv[0], "append") == 0)
|
||||
{
|
||||
if (argc != 3 && argc != 5)
|
||||
{
|
||||
|
@ -562,7 +566,8 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
|
||||
return 1;
|
||||
}
|
||||
else if (_strcmpi(argv[0], "build") == 0)
|
||||
|
||||
if (_strcmpi(argv[0], "build") == 0)
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
|
@ -650,9 +655,7 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
fprintf(stdout, "Finished\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Unknown sprite command.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Unknown sprite command.\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -588,15 +588,13 @@ namespace OpenRCT2
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
if (!LoadParkFromStream(&fs, path, loadTitleScreenOnFail, asScenario))
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
if (!LoadParkFromStream(&fs, path, loadTitleScreenOnFail, asScenario))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
|
@ -531,12 +531,14 @@ bool window_editor_object_selection_select_object(uint8_t isMasterObject, int32_
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if (*selectionFlags & OBJECT_SELECTION_FLAG_IN_USE)
|
||||
|
||||
if (*selectionFlags & OBJECT_SELECTION_FLAG_IN_USE)
|
||||
{
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_CURRENTLY_IN_USE);
|
||||
return false;
|
||||
}
|
||||
else if (*selectionFlags & OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED)
|
||||
|
||||
if (*selectionFlags & OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED)
|
||||
{
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_ALWAYS_REQUIRED);
|
||||
return false;
|
||||
|
@ -555,66 +557,65 @@ bool window_editor_object_selection_select_object(uint8_t isMasterObject, int32_
|
|||
*selectionFlags &= ~OBJECT_SELECTION_FLAG_SELECTED;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if (isMasterObject == 0)
|
||||
{
|
||||
if (isMasterObject == 0)
|
||||
if (flags & INPUT_FLAG_EDITOR_OBJECT_ALWAYS_REQUIRED)
|
||||
{
|
||||
if (flags & INPUT_FLAG_EDITOR_OBJECT_ALWAYS_REQUIRED)
|
||||
{
|
||||
*selectionFlags |= OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED;
|
||||
}
|
||||
}
|
||||
if (*selectionFlags & OBJECT_SELECTION_FLAG_SELECTED)
|
||||
{
|
||||
return true;
|
||||
*selectionFlags |= OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED;
|
||||
}
|
||||
}
|
||||
|
||||
ObjectType objectType = item->Type;
|
||||
uint16_t maxObjects = object_entry_group_counts[EnumValue(objectType)];
|
||||
|
||||
if (maxObjects <= _numSelectedObjectsForType[EnumValue(objectType)])
|
||||
{
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (objectType == ObjectType::SceneryGroup && (flags & INPUT_FLAG_EDITOR_OBJECT_SELECT_OBJECTS_IN_SCENERY_GROUP))
|
||||
{
|
||||
for (const auto& sgEntry : item->SceneryGroupInfo.Entries)
|
||||
{
|
||||
if (!window_editor_object_selection_select_object(++isMasterObject, flags, sgEntry))
|
||||
{
|
||||
_maxObjectsWasHit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (objectType == ObjectType::Water)
|
||||
{
|
||||
// Replace old palette with newly selected palette immediately.
|
||||
ReplaceSelectedWaterPalette(item);
|
||||
}
|
||||
|
||||
if (isMasterObject != 0 && !(flags & INPUT_FLAG_EDITOR_OBJECT_1))
|
||||
{
|
||||
char objectName[64];
|
||||
object_create_identifier_name(objectName, 64, &item->ObjectEntry);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<const char*>(objectName);
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_SHOULD_SELECT_X_FIRST);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (maxObjects <= _numSelectedObjectsForType[EnumValue(objectType)])
|
||||
{
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
_numSelectedObjectsForType[EnumValue(objectType)]++;
|
||||
|
||||
*selectionFlags |= OBJECT_SELECTION_FLAG_SELECTED;
|
||||
if (*selectionFlags & OBJECT_SELECTION_FLAG_SELECTED)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ObjectType objectType = item->Type;
|
||||
uint16_t maxObjects = object_entry_group_counts[EnumValue(objectType)];
|
||||
|
||||
if (maxObjects <= _numSelectedObjectsForType[EnumValue(objectType)])
|
||||
{
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (objectType == ObjectType::SceneryGroup && (flags & INPUT_FLAG_EDITOR_OBJECT_SELECT_OBJECTS_IN_SCENERY_GROUP))
|
||||
{
|
||||
for (const auto& sgEntry : item->SceneryGroupInfo.Entries)
|
||||
{
|
||||
if (!window_editor_object_selection_select_object(++isMasterObject, flags, sgEntry))
|
||||
{
|
||||
_maxObjectsWasHit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (objectType == ObjectType::Water)
|
||||
{
|
||||
// Replace old palette with newly selected palette immediately.
|
||||
ReplaceSelectedWaterPalette(item);
|
||||
}
|
||||
|
||||
if (isMasterObject != 0 && !(flags & INPUT_FLAG_EDITOR_OBJECT_1))
|
||||
{
|
||||
char objectName[64];
|
||||
object_create_identifier_name(objectName, 64, &item->ObjectEntry);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<const char*>(objectName);
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_SHOULD_SELECT_X_FIRST);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (maxObjects <= _numSelectedObjectsForType[EnumValue(objectType)])
|
||||
{
|
||||
set_object_selection_error(isMasterObject, STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
_numSelectedObjectsForType[EnumValue(objectType)]++;
|
||||
|
||||
*selectionFlags |= OBJECT_SELECTION_FLAG_SELECTED;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool window_editor_object_selection_select_object(
|
||||
|
|
|
@ -702,10 +702,8 @@ namespace OpenRCT2
|
|||
cs.ReadWrite(award.Type);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
cs.ReadWrite(gParkValue);
|
||||
|
@ -4505,10 +4503,8 @@ static const FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& de
|
|||
objectEntry.SetName(datPathName.value());
|
||||
return GetFootpathSurfaceId(ObjectEntryDescriptor(objectEntry));
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Even old .park saves with DAT identifiers somehow exist.
|
||||
|
|
|
@ -106,10 +106,7 @@ GameActions::Result::Ptr FootpathPlaceAction::Query() const
|
|||
{
|
||||
return ElementInsertQuery(std::move(res));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ElementUpdateQuery(tileElement, std::move(res));
|
||||
}
|
||||
return ElementUpdateQuery(tileElement, std::move(res));
|
||||
}
|
||||
|
||||
GameActions::Result::Ptr FootpathPlaceAction::Execute() const
|
||||
|
@ -150,10 +147,7 @@ GameActions::Result::Ptr FootpathPlaceAction::Execute() const
|
|||
{
|
||||
return ElementInsertExecute(std::move(res));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ElementUpdateExecute(tileElement, std::move(res));
|
||||
}
|
||||
return ElementUpdateExecute(tileElement, std::move(res));
|
||||
}
|
||||
|
||||
bool FootpathPlaceAction::IsSameAsPathElement(const PathElement* pathElement) const
|
||||
|
@ -169,22 +163,16 @@ bool FootpathPlaceAction::IsSameAsPathElement(const PathElement* pathElement) co
|
|||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pathElement->GetSurfaceEntryIndex() == _type && pathElement->GetRailingsEntryIndex() == _railingsType;
|
||||
}
|
||||
|
||||
return pathElement->GetSurfaceEntryIndex() == _type && pathElement->GetRailingsEntryIndex() == _railingsType;
|
||||
}
|
||||
else
|
||||
|
||||
if (_constructFlags & PathConstructFlag::IsLegacyPathObject)
|
||||
{
|
||||
if (_constructFlags & PathConstructFlag::IsLegacyPathObject)
|
||||
{
|
||||
return pathElement->GetLegacyPathEntryIndex() == _type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pathElement->GetLegacyPathEntryIndex() == _type;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FootpathPlaceAction::IsSameAsEntranceElement(const EntranceElement& entranceElement) const
|
||||
|
@ -195,20 +183,16 @@ bool FootpathPlaceAction::IsSameAsEntranceElement(const EntranceElement& entranc
|
|||
{
|
||||
return entranceElement.GetLegacyPathEntryIndex() == _type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_constructFlags & PathConstructFlag::IsLegacyPathObject)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return entranceElement.GetSurfaceEntryIndex() == _type;
|
||||
}
|
||||
|
||||
return entranceElement.GetSurfaceEntryIndex() == _type;
|
||||
}
|
||||
|
||||
GameActions::Result::Ptr FootpathPlaceAction::ElementUpdateQuery(PathElement* pathElement, GameActions::Result::Ptr res) const
|
||||
|
|
|
@ -281,18 +281,14 @@ bool FootpathPlaceFromTrackAction::IsSameAsEntranceElement(const EntranceElement
|
|||
{
|
||||
return entranceElement.GetLegacyPathEntryIndex() == _type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_constructFlags & PathConstructFlag::IsLegacyPathObject)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return entranceElement.GetSurfaceEntryIndex() == _type;
|
||||
}
|
||||
|
||||
return entranceElement.GetSurfaceEntryIndex() == _type;
|
||||
}
|
||||
|
|
|
@ -165,7 +165,8 @@ GameActions::Result::Ptr FootpathRemoveAction::RemoveBannersAtElement(const Coor
|
|||
{
|
||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
return result;
|
||||
else if (tileElement->GetType() != TILE_ELEMENT_TYPE_BANNER)
|
||||
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_BANNER)
|
||||
continue;
|
||||
|
||||
auto bannerRemoveAction = BannerRemoveAction({ loc, tileElement->GetBaseZ(), tileElement->AsBanner()->GetPosition() });
|
||||
|
|
|
@ -335,7 +335,7 @@ namespace GameActions
|
|||
{
|
||||
if (network_get_mode() == NETWORK_MODE_CLIENT)
|
||||
return "cl";
|
||||
else if (network_get_mode() == NETWORK_MODE_SERVER)
|
||||
if (network_get_mode() == NETWORK_MODE_SERVER)
|
||||
return "sv";
|
||||
return "sp";
|
||||
}
|
||||
|
|
|
@ -198,7 +198,8 @@ rct_string_id LandSetHeightAction::CheckParameters() const
|
|||
{
|
||||
return STR_TOO_HIGH;
|
||||
}
|
||||
else if (_height > MAXIMUM_LAND_HEIGHT - 2 && (_style & TILE_ELEMENT_SURFACE_SLOPE_MASK) != 0)
|
||||
|
||||
if (_height > MAXIMUM_LAND_HEIGHT - 2 && (_style & TILE_ELEMENT_SURFACE_SLOPE_MASK) != 0)
|
||||
{
|
||||
return STR_TOO_HIGH;
|
||||
}
|
||||
|
|
|
@ -291,9 +291,6 @@ rct_string_id RideSetSettingAction::GetOperationErrorMessage(Ride* ride) const
|
|||
{
|
||||
return STR_CANT_CHANGE_THIS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return STR_CANT_CHANGE_LAUNCH_SPEED;
|
||||
}
|
||||
return STR_CANT_CHANGE_LAUNCH_SPEED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@ GameActions::Result::Ptr RideSetStatusAction::Query() const
|
|||
res->ErrorMessage = STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING;
|
||||
return res;
|
||||
}
|
||||
else if (_status == RideStatus::Testing || _status == RideStatus::Simulating)
|
||||
|
||||
if (_status == RideStatus::Testing || _status == RideStatus::Simulating)
|
||||
{
|
||||
if (!ride->Test(_status, false))
|
||||
{
|
||||
|
|
|
@ -38,10 +38,8 @@ bool CommandLineArgEnumerator::Backtrack()
|
|||
_index--;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CommandLineArgEnumerator::TryPop()
|
||||
|
@ -51,10 +49,8 @@ bool CommandLineArgEnumerator::TryPop()
|
|||
_index++;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CommandLineArgEnumerator::TryPopInteger(int32_t* result)
|
||||
|
@ -89,10 +85,8 @@ bool CommandLineArgEnumerator::TryPopString(const char** result)
|
|||
_index++;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
@ -317,11 +311,9 @@ namespace CommandLine
|
|||
// Found matching command
|
||||
return command;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Recurse for the sub command table
|
||||
return FindCommandFor(command->SubCommands, argEnumerator);
|
||||
}
|
||||
|
||||
// Recurse for the sub command table
|
||||
return FindCommandFor(command->SubCommands, argEnumerator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,10 +356,8 @@ namespace CommandLine
|
|||
Console::Error::WriteLine("All options must be passed at the end of the command line.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -424,12 +414,10 @@ namespace CommandLine
|
|||
Console::Error::WriteLine("Option is a switch: %s", optionName);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
if (!ParseOptionValue(option, equalsCh + 1))
|
||||
{
|
||||
if (!ParseOptionValue(option, equalsCh + 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,8 +551,6 @@ int32_t cmdline_run(const char** argv, int32_t argc)
|
|||
{
|
||||
return CommandLine::HandleCommandDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
return command->Func(&argEnumerator);
|
||||
}
|
||||
|
||||
return command->Func(&argEnumerator);
|
||||
}
|
||||
|
|
|
@ -387,11 +387,9 @@ static exitcode_t HandleCommandSetRCT2(CommandLineArgEnumerator* enumerator)
|
|||
Console::WriteLine("Updated config.ini");
|
||||
return EXITCODE_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::Error::WriteLine("Unable to update config.ini");
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
Console::Error::WriteLine("Unable to update config.ini");
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
static exitcode_t HandleCommandScanObjects([[maybe_unused]] CommandLineArgEnumerator* enumerator)
|
||||
|
|
|
@ -68,11 +68,9 @@ static exitcode_t HandleUriJoin(const std::vector<std::string>& args)
|
|||
gNetworkStartPort = port;
|
||||
return EXITCODE_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::Error::WriteLine("Expected hostname:port after join");
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
Console::Error::WriteLine("Expected hostname:port after join");
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
static bool TryParseHostnamePort(
|
||||
|
|
|
@ -327,7 +327,8 @@ private:
|
|||
{
|
||||
return s.substr(0, i);
|
||||
}
|
||||
else if (c == inQuotes && !escaped)
|
||||
|
||||
if (c == inQuotes && !escaped)
|
||||
{
|
||||
inQuotes = 0;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ private:
|
|||
return true;
|
||||
else if constexpr (std::is_integral_v<T>)
|
||||
return true;
|
||||
return false;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static constexpr auto ValueDistance(T a, T b)
|
||||
|
@ -134,10 +135,8 @@ public:
|
|||
auto index = static_cast<size_t>(k);
|
||||
return _map.begin() + index;
|
||||
}
|
||||
else
|
||||
{
|
||||
return binarySearchValue();
|
||||
}
|
||||
|
||||
return binarySearchValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -257,14 +257,13 @@ namespace Imaging
|
|||
{
|
||||
return IMAGE_FORMAT::PNG;
|
||||
}
|
||||
else if (String::EndsWith(path, ".bmp", true))
|
||||
|
||||
if (String::EndsWith(path, ".bmp", true))
|
||||
{
|
||||
return IMAGE_FORMAT::BITMAP;
|
||||
}
|
||||
else
|
||||
{
|
||||
return IMAGE_FORMAT::UNKNOWN;
|
||||
}
|
||||
|
||||
return IMAGE_FORMAT::UNKNOWN;
|
||||
}
|
||||
|
||||
static ImageReaderFunc GetReader(IMAGE_FORMAT format)
|
||||
|
|
|
@ -194,22 +194,18 @@ namespace OpenRCT2
|
|||
f(stream);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentChunk.Id = chunkId;
|
||||
_currentChunk.Offset = _buffer.GetPosition();
|
||||
_currentChunk.Length = 0;
|
||||
ChunkStream stream(_buffer, _mode);
|
||||
f(stream);
|
||||
_currentChunk.Length = static_cast<uint64_t>(_buffer.GetPosition()) - _currentChunk.Offset;
|
||||
_chunks.push_back(_currentChunk);
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_currentChunk.Id = chunkId;
|
||||
_currentChunk.Offset = _buffer.GetPosition();
|
||||
_currentChunk.Length = 0;
|
||||
ChunkStream stream(_buffer, _mode);
|
||||
f(stream);
|
||||
_currentChunk.Length = static_cast<uint64_t>(_buffer.GetPosition()) - _currentChunk.Offset;
|
||||
_chunks.push_back(_currentChunk);
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -519,12 +515,10 @@ namespace OpenRCT2
|
|||
Read(&raw, sizeof(raw));
|
||||
return static_cast<T>(raw);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t raw{};
|
||||
Read(&raw, sizeof(raw));
|
||||
return static_cast<T>(raw);
|
||||
}
|
||||
|
||||
uint64_t raw{};
|
||||
Read(&raw, sizeof(raw));
|
||||
return static_cast<T>(raw);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -621,16 +615,14 @@ namespace OpenRCT2
|
|||
arrayState.LastPos = _buffer.GetPosition();
|
||||
return arrayState.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
arrayState.Count = 0;
|
||||
arrayState.ElementSize = 0;
|
||||
arrayState.StartPos = _buffer.GetPosition();
|
||||
Write<uint32_t>(0);
|
||||
Write<uint32_t>(0);
|
||||
arrayState.LastPos = _buffer.GetPosition();
|
||||
return 0;
|
||||
}
|
||||
|
||||
arrayState.Count = 0;
|
||||
arrayState.ElementSize = 0;
|
||||
arrayState.StartPos = _buffer.GetPosition();
|
||||
Write<uint32_t>(0);
|
||||
Write<uint32_t>(0);
|
||||
arrayState.LastPos = _buffer.GetPosition();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool NextArrayElement()
|
||||
|
@ -650,24 +642,22 @@ namespace OpenRCT2
|
|||
arrayState.Count--;
|
||||
return arrayState.Count == 0;
|
||||
}
|
||||
else
|
||||
|
||||
auto lastElSize = static_cast<size_t>(_buffer.GetPosition()) - arrayState.LastPos;
|
||||
if (arrayState.Count == 0)
|
||||
{
|
||||
auto lastElSize = static_cast<size_t>(_buffer.GetPosition()) - arrayState.LastPos;
|
||||
if (arrayState.Count == 0)
|
||||
{
|
||||
// Set array element size based on first element size
|
||||
arrayState.ElementSize = lastElSize;
|
||||
}
|
||||
else if (arrayState.ElementSize != lastElSize)
|
||||
{
|
||||
// Array element size was different from first element so reset it
|
||||
// to dynamic
|
||||
arrayState.ElementSize = 0;
|
||||
}
|
||||
arrayState.Count++;
|
||||
arrayState.LastPos = _buffer.GetPosition();
|
||||
return true;
|
||||
// Set array element size based on first element size
|
||||
arrayState.ElementSize = lastElSize;
|
||||
}
|
||||
else if (arrayState.ElementSize != lastElSize)
|
||||
{
|
||||
// Array element size was different from first element so reset it
|
||||
// to dynamic
|
||||
arrayState.ElementSize = 0;
|
||||
}
|
||||
arrayState.Count++;
|
||||
arrayState.LastPos = _buffer.GetPosition();
|
||||
return true;
|
||||
}
|
||||
|
||||
void EndArray()
|
||||
|
|
|
@ -42,22 +42,16 @@ namespace Path
|
|||
{
|
||||
return std::string(a) + std::string(b.substr(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string(a) + std::string(b);
|
||||
}
|
||||
|
||||
return std::string(a) + std::string(b);
|
||||
}
|
||||
else
|
||||
|
||||
if (Platform::IsPathSeparator(bBegin))
|
||||
{
|
||||
if (Platform::IsPathSeparator(bBegin))
|
||||
{
|
||||
return std::string(a) + std::string(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string(a) + PATH_SEPARATOR + std::string(b);
|
||||
}
|
||||
return std::string(a) + std::string(b);
|
||||
}
|
||||
|
||||
return std::string(a) + PATH_SEPARATOR + std::string(b);
|
||||
}
|
||||
|
||||
std::string GetDirectory(const std::string& path)
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace String
|
|||
{
|
||||
if (str == nullptr)
|
||||
return std::string();
|
||||
else
|
||||
return std::string(str);
|
||||
|
||||
return std::string(str);
|
||||
}
|
||||
|
||||
std::string StdFormat_VA(const utf8* format, va_list args)
|
||||
|
@ -138,10 +138,8 @@ namespace String
|
|||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
len++;
|
||||
}
|
||||
|
||||
len++;
|
||||
}
|
||||
return std::string_view(ch, len);
|
||||
}
|
||||
|
@ -168,10 +166,8 @@ namespace String
|
|||
{
|
||||
return _stricmp(a, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strcmp(a, b);
|
||||
}
|
||||
|
||||
return strcmp(a, b);
|
||||
}
|
||||
|
||||
bool Equals(std::string_view a, std::string_view b, bool ignoreCase)
|
||||
|
@ -189,15 +185,11 @@ namespace String
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return a == b;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return a == b;
|
||||
}
|
||||
|
||||
bool Equals(const std::string& a, const std::string& b, bool ignoreCase)
|
||||
|
@ -251,10 +243,8 @@ namespace String
|
|||
{
|
||||
return _stricmp(a, b) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return strcmp(a, b) == 0;
|
||||
}
|
||||
|
||||
return strcmp(a, b) == 0;
|
||||
}
|
||||
|
||||
bool StartsWith(std::string_view str, std::string_view match, bool ignoreCase)
|
||||
|
@ -306,10 +296,8 @@ namespace String
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lastOccurance - str;
|
||||
}
|
||||
|
||||
return lastOccurance - str;
|
||||
}
|
||||
|
||||
size_t LengthOf(const utf8* str)
|
||||
|
@ -791,10 +779,8 @@ namespace String
|
|||
log_warning("LCMapStringEx failed with %d", error);
|
||||
return std::string(src);
|
||||
}
|
||||
else
|
||||
{
|
||||
return String::ToUtf8(dstW);
|
||||
}
|
||||
|
||||
return String::ToUtf8(dstW);
|
||||
# else
|
||||
std::string dst = std::string(src);
|
||||
std::transform(dst.begin(), dst.end(), dst.begin(), [](unsigned char c) { return std::toupper(c); });
|
||||
|
|
|
@ -158,15 +158,15 @@ namespace String
|
|||
{
|
||||
return { 1 };
|
||||
}
|
||||
else if (v.size() >= 2 && ((v[0] & 0xE0) == 0xC0))
|
||||
if (v.size() >= 2 && ((v[0] & 0xE0) == 0xC0))
|
||||
{
|
||||
return { 2 };
|
||||
}
|
||||
else if (v.size() >= 3 && ((v[0] & 0xF0) == 0xE0))
|
||||
if (v.size() >= 3 && ((v[0] & 0xF0) == 0xE0))
|
||||
{
|
||||
return { 3 };
|
||||
}
|
||||
else if (v.size() >= 4 && ((v[0] & 0xF8) == 0xF0))
|
||||
if (v.size() >= 4 && ((v[0] & 0xF8) == 0xF0))
|
||||
{
|
||||
return { 4 };
|
||||
}
|
||||
|
|
|
@ -121,10 +121,8 @@ public:
|
|||
{
|
||||
return zipFileStat.size;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> GetFileData(std::string_view path) const override
|
||||
|
@ -306,11 +304,9 @@ private:
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_pos += readBytes;
|
||||
return static_cast<uint64_t>(readBytes);
|
||||
}
|
||||
|
||||
_pos += readBytes;
|
||||
return static_cast<uint64_t>(readBytes);
|
||||
}
|
||||
|
||||
const void* GetData() const override
|
||||
|
|
|
@ -56,15 +56,15 @@ sprite_peep_pickup_starts[15] =
|
|||
|
||||
static inline uint32_t rctc_to_rct2_index(uint32_t image)
|
||||
{
|
||||
if ( image < 1542) return image;
|
||||
else if (image >= 1574 && image < 4983) return image - 32;
|
||||
else if (image >= 4986 && image < 17189) return image - 35;
|
||||
else if (image >= 17191 && image < 18121) return image - 37;
|
||||
else if (image >= 18123 && image < 23800) return image - 39;
|
||||
else if (image >= 23804 && image < 24670) return image - 43;
|
||||
else if (image >= 24674 && image < 28244) return image - 47;
|
||||
else if (image >= 28246 ) return image - 49;
|
||||
else throw std::runtime_error("Invalid RCTC g1.dat file");
|
||||
if ( image < 1542) return image;
|
||||
if (image >= 1574 && image < 4983) return image - 32;
|
||||
if (image >= 4986 && image < 17189) return image - 35;
|
||||
if (image >= 17191 && image < 18121) return image - 37;
|
||||
if (image >= 18123 && image < 23800) return image - 39;
|
||||
if (image >= 23804 && image < 24670) return image - 43;
|
||||
if (image >= 24674 && image < 28244) return image - 47;
|
||||
if (image >= 28246 ) return image - 49;
|
||||
throw std::runtime_error("Invalid RCTC g1.dat file");
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
|
@ -371,38 +371,34 @@ static std::optional<PaletteMap> FASTCALL gfx_draw_sprite_get_palette(ImageId im
|
|||
}
|
||||
return GetPaletteMapForColour(paletteId);
|
||||
}
|
||||
else
|
||||
|
||||
auto paletteMap = PaletteMap(gPeepPalette);
|
||||
if (imageId.HasTertiary())
|
||||
{
|
||||
auto paletteMap = PaletteMap(gPeepPalette);
|
||||
if (imageId.HasTertiary())
|
||||
{
|
||||
paletteMap = PaletteMap(gOtherPalette);
|
||||
auto tertiaryPaletteMap = GetPaletteMapForColour(imageId.GetTertiary());
|
||||
if (tertiaryPaletteMap.has_value())
|
||||
{
|
||||
paletteMap.Copy(
|
||||
PALETTE_OFFSET_REMAP_TERTIARY, tertiaryPaletteMap.value(), PALETTE_OFFSET_REMAP_PRIMARY,
|
||||
PALETTE_LENGTH_REMAP);
|
||||
}
|
||||
}
|
||||
|
||||
auto primaryPaletteMap = GetPaletteMapForColour(imageId.GetPrimary());
|
||||
if (primaryPaletteMap.has_value())
|
||||
paletteMap = PaletteMap(gOtherPalette);
|
||||
auto tertiaryPaletteMap = GetPaletteMapForColour(imageId.GetTertiary());
|
||||
if (tertiaryPaletteMap.has_value())
|
||||
{
|
||||
paletteMap.Copy(
|
||||
PALETTE_OFFSET_REMAP_PRIMARY, primaryPaletteMap.value(), PALETTE_OFFSET_REMAP_PRIMARY, PALETTE_LENGTH_REMAP);
|
||||
PALETTE_OFFSET_REMAP_TERTIARY, tertiaryPaletteMap.value(), PALETTE_OFFSET_REMAP_PRIMARY, PALETTE_LENGTH_REMAP);
|
||||
}
|
||||
|
||||
auto secondaryPaletteMap = GetPaletteMapForColour(imageId.GetSecondary());
|
||||
if (secondaryPaletteMap.has_value())
|
||||
{
|
||||
paletteMap.Copy(
|
||||
PALETTE_OFFSET_REMAP_SECONDARY, secondaryPaletteMap.value(), PALETTE_OFFSET_REMAP_PRIMARY,
|
||||
PALETTE_LENGTH_REMAP);
|
||||
}
|
||||
|
||||
return paletteMap;
|
||||
}
|
||||
|
||||
auto primaryPaletteMap = GetPaletteMapForColour(imageId.GetPrimary());
|
||||
if (primaryPaletteMap.has_value())
|
||||
{
|
||||
paletteMap.Copy(
|
||||
PALETTE_OFFSET_REMAP_PRIMARY, primaryPaletteMap.value(), PALETTE_OFFSET_REMAP_PRIMARY, PALETTE_LENGTH_REMAP);
|
||||
}
|
||||
|
||||
auto secondaryPaletteMap = GetPaletteMapForColour(imageId.GetSecondary());
|
||||
if (secondaryPaletteMap.has_value())
|
||||
{
|
||||
paletteMap.Copy(
|
||||
PALETTE_OFFSET_REMAP_SECONDARY, secondaryPaletteMap.value(), PALETTE_OFFSET_REMAP_PRIMARY, PALETTE_LENGTH_REMAP);
|
||||
}
|
||||
|
||||
return paletteMap;
|
||||
}
|
||||
|
||||
void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo* dpi, ImageId imageId, const ScreenCoordsXY& spriteCoords)
|
||||
|
@ -667,11 +663,13 @@ const rct_g1_element* gfx_get_g1_element(int32_t image_id)
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
else if (offset == SPR_TEMP)
|
||||
|
||||
if (offset == SPR_TEMP)
|
||||
{
|
||||
return &_g1Temp;
|
||||
}
|
||||
else if (offset < SPR_RCTC_G1_END)
|
||||
|
||||
if (offset < SPR_RCTC_G1_END)
|
||||
{
|
||||
if (offset < _g1.elements.size())
|
||||
{
|
||||
|
@ -685,10 +683,8 @@ const rct_g1_element* gfx_get_g1_element(int32_t image_id)
|
|||
{
|
||||
return &_g2.elements[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
log_warning("Invalid entry in g2.dat requested, idx = %u. You may have to update your g2.dat.", idx);
|
||||
}
|
||||
|
||||
log_warning("Invalid entry in g2.dat requested, idx = %u. You may have to update your g2.dat.", idx);
|
||||
}
|
||||
else if (offset < SPR_CSG_END)
|
||||
{
|
||||
|
@ -699,10 +695,8 @@ const rct_g1_element* gfx_get_g1_element(int32_t image_id)
|
|||
{
|
||||
return &_csg.elements[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
log_warning("Invalid entry in csg.dat requested, idx = %u.", idx);
|
||||
}
|
||||
|
||||
log_warning("Invalid entry in csg.dat requested, idx = %u.", idx);
|
||||
}
|
||||
}
|
||||
else if (offset < SPR_SCROLLING_TEXT_END)
|
||||
|
@ -796,31 +790,28 @@ size_t g1_calculate_data_size(const rct_g1_element* g1)
|
|||
{
|
||||
return g1->width * 3;
|
||||
}
|
||||
else if (g1->flags & G1_FLAG_RLE_COMPRESSION)
|
||||
|
||||
if (g1->flags & G1_FLAG_RLE_COMPRESSION)
|
||||
{
|
||||
if (g1->offset == nullptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
||||
auto idx = (g1->height - 1) * 2;
|
||||
uint16_t offset = g1->offset[idx] | (g1->offset[idx + 1] << 8);
|
||||
uint8_t* ptr = g1->offset + offset;
|
||||
bool endOfLine = false;
|
||||
do
|
||||
{
|
||||
auto idx = (g1->height - 1) * 2;
|
||||
uint16_t offset = g1->offset[idx] | (g1->offset[idx + 1] << 8);
|
||||
uint8_t* ptr = g1->offset + offset;
|
||||
bool endOfLine = false;
|
||||
do
|
||||
{
|
||||
uint8_t chunk0 = *ptr++;
|
||||
ptr++; // offset
|
||||
uint8_t chunkSize = chunk0 & 0x7F;
|
||||
ptr += chunkSize;
|
||||
endOfLine = (chunk0 & 0x80) != 0;
|
||||
} while (!endOfLine);
|
||||
return ptr - g1->offset;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return g1->width * g1->height;
|
||||
uint8_t chunk0 = *ptr++;
|
||||
ptr++; // offset
|
||||
uint8_t chunkSize = chunk0 & 0x7F;
|
||||
ptr += chunkSize;
|
||||
endOfLine = (chunk0 & 0x80) != 0;
|
||||
} while (!endOfLine);
|
||||
return ptr - g1->offset;
|
||||
}
|
||||
|
||||
return g1->width * g1->height;
|
||||
}
|
||||
|
|
|
@ -376,7 +376,8 @@ int32_t string_get_height_raw(std::string_view text, FontSpriteBase fontBase)
|
|||
height += 10;
|
||||
break;
|
||||
}
|
||||
else if (fontBase == FontSpriteBase::TINY)
|
||||
|
||||
if (fontBase == FontSpriteBase::TINY)
|
||||
{
|
||||
height += 6;
|
||||
break;
|
||||
|
@ -389,7 +390,8 @@ int32_t string_get_height_raw(std::string_view text, FontSpriteBase fontBase)
|
|||
height += 5;
|
||||
break;
|
||||
}
|
||||
else if (fontBase == FontSpriteBase::TINY)
|
||||
|
||||
if (fontBase == FontSpriteBase::TINY)
|
||||
{
|
||||
height += 3;
|
||||
break;
|
||||
|
@ -546,164 +548,161 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo* dpi, std::string_view tex
|
|||
info->x += ttf_getwidth_cache_get_or_add(fontDesc->font, text);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
uint8_t colour = info->palette[1];
|
||||
TTFSurface* surface = ttf_surface_cache_get_or_add(fontDesc->font, text);
|
||||
if (surface == nullptr)
|
||||
return;
|
||||
|
||||
int32_t drawX = info->x + fontDesc->offset_x;
|
||||
int32_t drawY = info->y + fontDesc->offset_y;
|
||||
int32_t width = surface->w;
|
||||
int32_t height = surface->h;
|
||||
|
||||
if (OpenRCT2::GetContext()->GetDrawingEngineType() == DrawingEngine::OpenGL)
|
||||
{
|
||||
uint8_t colour = info->palette[1];
|
||||
TTFSurface* surface = ttf_surface_cache_get_or_add(fontDesc->font, text);
|
||||
if (surface == nullptr)
|
||||
return;
|
||||
|
||||
int32_t drawX = info->x + fontDesc->offset_x;
|
||||
int32_t drawY = info->y + fontDesc->offset_y;
|
||||
int32_t width = surface->w;
|
||||
int32_t height = surface->h;
|
||||
|
||||
if (OpenRCT2::GetContext()->GetDrawingEngineType() == DrawingEngine::OpenGL)
|
||||
auto pixels = reinterpret_cast<uint8_t*>(const_cast<void*>(surface->pixels));
|
||||
auto pixelsLen = static_cast<size_t>(surface->pitch) * surface->h;
|
||||
for (size_t pp = 0; pp < pixelsLen; pp++)
|
||||
{
|
||||
auto pixels = reinterpret_cast<uint8_t*>(const_cast<void*>(surface->pixels));
|
||||
auto pixelsLen = static_cast<size_t>(surface->pitch) * surface->h;
|
||||
for (size_t pp = 0; pp < pixelsLen; pp++)
|
||||
if (pixels[pp] != 0)
|
||||
{
|
||||
if (pixels[pp] != 0)
|
||||
{
|
||||
pixels[pp] = colour;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixels[pp] = PALETTE_INDEX_0;
|
||||
}
|
||||
pixels[pp] = colour;
|
||||
}
|
||||
|
||||
auto baseId = uint32_t(0x7FFFF) - 1024;
|
||||
auto imageId = baseId + _ttfGlId;
|
||||
auto drawingEngine = dpi->DrawingEngine;
|
||||
auto drawingContext = drawingEngine->GetDrawingContext(dpi);
|
||||
drawingEngine->InvalidateImage(imageId);
|
||||
drawingContext->DrawBitmap(imageId, surface->pixels, surface->pitch, surface->h, drawX, drawY);
|
||||
|
||||
_ttfGlId++;
|
||||
if (_ttfGlId >= 1023)
|
||||
else
|
||||
{
|
||||
_ttfGlId = 0;
|
||||
pixels[pp] = PALETTE_INDEX_0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t overflowX = (dpi->x + dpi->width) - (drawX + width);
|
||||
int32_t overflowY = (dpi->y + dpi->height) - (drawY + height);
|
||||
if (overflowX < 0)
|
||||
width += overflowX;
|
||||
if (overflowY < 0)
|
||||
height += overflowY;
|
||||
int32_t skipX = drawX - dpi->x;
|
||||
int32_t skipY = drawY - dpi->y;
|
||||
info->x += width;
|
||||
auto baseId = uint32_t(0x7FFFF) - 1024;
|
||||
auto imageId = baseId + _ttfGlId;
|
||||
auto drawingEngine = dpi->DrawingEngine;
|
||||
auto drawingContext = drawingEngine->GetDrawingContext(dpi);
|
||||
drawingEngine->InvalidateImage(imageId);
|
||||
drawingContext->DrawBitmap(imageId, surface->pixels, surface->pitch, surface->h, drawX, drawY);
|
||||
|
||||
auto src = static_cast<const uint8_t*>(surface->pixels);
|
||||
uint8_t* dst = dpi->bits;
|
||||
|
||||
if (skipX < 0)
|
||||
_ttfGlId++;
|
||||
if (_ttfGlId >= 1023)
|
||||
{
|
||||
width += skipX;
|
||||
src += -skipX;
|
||||
skipX = 0;
|
||||
_ttfGlId = 0;
|
||||
}
|
||||
if (skipY < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t overflowX = (dpi->x + dpi->width) - (drawX + width);
|
||||
int32_t overflowY = (dpi->y + dpi->height) - (drawY + height);
|
||||
if (overflowX < 0)
|
||||
width += overflowX;
|
||||
if (overflowY < 0)
|
||||
height += overflowY;
|
||||
int32_t skipX = drawX - dpi->x;
|
||||
int32_t skipY = drawY - dpi->y;
|
||||
info->x += width;
|
||||
|
||||
auto src = static_cast<const uint8_t*>(surface->pixels);
|
||||
uint8_t* dst = dpi->bits;
|
||||
|
||||
if (skipX < 0)
|
||||
{
|
||||
width += skipX;
|
||||
src += -skipX;
|
||||
skipX = 0;
|
||||
}
|
||||
if (skipY < 0)
|
||||
{
|
||||
height += skipY;
|
||||
src += (-skipY * surface->pitch);
|
||||
skipY = 0;
|
||||
}
|
||||
|
||||
dst += skipX;
|
||||
dst += skipY * (dpi->width + dpi->pitch);
|
||||
|
||||
int32_t srcScanSkip = surface->pitch - width;
|
||||
int32_t dstScanSkip = dpi->width + dpi->pitch - width;
|
||||
uint8_t* dst_orig = dst;
|
||||
const uint8_t* src_orig = src;
|
||||
|
||||
// Draw shadow/outline
|
||||
if (info->flags & TEXT_DRAW_FLAG_OUTLINE)
|
||||
{
|
||||
for (int32_t yy = 0; yy < height - 0; yy++)
|
||||
{
|
||||
height += skipY;
|
||||
src += (-skipY * surface->pitch);
|
||||
skipY = 0;
|
||||
}
|
||||
|
||||
dst += skipX;
|
||||
dst += skipY * (dpi->width + dpi->pitch);
|
||||
|
||||
int32_t srcScanSkip = surface->pitch - width;
|
||||
int32_t dstScanSkip = dpi->width + dpi->pitch - width;
|
||||
uint8_t* dst_orig = dst;
|
||||
const uint8_t* src_orig = src;
|
||||
|
||||
// Draw shadow/outline
|
||||
if (info->flags & TEXT_DRAW_FLAG_OUTLINE)
|
||||
{
|
||||
for (int32_t yy = 0; yy < height - 0; yy++)
|
||||
for (int32_t xx = 0; xx < width - 0; xx++)
|
||||
{
|
||||
for (int32_t xx = 0; xx < width - 0; xx++)
|
||||
if (*src != 0)
|
||||
{
|
||||
if (*src != 0)
|
||||
// right
|
||||
if (xx + skipX < dpi->width + dpi->pitch - 1)
|
||||
{
|
||||
// right
|
||||
if (xx + skipX < dpi->width + dpi->pitch - 1)
|
||||
{
|
||||
*(dst + 1) = info->palette[3];
|
||||
}
|
||||
// left
|
||||
if (xx + skipX > 1)
|
||||
{
|
||||
*(dst - 1) = info->palette[3];
|
||||
}
|
||||
// top
|
||||
if (yy + skipY > 1)
|
||||
{
|
||||
*(dst - width - dstScanSkip) = info->palette[3];
|
||||
}
|
||||
// bottom
|
||||
if (yy + skipY < dpi->height - 1)
|
||||
{
|
||||
*(dst + width + dstScanSkip) = info->palette[3];
|
||||
}
|
||||
*(dst + 1) = info->palette[3];
|
||||
}
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
// Skip any remaining bits
|
||||
src += srcScanSkip;
|
||||
dst += dstScanSkip;
|
||||
}
|
||||
}
|
||||
{
|
||||
dst = dst_orig;
|
||||
src = src_orig;
|
||||
bool use_hinting = gConfigFonts.enable_hinting && fontDesc->hinting_threshold > 0;
|
||||
for (int32_t yy = 0; yy < height; yy++)
|
||||
{
|
||||
for (int32_t xx = 0; xx < width; xx++)
|
||||
{
|
||||
if (*src != 0)
|
||||
// left
|
||||
if (xx + skipX > 1)
|
||||
{
|
||||
if (info->flags & TEXT_DRAW_FLAG_INSET)
|
||||
{
|
||||
*(dst + width + dstScanSkip + 1) = info->palette[3];
|
||||
}
|
||||
|
||||
if (*src > 180 || !use_hinting)
|
||||
{
|
||||
// Centre of the glyph: use full colour.
|
||||
*dst = colour;
|
||||
}
|
||||
else if (use_hinting && *src > fontDesc->hinting_threshold)
|
||||
{
|
||||
// Simulate font hinting by shading the background colour instead.
|
||||
if (info->flags & TEXT_DRAW_FLAG_OUTLINE)
|
||||
{
|
||||
// As outlines are black, these texts should always use a darker shade
|
||||
// of the foreground colour for font hinting.
|
||||
*dst = blendColours(colour, PALETTE_INDEX_0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst = blendColours(colour, *dst);
|
||||
}
|
||||
}
|
||||
*(dst - 1) = info->palette[3];
|
||||
}
|
||||
// top
|
||||
if (yy + skipY > 1)
|
||||
{
|
||||
*(dst - width - dstScanSkip) = info->palette[3];
|
||||
}
|
||||
// bottom
|
||||
if (yy + skipY < dpi->height - 1)
|
||||
{
|
||||
*(dst + width + dstScanSkip) = info->palette[3];
|
||||
}
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
src += srcScanSkip;
|
||||
dst += dstScanSkip;
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
// Skip any remaining bits
|
||||
src += srcScanSkip;
|
||||
dst += dstScanSkip;
|
||||
}
|
||||
}
|
||||
|
||||
dst = dst_orig;
|
||||
src = src_orig;
|
||||
bool use_hinting = gConfigFonts.enable_hinting && fontDesc->hinting_threshold > 0;
|
||||
for (int32_t yy = 0; yy < height; yy++)
|
||||
{
|
||||
for (int32_t xx = 0; xx < width; xx++)
|
||||
{
|
||||
if (*src != 0)
|
||||
{
|
||||
if (info->flags & TEXT_DRAW_FLAG_INSET)
|
||||
{
|
||||
*(dst + width + dstScanSkip + 1) = info->palette[3];
|
||||
}
|
||||
|
||||
if (*src > 180 || !use_hinting)
|
||||
{
|
||||
// Centre of the glyph: use full colour.
|
||||
*dst = colour;
|
||||
}
|
||||
else if (use_hinting && *src > fontDesc->hinting_threshold)
|
||||
{
|
||||
// Simulate font hinting by shading the background colour instead.
|
||||
if (info->flags & TEXT_DRAW_FLAG_OUTLINE)
|
||||
{
|
||||
// As outlines are black, these texts should always use a darker shade
|
||||
// of the foreground colour for font hinting.
|
||||
*dst = blendColours(colour, PALETTE_INDEX_0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst = blendColours(colour, *dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
src += srcScanSkip;
|
||||
dst += dstScanSkip;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NO_TTF
|
||||
|
|
|
@ -528,19 +528,19 @@ ImageCatalogue ImageId::GetCatalogue() const
|
|||
{
|
||||
return ImageCatalogue::TEMPORARY;
|
||||
}
|
||||
else if (index < SPR_RCTC_G1_END)
|
||||
if (index < SPR_RCTC_G1_END)
|
||||
{
|
||||
return ImageCatalogue::G1;
|
||||
}
|
||||
else if (index < SPR_G2_END)
|
||||
if (index < SPR_G2_END)
|
||||
{
|
||||
return ImageCatalogue::G2;
|
||||
}
|
||||
else if (index < SPR_CSG_END)
|
||||
if (index < SPR_CSG_END)
|
||||
{
|
||||
return ImageCatalogue::CSG;
|
||||
}
|
||||
else if (index < SPR_IMAGE_LIST_END)
|
||||
if (index < SPR_IMAGE_LIST_END)
|
||||
{
|
||||
return ImageCatalogue::OBJECT;
|
||||
}
|
||||
|
|
|
@ -306,7 +306,8 @@ int32_t font_sprite_get_codepoint_width(FontSpriteBase fontSpriteBase, int32_t c
|
|||
}
|
||||
return _additionalSpriteFontCharacterWidth[baseFontIndex][glyphIndex];
|
||||
}
|
||||
else if (glyphIndex < 0 || glyphIndex >= static_cast<int32_t>(FONT_SPRITE_GLYPH_COUNT))
|
||||
|
||||
if (glyphIndex < 0 || glyphIndex >= static_cast<int32_t>(FONT_SPRITE_GLYPH_COUNT))
|
||||
{
|
||||
log_warning("Invalid glyph index %u", glyphIndex);
|
||||
glyphIndex = 0;
|
||||
|
@ -362,13 +363,8 @@ int32_t font_get_line_height(FontSpriteBase fontSpriteBase)
|
|||
{
|
||||
return gCurrentTTFFontSet->size[fontSize].line_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif // NO_TTF
|
||||
return SpriteFontLineHeight[fontSize];
|
||||
#ifndef NO_TTF
|
||||
}
|
||||
#endif // NO_TTF
|
||||
return SpriteFontLineHeight[fontSize];
|
||||
}
|
||||
|
||||
int32_t font_get_line_height_small(FontSpriteBase fontSpriteBase)
|
||||
|
@ -434,8 +430,6 @@ bool font_supports_string(const utf8* text, int32_t fontSize)
|
|||
{
|
||||
return font_supports_string_ttf(text, fontSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
return font_supports_string_sprite(text);
|
||||
}
|
||||
|
||||
return font_supports_string_sprite(text);
|
||||
}
|
||||
|
|
|
@ -178,7 +178,8 @@ static void FreeImageList(uint32_t baseImageId, uint32_t count)
|
|||
it->Count += count;
|
||||
return;
|
||||
}
|
||||
else if (baseImageId + count == it->BaseId)
|
||||
|
||||
if (baseImageId + count == it->BaseId)
|
||||
{
|
||||
it->BaseId = baseImageId;
|
||||
it->Count += count;
|
||||
|
|
|
@ -40,10 +40,8 @@ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, const ScreenRect& rect, int32_t
|
|||
assert(false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
palette = TranslucentWindowPalettes[BASE_COLOUR(colour)];
|
||||
}
|
||||
|
||||
palette = TranslucentWindowPalettes[BASE_COLOUR(colour)];
|
||||
|
||||
if (flags & INSET_RECT_FLAG_BORDER_NONE)
|
||||
{
|
||||
|
|
|
@ -128,10 +128,8 @@ static uint8_t* font_sprite_get_codepoint_bitmap(int32_t codepoint)
|
|||
{
|
||||
return _characterBitmaps[offset - (SPR_G2_CHAR_BEGIN - SPR_CHAR_START) + FONT_SPRITE_GLYPH_COUNT];
|
||||
}
|
||||
else
|
||||
{
|
||||
return _characterBitmaps[offset];
|
||||
}
|
||||
|
||||
return _characterBitmaps[offset];
|
||||
}
|
||||
|
||||
static int32_t scrolling_text_get_matching_or_oldest(
|
||||
|
|
|
@ -373,10 +373,8 @@ static TTFSurface* ttf_render(TTF_Font* font, std::string_view text)
|
|||
{
|
||||
return TTF_RenderUTF8_Shaded(font, buffer.c_str(), 0x000000FF, 0x000000FF);
|
||||
}
|
||||
else
|
||||
{
|
||||
return TTF_RenderUTF8_Solid(font, buffer.c_str(), 0x000000FF);
|
||||
}
|
||||
|
||||
return TTF_RenderUTF8_Solid(font, buffer.c_str(), 0x000000FF);
|
||||
}
|
||||
|
||||
void ttf_free_surface(TTFSurface* surface)
|
||||
|
|
|
@ -1553,9 +1553,9 @@ int TTF_GetFontHinting(const TTF_Font* font)
|
|||
{
|
||||
if (font->hinting == FT_LOAD_TARGET_ALT(FT_RENDER_MODE_LIGHT))
|
||||
return TTF_HINTING_LIGHT;
|
||||
else if (font->hinting == FT_LOAD_TARGET_ALT(FT_RENDER_MODE_MONO))
|
||||
if (font->hinting == FT_LOAD_TARGET_ALT(FT_RENDER_MODE_MONO))
|
||||
return TTF_HINTING_MONO;
|
||||
else if (font->hinting == FT_LOAD_NO_HINTING)
|
||||
if (font->hinting == FT_LOAD_NO_HINTING)
|
||||
return TTF_HINTING_NONE;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1400,19 +1400,15 @@ static int32_t cc_say(InteractiveConsole& console, const arguments_t& argv)
|
|||
console.WriteFormatLine("This command only works in multiplayer mode.");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
||||
if (!argv.empty())
|
||||
{
|
||||
if (!argv.empty())
|
||||
{
|
||||
network_send_chat(argv[0].c_str());
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
console.WriteFormatLine("Input your message");
|
||||
return 0;
|
||||
}
|
||||
network_send_chat(argv[0].c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
console.WriteFormatLine("Input your message");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t cc_replay_startrecord(InteractiveConsole& console, const arguments_t& argv)
|
||||
|
|
|
@ -170,10 +170,8 @@ std::string screenshot_dump_png(rct_drawpixelinfo* dpi)
|
|||
{
|
||||
return path.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string screenshot_dump_png_32bpp(int32_t width, int32_t height, const void* pixels)
|
||||
|
@ -765,28 +763,26 @@ static std::string ResolveFilenameForCapture(const fs::path& filename)
|
|||
}
|
||||
return *path;
|
||||
}
|
||||
else
|
||||
|
||||
auto screenshotDirectory = fs::u8path(screenshot_get_directory());
|
||||
auto screenshotPath = fs::absolute(screenshotDirectory / filename);
|
||||
|
||||
// Check the filename isn't attempting to leave the screenshot directory for security
|
||||
if (!IsPathChildOf(screenshotPath, screenshotDirectory))
|
||||
{
|
||||
auto screenshotDirectory = fs::u8path(screenshot_get_directory());
|
||||
auto screenshotPath = fs::absolute(screenshotDirectory / filename);
|
||||
|
||||
// Check the filename isn't attempting to leave the screenshot directory for security
|
||||
if (!IsPathChildOf(screenshotPath, screenshotDirectory))
|
||||
{
|
||||
throw std::runtime_error("Filename is not a child of the screenshot directory.");
|
||||
}
|
||||
|
||||
auto directory = screenshotPath.parent_path();
|
||||
if (!fs::is_directory(directory))
|
||||
{
|
||||
if (!fs::create_directory(directory, screenshotDirectory))
|
||||
{
|
||||
throw std::runtime_error("Unable to create directory.");
|
||||
}
|
||||
}
|
||||
|
||||
return screenshotPath.string();
|
||||
throw std::runtime_error("Filename is not a child of the screenshot directory.");
|
||||
}
|
||||
|
||||
auto directory = screenshotPath.parent_path();
|
||||
if (!fs::is_directory(directory))
|
||||
{
|
||||
if (!fs::create_directory(directory, screenshotDirectory))
|
||||
{
|
||||
throw std::runtime_error("Unable to create directory.");
|
||||
}
|
||||
}
|
||||
|
||||
return screenshotPath.string();
|
||||
}
|
||||
|
||||
void CaptureImage(const CaptureOptions& options)
|
||||
|
|
|
@ -50,11 +50,9 @@ void StdInOutConsole::Start()
|
|||
openrct2_finish();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastPromptQuit = true;
|
||||
std::puts("(To exit, press ^C again)");
|
||||
}
|
||||
|
||||
lastPromptQuit = true;
|
||||
std::puts("(To exit, press ^C again)");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1972,8 +1972,6 @@ ZoomLevel ZoomLevel::min()
|
|||
{
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -432,7 +432,8 @@ rct_widgetindex window_find_widget_from_point(rct_window* w, const ScreenCoordsX
|
|||
{
|
||||
break;
|
||||
}
|
||||
else if (widget->type != WindowWidgetType::Empty && widget->IsVisible())
|
||||
|
||||
if (widget->type != WindowWidgetType::Empty && widget->IsVisible())
|
||||
{
|
||||
if (screenCoords.x >= w->windowPos.x + widget->left && screenCoords.x <= w->windowPos.x + widget->right
|
||||
&& screenCoords.y >= w->windowPos.y + widget->top && screenCoords.y <= w->windowPos.y + widget->bottom)
|
||||
|
@ -1337,10 +1338,8 @@ bool tool_set(rct_window* w, rct_widgetindex widgetIndex, Tool tool)
|
|||
tool_cancel();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_cancel();
|
||||
}
|
||||
|
||||
tool_cancel();
|
||||
}
|
||||
|
||||
input_set_flag(INPUT_FLAG_TOOL_ACTIVE, true);
|
||||
|
@ -1580,14 +1579,13 @@ OpenRCT2String window_event_tooltip_call(rct_window* w, const rct_widgetindex wi
|
|||
{
|
||||
return w->OnTooltip(widgetIndex, fallback);
|
||||
}
|
||||
else if (w->event_handlers->tooltip != nullptr)
|
||||
|
||||
if (w->event_handlers->tooltip != nullptr)
|
||||
{
|
||||
return w->event_handlers->tooltip(w, widgetIndex, fallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
return { fallback, {} };
|
||||
}
|
||||
|
||||
return { fallback, {} };
|
||||
}
|
||||
|
||||
CursorID window_event_cursor_call(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
||||
|
|
|
@ -130,8 +130,8 @@ struct rct_widget
|
|||
{
|
||||
if (height() >= 10)
|
||||
return std::max<int32_t>(top, top + (height() / 2) - 5);
|
||||
else
|
||||
return top - 1;
|
||||
|
||||
return top - 1;
|
||||
}
|
||||
|
||||
bool IsVisible() const
|
||||
|
|
|
@ -51,16 +51,16 @@ public:
|
|||
{
|
||||
if (rhs._level < 0)
|
||||
return lhs >> -rhs._level;
|
||||
else
|
||||
return lhs << rhs._level;
|
||||
|
||||
return lhs << rhs._level;
|
||||
}
|
||||
|
||||
template<typename T> friend T operator/(const T& lhs, const ZoomLevel& rhs)
|
||||
{
|
||||
if (rhs._level < 0)
|
||||
return lhs << -rhs._level;
|
||||
else
|
||||
return lhs >> rhs._level;
|
||||
|
||||
return lhs >> rhs._level;
|
||||
}
|
||||
|
||||
static ZoomLevel min();
|
||||
|
|
|
@ -111,8 +111,9 @@ static int32_t encoding_search_compare(const void *pKey, const void *pEntry)
|
|||
static wchar_t encoding_convert_x_to_unicode(wchar_t code, const encoding_convert_entry *table, size_t count)
|
||||
{
|
||||
encoding_convert_entry * entry = static_cast<encoding_convert_entry *>(std::bsearch(&code, table, count, sizeof(encoding_convert_entry), encoding_search_compare));
|
||||
if (entry == nullptr) return code;
|
||||
else return entry->unicode;
|
||||
if (entry == nullptr)
|
||||
return code;
|
||||
return entry->unicode;
|
||||
}
|
||||
|
||||
wchar_t encoding_convert_rct2_to_unicode(wchar_t rct2str)
|
||||
|
|
|
@ -149,11 +149,9 @@ std::string rct2_to_utf8(std::string_view src, RCT2LanguageId languageId)
|
|||
// The code page used by RCT2 was not quite 1252 as some codes were used for Polish characters.
|
||||
return DecodeConvertWithTable(src, encoding_convert_rct2_to_unicode);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto decoded = DecodeToMultiByte(src);
|
||||
return String::Convert(decoded, codePage, CODE_PAGE::CP_UTF8);
|
||||
}
|
||||
|
||||
auto decoded = DecodeToMultiByte(src);
|
||||
return String::Convert(decoded, codePage, CODE_PAGE::CP_UTF8);
|
||||
}
|
||||
|
||||
std::string utf8_to_rct2(std::string_view src)
|
||||
|
|
|
@ -96,14 +96,12 @@ std::string_view FormatTokenToString(FormatToken token, bool withBraces)
|
|||
{
|
||||
return GetFormatTokenStringWithBraces(token);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = FormatTokenMap.find(token);
|
||||
if (it != FormatTokenMap.end())
|
||||
return it->first;
|
||||
|
||||
return {};
|
||||
}
|
||||
auto it = FormatTokenMap.find(token);
|
||||
if (it != FormatTokenMap.end())
|
||||
return it->first;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
bool FormatTokenTakesArgument(FormatToken token)
|
||||
|
|
|
@ -131,7 +131,8 @@ namespace OpenRCT2
|
|||
current = token(FormatToken::Move, str.substr(startIndex, i - startIndex), p);
|
||||
return;
|
||||
}
|
||||
else if (inner == "INLINE_SPRITE")
|
||||
|
||||
if (inner == "INLINE_SPRITE")
|
||||
{
|
||||
uint32_t p = 0;
|
||||
auto p0 = ParseNumericToken(str, i);
|
||||
|
@ -178,12 +179,12 @@ namespace OpenRCT2
|
|||
{
|
||||
return token(FormatToken::Escaped, sztoken);
|
||||
}
|
||||
else if (sztoken.size() >= 2 && sztoken[0] == '{' && sztoken[1] != '{')
|
||||
if (sztoken.size() >= 2 && sztoken[0] == '{' && sztoken[1] != '{')
|
||||
{
|
||||
auto kind = FormatTokenFromString(sztoken.substr(1, len - 2));
|
||||
return token(kind, sztoken);
|
||||
}
|
||||
else if (sztoken == "\n" || sztoken == "\r")
|
||||
if (sztoken == "\n" || sztoken == "\r")
|
||||
{
|
||||
return token(FormatToken::Newline, sztoken);
|
||||
}
|
||||
|
|
|
@ -243,13 +243,11 @@ namespace OpenRCT2
|
|||
FormatRealName(ss, stringId);
|
||||
return FormatString(ss, stack, argN...);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto subfmt = GetFmtStringById(stringId);
|
||||
auto subit = subfmt.begin();
|
||||
stack.push(subit);
|
||||
return FormatString(ss, stack, argN...);
|
||||
}
|
||||
|
||||
auto subfmt = GetFmtStringById(stringId);
|
||||
auto subit = subfmt.begin();
|
||||
stack.push(subit);
|
||||
return FormatString(ss, stack, argN...);
|
||||
}
|
||||
}
|
||||
else if (FormatTokenTakesArgument(token.kind))
|
||||
|
@ -257,10 +255,8 @@ namespace OpenRCT2
|
|||
FormatArgument(ss, token.kind, arg0);
|
||||
return FormatString(ss, stack, argN...);
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << token.text;
|
||||
}
|
||||
|
||||
ss << token.text;
|
||||
}
|
||||
stack.pop();
|
||||
}
|
||||
|
|
|
@ -114,25 +114,23 @@ constexpr utf8* utf8_write_codepoint(utf8* dst, uint32_t codepoint)
|
|||
dst[0] = static_cast<utf8>(codepoint);
|
||||
return dst + 1;
|
||||
}
|
||||
else if (codepoint <= 0x7FF)
|
||||
if (codepoint <= 0x7FF)
|
||||
{
|
||||
dst[0] = 0xC0 | ((codepoint >> 6) & 0x1F);
|
||||
dst[1] = 0x80 | (codepoint & 0x3F);
|
||||
return dst + 2;
|
||||
}
|
||||
else if (codepoint <= 0xFFFF)
|
||||
if (codepoint <= 0xFFFF)
|
||||
{
|
||||
dst[0] = 0xE0 | ((codepoint >> 12) & 0x0F);
|
||||
dst[1] = 0x80 | ((codepoint >> 6) & 0x3F);
|
||||
dst[2] = 0x80 | (codepoint & 0x3F);
|
||||
return dst + 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst[0] = 0xF0 | ((codepoint >> 18) & 0x07);
|
||||
dst[1] = 0x80 | ((codepoint >> 12) & 0x3F);
|
||||
dst[2] = 0x80 | ((codepoint >> 6) & 0x3F);
|
||||
dst[3] = 0x80 | (codepoint & 0x3F);
|
||||
return dst + 4;
|
||||
}
|
||||
|
||||
dst[0] = 0xF0 | ((codepoint >> 18) & 0x07);
|
||||
dst[1] = 0x80 | ((codepoint >> 12) & 0x3F);
|
||||
dst[2] = 0x80 | ((codepoint >> 6) & 0x3F);
|
||||
dst[3] = 0x80 | (codepoint & 0x3F);
|
||||
return dst + 4;
|
||||
}
|
||||
|
|
|
@ -158,12 +158,11 @@ public:
|
|||
{
|
||||
return _scenarioOverrides[ooIndex].strings[ooStringIndex].c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
else if (stringId >= ObjectOverrideBase)
|
||||
|
||||
if (stringId >= ObjectOverrideBase)
|
||||
{
|
||||
int32_t offset = stringId - ObjectOverrideBase;
|
||||
int32_t ooIndex = offset / ObjectOverrideMaxStringCount;
|
||||
|
@ -174,22 +173,16 @@ public:
|
|||
{
|
||||
return _objectOverrides[ooIndex].strings[ooStringIndex].c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
|
||||
if ((_strings.size() > static_cast<size_t>(stringId)) && !_strings[stringId].empty())
|
||||
{
|
||||
if ((_strings.size() > static_cast<size_t>(stringId)) && !_strings[stringId].empty())
|
||||
{
|
||||
return _strings[stringId].c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return _strings[stringId].c_str();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rct_string_id GetObjectOverrideStringId(std::string_view legacyIdentifier, uint8_t index) override
|
||||
|
@ -469,7 +462,8 @@ private:
|
|||
// Unexpected new line, ignore line entirely
|
||||
return;
|
||||
}
|
||||
else if (!IsWhitespace(codepoint) && codepoint != ':')
|
||||
|
||||
if (!IsWhitespace(codepoint) && codepoint != ':')
|
||||
{
|
||||
reader->Skip();
|
||||
sb.Append(codepoint);
|
||||
|
|
|
@ -445,8 +445,7 @@ money32 string_to_money(const char* string_to_monetise)
|
|||
{
|
||||
if (hasDecSep)
|
||||
return MONEY32_UNDEFINED;
|
||||
else
|
||||
hasDecSep = true;
|
||||
hasDecSep = true;
|
||||
|
||||
// Replace localised decimal separator with an English one.
|
||||
*dst_ptr++ = '.';
|
||||
|
@ -457,8 +456,7 @@ money32 string_to_money(const char* string_to_monetise)
|
|||
{
|
||||
if (hasMinus)
|
||||
return MONEY32_UNDEFINED;
|
||||
else
|
||||
hasMinus = true;
|
||||
hasMinus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -55,10 +55,8 @@ const char* LocalisationService::GetString(rct_string_id id) const
|
|||
{
|
||||
return _objectStrings[index].c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "(unallocated string)";
|
||||
}
|
||||
|
||||
result = "(unallocated string)";
|
||||
}
|
||||
else if (id != STR_NONE)
|
||||
{
|
||||
|
|
|
@ -77,18 +77,15 @@ int32_t utf8_get_codepoint_length(char32_t codepoint)
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
else if (codepoint <= 0x7FF)
|
||||
if (codepoint <= 0x7FF)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (codepoint <= 0xFFFF)
|
||||
if (codepoint <= 0xFFFF)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,8 +62,8 @@ const News::Item& News::ItemQueues::operator[](size_t index) const
|
|||
{
|
||||
if (index < Recent.capacity())
|
||||
return Recent[index];
|
||||
else
|
||||
return Archived[index - Recent.capacity()];
|
||||
|
||||
return Archived[index - Recent.capacity()];
|
||||
}
|
||||
|
||||
News::Item* News::ItemQueues::At(int32_t index)
|
||||
|
@ -77,10 +77,8 @@ const News::Item* News::ItemQueues::At(int32_t index) const
|
|||
{
|
||||
return &(*this)[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool News::IsQueueEmpty()
|
||||
|
|
|
@ -159,13 +159,12 @@ static void research_next_design()
|
|||
it = gResearchItemsUninvented.begin();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
research_mark_as_fully_completed();
|
||||
return;
|
||||
}
|
||||
|
||||
research_mark_as_fully_completed();
|
||||
return;
|
||||
}
|
||||
else if (ignoreActiveResearchTypes || (gResearchPriorities & EnumToFlag(researchItem.category)))
|
||||
|
||||
if (ignoreActiveResearchTypes || (gResearchPriorities & EnumToFlag(researchItem.category)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -567,11 +566,9 @@ bool scenery_is_invented(const ScenerySelection& sceneryItem)
|
|||
{
|
||||
return _researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
log_warning("Invalid Scenery Type");
|
||||
return false;
|
||||
}
|
||||
|
||||
log_warning("Invalid Scenery Type");
|
||||
return false;
|
||||
}
|
||||
|
||||
void scenery_set_invented(const ScenerySelection& sceneryItem)
|
||||
|
@ -703,23 +700,17 @@ rct_string_id ResearchItem::GetName() const
|
|||
{
|
||||
return STR_EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rideEntry->naming.Name;
|
||||
}
|
||||
|
||||
return rideEntry->naming.Name;
|
||||
}
|
||||
else
|
||||
|
||||
rct_scenery_group_entry* sceneryEntry = get_scenery_group_entry(entryIndex);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
rct_scenery_group_entry* sceneryEntry = get_scenery_group_entry(entryIndex);
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return STR_EMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
return sceneryEntry->name;
|
||||
}
|
||||
return STR_EMPTY;
|
||||
}
|
||||
|
||||
return sceneryEntry->name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -423,7 +423,7 @@ NetworkAuth NetworkBase::GetAuthStatus()
|
|||
{
|
||||
return _serverConnection->AuthStatus;
|
||||
}
|
||||
else if (GetMode() == NETWORK_MODE_SERVER)
|
||||
if (GetMode() == NETWORK_MODE_SERVER)
|
||||
{
|
||||
return NetworkAuth::Ok;
|
||||
}
|
||||
|
@ -860,10 +860,8 @@ std::string NetworkBase::GetMasterServerUrl()
|
|||
{
|
||||
return OPENRCT2_MASTER_SERVER_URL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return gConfigNetwork.master_server_url;
|
||||
}
|
||||
|
||||
return gConfigNetwork.master_server_url;
|
||||
}
|
||||
|
||||
NetworkGroup* NetworkBase::AddGroup()
|
||||
|
@ -3697,10 +3695,8 @@ rct_string_id network_get_action_name_string_id(uint32_t index)
|
|||
{
|
||||
return NetworkActions::Actions[index].Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return STR_NONE;
|
||||
}
|
||||
|
||||
return STR_NONE;
|
||||
}
|
||||
|
||||
int32_t network_can_perform_action(uint32_t groupindex, NetworkPermission index)
|
||||
|
@ -3743,15 +3739,13 @@ Peep* network_get_pickup_peep(uint8_t playerid)
|
|||
{
|
||||
return _pickup_peep;
|
||||
}
|
||||
else
|
||||
|
||||
NetworkPlayer* player = network.GetPlayerByID(playerid);
|
||||
if (player)
|
||||
{
|
||||
NetworkPlayer* player = network.GetPlayerByID(playerid);
|
||||
if (player)
|
||||
{
|
||||
return player->PickupPeep;
|
||||
}
|
||||
return nullptr;
|
||||
return player->PickupPeep;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void network_set_pickup_peep_old_x(uint8_t playerid, int32_t x)
|
||||
|
@ -3778,15 +3772,13 @@ int32_t network_get_pickup_peep_old_x(uint8_t playerid)
|
|||
{
|
||||
return _pickup_peep_old_x;
|
||||
}
|
||||
else
|
||||
|
||||
NetworkPlayer* player = network.GetPlayerByID(playerid);
|
||||
if (player)
|
||||
{
|
||||
NetworkPlayer* player = network.GetPlayerByID(playerid);
|
||||
if (player)
|
||||
{
|
||||
return player->PickupPeepOldX;
|
||||
}
|
||||
return -1;
|
||||
return player->PickupPeepOldX;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t network_get_current_player_group_index()
|
||||
|
|
|
@ -54,7 +54,7 @@ bool NetworkKey::LoadPrivate(OpenRCT2::IStream* stream)
|
|||
log_error("unknown size, refusing to load key");
|
||||
return false;
|
||||
}
|
||||
else if (size > 4 * 1024 * 1024)
|
||||
if (size > 4 * 1024 * 1024)
|
||||
{
|
||||
log_error("Key file suspiciously large, refusing to load it");
|
||||
return false;
|
||||
|
@ -86,7 +86,7 @@ bool NetworkKey::LoadPublic(OpenRCT2::IStream* stream)
|
|||
log_error("unknown size, refusing to load key");
|
||||
return false;
|
||||
}
|
||||
else if (size > 4 * 1024 * 1024)
|
||||
if (size > 4 * 1024 * 1024)
|
||||
{
|
||||
log_error("Key file suspiciously large, refusing to load it");
|
||||
return false;
|
||||
|
|
|
@ -78,12 +78,10 @@ const uint8_t* NetworkPacket::Read(size_t size)
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint8_t* data = Data.data() + BytesRead;
|
||||
BytesRead += size;
|
||||
return data;
|
||||
}
|
||||
|
||||
const uint8_t* data = Data.data() + BytesRead;
|
||||
BytesRead += size;
|
||||
return data;
|
||||
}
|
||||
|
||||
std::string_view NetworkPacket::ReadString()
|
||||
|
|
|
@ -143,12 +143,10 @@ void NetworkUserManager::Save()
|
|||
// erase advances the iterator so make sure we don't do it again
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// replace the existing element in jsonUsers
|
||||
*it = networkUser->ToJson();
|
||||
savedHashes.insert(hashString);
|
||||
}
|
||||
|
||||
// replace the existing element in jsonUsers
|
||||
*it = networkUser->ToJson();
|
||||
savedHashes.insert(hashString);
|
||||
}
|
||||
|
||||
it++;
|
||||
|
|
|
@ -95,20 +95,18 @@ std::optional<ServerListEntry> ServerListEntry::FromJson(json_t& server)
|
|||
|
||||
return std::nullopt;
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerListEntry entry;
|
||||
|
||||
entry.Address = ip + ":" + std::to_string(port);
|
||||
entry.Name = name;
|
||||
entry.Description = description;
|
||||
entry.Version = version;
|
||||
entry.RequiresPassword = requiresPassword;
|
||||
entry.Players = players;
|
||||
entry.MaxPlayers = maxPlayers;
|
||||
ServerListEntry entry;
|
||||
|
||||
return entry;
|
||||
}
|
||||
entry.Address = ip + ":" + std::to_string(port);
|
||||
entry.Name = name;
|
||||
entry.Description = description;
|
||||
entry.Version = version;
|
||||
entry.RequiresPassword = requiresPassword;
|
||||
entry.Players = players;
|
||||
entry.MaxPlayers = maxPlayers;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
void ServerList::Sort()
|
||||
|
|
|
@ -164,10 +164,8 @@ public:
|
|||
{
|
||||
return reinterpret_cast<const sockaddr_in*>(&_address)->sin_port;
|
||||
}
|
||||
else
|
||||
{
|
||||
return reinterpret_cast<const sockaddr_in6*>(&_address)->sin6_port;
|
||||
}
|
||||
|
||||
return reinterpret_cast<const sockaddr_in6*>(&_address)->sin6_port;
|
||||
}
|
||||
|
||||
std::string GetHostname() const override
|
||||
|
@ -233,17 +231,16 @@ private:
|
|||
log_error("Resolution error message: %s.", gai_strerror(errorcode));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (result == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::memcpy(ss, result->ai_addr, result->ai_addrlen);
|
||||
*ss_len = static_cast<socklen_t>(result->ai_addrlen);
|
||||
freeaddrinfo(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::memcpy(ss, result->ai_addr, result->ai_addrlen);
|
||||
*ss_len = static_cast<socklen_t>(result->ai_addrlen);
|
||||
freeaddrinfo(result);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -579,7 +576,8 @@ public:
|
|||
*sizeReceived = 0;
|
||||
return NetworkReadPacket::Disconnected;
|
||||
}
|
||||
else if (readBytes == SOCKET_ERROR)
|
||||
|
||||
if (readBytes == SOCKET_ERROR)
|
||||
{
|
||||
*sizeReceived = 0;
|
||||
# ifndef _WIN32
|
||||
|
@ -598,16 +596,12 @@ public:
|
|||
{
|
||||
return NetworkReadPacket::Disconnected;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NetworkReadPacket::NoData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*sizeReceived = readBytes;
|
||||
return NetworkReadPacket::Success;
|
||||
|
||||
return NetworkReadPacket::NoData;
|
||||
}
|
||||
|
||||
*sizeReceived = readBytes;
|
||||
return NetworkReadPacket::Success;
|
||||
}
|
||||
|
||||
void Close() override
|
||||
|
@ -810,15 +804,13 @@ public:
|
|||
*sizeReceived = 0;
|
||||
return NetworkReadPacket::NoData;
|
||||
}
|
||||
else
|
||||
|
||||
*sizeReceived = readBytes;
|
||||
if (sender != nullptr)
|
||||
{
|
||||
*sizeReceived = readBytes;
|
||||
if (sender != nullptr)
|
||||
{
|
||||
*sender = std::make_unique<NetworkEndpoint>(reinterpret_cast<sockaddr*>(&senderAddr), senderAddrLen);
|
||||
}
|
||||
return NetworkReadPacket::Success;
|
||||
*sender = std::make_unique<NetworkEndpoint>(reinterpret_cast<sockaddr*>(&senderAddr), senderAddrLen);
|
||||
}
|
||||
return NetworkReadPacket::Success;
|
||||
}
|
||||
|
||||
void Close() override
|
||||
|
|
|
@ -133,11 +133,9 @@ bool MusicObject::SupportsRideType(uint8_t rideType)
|
|||
// Default behaviour for music is to only exclude from merry-go-round
|
||||
return rideType != RIDE_TYPE_MERRY_GO_ROUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = std::find(_rideTypes.begin(), _rideTypes.end(), rideType);
|
||||
return it != _rideTypes.end();
|
||||
}
|
||||
|
||||
auto it = std::find(_rideTypes.begin(), _rideTypes.end(), rideType);
|
||||
return it != _rideTypes.end();
|
||||
}
|
||||
|
||||
size_t MusicObject::GetTrackCount() const
|
||||
|
@ -163,8 +161,6 @@ ObjectAsset MusicObject::GetAsset(IReadObjectContext& context, std::string_view
|
|||
auto path2 = Path::Combine(dir, std::string(path.substr(11)));
|
||||
return ObjectAsset(path2);
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.GetAsset(path);
|
||||
}
|
||||
|
||||
return context.GetAsset(path);
|
||||
}
|
||||
|
|
|
@ -92,10 +92,8 @@ bool ObjectEntryDescriptor::operator==(const ObjectEntryDescriptor& rhs) const
|
|||
{
|
||||
return Entry == rhs.Entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Type == rhs.Type && Identifier == rhs.Identifier;
|
||||
}
|
||||
|
||||
return Type == rhs.Type && Identifier == rhs.Identifier;
|
||||
}
|
||||
|
||||
bool ObjectEntryDescriptor::operator!=(const ObjectEntryDescriptor& rhs) const
|
||||
|
@ -297,11 +295,9 @@ bool ObjectAsset::IsAvailable() const
|
|||
{
|
||||
return File::Exists(_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto zipArchive = Zip::TryOpen(_zipPath, ZIP_ACCESS::READ);
|
||||
return zipArchive != nullptr && zipArchive->Exists(_path);
|
||||
}
|
||||
|
||||
auto zipArchive = Zip::TryOpen(_zipPath, ZIP_ACCESS::READ);
|
||||
return zipArchive != nullptr && zipArchive->Exists(_path);
|
||||
}
|
||||
|
||||
uint64_t ObjectAsset::GetSize() const
|
||||
|
@ -310,17 +306,15 @@ uint64_t ObjectAsset::GetSize() const
|
|||
{
|
||||
return File::GetSize(_path);
|
||||
}
|
||||
else
|
||||
|
||||
auto zipArchive = Zip::TryOpen(_zipPath, ZIP_ACCESS::READ);
|
||||
if (zipArchive != nullptr)
|
||||
{
|
||||
auto zipArchive = Zip::TryOpen(_zipPath, ZIP_ACCESS::READ);
|
||||
if (zipArchive != nullptr)
|
||||
auto index = zipArchive->GetIndexFromPath(_path);
|
||||
if (index.has_value())
|
||||
{
|
||||
auto index = zipArchive->GetIndexFromPath(_path);
|
||||
if (index.has_value())
|
||||
{
|
||||
auto size = zipArchive->GetFileSize(index.value());
|
||||
return size;
|
||||
}
|
||||
auto size = zipArchive->GetFileSize(index.value());
|
||||
return size;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -332,16 +326,14 @@ std::unique_ptr<IStream> ObjectAsset::GetStream() const
|
|||
{
|
||||
return std::make_unique<FileStream>(_path, FILE_MODE_OPEN);
|
||||
}
|
||||
else
|
||||
|
||||
auto zipArchive = Zip::TryOpen(_zipPath, ZIP_ACCESS::READ);
|
||||
if (zipArchive != nullptr)
|
||||
{
|
||||
auto zipArchive = Zip::TryOpen(_zipPath, ZIP_ACCESS::READ);
|
||||
if (zipArchive != nullptr)
|
||||
auto stream = zipArchive->GetFileStream(_path);
|
||||
if (stream != nullptr)
|
||||
{
|
||||
auto stream = zipArchive->GetFileStream(_path);
|
||||
if (stream != nullptr)
|
||||
{
|
||||
return std::make_unique<ZipStreamWrapper>(std::move(zipArchive), std::move(stream));
|
||||
}
|
||||
return std::make_unique<ZipStreamWrapper>(std::move(zipArchive), std::move(stream));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -338,7 +338,7 @@ private:
|
|||
_loadedObjects.resize(i + 1);
|
||||
return static_cast<int32_t>(i);
|
||||
}
|
||||
else if (_loadedObjects[i] == nullptr)
|
||||
if (_loadedObjects[i] == nullptr)
|
||||
{
|
||||
return static_cast<int32_t>(i);
|
||||
}
|
||||
|
|
|
@ -264,14 +264,12 @@ public:
|
|||
{
|
||||
return ObjectFactory::CreateObjectFromJsonFile(*this, ori->Path);
|
||||
}
|
||||
else if (String::Equals(extension, ".parkobj", true))
|
||||
if (String::Equals(extension, ".parkobj", true))
|
||||
{
|
||||
return ObjectFactory::CreateObjectFromZipFile(*this, ori->Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ObjectFactory::CreateObjectFromLegacyFile(*this, ori->Path.c_str());
|
||||
}
|
||||
|
||||
return ObjectFactory::CreateObjectFromLegacyFile(*this, ori->Path.c_str());
|
||||
}
|
||||
|
||||
void RegisterLoadedObject(const ObjectRepositoryItem* ori, std::unique_ptr<Object>&& object) override
|
||||
|
@ -447,12 +445,10 @@ private:
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::Error::WriteLine("Object conflict: '%s'", conflict->Path.c_str());
|
||||
Console::Error::WriteLine(" : '%s'", item.Path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
Console::Error::WriteLine("Object conflict: '%s'", conflict->Path.c_str());
|
||||
Console::Error::WriteLine(" : '%s'", item.Path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScanObject(const std::string& path)
|
||||
|
@ -616,10 +612,8 @@ private:
|
|||
// Convert to UTF-8 filename
|
||||
return String::Convert(normalisedName, CODE_PAGE::CP_1252, CODE_PAGE::CP_UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string(name);
|
||||
}
|
||||
|
||||
return std::string(name);
|
||||
}
|
||||
|
||||
void WritePackedObject(OpenRCT2::IStream* stream, const rct_object_entry* entry)
|
||||
|
|
|
@ -65,8 +65,8 @@ struct ObjectRepositoryItem
|
|||
{
|
||||
if (Sources.empty())
|
||||
return ObjectSourceGame::Custom;
|
||||
else
|
||||
return static_cast<ObjectSourceGame>(Sources[0]);
|
||||
|
||||
return static_cast<ObjectSourceGame>(Sources[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -387,8 +387,8 @@ void RideObject::DrawPreview(rct_drawpixelinfo* dpi, [[maybe_unused]] int32_t wi
|
|||
{
|
||||
if (rideType != RIDE_TYPE_NULL)
|
||||
break;
|
||||
else
|
||||
imageId++;
|
||||
|
||||
imageId++;
|
||||
}
|
||||
|
||||
gfx_draw_sprite(dpi, imageId, { 0, 0 }, 0);
|
||||
|
|
|
@ -21,12 +21,9 @@ paint_struct* PaintAddImageAsParentRotated(
|
|||
session, image_id, { y_offset, x_offset, z_offset },
|
||||
{ bound_box_length_y, bound_box_length_x, bound_box_length_z });
|
||||
}
|
||||
else
|
||||
{
|
||||
return PaintAddImageAsParent(
|
||||
session, image_id, { x_offset, y_offset, z_offset },
|
||||
{ bound_box_length_x, bound_box_length_y, bound_box_length_z });
|
||||
}
|
||||
|
||||
return PaintAddImageAsParent(
|
||||
session, image_id, { x_offset, y_offset, z_offset }, { bound_box_length_x, bound_box_length_y, bound_box_length_z });
|
||||
}
|
||||
|
||||
paint_struct* PaintAddImageAsParentRotated(
|
||||
|
@ -40,12 +37,10 @@ paint_struct* PaintAddImageAsParentRotated(
|
|||
session, image_id, { y_offset, x_offset, z_offset }, { bound_box_length_y, bound_box_length_x, bound_box_length_z },
|
||||
{ bound_box_offset_y, bound_box_offset_x, bound_box_offset_z });
|
||||
}
|
||||
else
|
||||
{
|
||||
return PaintAddImageAsParent(
|
||||
session, image_id, { x_offset, y_offset, z_offset }, { bound_box_length_x, bound_box_length_y, bound_box_length_z },
|
||||
{ bound_box_offset_x, bound_box_offset_y, bound_box_offset_z });
|
||||
}
|
||||
|
||||
return PaintAddImageAsParent(
|
||||
session, image_id, { x_offset, y_offset, z_offset }, { bound_box_length_x, bound_box_length_y, bound_box_length_z },
|
||||
{ bound_box_offset_x, bound_box_offset_y, bound_box_offset_z });
|
||||
}
|
||||
|
||||
paint_struct* PaintAddImageAsParentRotated(
|
||||
|
@ -58,10 +53,8 @@ paint_struct* PaintAddImageAsParentRotated(
|
|||
session, image_id, { offset.y, offset.x, offset.z }, { boundBoxSize.y, boundBoxSize.x, boundBoxSize.z },
|
||||
{ boundBoxOffset.y, boundBoxOffset.x, boundBoxOffset.z });
|
||||
}
|
||||
else
|
||||
{
|
||||
return PaintAddImageAsParent(session, image_id, offset, boundBoxSize, boundBoxOffset);
|
||||
}
|
||||
|
||||
return PaintAddImageAsParent(session, image_id, offset, boundBoxSize, boundBoxOffset);
|
||||
}
|
||||
|
||||
paint_struct* PaintAddImageAsParentRotated(
|
||||
|
@ -73,10 +66,8 @@ paint_struct* PaintAddImageAsParentRotated(
|
|||
return PaintAddImageAsParent(
|
||||
session, image_id, { offset.y, offset.x, offset.z }, { boundBoxSize.y, boundBoxSize.x, boundBoxSize.z });
|
||||
}
|
||||
else
|
||||
{
|
||||
return PaintAddImageAsParent(session, image_id, offset, boundBoxSize);
|
||||
}
|
||||
|
||||
return PaintAddImageAsParent(session, image_id, offset, boundBoxSize);
|
||||
}
|
||||
|
||||
paint_struct* PaintAddImageAsChildRotated(
|
||||
|
@ -90,12 +81,10 @@ paint_struct* PaintAddImageAsChildRotated(
|
|||
session, image_id, y_offset, x_offset, bound_box_length_y, bound_box_length_x, bound_box_length_z, z_offset,
|
||||
bound_box_offset_y, bound_box_offset_x, bound_box_offset_z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PaintAddImageAsChild(
|
||||
session, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z);
|
||||
}
|
||||
|
||||
return PaintAddImageAsChild(
|
||||
session, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z);
|
||||
}
|
||||
|
||||
paint_struct* PaintAddImageAsChildRotated(
|
||||
|
@ -108,10 +97,8 @@ paint_struct* PaintAddImageAsChildRotated(
|
|||
session, image_id, { offset.y, offset.x, offset.z }, { boundBoxSize.y, boundBoxSize.x, boundBoxSize.z },
|
||||
{ boundBoxOffset.y, boundBoxOffset.x, boundBoxOffset.z });
|
||||
}
|
||||
else
|
||||
{
|
||||
return PaintAddImageAsChild(session, image_id, offset, boundBoxSize, boundBoxOffset);
|
||||
}
|
||||
|
||||
return PaintAddImageAsChild(session, image_id, offset, boundBoxSize, boundBoxOffset);
|
||||
}
|
||||
|
||||
void paint_util_push_tunnel_rotated(paint_session* session, uint8_t direction, uint16_t height, uint8_t type)
|
||||
|
|
|
@ -186,7 +186,8 @@ bool virtual_floor_tile_is_floor(const CoordsXY& loc)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT)
|
||||
|
||||
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT)
|
||||
{
|
||||
// Check if we are anywhere near the selection tiles (larger scenery / rides)
|
||||
for (const auto& tile : gMapSelectionTiles)
|
||||
|
|
|
@ -906,10 +906,8 @@ void Guest::Tick128UpdateGuest(int32_t index)
|
|||
Remove();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
PeepFlags &= ~PEEP_FLAGS_EXPLODE;
|
||||
}
|
||||
|
||||
PeepFlags &= ~PEEP_FLAGS_EXPLODE;
|
||||
}
|
||||
|
||||
if (PeepFlags & PEEP_FLAGS_HUNGER)
|
||||
|
@ -1478,7 +1476,8 @@ bool Guest::DecideAndBuyItem(Ride* ride, ShopItem shopItem, money32 price)
|
|||
InsertNewThought(PeepThoughtType::HaventFinished, static_cast<ShopItem>(food));
|
||||
return false;
|
||||
}
|
||||
else if (Nausea >= 145)
|
||||
|
||||
if (Nausea >= 145)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3635,30 +3634,28 @@ void Guest::UpdateRideAdvanceThroughEntrance()
|
|||
peep_update_ride_leave_entrance_maze(this, ride, entranceLocation);
|
||||
return;
|
||||
}
|
||||
else if (ride->type == RIDE_TYPE_SPIRAL_SLIDE)
|
||||
if (ride->type == RIDE_TYPE_SPIRAL_SLIDE)
|
||||
{
|
||||
peep_update_ride_leave_entrance_spiral_slide(this, ride, entranceLocation);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
// If the ride type was changed guests will become stuck.
|
||||
// Inform the player about this if its a new issue or hasn't been addressed within 120 seconds.
|
||||
if ((ride->current_issues & RIDE_ISSUE_GUESTS_STUCK) == 0 || gCurrentTicks - ride->last_issue_time > 3000)
|
||||
{
|
||||
// If the ride type was changed guests will become stuck.
|
||||
// Inform the player about this if its a new issue or hasn't been addressed within 120 seconds.
|
||||
if ((ride->current_issues & RIDE_ISSUE_GUESTS_STUCK) == 0 || gCurrentTicks - ride->last_issue_time > 3000)
|
||||
ride->current_issues |= RIDE_ISSUE_GUESTS_STUCK;
|
||||
ride->last_issue_time = gCurrentTicks;
|
||||
|
||||
auto ft = Formatter();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
ride->current_issues |= RIDE_ISSUE_GUESTS_STUCK;
|
||||
ride->last_issue_time = gCurrentTicks;
|
||||
|
||||
auto ft = Formatter();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_GUESTS_GETTING_STUCK_ON_RIDE, EnumValue(CurrentRide), ft);
|
||||
}
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_GUESTS_GETTING_STUCK_ON_RIDE, EnumValue(CurrentRide), ft);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[CurrentTrain]);
|
||||
|
@ -4553,7 +4550,8 @@ void Guest::UpdateRideApproachSpiralSlide()
|
|||
MoveTo({ LOCATION_NULL, y, z });
|
||||
return;
|
||||
}
|
||||
else if (waypoint == 2)
|
||||
|
||||
if (waypoint == 2)
|
||||
{
|
||||
bool lastRide = false;
|
||||
if (ride->status != RideStatus::Open)
|
||||
|
|
|
@ -1669,8 +1669,8 @@ static int32_t guest_path_find_entering_park(Peep* peep, uint8_t edges)
|
|||
|
||||
if (chosenDirection == INVALID_DIRECTION)
|
||||
return guest_path_find_aimless(peep, edges);
|
||||
else
|
||||
return peep_move_one_tile(chosenDirection, peep);
|
||||
|
||||
return peep_move_one_tile(chosenDirection, peep);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1724,8 +1724,8 @@ static int32_t guest_path_find_leaving_park(Peep* peep, uint8_t edges)
|
|||
direction = peep_pathfind_choose_direction(TileCoordsXYZ{ peep->NextLoc }, peep);
|
||||
if (direction == INVALID_DIRECTION)
|
||||
return guest_path_find_aimless(peep, edges);
|
||||
else
|
||||
return peep_move_one_tile(direction, peep);
|
||||
|
||||
return peep_move_one_tile(direction, peep);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1782,8 +1782,8 @@ static int32_t guest_path_find_park_entrance(Peep* peep, uint8_t edges)
|
|||
|
||||
if (chosenDirection == INVALID_DIRECTION)
|
||||
return guest_path_find_aimless(peep, edges);
|
||||
else
|
||||
return peep_move_one_tile(chosenDirection, peep);
|
||||
|
||||
return peep_move_one_tile(chosenDirection, peep);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -313,17 +313,16 @@ PeepActionSpriteType Peep::GetActionSpriteType()
|
|||
{ // PeepActionType::None1 or PeepActionType::None2
|
||||
return PeepSpecialSpriteToSpriteTypeMap[SpecialSprite];
|
||||
}
|
||||
else if (EnumValue(Action) < std::size(PeepActionToSpriteTypeMap))
|
||||
|
||||
if (EnumValue(Action) < std::size(PeepActionToSpriteTypeMap))
|
||||
{
|
||||
return PeepActionToSpriteTypeMap[EnumValue(Action)];
|
||||
}
|
||||
else
|
||||
{
|
||||
openrct2_assert(
|
||||
EnumValue(Action) >= std::size(PeepActionToSpriteTypeMap) && Action < PeepActionType::Idle,
|
||||
"Invalid peep action %u", EnumValue(Action));
|
||||
return PeepActionSpriteType::None;
|
||||
}
|
||||
|
||||
openrct2_assert(
|
||||
EnumValue(Action) >= std::size(PeepActionToSpriteTypeMap) && Action < PeepActionType::Idle, "Invalid peep action %u",
|
||||
EnumValue(Action));
|
||||
return PeepActionSpriteType::None;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1512,17 +1511,15 @@ bool Peep::SetName(std::string_view value)
|
|||
Name = nullptr;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
auto newNameMemory = static_cast<char*>(std::malloc(value.size() + 1));
|
||||
if (newNameMemory != nullptr)
|
||||
{
|
||||
auto newNameMemory = static_cast<char*>(std::malloc(value.size() + 1));
|
||||
if (newNameMemory != nullptr)
|
||||
{
|
||||
std::memcpy(newNameMemory, value.data(), value.size());
|
||||
newNameMemory[value.size()] = '\0';
|
||||
std::free(Name);
|
||||
Name = newNameMemory;
|
||||
return true;
|
||||
}
|
||||
std::memcpy(newNameMemory, value.data(), value.size());
|
||||
newNameMemory[value.size()] = '\0';
|
||||
std::free(Name);
|
||||
Name = newNameMemory;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1834,15 +1831,13 @@ static bool peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
|
|||
found = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
if (z != nextTileElement->base_height)
|
||||
{
|
||||
if (z != nextTileElement->base_height)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
} while (!(nextTileElement++)->IsLastForTile());
|
||||
}
|
||||
|
||||
|
@ -1962,7 +1957,8 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool
|
|||
crowded++;
|
||||
continue;
|
||||
}
|
||||
else if (auto litter = entity->As<Litter>(); litter != nullptr)
|
||||
|
||||
if (auto litter = entity->As<Litter>(); litter != nullptr)
|
||||
{
|
||||
if (abs(litter->z - guest->NextLoc.z) > 16)
|
||||
continue;
|
||||
|
@ -2358,7 +2354,8 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result)
|
|||
tile_result = tileElement;
|
||||
return;
|
||||
}
|
||||
else if (tileElement->GetType() == TILE_ELEMENT_TYPE_TRACK)
|
||||
|
||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_TRACK)
|
||||
{
|
||||
if (peep_interact_with_shop(this, { newLoc, tileElement }))
|
||||
{
|
||||
|
|
|
@ -1521,7 +1521,7 @@ void Staff::UpdateAnswering()
|
|||
peep_window_state_update(this);
|
||||
return;
|
||||
}
|
||||
else if (SubState == 1)
|
||||
if (SubState == 1)
|
||||
{
|
||||
if (IsActionWalking())
|
||||
{
|
||||
|
@ -1535,7 +1535,7 @@ void Staff::UpdateAnswering()
|
|||
Invalidate();
|
||||
return;
|
||||
}
|
||||
else if (SubState <= 3)
|
||||
if (SubState <= 3)
|
||||
{
|
||||
MechanicTimeSinceCall++;
|
||||
if (MechanicTimeSinceCall > 2500)
|
||||
|
@ -2555,10 +2555,8 @@ bool Staff::UpdateFixingMoveToStationExit(bool firstRun, const Ride* ride)
|
|||
MoveTo({ loc.value(), z });
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,11 +83,11 @@ uint16_t platform_get_locale_language()
|
|||
{
|
||||
return LANGUAGE_ENGLISH_US;
|
||||
}
|
||||
else if (!fnmatch(pattern, "zh_CN", 0))
|
||||
if (!fnmatch(pattern, "zh_CN", 0))
|
||||
{
|
||||
return LANGUAGE_CHINESE_SIMPLIFIED;
|
||||
}
|
||||
else if (!fnmatch(pattern, "zh_TW", 0))
|
||||
if (!fnmatch(pattern, "zh_TW", 0))
|
||||
{
|
||||
return LANGUAGE_CHINESE_TRADITIONAL;
|
||||
}
|
||||
|
|
|
@ -42,18 +42,14 @@ namespace Platform
|
|||
{
|
||||
return std::string();
|
||||
}
|
||||
else
|
||||
|
||||
auto colon = std::strchr(value, ':');
|
||||
if (colon == nullptr)
|
||||
{
|
||||
auto colon = std::strchr(value, ':');
|
||||
if (colon == nullptr)
|
||||
{
|
||||
return std::string(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string(value, colon);
|
||||
}
|
||||
return std::string(value);
|
||||
}
|
||||
|
||||
return std::string(value, colon);
|
||||
}
|
||||
|
||||
std::string GetHomePath()
|
||||
|
@ -207,12 +203,10 @@ namespace Platform
|
|||
{
|
||||
return String::Set(buffer, bufferSize, relativePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
String::Set(buffer, bufferSize, absolutePath);
|
||||
Memory::Free(absolutePath);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
String::Set(buffer, bufferSize, absolutePath);
|
||||
Memory::Free(absolutePath);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::string ResolveCasing(const std::string& path, bool fileExists)
|
||||
|
|
|
@ -589,12 +589,10 @@ namespace Platform
|
|||
{
|
||||
return String::Set(buffer, bufferSize, relativePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto absolutePath = String::ToUtf8(absolutePathW);
|
||||
String::Set(buffer, bufferSize, absolutePath.c_str());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
auto absolutePath = String::ToUtf8(absolutePathW);
|
||||
String::Set(buffer, bufferSize, absolutePath.c_str());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::string ResolveCasing(const std::string& path, bool fileExists)
|
||||
|
|
|
@ -120,12 +120,10 @@ bool platform_lock_single_instance()
|
|||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Already running
|
||||
CloseHandle(mutex);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Already running
|
||||
CloseHandle(mutex);
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t platform_get_drives()
|
||||
|
@ -223,55 +221,55 @@ uint16_t platform_get_locale_language()
|
|||
{
|
||||
return LANGUAGE_ENGLISH_UK;
|
||||
}
|
||||
else if (strcmp(langCode, "ENU") == 0)
|
||||
if (strcmp(langCode, "ENU") == 0)
|
||||
{
|
||||
return LANGUAGE_ENGLISH_US;
|
||||
}
|
||||
else if (strcmp(langCode, "DEU") == 0)
|
||||
if (strcmp(langCode, "DEU") == 0)
|
||||
{
|
||||
return LANGUAGE_GERMAN;
|
||||
}
|
||||
else if (strcmp(langCode, "NLD") == 0)
|
||||
if (strcmp(langCode, "NLD") == 0)
|
||||
{
|
||||
return LANGUAGE_DUTCH;
|
||||
}
|
||||
else if (strcmp(langCode, "FRA") == 0)
|
||||
if (strcmp(langCode, "FRA") == 0)
|
||||
{
|
||||
return LANGUAGE_FRENCH;
|
||||
}
|
||||
else if (strcmp(langCode, "HUN") == 0)
|
||||
if (strcmp(langCode, "HUN") == 0)
|
||||
{
|
||||
return LANGUAGE_HUNGARIAN;
|
||||
}
|
||||
else if (strcmp(langCode, "PLK") == 0)
|
||||
if (strcmp(langCode, "PLK") == 0)
|
||||
{
|
||||
return LANGUAGE_POLISH;
|
||||
}
|
||||
else if (strcmp(langCode, "ESP") == 0)
|
||||
if (strcmp(langCode, "ESP") == 0)
|
||||
{
|
||||
return LANGUAGE_SPANISH;
|
||||
}
|
||||
else if (strcmp(langCode, "SVE") == 0)
|
||||
if (strcmp(langCode, "SVE") == 0)
|
||||
{
|
||||
return LANGUAGE_SWEDISH;
|
||||
}
|
||||
else if (strcmp(langCode, "ITA") == 0)
|
||||
if (strcmp(langCode, "ITA") == 0)
|
||||
{
|
||||
return LANGUAGE_ITALIAN;
|
||||
}
|
||||
else if (strcmp(langCode, "POR") == 0)
|
||||
if (strcmp(langCode, "POR") == 0)
|
||||
{
|
||||
return LANGUAGE_PORTUGUESE_BR;
|
||||
}
|
||||
else if (strcmp(langCode, "FIN") == 0)
|
||||
if (strcmp(langCode, "FIN") == 0)
|
||||
{
|
||||
return LANGUAGE_FINNISH;
|
||||
}
|
||||
else if (strcmp(langCode, "NOR") == 0)
|
||||
if (strcmp(langCode, "NOR") == 0)
|
||||
{
|
||||
return LANGUAGE_NORWEGIAN;
|
||||
}
|
||||
else if (strcmp(langCode, "DAN") == 0)
|
||||
if (strcmp(langCode, "DAN") == 0)
|
||||
{
|
||||
return LANGUAGE_DANISH;
|
||||
}
|
||||
|
@ -347,8 +345,8 @@ TemperatureUnit platform_get_locale_temperature_format()
|
|||
|
||||
if (fahrenheit)
|
||||
return TemperatureUnit::Fahrenheit;
|
||||
else
|
||||
return TemperatureUnit::Celsius;
|
||||
|
||||
return TemperatureUnit::Celsius;
|
||||
}
|
||||
|
||||
uint8_t platform_get_locale_date_format()
|
||||
|
@ -381,21 +379,19 @@ uint8_t platform_get_locale_date_format()
|
|||
{
|
||||
return DATE_FORMAT_DAY_MONTH_YEAR;
|
||||
}
|
||||
else if (wcsncmp(L"M", first, 1) == 0)
|
||||
if (wcsncmp(L"M", first, 1) == 0)
|
||||
{
|
||||
return DATE_FORMAT_MONTH_DAY_YEAR;
|
||||
}
|
||||
else if (wcsncmp(L"y", first, 1) == 0)
|
||||
if (wcsncmp(L"y", first, 1) == 0)
|
||||
{
|
||||
if (wcsncmp(L"d", second, 1) == 0)
|
||||
{
|
||||
return DATE_FORMAT_YEAR_DAY_MONTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Closest possible option
|
||||
return DATE_FORMAT_YEAR_MONTH_DAY;
|
||||
}
|
||||
|
||||
// Closest possible option
|
||||
return DATE_FORMAT_YEAR_MONTH_DAY;
|
||||
}
|
||||
# endif
|
||||
|
||||
|
@ -421,10 +417,8 @@ bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
|||
safe_strcat_path(buffer, font->filename, size);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
# else
|
||||
log_warning("Compatibility hack: falling back to C:\\Windows\\Fonts");
|
||||
safe_strcpy(buffer, "C:\\Windows\\Fonts\\", size);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue