Changeset 549 for trunk/GameServer.pas
- Timestamp:
- Apr 21, 2024, 8:55:53 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GameServer.pas
r531 r549 474 474 for ix := 0 to RW[P].nUn - 1 do 475 475 with RW[P].Un[ix] do 476 if (Loc >= 0) and (SavedStatus <> Status) then 476 if (Loc >= 0) and (SavedStatus <> Status) then begin 477 477 Result := True; 478 Exit; 479 end; 478 480 for ix := 0 to RW[P].nCity - 1 do 479 481 with RW[P].City[ix] do 480 if (Loc >= 0) and (SavedStatus <> Status) then 482 if (Loc >= 0) and (SavedStatus <> Status) then begin 481 483 Result := True; 484 Exit; 485 end; 482 486 for ix := 0 to RW[P].nModel - 1 do 483 487 with RW[P].Model[ix] do 484 if SavedStatus <> Status then 488 if SavedStatus <> Status then begin 485 489 Result := True; 490 Exit; 491 end; 486 492 for ix := 0 to RW[P].nEnemyCity - 1 do 487 493 with RW[P].EnemyCity[ix] do 488 if (Loc >= 0) and (SavedStatus <> Status) then 494 if (Loc >= 0) and (SavedStatus <> Status) then begin 489 495 Result := True; 496 Exit; 497 end; 490 498 if RW[P].Data <> nil then 491 499 for ix := 0 to bix[P].DataSize - 1 do 492 if PDWortList(SavedData[P])[ix] <> PDWortList(RW[P].Data)[ix] then 500 if PDWortList(SavedData[P])[ix] <> PDWortList(RW[P].Data)[ix] then begin 493 501 Result := True; 502 Exit; 503 end; 494 504 end; 495 505 … … 1069 1079 for cix := 0 to RW[pTurn].nCity - 1 do 1070 1080 with RW[pTurn].City[cix] do 1071 if Loc >= 0 then 1072 begin 1073 // if SavedResourceWeights[cix]<>ResourceWeights then result:=true; 1074 if SavedTiles[cix] <> Tiles then 1081 if Loc >= 0 then begin 1082 // if SavedResourceWeights[cix] <> ResourceWeights then Result := true; 1083 if SavedTiles[cix] <> Tiles then begin 1075 1084 Result := True; 1085 Break; 1086 end; 1076 1087 end; 1077 1088 end; … … 1204 1215 Notify(ntLoadBegin); 1205 1216 1206 started := False;1217 Started := False; 1207 1218 StatRequest := False; 1208 1219 MovieStopped := False; … … 1224 1235 end; 1225 1236 // complete all internal commands following an sTurn before generating statistics 1226 if (Command = sTurn) and not started then1237 if (Command = sTurn) and not Started then 1227 1238 begin 1228 1239 {$IFDEF TEXTLOG}WriteLn(TextLog, '---Turn 0 P0---'); {$ENDIF} … … 1237 1248 end; 1238 1249 StatRequest := True; 1239 started := True;1250 Started := True; 1240 1251 end 1241 1252 else if (Command = sTurn) and (pTurn = 0) and (GTurn = LoadTurn) then … … 1283 1294 if StatRequest then 1284 1295 GenerateStat(pTurn); 1285 Assert( started);1296 Assert(Started); 1286 1297 {$IFDEF TEXTLOG}CloseFile(TextLog); {$ENDIF} 1287 1298 {$IFDEF LOADPERF}QueryPerformanceCounter(time_total); { time in s is: (time_total-time_total0)/PerfFreq }{$ENDIF} … … 1499 1510 procedure DestroyCity_TellPlayers(P, cix: Integer; SaveUnits: Boolean); 1500 1511 begin 1501 if RW[P].City[cix]. built[imSpacePort] > 0 then1512 if RW[P].City[cix].Built[imSpacePort] > 0 then 1502 1513 DestroySpacePort_TellPlayers(P, -1); 1503 1514 DestroyCity(P, cix, SaveUnits); … … 1506 1517 procedure ChangeCityOwner_TellPlayers(pOld, cixOld, pNew: Integer); 1507 1518 begin 1508 if RW[pOld].City[cixOld]. built[imSpacePort] > 0 then1519 if RW[pOld].City[cixOld].Built[imSpacePort] > 0 then 1509 1520 if RW[pNew].NatBuilt[imSpacePort] > 0 then 1510 1521 DestroySpacePort_TellPlayers(pOld, pNew) … … 1521 1532 ShipComplete := True; 1522 1533 for I := 0 to nShipPart - 1 do 1523 if GShip[P].Parts[I] < ShipNeed[I] then 1534 if GShip[P].Parts[I] < ShipNeed[I] then begin 1524 1535 ShipComplete := False; 1536 Break; 1537 end; 1525 1538 if ShipComplete then 1526 1539 GWinner := GWinner or 1 shl P; // game won! … … 1587 1600 for cix := 1 to nCity - 1 do 1588 1601 if (City[cix].Loc >= 0) and 1589 ((Loc1 < 0) or (City[cix]. built[imPalace] > 0)) then1602 ((Loc1 < 0) or (City[cix].Built[imPalace] > 0)) then 1590 1603 Loc1 := City[cix].Loc; 1591 1604 for uix := 0 to nUn - 1 do … … 1933 1946 for cix := 0 to RW[p1].nCity - 1 do 1934 1947 if (RW[p1].City[cix].Loc >= 0) and 1935 (RW[p1].City[cix]. built[imTemple] > 0) then1948 (RW[p1].City[cix].Built[imTemple] > 0) then 1936 1949 Inc(OracleIncome); 1937 1950 end; … … 2396 2409 dGround: 2397 2410 LoseCityPop := (PModel.Cap[mcArtillery] > 0) or 2398 (RW[MoveInfo.Defender].City[MoveInfo.Dcix]. built[imWalls] = 0) and2411 (RW[MoveInfo.Defender].City[MoveInfo.Dcix].Built[imWalls] = 0) and 2399 2412 (Continent[ToLoc] <> GrWallContinent[MoveInfo.Defender]); 2400 2413 dSea: 2401 LoseCityPop := RW[MoveInfo.Defender].City[MoveInfo.Dcix]. built2414 LoseCityPop := RW[MoveInfo.Defender].City[MoveInfo.Dcix].Built 2402 2415 [imCoastalFort] = 0; 2403 2416 dAir: 2404 LoseCityPop := RW[MoveInfo.Defender].City[MoveInfo.Dcix]. built2417 LoseCityPop := RW[MoveInfo.Defender].City[MoveInfo.Dcix].Built 2405 2418 [imMissileBat] = 0; 2406 2419 end; … … 2459 2472 for cix1 := 1 to nCity - 1 do 2460 2473 if (City[cix1].Loc >= 0) and 2461 ((ExpelToLoc < 0) or (City[cix1]. built[imPalace] > 0)) then2474 ((ExpelToLoc < 0) or (City[cix1].Built[imPalace] > 0)) then 2462 2475 ExpelToLoc := City[cix1].Loc; 2463 2476 end; … … 3105 3118 AllHumansDead := True; 3106 3119 for p1 := 0 to nPl - 1 do 3107 if (1 shl p1 and GAlive <> 0) and (bix[p1].Kind = btTerm) then 3120 if (1 shl p1 and GAlive <> 0) and (bix[p1].Kind = btTerm) then begin 3108 3121 AllHumansDead := False; 3122 Break; 3123 end; 3109 3124 if (pDipActive >= 0) // still in negotiation mode 3110 3125 or (pTurn = 0) and ((GWinner > 0) or (GTurn = MaxTurn) or … … 3225 3240 (Integer(Data) >= 0) and (Integer(Data) < GTurn); 3226 3241 for p1 := 1 to nPl - 1 do 3227 if bix[p1].Kind = btTerm then 3242 if bix[p1].Kind = btTerm then begin 3228 3243 Ok := False; 3244 Break; 3245 end; 3229 3246 // allow reload in AI-only games only 3230 3247 end … … 3363 3380 Result := eOfferNotAcceptable; 3364 3381 for I := 0 to nDeliver + nCost - 1 do 3365 if Price[I] = opChoose then 3382 if Price[I] = opChoose then begin 3366 3383 Result := eOfferNotAcceptable; 3384 Break; 3385 end; 3367 3386 for I := 0 to nCost - 1 do 3368 3387 if not PayPrice(pDipActive, p1, Price[nDeliver + I], False) then … … 3487 3506 begin // no tribute allowed! 3488 3507 for I := 0 to TOffer(Data).nDeliver + TOffer(Data).nCost - 1 do 3489 if (TOffer(Data).Price[I] and opMask = opTribute) then 3508 if (TOffer(Data).Price[I] and opMask = opTribute) then begin 3490 3509 Result := eInvalidOffer; 3510 Break; 3511 end; 3491 3512 for I := 0 to TOffer(Data).nDeliver + TOffer(Data).nCost - 1 do 3492 if (TOffer(Data).Price[I] = opTreaty + trPeace) then 3513 if (TOffer(Data).Price[I] = opTreaty + trPeace) then begin 3493 3514 Result := eOK; 3515 Break; 3516 end; 3494 3517 end; 3495 3518 for I := 0 to TOffer(Data).nDeliver - 1 do … … 3500 3523 Result := eInvalidOffer; 3501 3524 for I := 0 to nShipPart - 1 do 3502 if CountPrice(TOffer(Data), opShipParts + I shl 16) > 1 then 3525 if CountPrice(TOffer(Data), opShipParts + I shl 16) > 1 then begin 3503 3526 Result := eInvalidOffer; 3527 Break; 3528 end; 3504 3529 if CountPrice(TOffer(Data), opMoney) > 1 then 3505 3530 Result := eInvalidOffer; … … 4191 4216 for I := 0 to nImpReplacement - 1 do 4192 4217 if (ImpReplacement[I].OldImp = NewProject and cpIndex) and 4193 (built[ImpReplacement[I].NewImp] > 0) then 4194 Result := eObsolete; 4218 (Built[ImpReplacement[I].NewImp] > 0) then begin 4219 Result := eObsolete; 4220 Break; 4221 end; 4195 4222 if Result = eObsolete then 4196 4223 else if Preq = preNA then … … 4199 4226 then 4200 4227 Result := eNoPreq 4201 else if built[NewProject and cpIndex] > 0 then4228 else if Built[NewProject and cpIndex] > 0 then 4202 4229 Result := eInvalid 4203 4230 else if (NewProject and cpIndex < nWonder) and … … 4207 4234 (RW[Player].NatBuilt[imSpacePort] > 0) then 4208 4235 Result := eViolation // space port already exists 4209 else if (NewProject = cpImp + imBank) and ( built[imMarket] = 0)4236 else if (NewProject = cpImp + imBank) and (Built[imMarket] = 0) 4210 4237 or (NewProject = cpImp + imUniversity) and 4211 ( built[imLibrary] = 0) or (NewProject = cpImp + imResLab) and4212 ( built[imUniversity] = 0) or (NewProject = cpImp + imMfgPlant)4213 and ( built[imFactory] = 0) then4238 (Built[imLibrary] = 0) or (NewProject = cpImp + imResLab) and 4239 (Built[imUniversity] = 0) or (NewProject = cpImp + imMfgPlant) 4240 and (Built[imFactory] = 0) then 4214 4241 Result := eNoPreq; 4215 4242 case NewProject - cpImp of … … 4362 4389 else 4363 4390 with RW[Player].City[Subject] do 4364 if built[Integer(Data)] = 0 then4391 if Built[Integer(Data)] = 0 then 4365 4392 Result := eInvalid 4366 4393 else if (RW[Player].Government = gAnarchy) or … … 4373 4400 Inc(RW[Player].Money, Imp[Integer(Data)].Cost * BuildCostMod 4374 4401 [Difficulty[Player]] div 12); 4375 built[Integer(Data)] := 0;4402 Built[Integer(Data)] := 0; 4376 4403 if Imp[Integer(Data)].Kind in [ikNatLocal, ikNatGlobal] then 4377 4404 begin … … 4402 4429 else 4403 4430 with RW[Player].City[Subject] do 4404 if ( built[OldImp] = 0) or (Project and cpImp = 0) or4431 if (Built[OldImp] = 0) or (Project and cpImp = 0) or 4405 4432 not(Imp[Project and cpIndex].Kind in [ikCommon, ikNatLocal, 4406 4433 ikNatGlobal]) then … … 4419 4446 Project0 := Project; 4420 4447 Prod0 := Prod; 4421 built[OldImp] := 0;4448 Built[OldImp] := 0; 4422 4449 if Imp[OldImp].Kind in [ikNatLocal, ikNatGlobal] then 4423 4450 begin // nat. project lost
Note:
See TracChangeset
for help on using the changeset viewer.