summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkai <kai@zittrig.eu>2020-04-02 19:07:13 +0100
committerkai <kai@zittrig.eu>2020-04-02 19:10:50 +0100
commit13ec4a87d36e18586142390632106eb85040d9ab (patch)
treee42fa32b2562165a5e9c367d9f5dec0daf9e7109
parenta49b55d8d98854331831d9ae32311b4003855ea7 (diff)
enneract approved codeā„¢ for G_admin_isconsoleaschacht
-rw-r--r--src/game/g_admin.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 12c50b2..cb1c36d 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -1089,38 +1089,19 @@ char* G_admin_adminPrintName( gentity_t *ent )
}
qboolean G_admin_isconsoleaschacht( void ){
- time_t t;
- struct tm *actual_time_tm;
- char day_s[ 10 ];
- int day;
-
- time( &t ); // what's the time
-
- actual_time_tm = localtime( &t ); // whats the local time
-
- strftime( day_s, sizeof( day_s ), "%d", actual_time_tm ); // i just need the actual day number
+ qtime_t qt;
- sscanf( day_s, "%d", &day ); // now convert it to an integer for the below logic
+ trap_RealTime( &qt );
- // G_Printf( "Day is (string): %s, day is (int) %i\n", day_s, day ); // debug
+ // G_Printf( "Day is %i (integer)\n", qt.tm_mday ); // debug
- if( day < 15 ){
- if( g_consoleIsASchacht.integer == day ) {
- return qfalse;
- }
- else
- {
- return qtrue;
- }
+ if( qt.tm_mday < 15 )
+ {
+ return g_consoleIsASchacht.integer != qt.tm_mday;
}
- else if( day >= 15 ){
- if( g_consoleIsASchacht.integer == ceil( day / 3 ) ){
- return qfalse;
- }
- else
- {
- return qtrue;
- }
+ else
+ {
+ return g_consoleIsASchacht.integer != ceil( qt.tm_mday / 3.0f );
}
}