equal
deleted
inserted
replaced
58 function endian(independent: LongWord): LongWord; inline; |
58 function endian(independent: LongWord): LongWord; inline; |
59 |
59 |
60 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
60 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
61 |
61 |
62 procedure AddFileLog(s: shortstring); |
62 procedure AddFileLog(s: shortstring); |
|
63 procedure AddFileLogRaw(s: pchar); cdecl; |
63 |
64 |
64 function CheckNoTeamOrHH: boolean; inline; |
65 function CheckNoTeamOrHH: boolean; inline; |
65 |
66 |
66 function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; |
67 function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; |
67 function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; |
68 function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; |
78 implementation |
79 implementation |
79 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; |
80 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; |
80 |
81 |
81 {$IFDEF DEBUGFILE} |
82 {$IFDEF DEBUGFILE} |
82 var f: textfile; |
83 var f: textfile; |
|
84 logMutex: TRTLCriticalSection; // mutex for debug file |
83 {$ENDIF} |
85 {$ENDIF} |
84 var CharArray: array[byte] of Char; |
86 var CharArray: array[byte] of Char; |
85 |
87 |
86 // should this include "strtolower()" for the split string? |
88 // should this include "strtolower()" for the split string? |
87 procedure SplitBySpace(var a, b: shortstring); |
89 procedure SplitBySpace(var a, b: shortstring); |
295 |
297 |
296 procedure AddFileLog(s: shortstring); |
298 procedure AddFileLog(s: shortstring); |
297 begin |
299 begin |
298 s:= s; |
300 s:= s; |
299 {$IFDEF DEBUGFILE} |
301 {$IFDEF DEBUGFILE} |
|
302 EnterCriticalSection(logMutex); |
300 writeln(f, inttostr(GameTicks) + ': ' + s); |
303 writeln(f, inttostr(GameTicks) + ': ' + s); |
301 flush(f) |
304 flush(f); |
302 {$ENDIF} |
305 LeaveCriticalSection(logMutex); |
303 end; |
306 {$ENDIF} |
304 |
307 end; |
|
308 |
|
309 procedure AddFileLogRaw(s: pchar); cdecl; |
|
310 begin |
|
311 s:= s; |
|
312 {$IFDEF DEBUGFILE} |
|
313 EnterCriticalSection(logMutex); |
|
314 write(f, s); |
|
315 flush(f); |
|
316 LeaveCriticalSection(logMutex); |
|
317 {$ENDIF} |
|
318 end; |
305 |
319 |
306 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
320 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
307 var l, i : LongInt; |
321 var l, i : LongInt; |
308 u: WideChar; |
322 u: WideChar; |
309 tmpstr: array[0..256] of WideChar; |
323 tmpstr: array[0..256] of WideChar; |
392 {$IFDEF DEBUGFILE} |
406 {$IFDEF DEBUGFILE} |
393 if isGame then |
407 if isGame then |
394 logfileBase:= 'game' |
408 logfileBase:= 'game' |
395 else |
409 else |
396 logfileBase:= 'preview'; |
410 logfileBase:= 'preview'; |
|
411 InitCriticalSection(logMutex); |
397 {$I-} |
412 {$I-} |
398 {$IFDEF MOBILE} |
413 {$IFDEF MOBILE} |
399 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} |
414 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} |
400 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
415 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
401 Rewrite(f); |
416 Rewrite(f); |
428 |
443 |
429 {$IFDEF DEBUGFILE} |
444 {$IFDEF DEBUGFILE} |
430 writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); |
445 writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); |
431 flush(f); |
446 flush(f); |
432 close(f); |
447 close(f); |
|
448 DoneCriticalSection(logMutex); |
433 {$ENDIF} |
449 {$ENDIF} |
434 end; |
450 end; |
435 |
451 |
436 end. |
452 end. |