GetPrompt efficiency

This commit is contained in:
mysticbbs 2012-03-10 03:54:29 -05:00
parent 3078f804bf
commit 7b569deb06
1 changed files with 11 additions and 8 deletions

View File

@ -220,14 +220,16 @@ End;
Function TBBSCore.GetPrompt (N : Word) : String; Function TBBSCore.GetPrompt (N : Word) : String;
Begin Begin
If N >= FileSize(PromptFile) Then Begin {$I-}
io.OutFull ('|CR|12Error Reading Prompt #' + strI2S(N) + ': Inform SysOp|CR|CR|PA');
SystemLog ('Error Reading Prompt ' + strI2S(N));
Halt(1);
End;
Seek (PromptFile, N); Seek (PromptFile, N);
Read (PromptFile, Prompt); Read (PromptFile, Prompt);
{$I+}
If IoResult <> 0 Then Begin
io.OutFull ('|CR|12Error reading prompt ' + strI2S(N) + '|DE|DE');
SystemLog ('Error reading prompt ' + strI2S(N));
Halt (1);
End;
If Prompt[1] = '@' Then Begin If Prompt[1] = '@' Then Begin
io.OutFile (Copy(Prompt, 2, Length(Prompt)), True, 0); io.OutFile (Copy(Prompt, 2, Length(Prompt)), True, 0);
@ -328,6 +330,7 @@ Begin
While Not Eof(LangFile) Do Begin While Not Eof(LangFile) Do Begin
Read (LangFile, Lang); Read (LangFile, Lang);
{$IFDEF FS_SENSITIVE} {$IFDEF FS_SENSITIVE}
If Lang.FileName = Str Then Begin If Lang.FileName = Str Then Begin
{$ELSE} {$ELSE}
@ -340,9 +343,9 @@ Begin
If IoResult <> 0 Then; If IoResult <> 0 Then;
Assign (PromptFile, Config.DataPath + Lang.FileName + '.thm'); Assign (PromptFile, Config.DataPath + Lang.FileName + '.thm');
Reset (PromptFile);
Result := True; Result := ioReset(PromptFile, SizeOf(RecPrompt), fmRWDN);
Break; Break;
End; End;
End; End;