Changeset 384


Ignore:
Timestamp:
Apr 27, 2021, 8:51:03 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Game version moved to Global unit.
  • Modified: Code cleanup.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GameServer.pas

    r375 r384  
    88uses
    99  Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils,
    10   Graphics, UBrain;
     10  Graphics, UBrain, Global;
    1111
    1212const
    13   Version = $010300;
    1413  FirstAICompatibleVersion = $000D00;
    1514  FirstBookCompatibleVersion = $010103;
     
    224223    BrainNetworkClient.Flags := fMultiple;
    225224    BrainNetworkClient.Initialized := False;
    226     BrainNetworkClient.ServerVersion := Version;
     225    BrainNetworkClient.ServerVersion := CevoVersion;
    227226    BrainNetworkClient.Kind := btNetworkClient;
    228227  end;
     
    231230  BrainTerm.Flags := fMultiple;
    232231  BrainTerm.Initialized := False;
    233   BrainTerm.ServerVersion := Version;
     232  BrainTerm.ServerVersion := CevoVersion;
    234233  BrainTerm.Kind := btTerm;
    235234  BrainRandom := Brains.AddNew;
     
    243242    BrainNetworkServer.Flags := fMultiple;
    244243    BrainNetworkServer.Initialized := False;
    245     BrainNetworkServer.ServerVersion := Version;
     244    BrainNetworkServer.ServerVersion := CevoVersion;
    246245    BrainNetworkServer.Kind := btNetworkServer;
    247246  end;
     
    255254      NewBrain.LoadFromFile(BasePath + DirectorySeparator + F.Name + '.ai.txt');
    256255      if (NewBrain.ServerVersion >= FirstAICompatibleVersion) and
    257         (NewBrain.ServerVersion <= Version) and
     256        (NewBrain.ServerVersion <= CevoVersion) and
    258257        ((NewBrain.Flags and fDotNet = 0) or (@DotNetClient <> nil)) then begin
    259258        end else Brains.Delete(Brains.Count - 1);
     
    405404          begin
    406405            CL.Put(sIntSetUnitStatus, p, ix, @Status);
    407             SavedStatus := Status
     406            SavedStatus := Status;
    408407          end;
    409408      // log city status changes
     
    413412          begin
    414413            CL.Put(sIntSetCityStatus, p, ix, @Status);
    415             SavedStatus := Status
     414            SavedStatus := Status;
    416415          end;
    417416      // log model status changes
     
    421420          begin
    422421            CL.Put(sIntSetModelStatus, p, ix, @Status);
    423             SavedStatus := Status
     422            SavedStatus := Status;
    424423          end;
    425424      // log enemy city status changes
     
    429428          begin
    430429            CL.Put(sIntSetECityStatus, p, ix, @Status);
    431             SavedStatus := Status
     430            SavedStatus := Status;
    432431          end;
    433432      // log data changes
     
    436435        CL.PutDataChanges(sIntDataChange, p, SavedData[p], RW[p].Data,
    437436          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;
    440439    end;
    441440end;
     
    461460          SavedStatus := Status;
    462461      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);
    464463    end;
    465464end;
     
    472471  ix: integer;
    473472begin
    474   result := false;
     473  Result := False;
    475474  for ix := 0 to RW[p].nUn - 1 do
    476475    with RW[p].Un[ix] do
    477476      if (Loc >= 0) and (SavedStatus <> Status) then
    478         result := true;
     477        Result := True;
    479478  for ix := 0 to RW[p].nCity - 1 do
    480479    with RW[p].City[ix] do
    481480      if (Loc >= 0) and (SavedStatus <> Status) then
    482         result := true;
     481        Result := True;
    483482  for ix := 0 to RW[p].nModel - 1 do
    484483    with RW[p].Model[ix] do
    485484      if SavedStatus <> Status then
    486         result := true;
     485        Result := True;
    487486  for ix := 0 to RW[p].nEnemyCity - 1 do
    488487    with RW[p].EnemyCity[ix] do
    489488      if (Loc >= 0) and (SavedStatus <> Status) then
    490         result := true;
     489        Result := True;
    491490  if RW[p].Data <> nil then
    492491    for ix := 0 to bix[p].DataSize - 1 do
    493492      if PDWortList(SavedData[p])[ix] <> PDWortList(RW[p].Data)[ix] then
    494         result := true
     493        Result := True;
    495494end;
    496495
     
    643642  s := 'cEvoBook';
    644643  LogFile.write(s[1], 8); { file id }
    645   i := Version;
     644  i := CevoVersion;
    646645  LogFile.write(i, 4); { c-evo version }
    647646  LogFile.write(ExeInfo.Time, 4);
     
    688687  begin
    689688    AutoSaveState := CL.State;
    690     AutoSaveExists := true
     689    AutoSaveExists := true;
    691690  end
    692691end;
     
    10961095      begin
    10971096        GiveCivilReport(pTurn, p1);
    1098         GiveMilReport(pTurn, p1)
     1097        GiveMilReport(pTurn, p1);
    10991098      end;
    11001099  end;
     
    11261125  LogFile.Read(J, 4); { exe time }
    11271126
    1128   if (i >= FirstBookCompatibleVersion) and (i <= Version) then
     1127  if (i >= FirstBookCompatibleVersion) and (i <= CevoVersion) then
    11291128  begin
    11301129    result := true;
     
    12931292  begin
    12941293    Delete(LogFileName, 1, 1);
    1295     nLogOpened := -1
     1294    nLogOpened := -1;
    12961295  end
    12971296  else
     
    14341433  Game.RO[0] := @RW[0];
    14351434  Game.Difficulty[0] := 0;
    1436   for p1 := 1 to nPl - 1 do
    1437   begin
     1435  for p1 := 1 to nPl - 1 do begin
    14381436    Game.RO[p1] := nil;
    1439     Game.Difficulty[p1] := -1
     1437    Game.Difficulty[p1] := -1;
    14401438  end;
    14411439  BrainTerm.Client(cNewMap, -1, Game);
     
    14451443  bix[0].Client(cShowGame, 0, nil^);
    14461444  Notify(ntBackOff);
    1447   ChangeClientWhenDone(cEditMap, 0, nil^, 0)
     1445  ChangeClientWhenDone(cEditMap, 0, nil^, 0);
    14481446end;
    14491447
     
    14641462        Prod0 := 0;
    14651463        Project := cpImp + imTrGoods;
    1466         Project0 := cpImp + imTrGoods
     1464        Project0 := cpImp + imTrGoods;
    14671465      end;
    14681466
     
    16191617                  Flags := Flags or unWithdrawn;
    16201618                  Happened := Happened or phPeaceEvacuation;
    1621                 end
     1619                end;
    16221620          end;
    16231621
     
    16881686                  inc(ShowShipChange.Ship1Change[Project0 and cpIndex -
    16891687                    imShipComp]);
    1690               end
    1691             end
     1688              end;
     1689            end;
    16921690          end; { city loop 1 }
    16931691      if nUpdateLoc > 0 then
     
    17151713            begin
    17161714              Movement := 0;
    1717               Flags := Flags and not unMountainDelay
     1715              Flags := Flags and not unMountainDelay;
    17181716            end
    17191717            else
     
    17451743              if (Health <= 0) or TribeExtinct then
    17461744                RemoveUnit_UpdateMap(pTurn, uix);
    1747             end
     1745            end;
    17481746          end;
    17491747
     
    17701768                      (ObserveLevel[Loc1] and (3 shl (2 * p1)) > 0) then
    17711769                      CallPlayer(cShowCityChanged, p1, Loc1);
    1772               end
     1770              end;
    17731771            end;
    17741772
     
    18081806                begin
    18091807                  Territory[Loc1] := -1;
    1810                   Map[Loc1] := Map[Loc1] and not fPeace
    1811                 end
     1808                  Map[Loc1] := Map[Loc1] and not fPeace;
     1809                end;
    18121810            end;
    18131811          end;
     
    18331831      begin
    18341832        Happened := Happened or phTech;
    1835         ResearchTech := -1
     1833        ResearchTech := -1;
    18361834      end;
    18371835
     
    18421840          begin
    18431841            inc(Credibility);
    1844             Break
     1842            Break;
    18451843          end;
    18461844
     
    19001898      if (bix[pTurn].Kind <> btNoTerm) and
    19011899        ((Difficulty[pTurn] > 0) or (Mode > moLoading_Fast)) then
    1902         DiscoverAll(pTurn, lObserveSuper)
     1900        DiscoverAll(pTurn, lObserveSuper);
    19031901    end
    19041902    else
     
    19061904      DiscoverViewAreas(pTurn);
    19071905      if MirBuilt then
    1908         DiscoverAll(pTurn, lObserveUnhidden)
    1909     end
     1906        DiscoverAll(pTurn, lObserveUnhidden);
     1907    end;
    19101908  end;
    19111909  // CheckContact;
     
    19701968                    (ObserveLevel[Loc1] and (3 shl (2 * p1)) > 0) then
    19711969                    CallPlayer(cShowCityChanged, p1, Loc1);
    1972             end
     1970            end;
    19731971          end;
    19741972    end;
     
    19831981            begin
    19841982              Fuel := Model[mix].Cap[mcFuel];
    1985               Flags := Flags or unBombsLoaded
     1983              Flags := Flags or unBombsLoaded;
    19861984            end
    19871985            else if Model[mix].Kind = mkSpecial_Glider then { glider }
     
    19901988              begin
    19911989                RemoveUnit_UpdateMap(pTurn, uix); // unit lost
    1992                 Happened := Happened or phGliderLost
    1993               end
     1990                Happened := Happened or phGliderLost;
     1991              end;
    19941992            end
    19951993            else
     
    19991997              begin
    20001998                RemoveUnit_UpdateMap(pTurn, uix); // unit lost
    2001                 Happened := Happened or phPlaneLost
     1999                Happened := Happened or phPlaneLost;
    20022000              end
    20032001            end
     
    20072005            if Health < 0 then
    20082006              RemoveUnit_UpdateMap(pTurn, uix);
    2009           end
     2007          end;
    20102008        end; { unit loop 1 }
    20112009
     
    21422140          begin
    21432141            UpdateLoc[nUpdateLoc] := Loc;
    2144             inc(nUpdateLoc)
     2142            inc(nUpdateLoc);
    21452143          end;
    21462144      // unit will be removed -- remember position and update for all players
     
    21702168              Happened := Happened or phStealTech;
    21712169              GStealFrom := MoveInfo.Defender;
    2172               Break
    2173             end
     2170              Break;
     2171            end;
    21742172        end;
    21752173        if Mode = moPlaying then
     
    28562854
    28572855    sGetVersion:
    2858       integer(Data) := Version;
     2856      integer(Data) := CevoVersion;
    28592857
    28602858    sGetGameChanged:
     
    36663664            begin
    36673665              if Tech[Subject] >= MaxFutureTech_Computing then
    3668                 result := eInvalid
     3666                result := eInvalid;
    36693667            end
    36703668            else if Subject in FutureTech then
    36713669            begin
    36723670              if Tech[Subject] >= MaxFutureTech then
    3673                 result := eInvalid
     3671                result := eInvalid;
    36743672            end
    36753673            else if Tech[Subject] >= tsApplicable then
     
    36833681                    inc(i);
    36843682                if i < 2 then
    3685                   result := eNoPreq
     3683                  result := eNoPreq;
    36863684              end
    36873685              else if (AdvPreq[Subject, 0] <> preNone) and
     
    36893687                (AdvPreq[Subject, 1] <> preNone) and
    36903688                (Tech[AdvPreq[Subject, 1]] < tsApplicable) then
    3691                 result := eNoPreq
     3689                result := eNoPreq;
    36923690          end;
    36933691          if (result = eOK) and (Command >= sExecute) then
     
    36973695            // save DevModel, because sctModel commands are not logged
    36983696            ResearchTech := Subject;
    3699           end
     3697          end;
    37003698        end
    37013699        else
     
    37173715          SeeTech(Player, Subject);
    37183716          dec(RW[Player].Happened, phStealTech);
    3719         end
     3717        end;
    37203718      end;
    37213719
     
    37363734          RW[Player].Attitude[p1] := Subject;
    37373735          RW[p1].EnemyReport[Player].Attitude := Subject;
    3738         end
     3736        end;
    37393737      end;
    37403738
     
    38703868                  MaxCap := 3;
    38713869                if RW[Player].Tech[adSteel] >= tsApplicable then
    3872                   inc(MaxCap)
     3870                  inc(MaxCap);
    38733871              end
    38743872              else
     
    38943892                      Cap[mcCarrier] := 0;
    38953893                      if Cap[mcDefense] > 2 then
    3896                         Cap[mcDefense] := 2
     3894                        Cap[mcDefense] := 2;
    38973895                    end;
    38983896                  mcSeaTrans:
     
    39193917
    39203918                CalculateModel(RW[Player].DevModel);
    3921               end
     3919              end;
    39223920            end;
    39233921        end
     
    39973995              result := eViolation
    39983996            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;
    40024000      end;
    40034001
     
    40234021          result := eInvalid
    40244022        else
    4025           result := UnloadUnit(Player, Subject, Command < sExecute)
     4023          result := UnloadUnit(Player, Subject, Command < sExecute);
    40264024      end;
    40274025
     
    40584056          PlaceUnit(p1, RW[p1].nUn - 1);
    40594057          UpdateUnitMap(integer(Data));
    4060         end
     4058        end;
    40614059      end
    40624060      else
     
    41174115                  CityGrowth(Player, cix1);
    41184116                RemoveUnit_UpdateMap(Player, Subject);
    4119               end
    4120           end
    4121         end
     4117              end;
     4118          end;
     4119        end;
    41224120      end;
    41234121
     
    41504148                  (ObserveLevel[Loc0] and (3 shl (2 * p1)) > 0) then
    41514149                  CallPlayer(cShowCityChanged, p1, Loc0);
    4152           end
     4150          end;
    41534151        end;
    41544152      end;
     
    42754273                    if Preq = 0 then
    42764274                      result := eNoPreq;
    4277                   end
     4275                  end;
    42784276              end;
    42794277
     
    42904288                    Prod := 0;
    42914289                    Prod0 := 0;
    4292                     Project0 := cpImp + imTrGoods
     4290                    Project0 := cpImp + imTrGoods;
    42934291                  end
    42944292                  else
    42954293                    Prod := Prod0 * 2 div 3;
    42964294                Project := NewProject
    4297               end
    4298             end
    4299           end
     4295              end;
     4296            end;
     4297          end;
    43004298      end;
    43014299
     
    43864384                  imSpacePort:
    43874385                    DestroySpacePort_TellPlayers(Player, -1);
    4388                 end
     4386                end;
    43894387              end;
    43904388              inc(Flags, chImprovementSold);
    4391             end
     4389            end;
    43924390      end;
    43934391
     
    44324430                    imSpacePort:
    44334431                      DestroySpacePort_TellPlayers(Player, -1);
    4434                   end
     4432                  end;
    44354433                end;
    44364434                inc(Flags, chImprovementSold);
    4437               end
    4438         end
     4435              end;
     4436        end;
    44394437      end;
    44404438
  • trunk/Global.pas

    r381 r384  
    1717  AITemplateManual = 'AI development manual';
    1818  AITemplateFileName = 'AI Template' + DirectorySeparator + AITemplateManual + '.html';
     19  CevoVersionMajor = 1;
     20  CevoVersionMinor = 3;
     21  CevoVersionBugFix = 0;
     22  CevoVersion = ((CevoVersionMajor and $ff) shl 16) or
     23    ((CevoVersionMinor and $ff) shl 8) or
     24    ((CevoVersionBugFix and $ff) shl 0);
    1925
    2026
Note: See TracChangeset for help on using the changeset viewer.