Changeset - r9130:69c4734ade18
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-05-07 13:37:53
rubidium@openttd.org
(svn r12990) -Fix: silence the redundanct declaration warning when compiling with iconv.
1 file changed with 93 insertions and 93 deletions:
0 comments (0 inline, 0 general)
src/unix.cpp
Show inline comments
 
@@ -106,99 +106,6 @@ bool FiosIsHiddenFile(const struct diren
 
	return ent->d_name[0] == '.';
 
}
 

	
 
void ShowInfo(const char *str)
 
{
 
	fprintf(stderr, "%s\n", str);
 
}
 

	
 
void ShowOSErrorBox(const char *buf)
 
{
 
#if defined(__APPLE__)
 
	/* this creates an NSAlertPanel with the contents of 'buf'
 
	 * this is the native and nicest way to do this on OSX */
 
	ShowMacDialog( buf, "See readme for more info\nMost likely you are missing files from the original TTD", "Quit" );
 
#else
 
	/* all systems, but OSX */
 
	fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
 
#endif
 
}
 

	
 
#ifdef WITH_COCOA
 
void cocoaSetupAutoreleasePool();
 
void cocoaReleaseAutoreleasePool();
 
#endif
 

	
 
int CDECL main(int argc, char* argv[])
 
{
 
	int ret;
 

	
 
#ifdef WITH_COCOA
 
	cocoaSetupAutoreleasePool();
 
	/* This is passed if we are launched by double-clicking */
 
	if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) {
 
		argv[1] = NULL;
 
		argc = 1;
 
	}
 
#endif
 

	
 
	SetRandomSeed(time(NULL));
 

	
 
	signal(SIGPIPE, SIG_IGN);
 

	
 
	ret = ttd_main(argc, argv);
 

	
 
#ifdef WITH_COCOA
 
	cocoaReleaseAutoreleasePool();
 
#endif
 

	
 
	return ret;
 
}
 

	
 
bool InsertTextBufferClipboard(Textbuf *tb)
 
{
 
	return false;
 
}
 

	
 

	
 
/* multi os compatible sleep function */
 

	
 
#ifdef __AMIGA__
 
/* usleep() implementation */
 
#	include <devices/timer.h>
 
#	include <dos/dos.h>
 

	
 
	extern struct Device      *TimerBase    = NULL;
 
	extern struct MsgPort     *TimerPort    = NULL;
 
	extern struct timerequest *TimerRequest = NULL;
 
#endif // __AMIGA__
 

	
 
void CSleep(int milliseconds)
 
{
 
	#if defined(PSP)
 
		sceKernelDelayThread(milliseconds * 1000);
 
	#elif defined(__BEOS__)
 
		snooze(milliseconds * 1000);
 
	#elif defined(__AMIGA__)
 
	{
 
		ULONG signals;
 
		ULONG TimerSigBit = 1 << TimerPort->mp_SigBit;
 

	
 
		/* send IORequest */
 
		TimerRequest->tr_node.io_Command = TR_ADDREQUEST;
 
		TimerRequest->tr_time.tv_secs    = (milliseconds * 1000) / 1000000;
 
		TimerRequest->tr_time.tv_micro   = (milliseconds * 1000) % 1000000;
 
		SendIO((struct IORequest *)TimerRequest);
 

	
 
		if (!((signals = Wait(TimerSigBit | SIGBREAKF_CTRL_C)) & TimerSigBit) ) {
 
			AbortIO((struct IORequest *)TimerRequest);
 
		}
 
		WaitIO((struct IORequest *)TimerRequest);
 
	}
 
	#else
 
		usleep(milliseconds * 1000);
 
	#endif
 
}
 

	
 
#ifdef WITH_ICONV
 

	
 
#include <iconv.h>
 
@@ -301,3 +208,96 @@ const char *FS2OTTD(const char *name)
 
const char *FS2OTTD(const char *name) {return name;}
 
const char *OTTD2FS(const char *name) {return name;}
 
#endif /* WITH_ICONV */
 

	
 
void ShowInfo(const char *str)
 
{
 
	fprintf(stderr, "%s\n", str);
 
}
 

	
 
void ShowOSErrorBox(const char *buf)
 
{
 
#if defined(__APPLE__)
 
	/* this creates an NSAlertPanel with the contents of 'buf'
 
	 * this is the native and nicest way to do this on OSX */
 
	ShowMacDialog( buf, "See readme for more info\nMost likely you are missing files from the original TTD", "Quit" );
 
#else
 
	/* all systems, but OSX */
 
	fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
 
#endif
 
}
 

	
 
#ifdef WITH_COCOA
 
void cocoaSetupAutoreleasePool();
 
void cocoaReleaseAutoreleasePool();
 
#endif
 

	
 
int CDECL main(int argc, char* argv[])
 
{
 
	int ret;
 

	
 
#ifdef WITH_COCOA
 
	cocoaSetupAutoreleasePool();
 
	/* This is passed if we are launched by double-clicking */
 
	if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) {
 
		argv[1] = NULL;
 
		argc = 1;
 
	}
 
#endif
 

	
 
	SetRandomSeed(time(NULL));
 

	
 
	signal(SIGPIPE, SIG_IGN);
 

	
 
	ret = ttd_main(argc, argv);
 

	
 
#ifdef WITH_COCOA
 
	cocoaReleaseAutoreleasePool();
 
#endif
 

	
 
	return ret;
 
}
 

	
 
bool InsertTextBufferClipboard(Textbuf *tb)
 
{
 
	return false;
 
}
 

	
 

	
 
/* multi os compatible sleep function */
 

	
 
#ifdef __AMIGA__
 
/* usleep() implementation */
 
#	include <devices/timer.h>
 
#	include <dos/dos.h>
 

	
 
	extern struct Device      *TimerBase    = NULL;
 
	extern struct MsgPort     *TimerPort    = NULL;
 
	extern struct timerequest *TimerRequest = NULL;
 
#endif // __AMIGA__
 

	
 
void CSleep(int milliseconds)
 
{
 
	#if defined(PSP)
 
		sceKernelDelayThread(milliseconds * 1000);
 
	#elif defined(__BEOS__)
 
		snooze(milliseconds * 1000);
 
	#elif defined(__AMIGA__)
 
	{
 
		ULONG signals;
 
		ULONG TimerSigBit = 1 << TimerPort->mp_SigBit;
 

	
 
		/* send IORequest */
 
		TimerRequest->tr_node.io_Command = TR_ADDREQUEST;
 
		TimerRequest->tr_time.tv_secs    = (milliseconds * 1000) / 1000000;
 
		TimerRequest->tr_time.tv_micro   = (milliseconds * 1000) % 1000000;
 
		SendIO((struct IORequest *)TimerRequest);
 

	
 
		if (!((signals = Wait(TimerSigBit | SIGBREAKF_CTRL_C)) & TimerSigBit) ) {
 
			AbortIO((struct IORequest *)TimerRequest);
 
		}
 
		WaitIO((struct IORequest *)TimerRequest);
 
	}
 
	#else
 
		usleep(milliseconds * 1000);
 
	#endif
 
}
0 comments (0 inline, 0 general)