- Timestamp:
- Apr 12, 2021, 11:55:20 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Direct.pas
r354 r364 43 43 44 44 uses 45 ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global; 45 ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global, UNetworkServer, 46 UNetworkClient; 46 47 47 48 {$R *.lfm} … … 185 186 BrainTerm.Client := LocalPlayer.Client; 186 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'); 187 192 BrainRandom.Name := Phrases.Lookup('RANDOMAI'); 188 193 Canvas.Font.Assign(UniFont[ftNormal]); -
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 -
trunk/Global.pas
r339 r364 12 12 CevoContact = 'https://' + CevoContactShort; 13 13 CevoContactBug = 'https://app.zdechov.net/c-evo/report/1'; 14 CevoNetworkPort = 41363; 14 15 AppRegistryKey = '\SOFTWARE\C-evo'; 15 16 AITemplateManual = 'AI development manual'; -
trunk/Integrated.lpi
r363 r364 36 36 <SearchPaths> 37 37 <IncludeFiles Value="LocalPlayer;$(ProjOutDir)"/> 38 <OtherUnitFiles Value="LocalPlayer "/>38 <OtherUnitFiles Value="LocalPlayer;Network"/> 39 39 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 40 40 </SearchPaths> … … 95 95 </Item2> 96 96 </RequiredPackages> 97 <Units Count="4 4">97 <Units Count="47"> 98 98 <Unit0> 99 99 <Filename Value="Integrated.lpr"/> … … 344 344 <IsPartOfProject Value="True"/> 345 345 </Unit43> 346 <Unit44> 347 <Filename Value="Network\UNetworkServer.pas"/> 348 <IsPartOfProject Value="True"/> 349 </Unit44> 350 <Unit45> 351 <Filename Value="Network\UNetworkClient.pas"/> 352 <IsPartOfProject Value="True"/> 353 </Unit45> 354 <Unit46> 355 <Filename Value="UTCPServer.pas"/> 356 <IsPartOfProject Value="True"/> 357 </Unit46> 346 358 </Units> 347 359 </ProjectOptions> … … 354 366 <SearchPaths> 355 367 <IncludeFiles Value="LocalPlayer;$(ProjOutDir)"/> 356 <OtherUnitFiles Value="LocalPlayer "/>368 <OtherUnitFiles Value="LocalPlayer;Network"/> 357 369 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 358 370 </SearchPaths> -
trunk/Integrated.lpr
r207 r364 3 3 4 4 uses 5 {$IFDEF UNIX} 6 cthreads, clocale, 7 {$ENDIF} 5 8 Forms, Interfaces, SysUtils, Protocol, GameServer, Direct, Start, Messg, Inp, 6 9 Back, Log, LocalPlayer, ClientTools, Tribes, IsoEngine, Term, CityScreen, Nego, -
trunk/Language.txt
r321 r364 405 405 #UTILIZE Utilize 406 406 #INTEGRATE Integrate 407 #NETWORK_SERVER Network Server 408 #NETWORK_CLIENT Network Client 407 409 408 410 'Busy Messages -
trunk/LocalPlayer/LocalPlayer.pas
r358 r364 16 16 FormsCreated: boolean; 17 17 18 procedure Client ;18 procedure Client(Command, Player: integer; var Data); 19 19 begin 20 20 if not FormsCreated then -
trunk/LocalPlayer/Term.pas
r352 r364 2910 2910 FormResize(nil); // calculate geometrics and paint all 2911 2911 SetTroopLoc(-1); 2912 idle := true 2912 idle := true; 2913 2913 end; 2914 2914 … … 2943 2943 DipMem[me].DeliveredPrices := []; 2944 2944 DipMem[me].ReceivedPrices := []; 2945 DipCall(scDipStart) 2945 DipCall(scDipStart); 2946 2946 end 2947 2947 else 2948 2948 begin 2949 2949 DipCall(scReject); 2950 EndNego 2950 EndNego; 2951 2951 end; 2952 2952 end; … … 2987 2987 end; 2988 2988 NegoDlg.Start; 2989 idle := true 2989 idle := true; 2990 2990 end; 2991 2991 … … 3039 3039 CurrentMoveInfo.DoShow := not mAlNoMoves.Checked 3040 3040 else 3041 CurrentMoveInfo.DoShow := not mEnNoMoves.Checked 3041 CurrentMoveInfo.DoShow := not mEnNoMoves.Checked; 3042 3042 end 3043 3043 else if Command = cShowUnitChanged then … … 3051 3051 else 3052 3052 CurrentMoveInfo.DoShow := 3053 not(mEnNoMoves.Checked or mEnAttacks.Checked) 3053 not(mEnNoMoves.Checked or mEnAttacks.Checked); 3054 3054 end; 3055 3055 // else keep DoShow from cShowMove/cShowAttack … … 3145 3145 ShowMoveDomain := Domain; 3146 3146 IsAlpine := Cap[mcAlpine] > 0; 3147 end 3148 end 3147 end; 3148 end; 3149 3149 end 3150 3150 else … … 3198 3198 CurrentMoveInfo.AfterMovePaintRadius := 2 3199 3199 else 3200 CurrentMoveInfo.AfterMovePaintRadius := 1 3200 CurrentMoveInfo.AfterMovePaintRadius := 1; 3201 3201 end 3202 3202 else … … 3265 3265 else 3266 3266 MapValid := false; 3267 end 3267 end; 3268 3268 end; 3269 3269 … … 3350 3350 else 3351 3351 MapValid := false; 3352 end 3352 end; 3353 3353 end; 3354 3354 … … 3362 3362 if 3 shl (p1 * 2) and Cardinal(Data) <> 0 then 3363 3363 s := s + '\' + Tribe[p1].TPhrase('SHORTNAME'); 3364 SoundMessageEx(s, '') 3364 SoundMessageEx(s, ''); 3365 3365 end; 3366 3366 -
trunk/Localization/cs/Language.txt
r321 r364 405 405 #UTILIZE Využít 406 406 #INTEGRATE Sloučit 407 #NETWORK_SERVER Síťový server 408 #NETWORK_CLIENT Síťový klient 407 409 408 410 'Busy Messages -
trunk/Localization/de/Language.txt
r321 r364 414 414 #UTILIZE Anwenden 415 415 #INTEGRATE Integrieren 416 #NETWORK_SERVER Network Server 417 #NETWORK_CLIENT Network Client 416 418 417 419 'Busy Messages -
trunk/Localization/it/Language.txt
r321 r364 395 395 #UTILIZE Ricicla 396 396 #INTEGRATE Integra 397 #NETWORK_SERVER Network Server 398 #NETWORK_CLIENT Network Client 397 399 398 400 'Busy Messages -
trunk/Localization/ru/Language.txt
r321 r364 421 421 #UTILIZE Использовать 422 422 #INTEGRATE Внедрить 423 #NETWORK_SERVER Network Server 424 #NETWORK_CLIENT Network Client 423 425 424 426 'Сообщения паузы -
trunk/Localization/zh-Hans/language.txt
r321 r364 413 413 #UTILIZE ²Î½¨ 414 414 #INTEGRATE Õû±à 415 #NETWORK_SERVER Network Server 416 #NETWORK_CLIENT Network Client 415 417 416 418 'Busy Messages -
trunk/Localization/zh-Hant/language.txt
r321 r364 413 413 #UTILIZE °Ñ«Ø 414 414 #INTEGRATE ¾ã½s 415 #NETWORK_SERVER Network Server 416 #NETWORK_CLIENT Network Client 415 417 416 418 'Busy Messages -
trunk/NoTerm.pas
r352 r364 9 9 10 10 type 11 TRunMode = (rmStop, rmStopped, rmRunning, rmQuit); 12 11 13 TNoTermDlg = class(TDrawDlg) 12 14 QuitBtn: TButtonB; … … 20 22 procedure Client(Command, Player: integer; var Data); 21 23 private 22 me, Active, ToldAlive, Round: integer; 23 LastShowYearTime, LastShowTurnChange, LastNewTurn: TDateTime; 24 TurnTime, TotalStatTime: extended; 24 Me: Integer; 25 Active: Integer; 26 ToldAlive: Integer; 27 Round: Integer; 28 LastShowYearTime: TDateTime; 29 LastShowTurnChange: TDateTime; 30 LastNewTurn: TDateTime; 31 TurnTime: Extended; 32 TotalStatTime: Extended; 25 33 G: TNewGameData; 26 34 Server: TServerCall; 27 35 Shade: TBitmap; 28 36 State: TBitmap; 29 WinStat, ExtStat, AloneStat: array [0 .. nPl - 1] of integer; 30 DisallowShowActive: array [0 .. nPl - 1] of boolean; 31 TimeStat: array [0 .. nPl - 1] of extended; 32 Mode: (Stop, Stopped, Running, Quit); 37 WinStat: array [0 .. nPl - 1] of Integer; 38 ExtStat: array [0 .. nPl - 1] of Integer; 39 AloneStat: array [0 .. nPl - 1] of Integer; 40 DisallowShowActive: array [0 .. nPl - 1] of Boolean; 41 TimeStat: array [0 .. nPl - 1] of Extended; 42 Mode: TRunMode; 33 43 procedure NewStat; 34 44 procedure EndPlaying; … … 92 102 FillChar(TimeStat, SizeOf(TimeStat), 0); 93 103 TotalStatTime := 0; 94 Mode := Stop;104 Mode := rmStop; 95 105 end; 96 106 … … 109 119 EndCommand := sResign 110 120 else 111 EndCommand := sBreak 121 EndCommand := sBreak; 112 122 end 113 123 else … … 171 181 begin 172 182 inc(Round); 173 if Mode = Running then183 if Mode = rmRunning then 174 184 begin 175 185 Invalidate; 176 Update 186 Update; 177 187 end 178 188 else … … 192 202 begin 193 203 LogDlg.List.Clear; 194 if Mode <> Running then204 if Mode <> rmRunning then 195 205 begin 196 206 if LogDlg.Visible then 197 207 LogDlg.Close; 198 208 Close; 199 end 209 end; 200 210 end; 201 211 … … 206 216 begin 207 217 ShowActive(Active, false); 208 Active := -1 218 Active := -1; 209 219 end; // should not happen 210 220 … … 229 239 end; 230 240 Application.ProcessMessages; 231 if Mode = Quit then241 if Mode = rmQuit then 232 242 EndPlaying 233 243 else if G.RO[me].Happened and phGameEnd <> 0 then … … 248 258 inc(WinStat[p]); 249 259 end; 250 if Mode = Running then251 Server(sNextRound, me, 0, nil^) 260 if Mode = rmRunning then 261 Server(sNextRound, me, 0, nil^); 252 262 end 253 else if Mode = Running then263 else if Mode = rmRunning then 254 264 Server(sTurn, me, 0, nil^); 255 if Mode = Stop then265 if Mode = rmStop then 256 266 begin 257 267 GoBtn.ButtonIndex := 22; 258 Mode := Stopped;268 Mode := rmStopped; 259 269 end; 260 270 end; … … 284 294 procedure TNoTermDlg.GoBtnClick(Sender: TObject); 285 295 begin 286 if Mode = Running then287 Mode := Stop288 else if Mode = Stopped then296 if Mode = rmRunning then 297 Mode := rmStop 298 else if Mode = rmStopped then 289 299 begin 290 Mode := Running;300 Mode := rmRunning; 291 301 GoBtn.ButtonIndex := 23; 292 302 GoBtn.Update; … … 297 307 procedure TNoTermDlg.QuitBtnClick(Sender: TObject); 298 308 begin 299 if Mode = Stopped then 300 EndPlaying 301 else 302 Mode := Quit; 309 if Mode = rmStopped then EndPlaying 310 else Mode := rmQuit; 303 311 end; 304 312 … … 362 370 end; 363 371 364 procedure Client ;372 procedure Client(Command, Player: integer; var Data); 365 373 begin 366 374 if not FormsCreated then … … 384 392 initialization 385 393 386 FormsCreated := false;394 FormsCreated := False; 387 395 388 396 end. -
trunk/Protocol.pas
r334 r364 1275 1275 TClientCall = procedure (Command, Player: Integer; var Data); stdcall; 1276 1276 1277 TCommand = ( 1278 cmInitModule = $0000, 1279 cmReleaseModule = $0100, 1280 cmBroadcast = $0200, 1281 cmHelpOnly = $0700, 1282 cmStartHelp = $0710, 1283 cmStartCredits = $0720, 1284 1285 cmNewGame = $0800, 1286 cmLoadGame = $0810, 1287 cmMovie = $0820, 1288 cmNewGameEx = $0840, 1289 cmLoadGameEx = $0850, 1290 cmNewMap = $0880, 1291 cmReplay = $08E0, 1292 cmGetReady = $08F0, 1293 cmBreakGame = $0900, 1294 1295 cmTurn = $2000, 1296 cmResume = $2010, 1297 cmContinue = $2080, 1298 cmMovieTurn = $2100, 1299 cmMovieEndTurn = $2110, 1300 cmEditMap = $2800, 1301 1302 // cShowTileM=$3000;cShowTileA=$3010;cShowFoundCity=$3020; 1303 cmShowUnitChanged = $3030, 1304 cmShowAfterMove = $3040, 1305 cmShowAfterAttack = $3050, 1306 cmShowCityChanged = $3090, 1307 // cShowMove=$3100;cShowCapture=$3110; 1308 // cShowAttackBegin=$3200;cShowAttackWon=$3210;cShowAttackLost=$3220; 1309 cmShowMoving = $3140, 1310 cmShowCapturing = $3150, 1311 cmShowAttacking = $3240, 1312 cmShowMissionResult = $3300, 1313 cmShowShipChange = $3400, 1314 cmShowGreatLibTech = $3500, 1315 cmShowTurnChange = $3700, 1316 cmShowCancelTreaty = $3800, 1317 cmShowEndContact = $3810, 1318 cmShowCancelTreatyByAlliance = $3820, 1319 cmShowSupportAllianceAgainst = $3830, 1320 cmShowPeaceViolation = $3880, 1321 cmShowGame = $3F00, { cShowSuperView=$3F80; } 1322 cmRefreshDebugMap = $3F90, 1323 1324 // diplomacy commands equal to server, see below 1325 1326 cmDebugMessage = $7000, 1327 cmShowNego = $7010 1328 ); 1329 1277 1330 TUn = packed record 1278 1331 Loc: LongInt; { location } … … 1777 1830 function DelphiRandom: Extended; overload; 1778 1831 procedure DelphiRandomize; 1832 function GetCommandDataSize(Command: TCommand): Integer; 1779 1833 1780 1834 … … 1919 1973 end; 1920 1974 1975 function GetCommandDataSize(Command: TCommand): Integer; 1976 begin 1977 case Command of 1978 cmInitModule: Result := SizeOf(TInitModuleData); 1979 cmGetReady: Result := 0; 1980 cmTurn: Result := 0; 1981 cmShowTurnChange: Result := SizeOf(Integer); 1982 cmShowNego: Result := SizeOf(TShowNegoData); 1983 cmNewGame, cmLoadGame, cmMovie, cmNewMap: Result := SizeOf(TNewGameData); 1984 else begin 1985 Result := 0; 1986 end; 1987 end; 1988 end; 1989 1990 1921 1991 initialization 1922 1992 -
trunk/Start.pas
r363 r364 10 10 11 11 type 12 13 { TPlayerSlot } 14 12 15 TPlayerSlot = class 13 16 DiffUpBtn: TButtonC; … … 84 87 procedure AutoEnemyDownBtnClick(Sender: TObject); 85 88 procedure ReplayBtnClick(Sender: TObject); 86 public87 EmptyPicture: TBitmap;88 procedure UpdateFormerGames;89 procedure UpdateMaps;90 89 private 91 90 WorldSize: Integer; … … 134 133 procedure LoadAiBrainsPictures; 135 134 procedure UpdateInterface; 135 procedure ShowSettings; 136 public 137 EmptyPicture: TBitmap; 138 procedure UpdateFormerGames; 139 procedure UpdateMaps; 136 140 end; 137 141 … … 492 496 (Screen.Height - Height) div 2, Width, Height) 493 497 end; 498 end; 499 500 procedure TStartDlg.ShowSettings; 501 begin 502 SettingsDlg := TSettingsDlg.Create(nil); 503 if SettingsDlg.ShowModal = mrOk then begin 504 LoadAssets; 505 Invalidate; 506 UpdateInterface; 507 Background.UpdateInterface; 508 end; 509 FreeAndNil(SettingsDlg); 494 510 end; 495 511 … … 968 984 969 985 OpenKey(AppRegistryKey, True); 970 if AutoDiff > 0 then 971 begin 972 WriteString('DefaultAI', BrainDefault.FileName); 973 SlotAvailable := 0; // PlayerSlot will be invalid hereafter 974 PlayersBrain[0] := BrainTerm; 975 Difficulty[0] := PlayerAutoDiff[AutoDiff]; 976 for I := 1 to nPl - 1 do 977 if (Page = pgStartRandom) and (I <= AutoEnemies) or 978 (Page = pgStartMap) and (I < nMapStartPositions) then begin 979 if AutoDiff = 1 then PlayersBrain[I] := Brains.GetBeginner 980 else PlayersBrain[I] := BrainDefault; 981 Difficulty[I] := EnemyAutoDiff[AutoDiff]; 982 end else PlayersBrain[I] := nil; 983 end else begin 984 for I := 6 to 8 do 985 if (PlayersBrain[0].Kind <> btNoTerm) and (MultiControl and (1 shl I) <> 0) 986 then begin 987 PlayersBrain[I + 3] := PlayersBrain[I]; 988 Difficulty[I + 3] := Difficulty[I]; 989 PlayersBrain[I + 6] := PlayersBrain[I]; 990 Difficulty[I + 6] := Difficulty[I]; 991 end else begin 992 PlayersBrain[I + 3] := nil; 993 PlayersBrain[I + 6] := nil; 994 end; 986 if BrainDefault.Kind <> btNetworkClient then begin 987 if AutoDiff > 0 then begin 988 WriteString('DefaultAI', BrainDefault.FileName); 989 SlotAvailable := 0; // PlayerSlot will be invalid hereafter 990 PlayersBrain[0] := BrainTerm; 991 Difficulty[0] := PlayerAutoDiff[AutoDiff]; 992 for I := 1 to nPl - 1 do 993 if (Page = pgStartRandom) and (I <= AutoEnemies) or 994 (Page = pgStartMap) and (I < nMapStartPositions) then begin 995 if AutoDiff = 1 then PlayersBrain[I] := Brains.GetBeginner 996 else PlayersBrain[I] := BrainDefault; 997 Difficulty[I] := EnemyAutoDiff[AutoDiff]; 998 end else PlayersBrain[I] := nil; 999 end else begin 1000 for I := 6 to 8 do 1001 if (PlayersBrain[0].Kind <> btNoTerm) and (MultiControl and (1 shl I) <> 0) 1002 then begin 1003 PlayersBrain[I + 3] := PlayersBrain[I]; 1004 Difficulty[I + 3] := Difficulty[I]; 1005 PlayersBrain[I + 6] := PlayersBrain[I]; 1006 Difficulty[I + 6] := Difficulty[I]; 1007 end else begin 1008 PlayersBrain[I + 3] := nil; 1009 PlayersBrain[I + 6] := nil; 1010 end; 1011 end; 995 1012 end; 996 1013 … … 1162 1179 AIBrains: TBrains; 1163 1180 begin 1181 FixedLines := 0; 1164 1182 PlayerPopupIndex := PlayerIndex; 1165 1183 EmptyMenu(PopupMenu1.Items); 1166 1184 if PlayerPopupIndex < 0 then begin // select default AI 1167 FixedLines := 0; 1185 OfferBrain(BrainNetworkClient, FixedLines); 1186 Inc(FixedLines); 1187 1188 MenuItem := TMenuItem.Create(PopupMenu1); 1189 MenuItem.Caption := '-'; 1190 PopupMenu1.Items.Add(MenuItem); 1191 1192 Inc(FixedLines); 1168 1193 if Brains.GetKindCount(btAI) >= 2 then begin 1169 1194 OfferBrain(BrainRandom, FixedLines); … … 1177 1202 FreeAndNil(AIBrains); 1178 1203 end else begin 1179 FixedLines := 0;1180 1204 if PlayerPopupIndex > 0 then begin 1181 1205 OfferBrain(nil, FixedLines); … … 1189 1213 end; 1190 1214 if PlayerPopupIndex > 0 then begin 1215 OfferBrain(BrainNetworkServer, FixedLines); 1216 Inc(FixedLines); 1217 1191 1218 MenuItem := TMenuItem.Create(PopupMenu1); 1192 1219 MenuItem.Caption := '-'; … … 1267 1294 begin 1268 1295 PlayersBrain[0] := BrainSuperVirtual; 1269 Difficulty[0] := 0 1296 Difficulty[0] := 0; 1270 1297 end; 1271 1298 if PlayersBrain[0].Kind in [btNoTerm, btSuperVirtual] then … … 1424 1451 ChangeTab(TStartTab((x - TabOffset) div TabSize)); 1425 1452 end 1426 else if Page = pgMain then 1427 begin 1453 else if Page = pgMain then begin 1428 1454 case SelectedAction of 1429 maConfig: 1430 begin 1431 SettingsDlg := TSettingsDlg.Create(nil); 1432 if SettingsDlg.ShowModal = mrOk then begin 1433 LoadAssets; 1434 Invalidate; 1435 UpdateInterface; 1436 Background.UpdateInterface; 1437 end; 1438 FreeAndNil(SettingsDlg); 1439 end; 1440 maManual: 1441 DirectHelp(cStartHelp); 1442 maCredits: 1443 DirectHelp(cStartCredits); 1444 maAIDev: 1445 OpenDocument(HomeDir + AITemplateFileName); 1446 maWeb: 1447 OpenURL(CevoHomepage); 1455 maConfig: ShowSettings; 1456 maManual: DirectHelp(cStartHelp); 1457 maCredits: DirectHelp(cStartCredits); 1458 maAIDev: OpenDocument(HomeDir + AITemplateFileName); 1459 maWeb: OpenURL(CevoHomepage); 1448 1460 end; 1449 1461 end … … 1460 1472 else 1461 1473 PopupMenu1.Popup(left + xBrain[I] + 4, top + yBrain[I] + 4); 1462 end 1474 end; 1463 1475 end 1464 1476 else if (AutoDiff > 1) and ((Page = pgStartRandom) or (Page = pgStartMap)) and -
trunk/UBrain.pas
r363 r364 15 15 16 16 type 17 TBrainType = (btNoTerm, btSuperVirtual, btTerm, btRandom, btAI); 17 TBrainType = (btNoTerm, btSuperVirtual, btTerm, btRandom, btAI, btNetworkServer, 18 btNetworkClient); 18 19 19 20 { TBrain }
Note:
See TracChangeset
for help on using the changeset viewer.