diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj
index baa3d25704..1613699264 100644
--- a/projects/openrct2.vcxproj
+++ b/projects/openrct2.vcxproj
@@ -124,6 +124,7 @@
+
diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters
index 3cf9846b55..93ba75f423 100644
--- a/projects/openrct2.vcxproj.filters
+++ b/projects/openrct2.vcxproj.filters
@@ -380,7 +380,6 @@
-
Source\Drawing
@@ -437,6 +436,10 @@
Source\Ride
+
+
+ Source\Windows
+
diff --git a/src/interface/window.h b/src/interface/window.h
index 2e504e8aa2..80ac18adeb 100644
--- a/src/interface/window.h
+++ b/src/interface/window.h
@@ -504,6 +504,7 @@ rct_window *window_ride_main_open(int rideIndex);
void window_ride_demolish_prompt_open(int rideIndex);
void window_ride_construct(rct_window *w);
void window_ride_list_open();
+rct_window * window_construction_open();
void window_track_place_open();
void window_new_ride_open();
void window_banner_open(rct_windownumber number);
diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h
index f26a7d9ad6..01dbcfe9a4 100644
--- a/src/localisation/string_ids.h
+++ b/src/localisation/string_ids.h
@@ -489,6 +489,7 @@ enum {
STR_HEADING_TO_RIDE_FOR_INSPECTION = 1793,
STR_FIXING_RIDE = 1794,
STR_ANSWERING_RADIO_CALL = 1795,
+ STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING = 1796,
STR_SAFETY_CUT_OUT = 1800,
STR_RESTRAINTS_STUCK_CLOSED = 1801,
diff --git a/src/ride/ride.c b/src/ride/ride.c
index 9549f028a7..428fcf8a96 100644
--- a/src/ride/ride.c
+++ b/src/ride/ride.c
@@ -22,6 +22,7 @@
#include "../addresses.h"
#include "../audio/audio.h"
#include "../game.h"
+#include "../input.h"
#include "../interface/window.h"
#include "../localisation/date.h"
#include "../localisation/localisation.h"
@@ -30,6 +31,7 @@
#include "../peep/staff.h"
#include "../scenario.h"
#include "../util/util.h"
+#include "../windows/error.h"
#include "../world/map.h"
#include "../world/sprite.h"
#include "ride.h"
@@ -499,6 +501,72 @@ int ride_try_construct(rct_map_element *trackMapElement)
return 1;
}
+/**
+ *
+ * rct2: 0x006CC3FB
+ */
+void sub_6CC3FB(int rideIndex)
+{
+ rct_ride *ride;
+ rct_window *w;
+
+ tool_cancel();
+ ride = GET_RIDE(rideIndex);
+ if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) {
+ RCT2_GLOBAL(0x013CE952 + 6, uint16) = ride->name;
+ RCT2_GLOBAL(0x013CE952 + 8, uint32) = ride->name_arguments;
+ window_error_open(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING);
+ return;
+ }
+
+ if (ride->status != RIDE_STATUS_CLOSED) {
+ RCT2_GLOBAL(0x013CE952 + 6, uint16) = ride->name;
+ RCT2_GLOBAL(0x013CE952 + 8, uint32) = ride->name_arguments;
+ window_error_open(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST);
+ return;
+ }
+
+ RCT2_CALLPROC_X(0x006DD4AC, 0, 0, 0, rideIndex, 0, 0, 0);
+ RCT2_CALLPROC_X(0x006664DF, 0, 0, 0, rideIndex, 0, 0, 0);
+
+ w = window_find_by_class(WC_RIDE_CONSTRUCTION);
+ if (w == NULL || w->number != rideIndex) {
+ window_close_construction_windows();
+ RCT2_GLOBAL(0x00F440A7, uint8) = rideIndex;
+ w = window_construction_open(rideIndex);
+ } else {
+ RCT2_CALLPROC_X(0x006C9627, 0, 0, 0, 0, 0, 0, 0);
+ RCT2_GLOBAL(0x00F440A7, uint8) = rideIndex;
+ }
+
+ tool_set(w, 23, 12);
+ RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
+
+ ride = GET_RIDE(RCT2_GLOBAL(0x00F440A7, uint8));
+
+ RCT2_GLOBAL(0x00F440A0, uint16) = RCT2_ADDRESS(0x0097CC68, uint8)[ride->type * 2] | 0x100;
+ RCT2_GLOBAL(0x00F440B2, uint8) = 0;
+ RCT2_GLOBAL(0x00F440B3, uint8) = 0;
+ RCT2_GLOBAL(0x00F440B4, uint8) = 0;
+ RCT2_GLOBAL(0x00F440B5, uint8) = 0;
+
+ if (RCT2_GLOBAL(0x0097D4F2 + (ride->type * 8), uint16) & 0x8000)
+ RCT2_GLOBAL(0x00F440B5, uint8) |= 2;
+
+ RCT2_GLOBAL(0x00F440B6, uint8) = 0;
+ RCT2_GLOBAL(0x00F440B7, uint8) = 0;
+
+ RCT2_GLOBAL(0x00F440AE, uint8) = 0;
+ RCT2_GLOBAL(0x00F440A6, uint8) = 4;
+ RCT2_GLOBAL(0x00F440B0, uint8) = 0;
+ RCT2_GLOBAL(0x00F440B1, uint8) = 0;
+ RCT2_GLOBAL(0x00F44159, uint8) = 0;
+ RCT2_GLOBAL(0x00F4415C, uint8) = 0;
+
+ RCT2_CALLPROC_X(0x006C84CE, 0, 0, 0, 0, 0, ride->type, 0);
+ // return 0;
+}
+
#pragma endregion
#pragma region Update functions
diff --git a/src/ride/ride.h b/src/ride/ride.h
index f8388da85b..de0628764b 100644
--- a/src/ride/ride.h
+++ b/src/ride/ride.h
@@ -624,5 +624,6 @@ void ride_measurements_update();
rct_ride_measurement *ride_get_measurement(int rideIndex, rct_string_id *message);
void ride_breakdown_add_news_item(int rideIndex);
rct_peep *ride_find_closest_mechanic(rct_ride *ride, int forInspection);
+void sub_6CC3FB(int rideIndex);
#endif
diff --git a/src/windows/ride.c b/src/windows/ride.c
index a3c0ba72b7..89dd5a0990 100644
--- a/src/windows/ride.c
+++ b/src/windows/ride.c
@@ -1382,7 +1382,7 @@ void window_ride_construct(rct_window *w)
trackMapElement = sub_6CAF80(rideIndex, &trackX, &trackY);
if (trackMapElement == (rct_map_element*)-1) {
- RCT2_CALLPROC_X(0x006CC3FB, 0, 0, 0, rideIndex, 0, 0, 0);
+ sub_6CC3FB(rideIndex);
} else {
trackMapElement = ride_find_track_gap(trackMapElement, &trackX, &trackY);
diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c
new file mode 100644
index 0000000000..fba8fd2aca
--- /dev/null
+++ b/src/windows/ride_construction.c
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2014 Ted John
+ * OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+ *
+ * This file is part of OpenRCT2.
+ *
+ * OpenRCT2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *****************************************************************************/
+
+#include "../addresses.h"
+#include "../interface/window.h"
+
+/**
+ *
+ * rct2: 0x006CB481
+ */
+rct_window *window_construction_open()
+{
+ int eax, ebx, ecx, edx, esi, edi, ebp;
+ RCT2_CALLFUNC_X(0x006CB481, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
+ return (rct_window*)esi;
+}
\ No newline at end of file
diff --git a/src/windows/track_place.c b/src/windows/track_place.c
index 5612ac1c98..9856fdf6a7 100644
--- a/src/windows/track_place.c
+++ b/src/windows/track_place.c
@@ -607,7 +607,7 @@ static void window_track_place_tooldown()
window_ride_main_open(rideIndex);
window_close(w);
} else {
- RCT2_CALLPROC_X(0x006CC3FB, 0, 0, 0, rideIndex, 0, 0, 0);
+ sub_6CC3FB(rideIndex);
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
window_event_helper(w, 29, WE_MOUSE_UP);
}