mirror of
https://github.com/id-Software/DOOM-iOS.git
synced 2026-03-20 00:49:34 +01:00
Source release for DOOM Classic for iOS version 2.1
This commit is contained in:
56
code/iphone/.svn/text-base/misc.c.svn-base
Normal file
56
code/iphone/.svn/text-base/misc.c.svn-base
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* misc.c
|
||||
* doom
|
||||
*
|
||||
* Created by John Carmack on 4/13/09.
|
||||
* Copyright 2009 idSoftware. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../doomiphone.h"
|
||||
|
||||
void Com_Printf( const char *fmt, ... ) {
|
||||
va_list argptr;
|
||||
|
||||
va_start( argptr, fmt );
|
||||
vprintf( fmt, argptr );
|
||||
va_end( argptr );
|
||||
}
|
||||
|
||||
void Com_Error( const char *fmt, ... ) {
|
||||
va_list argptr;
|
||||
|
||||
va_start( argptr, fmt );
|
||||
vprintf( fmt, argptr );
|
||||
va_end( argptr );
|
||||
|
||||
// drop into the editor
|
||||
abort();
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
char *va( const char *format, ... ) {
|
||||
va_list argptr;
|
||||
static char string[ 1024 ];
|
||||
|
||||
va_start( argptr, format );
|
||||
(void)vsnprintf( string, sizeof( string ), format, argptr );
|
||||
va_end( argptr );
|
||||
|
||||
string[ sizeof( string ) - 1 ] = '\0';
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
int HashString( const char *string ) {
|
||||
int hash = *string;
|
||||
|
||||
if( hash ) {
|
||||
for( string += 1; *string != '\0'; ++string ) {
|
||||
hash = (hash << 5) - hash + tolower(*string);
|
||||
}
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user