Changeset 124 for trunk/GameServer.pas
- Timestamp:
- Apr 21, 2018, 11:40:27 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GameServer.pas
r120 r124 185 185 Key: string; 186 186 Value: string; 187 BasePath: string; 188 AIFileName: string; 187 189 begin 188 190 Notify := NotifyFunction; … … 205 207 nBrain := bixFirstAI; 206 208 bixBeginner := bixFirstAI; 207 if FindFirst(HomeDir + 'AI' + DirectorySeparator + '*.ai.txt', $21, f) = 0 then 208 repeat 209 with Brain[nBrain] do 210 begin 211 FileName := Copy(f.Name, 1, Length(f.Name) - 7); 212 DLLName := HomeDir + 'AI' + DirectorySeparator + FileName; 213 Name := Copy(f.Name, 1, Length(f.Name) - 7); 209 if FindFirst(HomeDir + 'AI' + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then 210 repeat 211 if (f.Name <> '.') and (f.Name <> '..') then begin 212 with Brain[nBrain] do begin 213 BasePath := HomeDir + 'AI' + DirectorySeparator + f.Name; 214 FileName := f.Name; 215 DLLName := BasePath + DirectorySeparator + FileName + '.dll'; 216 AIFileName := BasePath + DirectorySeparator + f.Name + '.ai.txt'; 217 Name := f.Name; 214 218 Credits := ''; 215 219 Flags := fMultiple; … … 217 221 Initialized := false; 218 222 ServerVersion := 0; 219 AssignFile(T, HomeDir + 'AI' + DirectorySeparator + f.Name); 223 if not FileExists(AIFileName) then 224 raise Exception.Create(Format('AI specification file %s not found', [AIFileName])); 225 AssignFile(T, AIFileName); 220 226 Reset(T); 221 227 while not EOF(T) do … … 237 243 bixBeginner := nBrain 238 244 else if Key = '#PATH' then 239 DLLName := HomeDir + 'AI'+ DirectorySeparator + Value245 DLLName := BasePath + DirectorySeparator + Value 240 246 {$IFDEF WINDOWS}{$IFDEF CPU32} 241 247 else if Key = '#PATH_WIN32' then 242 DLLName := HomeDir + 'AI'+ DirectorySeparator + Value248 DLLName := BasePath + DirectorySeparator + Value 243 249 {$ENDIF}{$ENDIF} 244 250 {$IFDEF WINDOWS}{$IFDEF CPU64} 245 251 else if Key = '#PATH_WIN64' then 246 DLLName := HomeDir + 'AI'+ DirectorySeparator + Value252 DLLName := BasePath + DirectorySeparator + Value 247 253 {$ENDIF}{$ENDIF} 248 254 {$IFDEF LINUX}{$IFDEF CPU32} 249 255 else if Key = '#PATH_LINUX32' then 250 DLLName := HomeDir + 'AI'+ DirectorySeparator + Value256 DLLName := BasePath + DirectorySeparator + Value 251 257 {$ENDIF}{$ENDIF} 252 258 {$IFDEF LINUX}{$IFDEF CPU64} 253 259 else if Key = '#PATH_LINUX64' then 254 DLLName := HomeDir + 'AI'+ DirectorySeparator + Value260 DLLName := BasePath + DirectorySeparator + Value 255 261 {$ENDIF}{$ENDIF} 256 262 else if Key = '#GAMEVERSION' then … … 272 278 ((Brain[nBrain].Flags and fDotNet = 0) or (@DotNetClient <> nil)) then 273 279 inc(nBrain); 274 until FindNext(f) <> 0; 280 end; 281 until FindNext(f) <> 0; 275 282 FindClose(F); 283 284 if nBrain = 0 then 285 raise Exception.Create(Format('No AI libraries found in directory %s', [HomeDir + 'AI'])); 276 286 end; 277 287
Note:
See TracChangeset
for help on using the changeset viewer.