Allow test ignoring

This commit is contained in:
Ted John 2016-09-18 16:46:26 +01:00
parent 21bb6c507d
commit a4b75fd84a
5 changed files with 93 additions and 4 deletions

View File

@ -168,4 +168,18 @@ void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sin
void viewport_draw_money_effects();
void viewport_paint_setup();
// TESTING
#ifdef __TESTPAINT__
void testpaint_clear_ignore();
void testpaint_ignore(uint8 direction, uint8 trackSequence);
void testpaint_ignore_all();
bool testpaint_is_ignored(uint8 direction, uint8 trackSequence);
#define TESTPAINT_IGNORE(direction, trackSequence) testpaint_ignore(direction, trackSequence)
#define TESTPAINT_IGNORE_ALL() testpaint_ignore_all()
#else
#define TESTPAINT_IGNORE(direction, trackSequence)
#define TESTPAINT_IGNORE_ALL()
#endif
#endif

View File

@ -576,7 +576,12 @@ static bool testTrackElement(uint8 rideType, uint8 trackType, utf8string *error)
callCount = 0;
testpaint_clear_ignore();
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
if (testpaint_is_ignored(direction, trackSequence)) {
sprintf(*error, "[ IGNORED ] [direction:%d trackSequence:%d]\n", direction, trackSequence);
continue;
}
uint8 newCallCount = callCount;
function_call newCalls[256];

View File

@ -397,8 +397,12 @@ namespace Intercept2
gSupportSegments[s].slope = 0xFF;
}
testpaint_clear_ignore();
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
if (testpaint_is_ignored(direction, trackSequence)) {
continue;
}
std::vector<SegmentSupportCall> newCalls = getSegmentCalls(gSupportSegments, direction);
@ -432,8 +436,12 @@ namespace Intercept2
gSupport.height = 0;
gSupport.slope = 0xFF;
testpaint_clear_ignore();
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
if (testpaint_is_ignored(direction, trackSequence)) {
continue;
}
if (referenceGeneralSupportCall.height != -1) {
if (gSupport.height != referenceGeneralSupportCall.height) {
@ -583,6 +591,7 @@ namespace Intercept2
gLeftTunnelCount = 0;
gRightTunnelCount = 0;
testpaint_clear_ignore();
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
for (int offset = -8; offset <= 8; offset += 8) {
@ -757,8 +766,12 @@ namespace Intercept2
for (int direction = 0; direction < 4; direction++) {
gVerticalTunnelHeight = 0;
testpaint_clear_ignore();
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
if (testpaint_is_ignored(direction, trackSequence)) {
continue;
}
if (gVerticalTunnelHeight != referenceHeight) {
if (referenceHeight == 0) {
@ -795,6 +808,44 @@ namespace Intercept2
return true;
}
struct IgnoredEntry
{
uint8 Direction;
uint8 TrackSequence;
};
static bool _ignoredAll;
static std::vector<IgnoredEntry> _ignoredEntries;
static void testClearIgnore()
{
_ignoredAll = false;
_ignoredEntries.clear();
}
static void testIgnore(uint8 direction, uint8 trackSequence)
{
_ignoredEntries.push_back({ direction, trackSequence });
}
static void testIgnoreAll()
{
_ignoredAll = true;
}
static bool testIsIgnored(uint8 direction, uint8 trackSequence)
{
if (_ignoredAll) return true;
for (const IgnoredEntry &entry : _ignoredEntries)
{
if (entry.Direction == direction &&
entry.TrackSequence == trackSequence)
{
return true;
}
}
return false;
}
}
extern "C"
@ -814,4 +865,23 @@ extern "C"
return Intercept2::testVerticalTunnels(rideType, trackType);
}
void testpaint_clear_ignore()
{
Intercept2::testClearIgnore();
}
void testpaint_ignore(uint8 direction, uint8 trackSequence)
{
Intercept2::testIgnore(direction, trackSequence);
}
void testpaint_ignore_all()
{
Intercept2::testIgnoreAll();
}
bool testpaint_is_ignored(uint8 direction, uint8 trackSequence)
{
return Intercept2::testIsIgnored(direction, trackSequence);
}
}

View File

@ -60,7 +60,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>DEBUG;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__TESTPAINT__;DEBUG;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
<DisableSpecificWarnings>4200</DisableSpecificWarnings>
</ClCompile>
@ -72,7 +72,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__TESTPAINT__;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatWarningAsError>true</TreatWarningAsError>
<DisableSpecificWarnings>4200</DisableSpecificWarnings>
</ClCompile>

View File

@ -4,13 +4,13 @@
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>--ride-type 4</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>--ride-type 42</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>--ride-type 4</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>--ride-type 42</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>