Skip to content

Commit

Permalink
Simplify the interface of dr_fatal_notify().
Browse files Browse the repository at this point in the history
- Remove the parameter choices, because all callers pass in 0.
- Remove the return value, because no caller uses it.

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@4937 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
chmallon committed Nov 9, 2011
1 parent d0560b1 commit 63ebace
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 37 deletions.
2 changes: 1 addition & 1 deletion simmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ int simu_main(int argc, char** argv)
if( umgebung_t::objfilename.empty() ) {
// nothing to be loaded => exit
fprintf(stderr, "*** No pak set found ***\n\nMost likely, you have no pak set installed.\nPlease download and install also graphics (pak).\n");
dr_fatal_notify( "*** No pak set found ***\n\nMost likely, you have no pak set installed.\nPlease download and install also graphcis (pak).\n", 0 );
dr_fatal_notify("*** No pak set found ***\n\nMost likely, you have no pak set installed.\nPlease download and install also graphcis (pak).\n");
simgraph_exit();
return 0;
}
Expand Down
3 changes: 1 addition & 2 deletions simsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ unsigned long dr_time(void);
void dr_sleep(uint32 millisec);

// error message in case of fatal events
// if choice!=0 then there will be a scond button
bool dr_fatal_notify(const char* msg, int choices);
void dr_fatal_notify(char const* msg);

/**
* Some wrappers can save screenshots.
Expand Down
17 changes: 4 additions & 13 deletions simsys_d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ int dr_os_init(const int* parameter)
set_close_button_callback(my_close_button_callback);

if (ok != 0) {
dr_fatal_notify("Could not init Allegro.\n",0);
dr_fatal_notify("Could not init Allegro.\n");
}
simtimer_init();

Expand Down Expand Up @@ -493,7 +493,7 @@ static void simtimer_init(void)
printf("Timer installed.\n");
}
else {
dr_fatal_notify("Error: Timer not available, aborting.\n",0);
dr_fatal_notify("Error: Timer not available, aborting.\n");
exit(1);
}
}
Expand All @@ -511,19 +511,10 @@ void dr_sleep(uint32 usec)
}


bool dr_fatal_notify(const char* msg, int choices)
void dr_fatal_notify(char const* const msg)
{
#ifdef _WIN32
if(choices==0) {
MessageBox( NULL, msg, "Fatal Error", MB_ICONEXCLAMATION|MB_OK );
return 0;
}
else {
return MessageBox( NULL, msg, "Fatal Error", MB_ICONEXCLAMATION|MB_RETRYCANCEL )==IDRETRY;
}
#else
// beep();
return choices;
MessageBox(0, msg, "Fatal Error", MB_ICONEXCLAMATION | MB_OK);
#endif
}

Expand Down
5 changes: 3 additions & 2 deletions simsys_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,13 @@ void dr_sleep(uint32 msec)
#endif
}

bool dr_fatal_notify(const char* msg, int choices)

void dr_fatal_notify(char const* const msg)
{
fputs(msg, stderr);
return choices;
}


int main(int argc, char **argv)
{
#ifdef _WIN32
Expand Down
11 changes: 2 additions & 9 deletions simsys_s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -620,19 +620,12 @@ void dr_sleep(uint32 usec)
}


bool dr_fatal_notify(const char* msg, int choices)
void dr_fatal_notify(char const* const msg)
{
#ifdef _WIN32
if(choices==0) {
MessageBoxA( NULL, msg, "Fatal Error", MB_ICONEXCLAMATION|MB_OK );
return 0;
}
else {
return MessageBoxA( NULL, msg, "Fatal Error", MB_ICONEXCLAMATION|MB_RETRYCANCEL )==IDRETRY;
}
MessageBoxA(0, msg, "Fatal Error", MB_ICONEXCLAMATION | MB_OK);
#else
fputs(msg, stderr);
return choices;
#endif
}

Expand Down
11 changes: 2 additions & 9 deletions simsys_w.cc
Original file line number Diff line number Diff line change
Expand Up @@ -736,16 +736,9 @@ void dr_sleep(uint32 millisec)
}



bool dr_fatal_notify(const char* msg, int choices)
void dr_fatal_notify(char const* const msg)
{
if(choices==0) {
MessageBoxA( hwnd, msg, "Fatal Error", MB_ICONEXCLAMATION|MB_OK );
return 0;
}
else {
return MessageBoxA( hwnd, msg, "Fatal Error", MB_ICONEXCLAMATION|MB_RETRYCANCEL )==IDRETRY;
}
MessageBoxA(hwnd, msg, "Fatal Error", MB_ICONEXCLAMATION | MB_OK);
}


Expand Down
2 changes: 1 addition & 1 deletion utils/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void log_t::fatal(const char *who, const char *format, ...)
}
else {
// use OS means, if there
dr_fatal_notify( buffer, 0 );
dr_fatal_notify(buffer);
}

#ifdef DEBUG
Expand Down

0 comments on commit 63ebace

Please sign in to comment.