Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 970cd70

Browse files
committed
Remove incorrect variable declaration in RTEError
Some minor formatting
1 parent fa90d05 commit 970cd70

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

System/RTEError.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ namespace RTE {
1212
extern bool RTEAbortFunc(const char *description, const char *file, int line) {
1313
// Save out the screen bitmap, after making a copy of it, faster sometimes
1414
if (screen) {
15-
if (!g_ScreendumpBuffer) { g_ScreendumpBuffer = create_bitmap(screen->w, screen->h); }
16-
blit(screen, g_ScreendumpBuffer, 0, 0, 0, 0, screen->w, screen->h);
15+
BITMAP *abortScreenBuffer = create_bitmap(screen->w, screen->h);
16+
blit(screen, abortScreenBuffer, 0, 0, 0, 0, screen->w, screen->h);
1717
PALETTE palette;
1818
get_palette(palette);
19-
save_bmp("abortscreen.bmp", g_ScreendumpBuffer, palette);
19+
save_bmp("abortscreen.bmp", abortScreenBuffer, palette);
20+
destroy_bitmap(abortScreenBuffer);
2021
}
2122
// Ditch the video mode so the message box appears without problems
2223
if (screen != 0) { set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); }

System/RTEError.h

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
namespace RTE {
1414

15-
static BITMAP *g_ScreendumpBuffer = 0; //!< Buffer for saving abort screendumps.
16-
1715
/// <summary>
1816
/// Pops up a message box dialog in the OS. For debug purposes mostly.
1917
/// </summary>
@@ -28,12 +26,11 @@ namespace RTE {
2826
/// <param name="line">The line where the abortion is made.</param>
2927
extern bool RTEAbortFunc(const char *description, const char *file, int line);
3028
extern bool RTEAbortFunc(const std::string description, const char *file, int line);
31-
#define RTEAbort(description) \
32-
{ \
33-
if (RTEAbortFunc(description, __FILE__, __LINE__)) { \
34-
DebuggerBreak \
35-
} \
29+
30+
#define RTEAbort(description) { \
31+
if (RTEAbortFunc(description, __FILE__, __LINE__)) { DebuggerBreak } \
3632
}
33+
3734
/// <summary>
3835
/// A souped-up, customized assert function that brings up a nice dialog box on assert failure.
3936
/// The user can choose to break or ignore the particular assertion failure once, or to always ignore.
@@ -46,14 +43,12 @@ namespace RTE {
4643
/// <returns>Whether the assertion failed AND the user chose to break in the dialog box.</returns>
4744
extern bool RTEAssertFunc(bool expression, const char *description, const char *file, int line, bool &alwaysIgnore);
4845
extern bool RTEAssertFunc(bool expression, const std::string description, const char *file, int line, bool &alwaysIgnore);
49-
#define RTEAssert(expression, description) \
50-
{ \
51-
static bool alwaysIgnore= false; \
52-
if (!alwaysIgnore) { \
53-
if (RTEAssertFunc(expression, description, __FILE__, __LINE__, alwaysIgnore)) { \
54-
DebuggerBreak \
55-
} \
56-
} \
46+
47+
#define RTEAssert(expression, description) { \
48+
static bool alwaysIgnore = false; \
49+
if (!alwaysIgnore) { \
50+
if (RTEAssertFunc(expression, description, __FILE__, __LINE__, alwaysIgnore)) { DebuggerBreak } \
51+
} \
5752
}
5853
}
5954
#endif

0 commit comments

Comments
 (0)