Changeset 364 for trunk/GameServer.pas
- Timestamp:
- Apr 12, 2021, 11:55:20 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GameServer.pas
r363 r364 49 49 var 50 50 // PARAMETERS 51 PlayersBrain: TBrains; { brain of the players }51 PlayersBrain: TBrains; { brain of the players view } 52 52 Difficulty: array [0 .. nPl - 1] of integer absolute Database.Difficulty; 53 53 { difficulty } … … 62 62 BrainTerm: TBrain; 63 63 BrainRandom: TBrain; 64 BrainNetworkClient: TBrain; 65 BrainNetworkServer: TBrain; 64 66 65 67 procedure Init(NotifyFunction: TNotifyFunction); … … 147 149 {$ELSE} 148 150 try 149 Brain[bix[p]].Client(Command, p, Data);151 bix[p].Client(Command, p, Data); 150 152 except 151 153 Notify(ntException + bix[p]); … … 199 201 BrainNoTerm.FileName := ':AIT'; 200 202 BrainNoTerm.Flags := 0; 201 BrainNoTerm.Initialized := false;203 BrainNoTerm.Initialized := False; 202 204 BrainNoTerm.Kind := btNoTerm; 203 205 BrainSuperVirtual := Brains.AddNew; 204 206 BrainSuperVirtual.FileName := ':Supervisor'; 205 207 BrainSuperVirtual.Flags := 0; 206 BrainSuperVirtual.Initialized := false;208 BrainSuperVirtual.Initialized := False; 207 209 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; 208 216 BrainTerm := Brains.AddNew; 209 217 BrainTerm.FileName := ':StdIntf'; 210 218 BrainTerm.Flags := fMultiple; 211 BrainTerm.Initialized := false;219 BrainTerm.Initialized := False; 212 220 BrainTerm.ServerVersion := Version; 213 221 BrainTerm.Kind := btTerm; … … 215 223 BrainRandom.FileName := ':Random'; 216 224 BrainRandom.Flags := fMultiple; 217 BrainRandom.Initialized := false;225 BrainRandom.Initialized := False; 218 226 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; 219 233 220 234 if FindFirst(GetAiDir + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then … … 330 344 Notify(ntDeactivationMissing, p); 331 345 ForceClientDeactivation; 332 end 346 end; 333 347 end; 334 348 … … 2386 2400 if PModel.Attack = 0 then 2387 2401 Flags := Flags and not unBombsLoaded; 2388 dec(Movement, 100) 2402 dec(Movement, 100); 2389 2403 end 2390 2404 else if MoveInfo.MoveType = mtExpel then … … 2393 2407 Job := jNone; 2394 2408 Flags := Flags and not unFortified; 2395 dec(Movement, 100) 2409 dec(Movement, 100); 2396 2410 end 2397 2411 else … … 2443 2457 inc(nUpdateLoc); 2444 2458 Flags := Flags or unWithdrawn; 2445 end 2459 end; 2446 2460 end 2447 2461 else if (MoveInfo.MoveType = mtAttack) and (MoveInfo.EndHealthDef > 0) then … … 2481 2495 begin 2482 2496 UpdateLoc[nUpdateLoc] := Loc; 2483 inc(nUpdateLoc) 2497 inc(nUpdateLoc); 2484 2498 end; 2485 2499 // unit will be removed -- remember position and update for all players … … 2529 2543 CallPlayer(cShowUnitChanged, p1, ExpelToLoc); 2530 2544 end; 2531 end 2532 end 2545 end; 2546 end; 2533 2547 end; // ExecuteAttack 2534 2548 … … 2546 2560 begin 2547 2561 result := eInvalid; 2548 exit 2562 exit; 2549 2563 end; 2550 2564 result := CalculateMove(p, uix, ToLoc, 3 - dy and 1, TestOnly, MoveInfo); … … 2580 2594 result := ExecuteMove(p, uix, ToLoc, MoveInfo, ShowMove) or result; 2581 2595 mtAttack, mtBombard, mtExpel: 2582 result := ExecuteAttack(p, uix, ToLoc, MoveInfo, ShowMove) or result 2583 end; 2584 end 2596 result := ExecuteAttack(p, uix, ToLoc, MoveInfo, ShowMove) or result; 2597 end; 2598 end; 2585 2599 end; // with 2586 2600 end; { MoveUnit } … … 2656 2670 result := ptShip 2657 2671 else 2658 result := ptImp 2672 result := ptImp; 2659 2673 end; 2660 2674 … … 2687 2701 begin 2688 2702 result := eUnknown; 2689 exit 2703 exit; 2690 2704 end; 2691 2705 … … 2695 2709 begin 2696 2710 result := eInvalid; 2697 exit 2711 exit; 2698 2712 end; 2699 2713 … … 2705 2719 PutMessage(1 shl 16 + 1, Format('NOT Alive: %d', [Player])); 2706 2720 result := eNoTurn; 2707 exit 2721 exit; 2708 2722 end; 2709 2723 … … 2732 2746 [Player, Command shr 4])); 2733 2747 result := eNoTurn; 2734 exit 2748 exit; 2735 2749 end; 2736 2750 … … 2858 2872 else 2859 2873 result := GetTileInfo(Player, TTileInfo(Data).ExplCity, Subject, 2860 TTileInfo(Data)) 2874 TTileInfo(Data)); 2861 2875 end 2862 2876 else … … 2869 2883 result := eNoPreq 2870 2884 else 2871 result := GetJobProgress(Player, Subject, TJobProgressData(Data)) 2885 result := GetJobProgress(Player, Subject, TJobProgressData(Data)); 2872 2886 end 2873 2887 else … … 2918 2932 end; 2919 2933 if result = eOK then 2920 result := eInvalid // no enemy unit there!2934 result := eInvalid; // no enemy unit there! 2921 2935 end 2922 2936 else … … 2949 2963 result := eOK 2950 2964 else 2951 result := eNoWay 2965 result := eNoWay; 2952 2966 end; 2953 2967 … … 3001 3015 TCityReport(Data).HypoTax := -1; 3002 3016 TCityReport(Data).HypoLux := -1; 3003 GetCityReport(p1, cix1, TCityReport(Data)) 3017 GetCityReport(p1, cix1, TCityReport(Data)); 3004 3018 end 3005 3019 else … … 3032 3046 p1 := 1; 3033 3047 SearchCity(Subject, p1, cix1); 3034 GetCityAreaInfo(p1, Subject, TCityAreaInfo(Data)) 3048 GetCityAreaInfo(p1, Subject, TCityAreaInfo(Data)); 3035 3049 end 3036 3050 else … … 3096 3110 LogChanges; 3097 3111 SaveGame('~' + LogFileName, true); 3098 end 3112 end; 3099 3113 {$ENDIF} 3100 3114 end … … 3125 3139 begin 3126 3140 if CheckSum <> Subject then 3127 LoadOK := false 3141 LoadOK := false; 3128 3142 end 3129 3143 else // save checksum … … 3171 3185 CCCommand := cTurn; 3172 3186 CCPlayer := pTurn; 3173 Notify(ntNextPlayer) 3187 Notify(ntNextPlayer); 3174 3188 end 3175 3189 else … … 3235 3249 sReload: 3236 3250 LoadGame(SavePath, LogFileName, integer(Data), false); 3237 end 3251 end; 3238 3252 end 3239 3253 else … … 3252 3266 Notify(ntStartGoRefreshMaps) 3253 3267 else 3254 Notify(ntStartGo) 3268 Notify(ntStartGo); 3255 3269 end 3256 3270 else … … 3292 3306 assert(Mode = moPlaying); 3293 3307 ChangeClientWhenDone(cContinue, pTurn, nil^, 0); 3294 end 3308 end; 3295 3309 end 3296 3310 else … … 3309 3323 IntServer(sIntHaveContact, pTurn, pContacted, nil^); 3310 3324 ChangeClientWhenDone(scDipStart, pDipActive, nil^, 0); 3311 end 3325 end; 3312 3326 end 3313 3327 else … … 3368 3382 ShowShipChange.Ship2Change[Price[i] shr 16 and 3] := 3369 3383 +integer(Price[i] and $FFFF); 3370 end 3384 end; 3371 3385 end; 3372 3386 if HasShipChanged then … … 3382 3396 if 1 shl p2 and GWatching <> 0 then 3383 3397 CallPlayer(cShowShipChange, p2, ShowShipChange); 3384 end 3385 end 3398 end; 3399 end; 3386 3400 end; 3387 3401 end … … 3408 3422 CallPlayer(cShowCancelTreatyByAlliance, pDipActive, i); 3409 3423 end; 3410 end 3424 end; 3411 3425 end 3412 3426 else … … 3431 3445 pDipActive := p1; 3432 3446 ChangeClientWhenDone(Command, pDipActive, nil^, 0); 3433 end 3447 end; 3434 3448 end 3435 3449 else … … 3449 3463 assert(Mode = moPlaying); 3450 3464 ChangeClientWhenDone(cContinue, pTurn, nil^, 0); 3451 end 3465 end; 3452 3466 end 3453 3467 else
Note:
See TracChangeset
for help on using the changeset viewer.