Changeset 367
- Timestamp:
- Apr 14, 2021, 9:12:03 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Direct.pas
r364 r367 186 186 BrainTerm.Client := LocalPlayer.Client; 187 187 BrainTerm.Name := Phrases.Lookup('HUMAN'); 188 BrainNetworkServer.Client := UNetworkServer.Client; 189 BrainNetworkServer.Name := Phrases.Lookup('NETWORK_SERVER'); 190 BrainNetworkClient.Client := UNetworkClient.Client; 191 BrainNetworkClient.Name := Phrases.Lookup('NETWORK_CLIENT'); 188 if NetworkEnabled then begin 189 BrainNetworkServer.Client := UNetworkServer.Client; 190 BrainNetworkServer.Name := Phrases.Lookup('NETWORK_SERVER'); 191 BrainNetworkClient.Client := UNetworkClient.Client; 192 BrainNetworkClient.Name := Phrases.Lookup('NETWORK_CLIENT'); 193 end; 192 194 BrainRandom.Name := Phrases.Lookup('RANDOMAI'); 193 195 Canvas.Font.Assign(UniFont[ftNormal]); -
trunk/GameServer.pas
r365 r367 64 64 BrainNetworkClient: TBrain; 65 65 BrainNetworkServer: TBrain; 66 67 NetworkEnabled: Boolean; 66 68 67 69 procedure Init(NotifyFunction: TNotifyFunction); … … 157 159 end; 158 160 161 procedure CallAllPlayers(Command: Integer; var Data); 162 var 163 I: Integer; 164 begin 165 for I := 0 to nPl - 1 do 166 if Assigned(bix[I]) then 167 CallPlayer(Command, I, Data); 168 end; 169 159 170 procedure CallClient(bix, Command: integer; var Data); 160 171 begin … … 208 219 BrainSuperVirtual.Initialized := False; 209 220 BrainSuperVirtual.Kind := btSuperVirtual; 210 BrainNetworkClient := Brains.AddNew; 211 BrainNetworkClient.FileName := ':NetworkClient'; 212 BrainNetworkClient.Flags := fMultiple; 213 BrainNetworkClient.Initialized := False; 214 BrainNetworkClient.ServerVersion := Version; 215 BrainNetworkClient.Kind := btNetworkClient; 221 if NetworkEnabled then begin 222 BrainNetworkClient := Brains.AddNew; 223 BrainNetworkClient.FileName := ':NetworkClient'; 224 BrainNetworkClient.Flags := fMultiple; 225 BrainNetworkClient.Initialized := False; 226 BrainNetworkClient.ServerVersion := Version; 227 BrainNetworkClient.Kind := btNetworkClient; 228 end; 216 229 BrainTerm := Brains.AddNew; 217 230 BrainTerm.FileName := ':StdIntf'; … … 225 238 BrainRandom.Initialized := False; 226 239 BrainRandom.Kind := btRandom; 227 BrainNetworkServer := Brains.AddNew; 228 BrainNetworkServer.FileName := ':NetworkServer'; 229 BrainNetworkServer.Flags := fMultiple; 230 BrainNetworkServer.Initialized := False; 231 BrainNetworkServer.ServerVersion := Version; 232 BrainNetworkServer.Kind := btNetworkServer; 240 if NetworkEnabled then begin 241 BrainNetworkServer := Brains.AddNew; 242 BrainNetworkServer.FileName := ':NetworkServer'; 243 BrainNetworkServer.Flags := fMultiple; 244 BrainNetworkServer.Initialized := False; 245 BrainNetworkServer.ServerVersion := Version; 246 BrainNetworkServer.Kind := btNetworkServer; 247 end; 233 248 234 249 if FindFirst(GetAiDir + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then … … 1330 1345 begin 1331 1346 CL.State := FormerCLState; 1332 Break 1333 end 1347 Break; 1348 end; 1334 1349 end; 1335 1350 {$IFOPT O-}InvalidTreatyMap := 0; {$ENDIF} … … 1339 1354 Newlx, Newly, NewLandMass, NewMaxTurn: integer); 1340 1355 var 1341 p: integer;1356 I: Integer; 1342 1357 begin 1343 1358 Notify(ntStartDone); … … 1364 1379 StartGame; 1365 1380 NoLogChanges; 1366 for p := 0 to nPl - 1 do 1367 if Assigned(bix[p]) then 1368 CallPlayer(cGetReady, p, nil^); 1381 CallAllPlayers(cGetReady, nil^); 1369 1382 LogChanges; 1370 1383 CL.Put(sTurn, 0, 0, nil); … … 1374 1387 nLogOpened := -1; 1375 1388 LastEndClientCommand := -1; 1376 bix[0].Client(cShowGame, 0, nil^); 1389 CallPlayer(cShowGame, 0, nil^); 1390 for I := 0 to nPl - 1 do 1391 if Assigned(bix[I]) and (bix[I].Kind = btNetworkServer) then 1392 CallPlayer(cShowGame, I, nil^); 1377 1393 Notify(ntBackOff); 1378 1394 Inform(pTurn); -
trunk/Network/UNetworkServer.pas
r365 r367 237 237 InitModuleData: TInitModuleData; 238 238 begin 239 NewConnection := TNetworkServerConnection.Create; ;239 NewConnection := TNetworkServerConnection.Create; 240 240 NewConnection.Socket := AStream; 241 241 NewConnection.NetworkServer := Self; -
trunk/Protocol.pas
r365 r367 1995 1995 cmShowCancelTreatyByAlliance: Result := SizeOf(Integer); 1996 1996 cmShowEndContact: Result := 0; 1997 cmShowGame: Result := 0; 1997 1998 //sIntCancelTreaty: Result := SizeOf(Integer); 1998 1999 else begin -
trunk/Start.pas
r364 r367 360 360 I: Integer; 361 361 S: string; 362 {$IFDEF WINDOWS} 362 363 ResolutionX, ResolutionY, ResolutionBPP, ResolutionFreq: Integer; 364 {$ENDIF} 363 365 ScreenMode: Integer; 364 366 begin … … 398 400 if ValueExists('LastGame') then LastGame := Reg.ReadString('LastGame') 399 401 else LastGame := ''; 402 if ValueExists('NetworkEnabled') then NetworkEnabled := Reg.ReadBool('NetworkEnabled') 403 else NetworkEnabled := False; 400 404 401 405 if ValueExists('ScreenMode') then … … 403 407 else ScreenMode := 1; 404 408 FullScreen := ScreenMode > 0; 409 if ValueExists('MultiControl') then 410 MultiControl := ReadInteger('MultiControl') 411 else MultiControl := 0; 412 {$IFDEF WINDOWS} 405 413 if ValueExists('ResolutionX') then 406 414 ResolutionX := ReadInteger('ResolutionX'); … … 411 419 if ValueExists('ResolutionFreq') then 412 420 ResolutionFreq := ReadInteger('ResolutionFreq'); 413 if ValueExists('MultiControl') then414 MultiControl := ReadInteger('MultiControl')415 else MultiControl := 0;416 {$IFDEF WINDOWS}417 421 if ScreenMode = 2 then 418 422 ChangeResolution(ResolutionX, ResolutionY, ResolutionBPP, … … 440 444 WriteInteger('StartTab', Integer(ShowTab)); 441 445 WriteString('LastGame', LastGame); 446 WriteBool('NetworkEnabled', NetworkEnabled); 442 447 finally 443 448 Free; … … 924 929 FormerGames.Delete(I); 925 930 if ListIndex[tbNew] = I then 926 ListIndex[tbNew] := 0 931 ListIndex[tbNew] := 0; 927 932 end; 928 933 end; … … 1183 1188 EmptyMenu(PopupMenu1.Items); 1184 1189 if PlayerPopupIndex < 0 then begin // select default AI 1185 OfferBrain(BrainNetworkClient, FixedLines); 1186 Inc(FixedLines); 1190 if NetworkEnabled then begin 1191 OfferBrain(BrainNetworkClient, FixedLines); 1192 Inc(FixedLines); 1193 end; 1187 1194 1188 1195 MenuItem := TMenuItem.Create(PopupMenu1); … … 1213 1220 end; 1214 1221 if PlayerPopupIndex > 0 then begin 1215 OfferBrain(BrainNetworkServer, FixedLines); 1216 Inc(FixedLines); 1222 if NetworkEnabled then begin 1223 OfferBrain(BrainNetworkServer, FixedLines); 1224 Inc(FixedLines); 1225 end; 1217 1226 1218 1227 MenuItem := TMenuItem.Create(PopupMenu1);
Note:
See TracChangeset
for help on using the changeset viewer.