Changeset 405 for branches/highdpi/GameServer.pas
- Timestamp:
- Nov 3, 2021, 11:22:02 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/GameServer.pas
r378 r405 8 8 uses 9 9 Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, 10 Graphics, UBrain ;10 Graphics, UBrain, Global; 11 11 12 12 const 13 Version = $010300;14 13 FirstAICompatibleVersion = $000D00; 15 14 FirstBookCompatibleVersion = $010103; … … 224 223 BrainNetworkClient.Flags := fMultiple; 225 224 BrainNetworkClient.Initialized := False; 226 BrainNetworkClient.ServerVersion := Version;225 BrainNetworkClient.ServerVersion := CevoVersion; 227 226 BrainNetworkClient.Kind := btNetworkClient; 228 227 end; … … 231 230 BrainTerm.Flags := fMultiple; 232 231 BrainTerm.Initialized := False; 233 BrainTerm.ServerVersion := Version;232 BrainTerm.ServerVersion := CevoVersion; 234 233 BrainTerm.Kind := btTerm; 235 234 BrainRandom := Brains.AddNew; … … 243 242 BrainNetworkServer.Flags := fMultiple; 244 243 BrainNetworkServer.Initialized := False; 245 BrainNetworkServer.ServerVersion := Version;244 BrainNetworkServer.ServerVersion := CevoVersion; 246 245 BrainNetworkServer.Kind := btNetworkServer; 247 246 end; … … 255 254 NewBrain.LoadFromFile(BasePath + DirectorySeparator + F.Name + '.ai.txt'); 256 255 if (NewBrain.ServerVersion >= FirstAICompatibleVersion) and 257 (NewBrain.ServerVersion <= Version) and256 (NewBrain.ServerVersion <= CevoVersion) and 258 257 ((NewBrain.Flags and fDotNet = 0) or (@DotNetClient <> nil)) then begin 259 258 end else Brains.Delete(Brains.Count - 1); … … 405 404 begin 406 405 CL.Put(sIntSetUnitStatus, p, ix, @Status); 407 SavedStatus := Status 406 SavedStatus := Status; 408 407 end; 409 408 // log city status changes … … 413 412 begin 414 413 CL.Put(sIntSetCityStatus, p, ix, @Status); 415 SavedStatus := Status 414 SavedStatus := Status; 416 415 end; 417 416 // log model status changes … … 421 420 begin 422 421 CL.Put(sIntSetModelStatus, p, ix, @Status); 423 SavedStatus := Status 422 SavedStatus := Status; 424 423 end; 425 424 // log enemy city status changes … … 429 428 begin 430 429 CL.Put(sIntSetECityStatus, p, ix, @Status); 431 SavedStatus := Status 430 SavedStatus := Status; 432 431 end; 433 432 // log data changes … … 436 435 CL.PutDataChanges(sIntDataChange, p, SavedData[p], RW[p].Data, 437 436 bix[p].DataSize); 438 move(RW[p].Data^, SavedData[p]^, bix[p].DataSize * 4);439 end 437 Move(RW[p].Data^, SavedData[p]^, bix[p].DataSize * 4); 438 end; 440 439 end; 441 440 end; … … 461 460 SavedStatus := Status; 462 461 if bix[p].DataSize > 0 then 463 move(RW[p].Data^, SavedData[p]^, bix[p].DataSize * 4);462 Move(RW[p].Data^, SavedData[p]^, bix[p].DataSize * 4); 464 463 end; 465 464 end; … … 472 471 ix: integer; 473 472 begin 474 result := false;473 Result := False; 475 474 for ix := 0 to RW[p].nUn - 1 do 476 475 with RW[p].Un[ix] do 477 476 if (Loc >= 0) and (SavedStatus <> Status) then 478 result := true;477 Result := True; 479 478 for ix := 0 to RW[p].nCity - 1 do 480 479 with RW[p].City[ix] do 481 480 if (Loc >= 0) and (SavedStatus <> Status) then 482 result := true;481 Result := True; 483 482 for ix := 0 to RW[p].nModel - 1 do 484 483 with RW[p].Model[ix] do 485 484 if SavedStatus <> Status then 486 result := true;485 Result := True; 487 486 for ix := 0 to RW[p].nEnemyCity - 1 do 488 487 with RW[p].EnemyCity[ix] do 489 488 if (Loc >= 0) and (SavedStatus <> Status) then 490 result := true;489 Result := True; 491 490 if RW[p].Data <> nil then 492 491 for ix := 0 to bix[p].DataSize - 1 do 493 492 if PDWortList(SavedData[p])[ix] <> PDWortList(RW[p].Data)[ix] then 494 result := true493 Result := True; 495 494 end; 496 495 … … 643 642 s := 'cEvoBook'; 644 643 LogFile.write(s[1], 8); { file id } 645 i := Version;644 i := CevoVersion; 646 645 LogFile.write(i, 4); { c-evo version } 647 646 LogFile.write(ExeInfo.Time, 4); … … 688 687 begin 689 688 AutoSaveState := CL.State; 690 AutoSaveExists := true 689 AutoSaveExists := true; 691 690 end 692 691 end; … … 1096 1095 begin 1097 1096 GiveCivilReport(pTurn, p1); 1098 GiveMilReport(pTurn, p1) 1097 GiveMilReport(pTurn, p1); 1099 1098 end; 1100 1099 end; … … 1126 1125 LogFile.Read(J, 4); { exe time } 1127 1126 1128 if (i >= FirstBookCompatibleVersion) and (i <= Version) then1127 if (i >= FirstBookCompatibleVersion) and (i <= CevoVersion) then 1129 1128 begin 1130 1129 result := true; … … 1223 1222 begin 1224 1223 GenerateStat(pTurn); 1225 StatRequest := false 1224 StatRequest := false; 1226 1225 end; 1227 1226 // complete all internal commands following an sTurn before generating statistics … … 1293 1292 begin 1294 1293 Delete(LogFileName, 1, 1); 1295 nLogOpened := -1 1294 nLogOpened := -1; 1296 1295 end 1297 1296 else … … 1434 1433 Game.RO[0] := @RW[0]; 1435 1434 Game.Difficulty[0] := 0; 1436 for p1 := 1 to nPl - 1 do 1437 begin 1435 for p1 := 1 to nPl - 1 do begin 1438 1436 Game.RO[p1] := nil; 1439 Game.Difficulty[p1] := -1 1437 Game.Difficulty[p1] := -1; 1440 1438 end; 1441 1439 BrainTerm.Client(cNewMap, -1, Game); … … 1445 1443 bix[0].Client(cShowGame, 0, nil^); 1446 1444 Notify(ntBackOff); 1447 ChangeClientWhenDone(cEditMap, 0, nil^, 0) 1445 ChangeClientWhenDone(cEditMap, 0, nil^, 0); 1448 1446 end; 1449 1447 … … 1464 1462 Prod0 := 0; 1465 1463 Project := cpImp + imTrGoods; 1466 Project0 := cpImp + imTrGoods 1464 Project0 := cpImp + imTrGoods; 1467 1465 end; 1468 1466 … … 1619 1617 Flags := Flags or unWithdrawn; 1620 1618 Happened := Happened or phPeaceEvacuation; 1621 end 1619 end; 1622 1620 end; 1623 1621 … … 1688 1686 inc(ShowShipChange.Ship1Change[Project0 and cpIndex - 1689 1687 imShipComp]); 1690 end 1691 end 1688 end; 1689 end; 1692 1690 end; { city loop 1 } 1693 1691 if nUpdateLoc > 0 then … … 1715 1713 begin 1716 1714 Movement := 0; 1717 Flags := Flags and not unMountainDelay 1715 Flags := Flags and not unMountainDelay; 1718 1716 end 1719 1717 else … … 1745 1743 if (Health <= 0) or TribeExtinct then 1746 1744 RemoveUnit_UpdateMap(pTurn, uix); 1747 end 1745 end; 1748 1746 end; 1749 1747 … … 1770 1768 (ObserveLevel[Loc1] and (3 shl (2 * p1)) > 0) then 1771 1769 CallPlayer(cShowCityChanged, p1, Loc1); 1772 end 1770 end; 1773 1771 end; 1774 1772 … … 1808 1806 begin 1809 1807 Territory[Loc1] := -1; 1810 Map[Loc1] := Map[Loc1] and not fPeace 1811 end 1808 Map[Loc1] := Map[Loc1] and not fPeace; 1809 end; 1812 1810 end; 1813 1811 end; … … 1833 1831 begin 1834 1832 Happened := Happened or phTech; 1835 ResearchTech := -1 1833 ResearchTech := -1; 1836 1834 end; 1837 1835 … … 1842 1840 begin 1843 1841 inc(Credibility); 1844 Break 1842 Break; 1845 1843 end; 1846 1844 … … 1900 1898 if (bix[pTurn].Kind <> btNoTerm) and 1901 1899 ((Difficulty[pTurn] > 0) or (Mode > moLoading_Fast)) then 1902 DiscoverAll(pTurn, lObserveSuper) 1900 DiscoverAll(pTurn, lObserveSuper); 1903 1901 end 1904 1902 else … … 1906 1904 DiscoverViewAreas(pTurn); 1907 1905 if MirBuilt then 1908 DiscoverAll(pTurn, lObserveUnhidden) 1909 end 1906 DiscoverAll(pTurn, lObserveUnhidden); 1907 end; 1910 1908 end; 1911 1909 // CheckContact; … … 1970 1968 (ObserveLevel[Loc1] and (3 shl (2 * p1)) > 0) then 1971 1969 CallPlayer(cShowCityChanged, p1, Loc1); 1972 end 1970 end; 1973 1971 end; 1974 1972 end; … … 1983 1981 begin 1984 1982 Fuel := Model[mix].Cap[mcFuel]; 1985 Flags := Flags or unBombsLoaded 1983 Flags := Flags or unBombsLoaded; 1986 1984 end 1987 1985 else if Model[mix].Kind = mkSpecial_Glider then { glider } … … 1990 1988 begin 1991 1989 RemoveUnit_UpdateMap(pTurn, uix); // unit lost 1992 Happened := Happened or phGliderLost 1993 end 1990 Happened := Happened or phGliderLost; 1991 end; 1994 1992 end 1995 1993 else … … 1999 1997 begin 2000 1998 RemoveUnit_UpdateMap(pTurn, uix); // unit lost 2001 Happened := Happened or phPlaneLost 1999 Happened := Happened or phPlaneLost; 2002 2000 end 2003 2001 end … … 2007 2005 if Health < 0 then 2008 2006 RemoveUnit_UpdateMap(pTurn, uix); 2009 end 2007 end; 2010 2008 end; { unit loop 1 } 2011 2009 … … 2142 2140 begin 2143 2141 UpdateLoc[nUpdateLoc] := Loc; 2144 inc(nUpdateLoc) 2142 inc(nUpdateLoc); 2145 2143 end; 2146 2144 // unit will be removed -- remember position and update for all players … … 2170 2168 Happened := Happened or phStealTech; 2171 2169 GStealFrom := MoveInfo.Defender; 2172 Break 2173 end 2170 Break; 2171 end; 2174 2172 end; 2175 2173 if Mode = moPlaying then … … 2856 2854 2857 2855 sGetVersion: 2858 integer(Data) := Version;2856 integer(Data) := CevoVersion; 2859 2857 2860 2858 sGetGameChanged: … … 3666 3664 begin 3667 3665 if Tech[Subject] >= MaxFutureTech_Computing then 3668 result := eInvalid 3666 result := eInvalid; 3669 3667 end 3670 3668 else if Subject in FutureTech then 3671 3669 begin 3672 3670 if Tech[Subject] >= MaxFutureTech then 3673 result := eInvalid 3671 result := eInvalid; 3674 3672 end 3675 3673 else if Tech[Subject] >= tsApplicable then … … 3683 3681 inc(i); 3684 3682 if i < 2 then 3685 result := eNoPreq 3683 result := eNoPreq; 3686 3684 end 3687 3685 else if (AdvPreq[Subject, 0] <> preNone) and … … 3689 3687 (AdvPreq[Subject, 1] <> preNone) and 3690 3688 (Tech[AdvPreq[Subject, 1]] < tsApplicable) then 3691 result := eNoPreq 3689 result := eNoPreq; 3692 3690 end; 3693 3691 if (result = eOK) and (Command >= sExecute) then … … 3697 3695 // save DevModel, because sctModel commands are not logged 3698 3696 ResearchTech := Subject; 3699 end 3697 end; 3700 3698 end 3701 3699 else … … 3717 3715 SeeTech(Player, Subject); 3718 3716 dec(RW[Player].Happened, phStealTech); 3719 end 3717 end; 3720 3718 end; 3721 3719 … … 3736 3734 RW[Player].Attitude[p1] := Subject; 3737 3735 RW[p1].EnemyReport[Player].Attitude := Subject; 3738 end 3736 end; 3739 3737 end; 3740 3738 … … 3870 3868 MaxCap := 3; 3871 3869 if RW[Player].Tech[adSteel] >= tsApplicable then 3872 inc(MaxCap) 3870 inc(MaxCap); 3873 3871 end 3874 3872 else … … 3894 3892 Cap[mcCarrier] := 0; 3895 3893 if Cap[mcDefense] > 2 then 3896 Cap[mcDefense] := 2 3894 Cap[mcDefense] := 2; 3897 3895 end; 3898 3896 mcSeaTrans: … … 3919 3917 3920 3918 CalculateModel(RW[Player].DevModel); 3921 end 3919 end; 3922 3920 end; 3923 3921 end … … 3997 3995 result := eViolation 3998 3996 else if Command >= sExecute then 3999 RW[Player].Un[Subject].Home := cix1 4000 end 4001 end 3997 RW[Player].Un[Subject].Home := cix1; 3998 end; 3999 end; 4002 4000 end; 4003 4001 … … 4023 4021 result := eInvalid 4024 4022 else 4025 result := UnloadUnit(Player, Subject, Command < sExecute) 4023 result := UnloadUnit(Player, Subject, Command < sExecute); 4026 4024 end; 4027 4025 … … 4058 4056 PlaceUnit(p1, RW[p1].nUn - 1); 4059 4057 UpdateUnitMap(integer(Data)); 4060 end 4058 end; 4061 4059 end 4062 4060 else … … 4117 4115 CityGrowth(Player, cix1); 4118 4116 RemoveUnit_UpdateMap(Player, Subject); 4119 end 4120 end 4121 end 4117 end; 4118 end; 4119 end; 4122 4120 end; 4123 4121 … … 4150 4148 (ObserveLevel[Loc0] and (3 shl (2 * p1)) > 0) then 4151 4149 CallPlayer(cShowCityChanged, p1, Loc0); 4152 end 4150 end; 4153 4151 end; 4154 4152 end; … … 4275 4273 if Preq = 0 then 4276 4274 result := eNoPreq; 4277 end 4275 end; 4278 4276 end; 4279 4277 … … 4290 4288 Prod := 0; 4291 4289 Prod0 := 0; 4292 Project0 := cpImp + imTrGoods 4290 Project0 := cpImp + imTrGoods; 4293 4291 end 4294 4292 else 4295 4293 Prod := Prod0 * 2 div 3; 4296 4294 Project := NewProject 4297 end 4298 end 4299 end 4295 end; 4296 end; 4297 end; 4300 4298 end; 4301 4299 … … 4386 4384 imSpacePort: 4387 4385 DestroySpacePort_TellPlayers(Player, -1); 4388 end 4386 end; 4389 4387 end; 4390 4388 inc(Flags, chImprovementSold); 4391 end 4389 end; 4392 4390 end; 4393 4391 … … 4432 4430 imSpacePort: 4433 4431 DestroySpacePort_TellPlayers(Player, -1); 4434 end 4432 end; 4435 4433 end; 4436 4434 inc(Flags, chImprovementSold); 4437 end 4438 end 4435 end; 4436 end; 4439 4437 end; 4440 4438
Note:
See TracChangeset
for help on using the changeset viewer.