Ignore:
Timestamp:
Nov 30, 2023, 10:16:14 PM (12 months ago)
Author:
chronos
Message:
  • Modified: Updated high dpi branch from trunk.
  • Modified: Use generics.collections instead of fgl.
  • Modified: Compile with Delphi syntax.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Protocol.pas

    r378 r465  
    1818  ExpCost = 50; { received damage required for next experience level }
    1919  MaxFutureTech = 25;
    20   // maximum number of future techs of one kind except computing technology
     20  // Maximum number of future techs of one kind except computing technology
    2121  MaxFutureTech_Computing = 100;
    22   // maximum number of computing technology future techs
     22  // Maximum number of computing technology future techs
    2323  CountryRadius = 9;
    2424  MaxCitySize = 30;
     
    3636  CancelTreatyTurns = 3;
    3737  PeaceEvaTurns = 5;
    38   // should be less then 2*CancelTreatyTurns, so that you can't attack an ally without re-entering
     38  // Should be less then 2*CancelTreatyTurns, so that you can't attack an ally without re-entering
    3939  ColdWarTurns = 40;
    4040  DesertThurst = 20; // damage for turn in desert
     
    4949  InitialCredibility = 95;
    5050
    51   // ai module flags (for TInitModuleData.Flags)
     51  // AI module flags (for TInitModuleData.Flags)
    5252  aiThreaded = $01;
    5353
    54   // difficulty settings
     54  // Difficulty settings
    5555  MaxDiff = 4; { maximum difficulty level }
    5656  StorageSize: array [1 .. MaxDiff] of Integer = (30, 40, 50, 60);
     
    5959  BuildCostMod: array [1 .. MaxDiff] of Integer = (9, 12, 15, 18); // in 1/12
    6060
    61   // test flags
     61  // Test flags
    6262  nTestFlags = 7; // max. 11
    6363  tfAllTechs = $001; { all nations get all techs }
     
    7070  tfTested = $800; // at least one test flag was set
    7171
    72   { server commands
     72  { Server commands
    7373    IMPORTANT: lowest 4 bits must indicate size in DWORDS of data parameter,
    7474    except for request commands }
     
    191191  sSetCityTiles = $7201;
    192192
    193   // free command space
     193  // Free command space
    194194  sctUnused = $3800;
    195195
    196   { client commands }
     196  { Client commands }
    197197  cInitModule = $0000;
    198198  cReleaseModule = $0100;
     
    241241  cRefreshDebugMap = $3F90;
    242242
    243   // diplomacy commands equal to server, see below
     243  // Diplomacy commands equal to server, see below
    244244
    245245  cDebugMessage = $7000;
    246246  cShowNego = $7010;
    247247
    248   // commands same for server and client
     248  // Commands same for server and client
    249249  scContact = $4900; // + concerned player shl 4 for server call
    250250  scReject = $4A00;
     
    256256  scDipBreak = $4BF0;
    257257
    258   { server return codes: flags }
     258  { Server return codes: flags }
    259259  rExecuted = $40000000;
    260260  rEffective = $20000000;
     
    262262  rEnemySpotted = $08000000;
    263263
    264   { server return codes: command executed }
    265   // note: the same return code might have a different meaning for different server functions!
     264  { Server return codes: command executed }
     265  // Note: the same return code might have a different meaning for different server functions!
    266266  eOK = $60000000; // ok
    267267  eEnemySpotted = $68000000; // unit move ok, new enemy unit/city spotted
    268268  eDied = $70000000; // move executed, unit died due to hostile terrain
    269269  eEnemySpotted_Died = $78000000;
    270   // unit move ok, new enemy unit/city spotted, unit died due to hostile terrain
     270  // Unit move ok, new enemy unit/city spotted, unit died due to hostile terrain
    271271  eLoaded = $60000002; // unit move caused loading to transport ship
    272272  eLost = $70000004; // attack executed, battle lost, unit is dead
     
    276276  eExpelled = $60000007; // friendly unit expelled
    277277  eMissionDone = $70000008;
    278   // spy moved into city: mission done, spy no longer exists
     278  // Spy moved into city: mission done, spy no longer exists
    279279  eJobDone = $60000001; // settler job started and already done
    280280  eJobDone_Died = $70000001;
    281   // settler job started and already done, unit died due to hostile terrain
     281  // Settler job started and already done, unit died due to hostile terrain
    282282  eCity = $70000002; // city founded, settler no more exists
    283283  eRemoved = $70000000; // sRemoveUnit: unit removed
     
    285285
    286286  eNotChanged = $40000000;
    287   // ok, but no effect (e.g. current city project set again)
    288 
    289   { server return codes: command not executed }
     287  // Ok, but no effect (e.g. current city project set again)
     288
     289  { Server return codes: command not executed }
    290290  eHiddenUnit = $20000013;
    291   // unit move: not possible, destination tile occupied by hidden foreign submarine
     291  // Unit move: not possible, destination tile occupied by hidden foreign submarine
    292292  eStealthUnit = $2000001A;
    293   // unit move: not possible, destination tile occupied by foreign stealth unit
     293  // Unit move: not possible, destination tile occupied by foreign stealth unit
    294294  eZOC_EnemySpotted = $28000014;
    295   // unit move: not possible, new enemy unit spotted, ZOC violation
     295  // Unit move: not possible, new enemy unit spotted, ZOC violation
    296296
    297297  eInvalid = $0000; // command not allowed now or parameter out of allowed range
     
    308308
    309309  eDomainMismatch = $0011;
    310   // move/attack: action not allowed for this unit domain
     310  // Move/attack: action not allowed for this unit domain
    311311  eNoCapturer = $0012;
    312   // unit move: this type of unit is not allowed to capture a city
     312  // Unit move: this type of unit is not allowed to capture a city
    313313  eZOC = $0014; // unit move: not possible, ZOC violation
    314314  eTreaty = $0015; // move/attack: not possible, peace treaty violation
     
    320320
    321321  eMaxSize = $0020;
    322   // add to city: bigger size not allowed due to missing aqueduct/sewer
     322  // Add to city: bigger size not allowed due to missing aqueduct/sewer
    323323  eNoCityTerrain = $0022; // found city: not possible in this terrain
    324324  eNoBridgeBuilding = $0023;
     
    332332  eNoWorkerAvailable = $0051;
    333333  eOnlyOnce = $0058;
    334   // sell/rebuild city improvement: only once per city and turn!
     334  // Sell/rebuild city improvement: only once per city and turn!
    335335  eObsolete = $0059; // city project: more advanced improvement already exists
    336336  eOutOfControl = $005A;
    337   // buy/sell/rebuild improvement: not in anarchy, not in captured cities
     337  // Buy/sell/rebuild improvement: not in anarchy, not in captured cities
    338338
    339339  eNoWay = $0100; // sGetMoveAdvice: no way found
    340340
    341   // chart types
     341  // Chart types
    342342  nStat = 6;
    343343  stPop = 0;
     
    348348  stWork = 5;
    349349
    350   { tile flags: terrain type }
     350  { Tile flags: terrain type }
    351351  fTerrain = $1F; // mask for terrain type
    352352  fOcean = $00;
     
    363363  fUNKNOWN = fTerrain;
    364364
    365   { tile flags: terrain improvements }
     365  { Tile flags: terrain improvements }
    366366  fTerImp = $0000F000; // mask for terrain improvement
    367367  tiNone = $00000000;
     
    372372  tiBase = $00005000;
    373373
    374   { tile flags: add ons }
     374  { Tile flags: add ons }
    375375  fSpecial = $00000060;
    376376  fSpecial1 = $00000020;
     
    378378  fRiver = $00000080;
    379379  fRoad = $00000100;
    380   fRR = $00000200;
     380  fRR = $00000200; // railroad
    381381  fCanal = $00000400;
    382382  fPoll = $00000800;
     
    389389  fMercury = $06000000;
    390390
    391   { tile flags: redundant helper info }
     391  { Tile flags: redundant helper info }
    392392  fGrWall = $00010000; // tile protected by great wall
    393393  fSpiedOut = $00020000;
     
    400400  fOwnZoCUnit = $10000000; // own ZoC unit present at this tile
    401401  fInEnemyZoC = $20000000;
    402   // tile is adjacent to known foreign ZoC unit (not allied)
     402  // Tile is adjacent to known foreign ZoC unit (not allied)
    403403  fPeace = $40000000;
    404404  // tile belongs to territory of nation that we are in peace with but not allied
    405405
    406   // city project flags
     406  // City project flags
    407407  cpIndex = $1FF;
    408408  cpConscripts = $200; // produce unit as conscripts
    409409  cpDisbandCity = $400;
    410   // allow to disband city when settlers/conscripts are produced
     410  // Allow to disband city when settlers/conscripts are produced
    411411  cpImp = $800; // 0: index refers to model, 1: index refers to city improvement
    412412  cpRepeat = $1000;
     
    414414  cpAuto = $F000; // for internal use only
    415415
    416   // tech status indicators
     416  // Tech status indicators
    417417  tsNA = -2;
    418418  tsSeen = -1;
     
    422422  tsApplicable = tsResearched;
    423423
    424   // nation treaties
     424  // Nation treaties
    425425  trNoContact = -1;
    426426  trNone = 0;
     
    429429  trAlliance = 4;
    430430
    431   // attitudes
     431  // Attitudes
    432432  nAttitude = 7;
    433433  atHostile = 0;
     
    439439  atEnth = 6;
    440440
    441   // offer prices
     441  // Offer prices
    442442  opChoose = $00000000;
    443443  opCivilReport = $11000000; // + turn + concerned player shl 16
     
    455455  opMask = $FF000000;
    456456
    457   // improvement kinds
     457  // Improvement kinds
    458458  ikTrGoods = 0;
    459459  ikCommon = 1;
     
    464464  ikNA = $7F;
    465465
    466   { model domains }
     466  { Model domains }
    467467  nDomains = 3;
    468468  dGround = 0;
     
    470470  dAir = 2;
    471471
    472   { model kinds }
     472  { Model kinds }
    473473  mkSelfDeveloped = $00;
    474474  mkEnemyDeveloped = $01;
     
    483483  mkFreight = $24;
    484484
    485   { unit flags }
     485  { Unit flags }
    486486  unFortified = $01;
    487487  unBombsLoaded = $02;
     
    491491  unMulti = $80;
    492492
    493   // unit report flags
     493  // Unit report flags
    494494  urfAlwaysSupport = $01;
    495495  urfDeployed = $02;
    496496
    497   // unit moves
     497  // Unit moves
    498498  umCapturing = $0100;
    499499  umSpyMission = $0200;
     
    505505  umPlaneUnloading = $8000;
    506506
    507   { model flags }
     507  { Model flags }
    508508  mdZOC = $01;
    509509  mdCivil = $02;
    510510  mdDoubleSupport = $04;
    511511
    512   { player happened flags }
     512  { Player happened flags }
    513513  phTech = $01;
    514514  phStealTech = $02;
     
    523523  phGameEnd = $F000;
    524524
    525   { city happened flags }
     525  { City happened flags }
    526526  chDisorder = $01;
    527527  chProduction = $02;
     
    541541  chImprovementSold = $80000000;
    542542
    543   { city info flags }
     543  { City info flags }
    544544  ciCapital = $01;
    545545  ciWalled = $02;
     
    549549  ciSpacePort = $20;
    550550
    551   { city tile available values }
     551  { City tile available values }
    552552  faAvailable = 0;
    553553  faNotAvailable = 1;
     
    556556  faInvalid = $FF;
    557557
    558   // battle history flags
     558  // Battle history flags
    559559  bhEnemyAttack = $01;
    560560  bhMyUnitLost = $02;
    561561  bhEnemyUnitLost = $04;
    562562
    563   { move advice special destinations }
     563  { Move advice special destinations }
    564564  maNextCity = -1;
    565565
    566   { goverment forms }
     566  { Goverment forms }
    567567  nGov = 8;
    568568  gAnarchy = 0;
     
    575575  gFuture = 7;
    576576
    577   // ship change reasons
     577  // Ship change reasons
    578578  scrProduction = 0;
    579579  scrDestruction = 1;
     
    581581  scrCapture = 3;
    582582
    583   { unit jobs }
     583  { Unit jobs }
    584584  nJob = 15;
    585585  jNone = 0;
     
    599599  jCity = 14;
    600600
    601   // job preconditions are:
     601  // Job preconditions are:
    602602  // technology JobPreq is available, no city, plus the following:
    603603  // jRoad: no river when bridge building unavailable
     
    614614  // jCity, jFort, jBase: none
    615615
    616   // spy mission
     616  // Spy mission
    617617  nSpyMission = 5;
    618618  smSabotageProd = 0;
     
    622622  smStealMilReport = 4;
    623623
    624   // resource weights
     624  // Resource weights
    625625  rwOff = $00000000;
    626626  rwMaxGrowth = $3F514141; // 120*F + 1/8*P + 1/16*T + 1/16*S
     
    630630  rwForceScience = $F1010101; // F^1/2 * (1*P + 1*T + 1*S)
    631631
    632   { advances }
     632  { Advances }
    633633  adAdvancedFlight = 0;
    634634  adAmphibiousWarfare = 1;
     
    731731  adMilitary = $800; // Military Research
    732732
    733   { wonders }
     733  { Wonders }
    734734  woPyramids = 00;
    735735  woZeus = 01;
     
    752752  woMir = 20;
    753753
    754   { city improvements }
     754  { City improvements }
    755755  imTrGoods = 28;
    756756  imBarracks = 29;
     
    801801  // in 1/2*city size
    802802
    803   // special prerequisite values
     803  // Special prerequisite values
    804804  preNone = -1;
    805805  preLighthouse = -2;
     
    813813    adExplosives, adConstruction, preNone, adMedicine, preNone, preNone);
    814814
    815   AdvPreq: array [0 .. nAdv - 1, 0 .. 2] of Integer = { advance prerequisites }
     815  AdvPreq: array [0 .. nAdv - 1, 0 .. 2] of Integer = { Advance prerequisites }
    816816    ((adFlight, adRobotics, preNone), // adAdvancedFlight
    817817    (adNavigation, adTactics, preNone), // adAmphibiousWarfare
     
    910910    (adSmartWeapons, preNone, preNone)); // futMissileTechnology
    911911
    912 Imp: array [0 .. nImp - 1] of // city improvements
     912Imp: array [0 .. nImp - 1] of // City improvements
    913913record
    914914  Kind: Integer;
     
    916916  Cost: Integer;
    917917  Maint: Integer;
    918   Expiration: integer;
     918  Expiration: Integer;
    919919end
    920920= ((Kind: ikWonder; Preq: adMathematics; Cost: 400; Maint: 0;
     
    10191019  (NewImp: imMilAcademy; OldImp: imBarracks));
    10201020
    1021 // colony ship
     1021// Colony ship
    10221022nShipPart = 3;
    10231023spComp = 0;
     
    10991099  TradeRes: (0, 0, 7); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); { Mou }
    11001100
    1101 // settler work required MP
     1101// Settler work required MP
    11021102PillageWork = 100;
    11031103CityWork = 900;
     
    11121112PollWork = 1800;
    11131113
    1114 // upgrades for new unit models
     1114// Upgrades for new unit models
    11151115// upgrade[domain,0].preq is domain precondition advance
    11161116// cost values accumulate if prerequisite is future tech / are maximized if not
    11171117nUpgrade = 15;
    1118 upgrade: array [0 .. nDomains - 1, 0 .. nUpgrade - 1] of record
     1118Upgrade: array [0..nDomains - 1, 0..nUpgrade - 1] of record
    11191119  Preq: Integer;
    11201120  Strength: Integer;
    11211121  Trans: Integer;
    1122   Cost: integer;
     1122  Cost: Integer;
    11231123end
    11241124= (((Preq: adWarriorCode; Strength: 4; Trans: 0; Cost: 3),
     
    11681168  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0)));
    11691169
    1170 { model features }
     1170{ Model features }
    11711171nFeature = 27;
    11721172mcWeapons = 0;
     
    12001200AutoFeature: set of mcFirstNonCap .. nFeature - 1 = [mcNav, mcSE, mcNP, mcJet,
    12011201  mcAcademy];
    1202 // unit class advances, automatically applied if available
    1203 
    1204 Feature: array [0 .. nFeature - 1] of { unit model features }
     1202// Unit class advances, automatically applied if available
     1203
     1204Feature: array [0 .. nFeature - 1] of { Unit model features }
    12051205  record
    12061206    Domains: Integer;
     
    12431243INFIN = 999999;
    12441244
    1245 // for backward compatibility
     1245// For backward compatibility
    12461246fRare = fDeadLands;
    12471247fRare1 = fCobalt;
     
    13221322    cmRefreshDebugMap = $3F90,
    13231323
    1324     // diplomacy commands equal to server, see below
     1324    // Diplomacy commands equal to server, see below
    13251325
    13261326    cmDebugMessage = $7000,
     
    13851385    Cost: Word;
    13861386    MStrength: Word;
    1387     // construction time multipliers, only valid if kind is mkSelfDeveloped or mkEnemyDeveloped
     1387    // Construction time multipliers, only valid if kind is mkSelfDeveloped or mkEnemyDeveloped
    13881388    MTrans: Byte;
    13891389    MCost: Byte;
    13901390    Weight: Byte;
    13911391    MaxWeight: Byte;
    1392     // weight and maximum weight (construction time)
     1392    // Weight and maximum weight (construction time)
    13931393    Upgrades: Cardinal; // bitarray indicating all upgrades
    13941394    Flags: Cardinal;
     
    15251525  TCityReportNew = record
    15261526    HypoTiles: Integer;
    1527     // tiles that should be considered as exploited (for the current adjustment, set this to -1 or to TCity.Tiles of the city)
     1527    // Tiles that should be considered as exploited (for the current adjustment, set this to -1 or to TCity.Tiles of the city)
    15281528    HypoTaxRate: Integer;
    15291529    HypoLuxuryRate: Integer;
    1530     // tax and luxury rate that should be assumed (for current rates, set this to -1 or to RO.TaxRate resp. RO.LuxRate)
     1530    // Tax and luxury rate that should be assumed (for current rates, set this to -1 or to RO.TaxRate resp. RO.LuxRate)
    15311531    Morale: Integer;
    15321532    FoodSupport: Integer;
    15331533    MaterialSupport: Integer;
    1534     // food and material taken for unit support
     1534    // Food and material taken for unit support
    15351535    ProjectCost: Integer; // material cost of current project
    15361536    Storage: Integer; // size of food storage
     
    15401540    CollectedMaterial: Integer;
    15411541    CollectedTrade: Integer;
    1542     // raw control, food, material and trade as collected by the citizens
     1542    // Raw control, food, material and trade as collected by the citizens
    15431543    Working: Integer; // number of exploited tiles including city tile
    15441544    FoodSurplus: Integer;
    15451545    Production: Integer;
    15461546    AddPollution: Integer;
    1547     // food surplus, production gain and pollution after all effects
     1547    // Food surplus, production gain and pollution after all effects
    15481548    Corruption: Integer;
    15491549    Tax: Integer;
    15501550    Science: Integer;
    15511551    Luxury: Integer;
    1552     // corruption, tax, science and wealth after all effects
     1552    // Corruption, tax, science and wealth after all effects
    15531553    HappinessBalance: Integer;
    15541554    // = (Morale+Wealth+Control) - (Size+Unrest), value < 0 means disorder
     
    15631563  TGetCityData = record
    15641564    Owner: Integer;
    1565     c: TCity;
     1565    C: TCity;
    15661566  end;
    15671567
     
    16001600    Movement: Integer;
    16011601    EndHealthDef: Integer;
    1602     EndHealthAtt: Integer; // must be same as in TBattleForecast
     1602    EndHealthAtt: Integer; // Must be same as in TBattleForecast
    16031603    AStr: Integer;
    16041604    DStr: Integer;
     
    16441644  TCreateUnitData = record
    16451645    Loc: Integer;
    1646     p: Integer;
     1646    P: Integer;
    16471647    mix: Integer;
    16481648  end;
     
    16531653  TOwnerList = array [0 .. INFIN] of ShortInt;
    16541654  TByteList = array [0 .. INFIN] of Byte;
    1655   TIntList = array [0 .. INFIN] of integer;
     1655  TIntList = array [0 .. INFIN] of Integer;
    16561656  TCityList = array [0 .. INFIN] of TCity;
    16571657  TUnList = array [0 .. INFIN] of TUn;
     
    16651665    Data: Pointer;
    16661666    Map: ^TTileList;
    1667     { the playground, a list of tiles with index = location, see tile flags }
     1667    { The playground, a list of tiles with index = location, see tile flags }
    16681668    MapObservedLast: ^TTileObservedLastList;
    1669     // turn in which the tile was observed last, index = location
     1669    // Turn in which the tile was observed last, index = location
    16701670    Territory: ^TOwnerList; // nation to which's territory a tile belongs, -1 indicates none
    16711671    Un: ^TUnList; { units }
     
    16951695    LuxRate: Integer;
    16961696    Research: Integer;
    1697     { collected research points for currently researched tech }
     1697    { Collected research points for currently researched tech }
    16981698    ResearchTech: Integer; // currently researched tech
    16991699    DevModel: TModel; { unit model currently under development }
     
    17301730    MaxTurn: Integer;
    17311731    Difficulty: array [0 .. nPl - 1] of Integer;
    1732     { difficulty levels of the players, if it's 0 this player is the supervisor,
     1732    { Difficulty levels of the players, if it's 0 this player is the supervisor,
    17331733      -1 for unused slots }
    17341734    RO: array [0 .. nPl - 1] of ^TPlayerContext;
     
    17441744    RND: Integer;
    17451745    Difficulty: array [0 .. nPl - 1] of Integer;
    1746     { difficulty levels of the players, if it's 0 this player is the supervisor,
     1746    { Difficulty levels of the players, if it's 0 this player is the supervisor,
    17471747      -1 for unused slots }
    17481748    Controlled: Integer;
     
    17571757
    17581758const
    1759   { predefined unit models: }
     1759  { Predefined unit models: }
    17601760  nSpecialModel = 9;
    17611761  SpecialModel: array [0 .. nSpecialModel - 1] of TModel = ((Status: 0;
     
    18151815    0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
    18161816
    1817   SpecialModelPreq: array [0 .. nSpecialModel - 1] of integer = (preNone,
     1817  SpecialModelPreq: array [0 .. nSpecialModel - 1] of Integer = (preNone,
    18181818    adExplosives, preNone, preNone, (* adWri, *) adIntelligence, adTrade,
    18191819    (* adTheCorporation,adHorsebackRiding,adAutomobile,adNavigation,
     
    18241824  DelphiRandSeed: Integer;
    18251825
    1826 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);
    1827 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);
     1826procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo);
     1827procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo);
    18281828function IsSameModel(const mi1, mi2: TModelInfo): Boolean;
    18291829function SpecialTile(Loc, TerrType, lx: Integer): Integer;
     
    18361836implementation
    18371837
    1838 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);
     1838procedure MakeUnitInfo(P: Integer; const U: TUn; var ui: TUnitInfo);
    18391839begin
    1840   ui.Owner := p;
    1841   ui.Loc := u.Loc;
    1842   ui.Health := u.Health;
    1843   ui.Fuel := u.Fuel;
    1844   ui.Job := u.Job;
    1845   ui.Exp := u.Exp;
    1846   ui.Load := u.TroopLoad + u.AirLoad;
    1847   ui.mix := u.mix;
    1848   ui.Flags := u.Flags;
     1840  ui.Owner := P;
     1841  ui.Loc := U.Loc;
     1842  ui.Health := U.Health;
     1843  ui.Fuel := U.Fuel;
     1844  ui.Job := U.Job;
     1845  ui.Exp := U.Exp;
     1846  ui.Load := U.TroopLoad + U.AirLoad;
     1847  ui.mix := U.mix;
     1848  ui.Flags := U.Flags;
    18491849end;
    18501850
    1851 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);
     1851procedure MakeModelInfo(P, mix: Integer; const M: TModel; var mi: TModelInfo);
    18521852var
    1853   i: Integer;
     1853  I: Integer;
    18541854begin
    1855   mi.Owner := p;
     1855  mi.Owner := P;
    18561856  mi.mix := mix;
    1857   mi.ID := m.ID;
    1858   mi.Domain := m.Domain;
    1859   if m.Kind = mkEnemyDeveloped then
    1860     mi.Kind := mkSelfDeveloped // important for IsSameModel()
     1857  mi.ID := M.ID;
     1858  mi.Domain := M.Domain;
     1859  if M.Kind = mkEnemyDeveloped then
     1860    mi.Kind := mkSelfDeveloped // Important for IsSameModel()
    18611861  else
    1862     mi.Kind := m.Kind;
    1863   mi.Attack := m.Attack;
    1864   mi.Defense := m.Defense;
    1865   mi.Speed := m.Speed;
    1866   mi.Cost := m.Cost;
     1862    mi.Kind := M.Kind;
     1863  mi.Attack := M.Attack;
     1864  mi.Defense := M.Defense;
     1865  mi.Speed := M.Speed;
     1866  mi.Cost := M.Cost;
    18671867  if mi.Domain = dAir then
    18681868  begin
    1869     mi.TTrans := m.Cap[mcAirTrans] * m.MTrans;
    1870     mi.ATrans_Fuel := m.Cap[mcFuel];
     1869    mi.TTrans := M.Cap[mcAirTrans] * M.MTrans;
     1870    mi.ATrans_Fuel := M.Cap[mcFuel];
    18711871  end
    18721872  else
    18731873  begin
    1874     mi.TTrans := m.Cap[mcSeaTrans] * m.MTrans;
    1875     mi.ATrans_Fuel := m.Cap[mcCarrier] * m.MTrans;
    1876   end;
    1877   mi.Bombs := m.Cap[mcBombs] * m.MStrength * 2;
     1874    mi.TTrans := M.Cap[mcSeaTrans] * M.MTrans;
     1875    mi.ATrans_Fuel := M.Cap[mcCarrier] * M.MTrans;
     1876  end;
     1877  mi.Bombs := M.Cap[mcBombs] * M.MStrength * 2;
    18781878  mi.Cap := 0;
    1879   for i := mcFirstNonCap to nFeature - 1 do
    1880     if m.Cap[i] > 0 then
    1881       mi.Cap := mi.Cap or (1 shl (i - mcFirstNonCap));
     1879  for I := mcFirstNonCap to nFeature - 1 do
     1880    if M.Cap[I] > 0 then
     1881      mi.Cap := mi.Cap or (1 shl (I - mcFirstNonCap));
    18821882  mi.MaxUpgrade := 0;
    1883   for i := 1 to nUpgrade - 1 do
    1884     if m.Upgrades and (1 shl i) <> 0 then
    1885       mi.MaxUpgrade := i;
    1886   mi.Weight := m.Weight;
     1883  for I := 1 to nUpgrade - 1 do
     1884    if M.Upgrades and (1 shl I) <> 0 then
     1885      mi.MaxUpgrade := I;
     1886  mi.Weight := M.Weight;
    18871887  mi.Lost := 0;
    18881888end;
     
    18961896  Compare1 := @mi1;
    18971897  Compare2 := @mi2;
    1898   result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and
     1898  Result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and
    18991899    (Compare1[2] = Compare2[2]) and (Compare1[3] = Compare2[3]) and
    19001900    (Compare1[4] = Compare2[4]) and (Compare1[5] = Compare2[5])
     
    19031903function SpecialTile(Loc, TerrType, lx: Integer): Integer;
    19041904var
    1905   x, y, qx, qy, a: Integer;
     1905  X, Y, qx, qy, A: Integer;
    19061906begin
    19071907  if TerrType = fOcean then
    1908     result := 0
     1908    Result := 0
    19091909  else
    19101910  begin
    1911     y := Loc div lx;
    1912     x := Loc - y * lx;
    1913     if TerrType = fGrass then { formula for productive grassland }
    1914       if Odd((lymax + x - y shr 1) shr 1 + x + (y + 1) shr 1) then
    1915         result := 1
     1911    Y := Loc div lx;
     1912    X := Loc - Y * lx;
     1913    if TerrType = fGrass then { Formula for productive grassland }
     1914      if Odd((lymax + X - Y shr 1) shr 1 + X + (Y + 1) shr 1) then
     1915        Result := 1
    19161916      else
    1917         result := 0
    1918     else { formula for special resources }
     1917        Result := 0
     1918    else { Formula for special resources }
    19191919    begin
    1920       a := 4 * x - y + 9980;
    1921       qx := a div 10;
    1922       if (qx * 10 = a) and (qx and 3 <> 0) then
     1920      A := 4 * X - Y + 9980;
     1921      qx := A div 10;
     1922      if (qx * 10 = A) and (qx and 3 <> 0) then
    19231923      begin
    1924         qy := (y + x) div 5;
     1924        qy := (Y + X) div 5;
    19251925        if qy and 3 <> qx shr 2 and 1 * 2 then
    19261926          if (TerrType = fArctic) or (TerrType = fSwamp) then
    1927             result := 1
     1927            Result := 1
    19281928          else if TerrType = fShore then
    19291929          begin
    19301930            if (qx + qy) and 1 = 0 then
    19311931              if qx and 3 = 2 then
    1932                 result := 2
     1932                Result := 2
    19331933              else
    1934                 result := 1
     1934                Result := 1
    19351935            else
    1936               result := 0
     1936              Result := 0
    19371937          end
    19381938          else
    1939             result := (qx + qy) and 1 + 1
     1939            Result := (qx + qy) and 1 + 1
    19401940        else
    1941           result := 0;
     1941          Result := 0;
    19421942      end
    19431943      else
    1944         result := 0;
    1945     end
     1944        Result := 0;
     1945    end;
    19461946  end;
    19471947end;
Note: See TracChangeset for help on using the changeset viewer.