equal
deleted
inserted
replaced
80 implementation |
80 implementation |
81 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; |
81 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; |
82 |
82 |
83 {$IFDEF DEBUGFILE} |
83 {$IFDEF DEBUGFILE} |
84 var f: textfile; |
84 var f: textfile; |
|
85 {$IFDEF USE_VIDEO_RECORDING} |
85 logMutex: TRTLCriticalSection; // mutex for debug file |
86 logMutex: TRTLCriticalSection; // mutex for debug file |
|
87 {$ENDIF} |
86 {$ENDIF} |
88 {$ENDIF} |
87 var CharArray: array[byte] of Char; |
89 var CharArray: array[byte] of Char; |
88 |
90 |
89 procedure SplitBySpace(var a,b: shortstring); |
91 procedure SplitBySpace(var a,b: shortstring); |
90 begin |
92 begin |
303 |
305 |
304 procedure AddFileLog(s: shortstring); |
306 procedure AddFileLog(s: shortstring); |
305 begin |
307 begin |
306 s:= s; |
308 s:= s; |
307 {$IFDEF DEBUGFILE} |
309 {$IFDEF DEBUGFILE} |
|
310 {$IFDEF USE_VIDEO_RECORDING} |
308 EnterCriticalSection(logMutex); |
311 EnterCriticalSection(logMutex); |
|
312 {$ENDIF} |
309 writeln(f, inttostr(GameTicks) + ': ' + s); |
313 writeln(f, inttostr(GameTicks) + ': ' + s); |
310 flush(f); |
314 flush(f); |
|
315 {$IFDEF USE_VIDEO_RECORDING} |
311 LeaveCriticalSection(logMutex); |
316 LeaveCriticalSection(logMutex); |
312 {$ENDIF} |
317 {$ENDIF} |
|
318 {$ENDIF} |
313 end; |
319 end; |
314 |
320 |
315 procedure AddFileLogRaw(s: pchar); cdecl; |
321 procedure AddFileLogRaw(s: pchar); cdecl; |
316 begin |
322 begin |
317 s:= s; |
323 s:= s; |
318 {$IFDEF DEBUGFILE} |
324 {$IFDEF DEBUGFILE} |
|
325 {$IFDEF USE_VIDEO_RECORDING} |
319 EnterCriticalSection(logMutex); |
326 EnterCriticalSection(logMutex); |
|
327 {$ENDIF} |
320 write(f, s); |
328 write(f, s); |
321 flush(f); |
329 flush(f); |
|
330 {$IFDEF USE_VIDEO_RECORDING} |
322 LeaveCriticalSection(logMutex); |
331 LeaveCriticalSection(logMutex); |
|
332 {$ENDIF} |
323 {$ENDIF} |
333 {$ENDIF} |
324 end; |
334 end; |
325 |
335 |
326 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
336 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
327 var l, i : LongInt; |
337 var l, i : LongInt; |
412 {$IFDEF DEBUGFILE} |
422 {$IFDEF DEBUGFILE} |
413 if isGame then |
423 if isGame then |
414 logfileBase:= 'game' |
424 logfileBase:= 'game' |
415 else |
425 else |
416 logfileBase:= 'preview'; |
426 logfileBase:= 'preview'; |
|
427 {$IFDEF USE_VIDEO_RECORDING} |
417 InitCriticalSection(logMutex); |
428 InitCriticalSection(logMutex); |
|
429 {$ENDIF} |
418 {$I-} |
430 {$I-} |
419 {$IFDEF MOBILE} |
431 {$IFDEF MOBILE} |
420 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} |
432 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} |
421 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
433 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
422 Rewrite(f); |
434 Rewrite(f); |
449 |
461 |
450 {$IFDEF DEBUGFILE} |
462 {$IFDEF DEBUGFILE} |
451 writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); |
463 writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); |
452 flush(f); |
464 flush(f); |
453 close(f); |
465 close(f); |
|
466 {$IFDEF USE_VIDEO_RECORDING} |
454 DoneCriticalSection(logMutex); |
467 DoneCriticalSection(logMutex); |
455 {$ENDIF} |
468 {$ENDIF} |
|
469 {$ENDIF} |
456 end; |
470 end; |
457 |
471 |
458 end. |
472 end. |