1  {$INCLUDE Switches.inc}


2  {$HINTS OFF}


3  unit Protocol;


4 


5  interface


6 


7  const


8  lxmax = 100;


9  lymax = 96;


10  nAdv = 94; { number of advances }


11  nImp = 70; { number of improvements }


12  nPl = 15; { max number of players, don't change! }


13  nUmax = 4096; { max units/player, don't set above 4096 }


14  nCmax = 1024; { max cities/player, don't set above 4096 }


15  nMmax = 256; { max models/player, don't set above 1024 }


16  nExp = 5; // number of experience levels


17  ExpCost = 50; { received damage required for next experience level }


18  MaxFutureTech = 25;


19  // maximum number of future techs of one kind except computing technology


20  MaxFutureTech_Computing = 100;


21  // maximum number of computing technology future techs


22  CountryRadius = 9;


23  MaxCitySize = 30;


24  BasicHappy = 2; { basically happy citizens }


25  MaxPollution = 240;


26  NeedAqueductSize = 8;


27  NeedSewerSize = 12;


28  ColossusEffect = 75; // percent wonder building cost


29  UniversityFutureBonus = 5; // percent per tech


30  ResLabFutureBonus = 10; // percent per tech


31  FactoryFutureBonus = 5; // percent per tech


32  MfgPlantFutureBonus = 10; // percent per tech


33  AnarchyTurns = 3;


34  CaptureTurns = 3;


35  CancelTreatyTurns = 3;


36  PeaceEvaTurns = 5;


37  // should be less then 2*CancelTreatyTurns, so that you can't attack an ally without reentering


38  ColdWarTurns = 40;


39  DesertThurst = 20; // damage for turn in desert


40  ArcticThurst = 20; // damage for turn in arctic


41  FastRecovery = 50;


42  CityRecovery = 20;


43  NoCityRecovery = 8;


44  MaxMoneyPrice = $FFFF;


45  MaxShipPartPrice = 100;


46  BombardmentDestroysCity = False;


47  StartMoney = 0;


48  InitialCredibility = 95;


49 


50  // ai module flags (for TInitModuleData.Flags)


51  aiThreaded = $01;


52 


53  // difficulty settings


54  MaxDiff = 4; { maximum difficulty level }


55  StorageSize: array [1 .. MaxDiff] of Integer = (30, 40, 50, 60);


56  TechFormula_M: array [1 .. MaxDiff] of Single = (2.0, 2.3, 2.6, 4.0);


57  TechFormula_D: array [1 .. MaxDiff] of Single = (102.0, 80.0, 64.0, 64.0);


58  BuildCostMod: array [1 .. MaxDiff] of Integer = (9, 12, 15, 18); // in 1/12


59 


60  // test flags


61  nTestFlags = 7; // max. 11


62  tfAllTechs = $001; { all nations get all techs }


63  tfImmImprove = $002; { city projects complete each turn }


64  tfImmAdvance = $004; { research complete each turn }


65  tfImmGrow = $008; { all cities grow in each turn }


66  tfUncover = $010; // all players see like supervisor


67  tfAllContact = $020; // all nations can contact each other


68  tfNoRareNeed = $040; // producing colony ship requires no modern resources


69  tfTested = $800; // at least one test flag was set


70 


71  { server commands


72  IMPORTANT: lowest 4 bits must indicate size in DWORDS of data parameter,


73  except for request commands }


74 


75  sctMask = $3800; // server command type


76  sExecute = $4000; { call commandsExecute to request return value without


77  execution }


78  cClientEx = $8000;


79 


80  // Info Request Commands


81  sctInfo = $0000;


82  sMessage = $0000;


83  sSetDebugMap = $0010;


84  sGetDebugMap = $0020;


85  { sChangeSuperView=$0030; } sRefreshDebugMap = $0040;


86  sGetChart = $0100; // + type shl 4


87  sGetTechCost = $0180;


88  sGetAIInfo = $01C0;


89  sGetAICredits = $01D0;


90  sGetVersion = $01E0;


91  sGetGameChanged = $01F0;


92  sGetTileInfo = $0200;


93  sGetCityTileInfo = $0210;


94  sGetHypoCityTileInfo = $0220;


95  sGetJobProgress = $0230;


96  sGetModels = $0270;


97  sGetUnits = $0280;


98  sGetDefender = $0290;


99  sGetBattleForecast = $02A0;


100  sGetUnitReport = $02B0;


101  sGetMoveAdvice = $02C0;


102  sGetPlaneReturn = $02D0;


103  sGetBattleForecastEx = $02E0;


104  sGetCity = $0300;


105  sGetCityReport = $0310;


106  sGetCityAreaInfo = $0320;


107  sGetEnemyCityReport = $0330;


108  sGetEnemyCityAreaInfo = $0340;


109  sGetCityTileAdvice = $0350;


110  sGetCityReportNew = $0360;


111  sGetEnemyCityReportNew = $0370;


112 


113  // Map Editor Commands


114  sEditTile = $0710;


115  sRandomMap = $0780;


116  sMapGeneratorRequest = $0790;


117 


118  // Server Internal Commands


119  sctInternal = sctInfo;


120  // sctInfo  without sExecute flag, sctInternal  with sExecute flag


121  sIntTellAboutNation = $4000;


122  sIntHaveContact = $4010;


123  sIntCancelTreaty = $4020;


124  sIntTellAboutModel = $4100; { +told player shl 4 }


125  sIntDiscoverZOC = $4201;


126  sIntExpandTerritory = $4218;


127  sIntBuyMaterial = $4301;


128  sIntPayPrices = $4402;


129  sIntSetDevModel = $450D;


130  sIntSetModelStatus = $4601;


131  sIntSetUnitStatus = $4611;


132  sIntSetCityStatus = $4621;


133  sIntSetECityStatus = $4631;


134  sIntDataChange = $4700;


135 


136  // Client Deactivation Commands


137  sctEndClient = $0800;


138  sTurn = $4800;


139  sBreak = $4810;


140  sResign = $4820;


141  sNextRound = $4830;


142  sReload = $4841;


143  sSaveMap = $4880;


144  sAbandonMap = $4890;


145  // diplomacy commands equal to client, see below


146 


147  // General Commands


148  sctGeneral = $1000;


149  sClearTestFlag = $5000;


150  sSetTestFlag = $5010;


151  sSetGovernment = $5100;


152  sSetRates = $5110;


153  sRevolution = $5120;


154  sSetResearch = $5200;


155  sStealTech = $5210;


156  sSetAttitude = $5300; // + concerned player shl 4


157  sCancelTreaty = $5400;


158 


159  // Model Related Commands


160  sctModel = $1800;


161  sCreateDevModel = $5800;


162  sSetDevModelCap = $5C00; { +value shl 4 }


163  { reserves $5CXX, $5DXX, $5EXX, $5FXX }


164 


165  // Unit Related Commands


166  sctUnit = $2000;


167  sRemoveUnit = $6000;


168  sSetUnitHome = $6010;


169  sSetSpyMission = $6100; // + mission shl 4


170  sLoadUnit = $6200;


171  sUnloadUnit = $6210;


172  sSelectTransport = $6220;


173  sCreateUnit = $6301; // + player shl 4


174  sMoveUnit = $6400; { +dx and 7 shl 4 +dy and 7 shl 7 }


175  { reserves $64XX, $65XX, $66XX, $67XX }


176 


177  // Settlers Related Commands


178  sctSettlers = $2800;


179  sAddToCity = $6810;


180  sStartJob = $6C00; { +job shl 4 }


181  { reserves $6CXX, $6DXX, $6EXX, $6FXX }


182 


183  // City Related Commands


184  sctCity = $3000;


185  sSetCityProject = $7001;


186  sBuyCityProject = $7010;


187  sSellCityProject = $7020;


188  sSellCityImprovement = $7101;


189  sRebuildCityImprovement = $7111;


190  sSetCityTiles = $7201;


191 


192  // free command space


193  sctUnused = $3800;


194 


195  { client commands }


196  cInitModule = $0000;


197  cReleaseModule = $0100;


198  cBroadcast = $0200;


199  cHelpOnly = $0700;


200  cStartHelp = $0710;


201  cStartCredits = $0720;


202 


203  cNewGame = $0800;


204  cLoadGame = $0810;


205  cMovie = $0820;


206  cNewGameEx = $0840;


207  cLoadGameEx = $0850;


208  cNewMap = $0880;


209  cReplay = $08E0;


210  cGetReady = $08F0;


211  cBreakGame = $0900;


212 


213  cTurn = $2000;


214  cResume = $2010;


215  cContinue = $2080;


216  cMovieTurn = $2100;


217  cMovieEndTurn = $2110;


218  cEditMap = $2800;


219 


220  // cShowTileM=$3000;cShowTileA=$3010;cShowFoundCity=$3020;


221  cShowUnitChanged = $3030;


222  cShowAfterMove = $3040;


223  cShowAfterAttack = $3050;


224  cShowCityChanged = $3090;


225  // cShowMove=$3100;cShowCapture=$3110;


226  // cShowAttackBegin=$3200;cShowAttackWon=$3210;cShowAttackLost=$3220;


227  cShowMoving = $3140;


228  cShowCapturing = $3150;


229  cShowAttacking = $3240;


230  cShowMissionResult = $3300;


231  cShowShipChange = $3400;


232  cShowGreatLibTech = $3500;


233  cShowTurnChange = $3700;


234  cShowCancelTreaty = $3800;


235  cShowEndContact = $3810;


236  cShowCancelTreatyByAlliance = $3820;


237  cShowSupportAllianceAgainst = $3830;


238  cShowPeaceViolation = $3880;


239  cShowGame = $3F00; { cShowSuperView=$3F80; }


240  cRefreshDebugMap = $3F90;


241 


242  // diplomacy commands equal to server, see below


243 


244  cDebugMessage = $7000;


245  cShowNego = $7010;


246 


247  // commands same for server and client


248  scContact = $4900; // + concerned player shl 4 for server call


249  scReject = $4A00;


250  scDipStart = $4B00;


251  scDipNotice = $4B10;


252  scDipAccept = $4B20;


253  scDipCancelTreaty = $4B30;


254  scDipOffer = $4B4E;


255  scDipBreak = $4BF0;


256 


257  { server return codes: flags }


258  rExecuted = $40000000;


259  rEffective = $20000000;


260  rUnitRemoved = $10000000;


261  rEnemySpotted = $08000000;


262 


263  { server return codes: command executed }


264  // note: the same return code might have a different meaning for different server functions!


265  eOK = $60000000; // ok


266  eEnemySpotted = $68000000; // unit move ok, new enemy unit/city spotted


267  eDied = $70000000; // move executed, unit died due to hostile terrain


268  eEnemySpotted_Died = $78000000;


269  // unit move ok, new enemy unit/city spotted, unit died due to hostile terrain


270  eLoaded = $60000002; // unit move caused loading to transport ship


271  eLost = $70000004; // attack executed, battle lost, unit is dead


272  eWon = $60000005; // attack executed, battle won, defender destroyed


273  eBloody = $70000005; // attack executed, defender destroyed, unit is dead


274  eBombarded = $60000006; // empty enemy city bombarded


275  eExpelled = $60000007; // friendly unit expelled


276  eMissionDone = $70000008;


277  // spy moved into city: mission done, spy no longer exists


278  eJobDone = $60000001; // settler job started and already done


279  eJobDone_Died = $70000001;


280  // settler job started and already done, unit died due to hostile terrain


281  eCity = $70000002; // city founded, settler no more exists


282  eRemoved = $70000000; // sRemoveUnit: unit removed


283  eUtilized = $70000001; // sRemoveUnit: unit utilized for city project


284 


285  eNotChanged = $40000000;


286  // ok, but no effect (e.g. current city project set again)


287 


288  { server return codes: command not executed }


289  eHiddenUnit = $20000013;


290  // unit move: not possible, destination tile occupied by hidden foreign submarine


291  eStealthUnit = $2000001A;


292  // unit move: not possible, destination tile occupied by foreign stealth unit


293  eZOC_EnemySpotted = $28000014;


294  // unit move: not possible, new enemy unit spotted, ZOC violation


295 


296  eInvalid = $0000; // command not allowed now or parameter out of allowed range


297  eUnknown = $0001; // unknown command


298  eNoTurn = $0002; // command only allowed during player's turn


299  eViolation = $0003; // general violation of game rules


300  eNoPreq = $0004; // the prerequisites for this command are not fully met


301 


302  eNoTime_Move = $0008; // normal unit move: too few movement points left


303  eNoTime_Load = $0009; // load unit: too few movement points left


304  eNoTime_Attack = $000A; // attack: no movement points left


305  eNoTime_Bombard = $000B; // bombard city: too few movement points left


306  eNoTime_Expel = $000C; // expel spy: too few movement points left


307 


308  eDomainMismatch = $0011;


309  // move/attack: action not allowed for this unit domain


310  eNoCapturer = $0012;


311  // unit move: this type of unit is not allowed to capture a city


312  eZOC = $0014; // unit move: not possible, ZOC violation


313  eTreaty = $0015; // move/attack: not possible, peace treaty violation


314  eDeadLands = $0016; // sStartJob: not possible, dead lands


315  eNoRoad = $0017; // unit move: not possible, no road


316  eNoNav = $0019; // unit move: not possible, open sea without navigation


317  eNoLoadCapacity = $001B; // load to transport: no more transport capacity


318  eNoBombarder = $001C; // bombardment impossible because no attack power


319 


320  eMaxSize = $0020;


321  // add to city: bigger size not allowed due to missing aqueduct/sewer


322  eNoCityTerrain = $0022; // found city: not possible in this terrain


323  eNoBridgeBuilding = $0023;


324  eInvalidOffer = $0030;


325  eOfferNotAcceptable = $0031;


326  eCancelTreatyRush = $0032;


327  eAnarchy = $0038; // no negotiation in anarchy


328  eColdWar = $003F;


329  eNoModel = $0040; // sCreateDevModel must be called before!


330  eTileNotAvailable = $0050;


331  eNoWorkerAvailable = $0051;


332  eOnlyOnce = $0058;


333  // sell/rebuild city improvement: only once per city and turn!


334  eObsolete = $0059; // city project: more advanced improvement already exists


335  eOutOfControl = $005A;


336  // buy/sell/rebuild improvement: not in anarchy, not in captured cities


337 


338  eNoWay = $0100; // sGetMoveAdvice: no way found


339 


340  // chart types


341  nStat = 6;


342  stPop = 0;


343  stTerritory = 1;


344  stMil = 2;


345  stScience = 3;


346  stExplore = 4;


347  stWork = 5;


348 


349  { tile flags: terrain type }


350  fTerrain = $1F; // mask for terrain type


351  fOcean = $00;


352  fShore = $01;


353  fGrass = $02;


354  fDesert = $03;


355  fPrairie = $04;


356  fTundra = $05;


357  fArctic = $06;


358  fSwamp = $07;


359  fForest = $09;


360  fHills = $0A;


361  fMountains = $0B;


362  fUNKNOWN = fTerrain;


363 


364  { tile flags: terrain improvements }


365  fTerImp = $0000F000; // mask for terrain improvement


366  tiNone = $00000000;


367  tiIrrigation = $00001000;


368  tiFarm = $00002000;


369  tiMine = $00003000;


370  tiFort = $00004000;


371  tiBase = $00005000;


372 


373  { tile flags: add ons }


374  fSpecial = $00000060;


375  fSpecial1 = $00000020;


376  fSpecial2 = $00000040;


377  fRiver = $00000080;


378  fRoad = $00000100;


379  fRR = $00000200;


380  fCanal = $00000400;


381  fPoll = $00000800;


382  fPrefStartPos = $00200000;


383  fStartPos = $00400000; // map editor only


384  fDeadLands = $01000000;


385  fModern = $06000000;


386  fCobalt = $02000000;


387  fUranium = $04000000;


388  fMercury = $06000000;


389 


390  { tile flags: redundant helper info }


391  fGrWall = $00010000; // tile protected by great wall


392  fSpiedOut = $00020000;


393  fStealthUnit = $00040000;


394  fHiddenUnit = $00080000;


395  fObserved = $00100000; // set if tile information is from this turn


396  fOwned = $00200000; // set if unit/city here is own one


397  fUnit = $00400000;


398  fCity = $00800000;


399  fOwnZoCUnit = $10000000; // own ZoC unit present at this tile


400  fInEnemyZoC = $20000000;


401  // tile is adjacent to known foreign ZoC unit (not allied)


402  fPeace = $40000000;


403  // tile belongs to territory of nation that we are in peace with but not allied


404 


405  // city project flags


406  cpIndex = $1FF;


407  cpConscripts = $200; // produce unit as conscripts


408  cpDisbandCity = $400;


409  // allow to disband city when settlers/conscripts are produced


410  cpImp = $800; // 0: index refers to model, 1: index refers to city improvement


411  cpRepeat = $1000;


412  cpCompleted = $2000;


413  cpAuto = $F000; // for internal use only


414 


415  // tech status indicators


416  tsNA = 2;


417  tsSeen = 1;


418  tsResearched = 0;


419  tsGrLibrary = 1;


420  tsCheat = 15;


421  tsApplicable = tsResearched;


422 


423  // nation treaties


424  trNoContact = 1;


425  trNone = 0;


426  trPeace = 2;


427  trFriendlyContact = 3;


428  trAlliance = 4;


429 


430  // attitudes


431  nAttitude = 7;


432  atHostile = 0;


433  atIcy = 1;


434  atUncoop = 2;


435  atNeutral = 3;


436  atReceptive = 4;


437  atCordial = 5;


438  atEnth = 6;


439 


440  // offer prices


441  opChoose = $00000000;


442  opCivilReport = $11000000; // + turn + concerned player shl 16


443  opMilReport = $12000000; // + turn + concerned player shl 16


444  opMap = $1F000000;


445  opTreaty = $20000000; // + suggested nation treaty


446  opShipParts = $30000000; // + number + part type shl 16


447  opMoney = $40000000; // + value


448  opTribute = $48000000; // obsolete


449  opTech = $50000000; // + advance


450  opAllTech = $51000000;


451  opModel = $58000000; // + model index


452  opAllModel = $59000000;


453 


454  opMask = $FF000000;


455 


456  // improvement kinds


457  ikTrGoods = 0;


458  ikCommon = 1;


459  ikNatLocal = 2;


460  ikNatGlobal = 3;


461  ikWonder = 4;


462  ikShipPart = 5;


463  ikNA = $7F;


464 


465  { model domains }


466  nDomains = 3;


467  dGround = 0;


468  dSea = 1;


469  dAir = 2;


470 


471  { model kinds }


472  mkSelfDeveloped = $00;


473  mkEnemyDeveloped = $01;


474  mkSpecial_Boat = $08;


475  mkSpecial_SubCabin = $0A;


476  mkSpecial_TownGuard = $10;


477  mkSpecial_Glider = $11;


478  mkScout = $20;


479  mkSlaves = $21;


480  mkSettler = $22;


481  mkCommando = $23;


482  mkFreight = $24;


483 


484  { unit flags }


485  unFortified = $01;


486  unBombsLoaded = $02;


487  unMountainDelay = $04;


488  unConscripts = $08;


489  unWithdrawn = $10;


490  unMulti = $80;


491 


492  // unit report flags


493  urfAlwaysSupport = $01;


494  urfDeployed = $02;


495 


496  // unit moves


497  umCapturing = $0100;


498  umSpyMission = $0200;


499  umBombarding = $0400;


500  umExpelling = $0800;


501  umShipLoading = $1000;


502  umShipUnloading = $2000;


503  umPlaneLoading = $4000;


504  umPlaneUnloading = $8000;


505 


506  { model flags }


507  mdZOC = $01;


508  mdCivil = $02;


509  mdDoubleSupport = $04;


510 


511  { player happened flags }


512  phTech = $01;


513  phStealTech = $02;


514  phChangeGov = $08;


515  phGliderLost = $100;


516  phPlaneLost = $200;


517  phPeaceViolation = $400;


518  phPeaceEvacuation = $800;


519  phShipComplete = $2000;


520  phTimeUp = $4000;


521  phExtinct = $8000;


522  phGameEnd = $F000;


523 


524  { city happened flags }


525  chDisorder = $01;


526  chProduction = $02;


527  chPopIncrease = $04;


528  chPopDecrease = $08;


529  chUnitLost = $10;


530  chImprovementLost = $20;


531  chProductionSabotaged = $40;


532  chNoGrowthWarning = $80;


533  chPollution = $100;


534  chSiege = $200;


535  chOldWonder = $400;


536  chNoSettlerProd = $800;


537  chFounded = $1000;


538  chAfterCapture = $2000;


539  chCaptured = $F0000;


540  chImprovementSold = $80000000;


541 


542  { city info flags }


543  ciCapital = $01;


544  ciWalled = $02;


545  ciCoastalFort = $04;


546  ciMissileBat = $08;


547  ciBunker = $10;


548  ciSpacePort = $20;


549 


550  { city tile available values }


551  faAvailable = 0;


552  faNotAvailable = 1;


553  faSiege = 2;


554  faTreaty = 4;


555  faInvalid = $FF;


556 


557  // battle history flags


558  bhEnemyAttack = $01;


559  bhMyUnitLost = $02;


560  bhEnemyUnitLost = $04;


561 


562  { move advice special destinations }


563  maNextCity = 1;


564 


565  { goverment forms }


566  nGov = 8;


567  gAnarchy = 0;


568  gDespotism = 1;


569  gMonarchy = 2;


570  gRepublic = 3;


571  gFundamentalism = 4;


572  gCommunism = 5;


573  gDemocracy = 6;


574  gFuture = 7;


575 


576  // ship change reasons


577  scrProduction = 0;


578  scrDestruction = 1;


579  scrTrade = 2;


580  scrCapture = 3;


581 


582  { unit jobs }


583  nJob = 15;


584  jNone = 0;


585  jRoad = 1;


586  jRR = 2;


587  jClear = 3;


588  jIrr = 4;


589  jFarm = 5;


590  jAfforest = 6;


591  jMine = 7;


592  jCanal = 8;


593  jTrans = 9;


594  jFort = 10;


595  jPoll = 11;


596  jBase = 12;


597  jPillage = 13;


598  jCity = 14;


599 


600  // job preconditions are:


601  // technology JobPreq is available, no city, plus the following:


602  // jRoad: no river when bridge building unavailable


603  // jRR: road


604  // jClear: Terrain.ClearTerrain, Hanging Gardens for desert


605  // jIrr: Terrain.IrrEff


606  // jFarm: irrigation


607  // jAfforest: Terrain.AfforestTerrain


608  // jMine: Terrain.MineEff


609  // jCanal: no Mountains, no Arctic


610  // jTrans: Terrain.TransWork


611  // jPoll: pollution


612  // jPillage: any tile improvement


613  // jCity, jFort, jBase: none


614 


615  // spy mission


616  nSpyMission = 5;


617  smSabotageProd = 0;


618  smStealMap = 1;


619  smStealForeignReports = 2;


620  smStealCivilReport = 3;


621  smStealMilReport = 4;


622 


623  // resource weights


624  rwOff = $00000000;


625  rwMaxGrowth = $3F514141; // 120*F + 1/8*P + 1/16*T + 1/16*S


626  rwMaxProd = $413F1F01; // 1/16*F + 120*P + 30*T + 1*S


627  rwMaxScience = $41040408; // 1/16*F + 4*P + 4*T + 8*S


628  rwForceProd = $F1080201; // F^1/2 * (8*P + 2*T + 1*S)


629  rwForceScience = $F1010101; // F^1/2 * (1*P + 1*T + 1*S)


630 


631  { advances }


632  adAdvancedFlight = 0;


633  adAmphibiousWarfare = 1;


634  adAstronomy = 2;


635  adAtomicTheory = 3;


636  adAutomobile = 4;


637  adBallistics = 5;


638  adBanking = 6;


639  adBridgeBuilding = 7;


640  adBronzeWorking = 8;


641  adCeremonialBurial = 9;


642  adChemistry = 10;


643  adChivalry = 11;


644  adComposites = 12;


645  adCodeOfLaws = 13;


646  adCombinedArms = 14;


647  adCombustionEngine = 15;


648  adCommunism = 16;


649  adComputers = 17;


650  adConscription = 18;


651  adConstruction = 19;


652  adTheCorporation = 20;


653  adSpaceFlight = 21;


654  adCurrency = 22;


655  adDemocracy = 23;


656  adEconomics = 24;


657  adElectricity = 25;


658  adElectronics = 26;


659  adEngineering = 27;


660  adEnvironmentalism = 28;


661  adWheel = 29;


662  adExplosives = 30;


663  adFlight = 31;


664  adIntelligence = 32;


665  adGunpowder = 33;


666  adHorsebackRiding = 34;


667  adImpulseDrive = 35;


668  adIndustrialization = 36;


669  adSmartWeapons = 37;


670  adInvention = 38;


671  adIronWorking = 39;


672  adTheLaser = 40;


673  adNuclearPower = 41;


674  adLiterature = 42;


675  adInternet = 43;


676  adMagnetism = 44;


677  adMapMaking = 45;


678  adMasonry = 46;


679  adMassProduction = 47;


680  adMathematics = 48;


681  adMedicine = 49;


682  adMetallurgy = 50;


683  adMin = 51;


684  adMobileWarfare = 52;


685  adMonarchy = 53;


686  adMysticism = 54;


687  adNavigation = 55;


688  adNuclearFission = 56;


689  adPhilosophy = 57;


690  adPhysics = 58;


691  adPlastics = 59;


692  adPoetry = 60;


693  adPottery = 61;


694  adRadio = 62;


695  adRecycling = 63;


696  adRefrigeration = 64;


697  adMonotheism = 65;


698  adTheRepublic = 66;


699  adRobotics = 67;


700  adRocketry = 68;


701  adRailroad = 69;


702  adSanitation = 70;


703  adScience = 71;


704  adWriting = 72;


705  adSeafaring = 73;


706  adSelfContainedEnvironment = 74;


707  adStealth = 75;


708  adSteamEngine = 76;


709  adSteel = 77;


710  adSyntheticFood = 78;


711  adTactics = 79;


712  adTheology = 80;


713  adTheoryOfGravity = 81;


714  adTrade = 82;


715  adTransstellarColonization = 83;


716  adUniversity = 84;


717  adAdvancedRocketry = 85;


718  adWarriorCode = 86;


719  adAlphabet = 87;


720  adPolytheism = 88;


721  adRefining = 89;


722  futComputingTechnology = 90;


723  futNanoTechnology = 91;


724  futMaterialTechnology = 92;


725  futArtificialIntelligence = 93;


726 


727  FutureTech = [futComputingTechnology, futNanoTechnology,


728  futMaterialTechnology, futArtificialIntelligence];


729 


730  adMilitary = $800; // Military Research


731 


732  { wonders }


733  woPyramids = 00;


734  woZeus = 01;


735  woGardens = 02;


736  woColossus = 03;


737  woLighthouse = 04;


738  woGrLibrary = 05;


739  woOracle = 06;


740  woSun = 07;


741  woLeo = 08;


742  woMagellan = 09;


743  woMich = 10; { 11; }


744  woNewton = 12;


745  woBach = 13;


746  { 14; } woLiberty = 15;


747  woEiffel = 16;


748  woHoover = 17;


749  woShinkansen = 18;


750  woManhattan = 19;


751  woMir = 20;


752 


753  { city improvements }


754  imTrGoods = 28;


755  imBarracks = 29;


756  imGranary = 30;


757  imTemple = 31;


758  imMarket = 32;


759  imLibrary = 33;


760  imCourt = 34;


761  imWalls = 35;


762  imAqueduct = 36;


763  imBank = 37;


764  imCathedral = 38;


765  imUniversity = 39;


766  imHarbor = 40;


767  imTheater = 41;


768  imFactory = 42;


769  imMfgPlant = 43;


770  imRecycling = 44;


771  imPower = 45;


772  imHydro = 46;


773  imNuclear = 47;


774  imPlatform = 48;


775  imTownHall = 49;


776  imSewer = 50;


777  imSupermarket = 51;


778  imHighways = 52;


779  imResLab = 53;


780  imMissileBat = 54;


781  imCoastalFort = 55;


782  imAirport = 56;


783  imDockyard = 57;


784  imPalace = 58;


785  imGrWall = 59;


786  imColosseum = 60;


787  imObservatory = 61;


788  imMilAcademy = 62;


789  imBunker = 63;


790  imAlgae = 64;


791  imStockEx = 65;


792  imSpacePort = 66;


793  imShipComp = 67;


794  imShipPow = 68;


795  imShipHab = 69;


796 


797  SettlerFood: array [0 .. nGov  1] of Integer = (1, 1, 1, 2, 1, 2, 2, 2);


798  CorrLevel: array [0 .. nGov  1] of Integer = (3, 3, 1, 2, 1, 0, 0, 0);


799  SupportFree: array [0 .. nGov  1] of Integer = (2, 2, 1, 0, 2, 1, 0, 0);


800  // in 1/2*city size


801 


802  // special prerequisite values


803  preNone = 1;


804  preLighthouse = 2;


805  preSun = 3;


806  preLeo = 4;


807  preBuilder = 5;


808  preNA = $FF;


809 


810  JobPreq: array [0 .. nJob  1] of Integer = (preNone, preNone, adRailroad,


811  preNone, preNone, adRefrigeration, preNone, preNone, adExplosives,


812  adExplosives, adConstruction, preNone, adMedicine, preNone, preNone);


813 


814  AdvPreq: array [0 .. nAdv  1, 0 .. 2] of Integer = { advance prerequisites }


815  ((adFlight, adRobotics, preNone), // adAdvancedFlight


816  (adNavigation, adTactics, preNone), // adAmphibiousWarfare


817  (adMysticism, adAlphabet, preNone), // adAstronomy


818  (adTheoryOfGravity, preNone, preNone), // adAtomicTheory


819  (adCombustionEngine, adSteel, preNone), // adAutomobile


820  (adMathematics, adMetallurgy, preNone), // adBallistics


821  (adCurrency, adEngineering, preNone), // adBanking


822  (adConstruction, adWheel, preNone), // adBridgeBuilding


823  (preNone, preNone, preNone), // adBronzeWorking


824  (preNone, preNone, preNone), // adCeremonialBurial


825  (adScience, preNone, preNone), // adChemistry


826  (adMonarchy, adWarriorCode, preNone), // adChivalry


827  (adMetallurgy, adPlastics, preNone), // adComposites


828  (adWriting, preNone, preNone), // adCodeOfLaws


829  (adAdvancedFlight, adMobileWarfare, preNone), // adCombinedArms


830  (adRefining, adExplosives, preNone), // adCombustionEngine


831  (adPhilosophy, adIndustrialization, preNone), // adCommunism


832  (adMin, preNone, preNone), // adComputers


833  (adTheRepublic, adTactics, preNone), // adConscription


834  (adMasonry, adAlphabet, preNone), // adConstruction


835  (adEconomics, adDemocracy, preNone), // adTheCorporation


836  (adAdvancedFlight, adAdvancedRocketry, preNone), // adSpaceFlight


837  (adBronzeWorking, preNone, preNone), // adCurrency


838  (adConscription, adIndustrialization, preNone), // adDemocracy


839  (adBanking, adUniversity, preNone), // adEconomics


840  (adMagnetism, preNone, preNone), // adElectricity


841  (adRadio, adAtomicTheory, preNone), // adElectronics


842  (adConstruction, adBronzeWorking, preNone), // adEngineering


843  (adIndustrialization, preNone, preNone), // adEnvironmentalism


844  (preNone, preNone, preNone), // adWheel


845  (adChemistry, adEngineering, preNone), // adExplosives


846  (adCombustionEngine, adPhysics, preNone), // adFlight


847  (adTactics, adInvention, preNone), // adIntelligence


848  (adMedicine, adIronWorking, preNone), // adGunpowder


849  (preNone, preNone, preNone), // adHorsebackRiding


850  (adSpaceFlight, adNuclearPower, preNone), // adImpulseDrive


851  (adRailroad, adBanking, preNone), // adIndustrialization


852  (adAdvancedRocketry, adTheLaser, preNone), // adIntelligenArms


853  (adWriting, adWheel, preNone), // adInvention


854  (adBronzeWorking, adInvention, preNone), // adIronWorking


855  (adMin, adPhysics, preNone), // adTheLaser


856  (adNuclearFission, preNone, preNone), // adNuclearPower


857  (adPoetry, adTrade, preNone), // adLiterature


858  (adDemocracy, adComputers, preNone), // adLybertarianism


859  (adPhysics, adIronWorking, preNone), // adMagnetism


860  (adAlphabet, preNone, preNone), // adMapMaking


861  (preNone, preNone, preNone), // adMasonry


862  (adAutomobile, adElectronics, adTheCorporation), // adMassProduction


863  (adCurrency, adAlphabet, preNone), // adMathematics


864  (adMysticism, adPottery, preNone), // adMedicine


865  (adGunpowder, preNone, preNone), // adMetallurgy


866  (adRobotics, adPlastics, preNone), // adMin


867  (adAutomobile, adTactics, preNone), // adMobileWarfare


868  (adPolytheism, preNone, preNone), // adMonarchy


869  (adCeremonialBurial, preNone, preNone), // adMysticism


870  (adSeafaring, adAstronomy, preNone), // adNavigation


871  (adAtomicTheory, adMassProduction, preNone), // adNuclearFission


872  (adMathematics, adLiterature, preNone), // adPhilosophy


873  (adScience, preNone, preNone), // adPhysics


874  (adMassProduction, adRefining, preNone), // adPlastics


875  (adMysticism, adWarriorCode, preNone), // adPoetry


876  (preNone, preNone, preNone), // adPottery


877  (adElectricity, adEngineering, preNone), // adRadio


878  (adEnvironmentalism, adPlastics, preNone), // adRecycling


879  (adElectricity, preNone, preNone), // adRefrigeration


880  (adPolytheism, adAstronomy, preNone), // adMonotheism


881  (adLiterature, preNone, preNone), // adTheRepublic


882  (adMassProduction, adEconomics, preNone), // adRobotics


883  (adBallistics, adExplosives, preNone), // adRocketry


884  (adSteamEngine, adBridgeBuilding, preNone), // adRailroad


885  (adEnvironmentalism, adMedicine, preNone), // adSanitation


886  (adMetallurgy, adTheology, adPhilosophy), // adScience


887  (adAlphabet, preNone, preNone), // adWriting


888  (adPottery, adMapMaking, preNone), // adSeafaring


889  (adRecycling, adSyntheticFood, preNone), // adSelfContainedEnvironment


890  (adComposites, adRadio, preNone), // adStealth


891  (adScience, adEngineering, preNone), // adSteamEngine


892  (adIronWorking, adRailroad, preNone), // adSteel


893  (adChemistry, adRefrigeration, preNone), // adSyntheticFood


894  (adWarriorCode, adUniversity, preNone), // adTactics


895  (adMonotheism, adPoetry, preNone), // adTheology


896  (adAstronomy, adPhysics, preNone), // adTheoryOfGravity


897  (adCurrency, adCodeOfLaws, preNone), // adTrade


898  (adImpulseDrive, adSelfContainedEnvironment, preNone),


899  // adTransstellarColonization


900  (adScience, preNone, preNone), // adUniversity


901  (adComputers, adRocketry, preNone), // adAdvancedRocketry


902  (preNone, preNone, preNone), // adWarriorCode


903  (preNone, preNone, preNone), // adAlphabet


904  (adCeremonialBurial, adHorsebackRiding, preNone), // adPolytheism


905  (adChemistry, preNone, preNone), // adRefining


906  (adComputers, preNone, preNone), // futResearchTechnology


907  (adRobotics, preNone, preNone), // futProductionTechnology


908  (adComposites, preNone, preNone), // futArmorTechnology


909  (adSmartWeapons, preNone, preNone)); // futMissileTechnology


910 


911  Imp: array [0 .. nImp  1] of // city improvements


912  record


913  Kind: Integer;


914  Preq: Integer;


915  Cost: Integer;


916  Maint: Integer;


917  Expiration: integer;


918  end


919  = ((Kind: ikWonder; Preq: adMathematics; Cost: 400; Maint: 0;


920  Expiration: adDemocracy), // woPyramids


921  (Kind: ikWonder; Preq: adPolytheism; Cost: 200; Maint: 0;


922  Expiration: adElectronics), // woZeus


923  (Kind: ikWonder; Preq: adInvention; Cost: 200; Maint: 0;


924  Expiration: adNuclearFission), // woGardens


925  (Kind: ikWonder; Preq: adBronzeWorking; Cost: 200; Maint: 0; Expiration:  1),


926  // woColossus


927  (Kind: ikWonder; Preq: adMapMaking; Cost: 200; Maint: 0; Expiration: adSteel),


928  // woLighthouse


929  (Kind: ikWonder; Preq: adLiterature; Cost: 400; Maint: 0;


930  Expiration: adPlastics), // woGrLibrary


931  (Kind: ikWonder; Preq: adMysticism; Cost: 200; Maint: 0; Expiration:  1),


932  // woOracle


933  (Kind: ikWonder; Preq: adChivalry; Cost: 300; Maint: 0;


934  Expiration: adSpaceFlight), // woSun


935  (Kind: ikWonder; Preq: adPhilosophy; Cost: 500; Maint: 0; Expiration:  1),


936  // woLeo


937  (Kind: ikWonder; Preq: adNavigation; Cost: 300; Maint: 0; Expiration:  1),


938  // woMagellan


939  (Kind: ikWonder; Preq: adMonotheism; Cost: 400; Maint: 0; Expiration:  1),


940  // woMich


941  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {11}


942  (Kind: ikWonder; Preq: adTheoryOfGravity; Cost: 400; Maint: 0; Expiration:  1), // woNewton


943  (Kind: ikWonder; Preq: adTheology; Cost: 400; Maint: 0; Expiration:  1),


944  // woBach


945  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {14}


946  (Kind: ikWonder; Preq: adDemocracy; Cost: 500; Maint: 0; Expiration:  1),


947  // woLiberty


948  (Kind: ikWonder; Preq: adSteel; Cost: 800; Maint: 0; Expiration:  1),


949  // woEiffel


950  (Kind: ikWonder; Preq: adElectronics; Cost: 800; Maint: 0; Expiration:  1),


951  // woHoover


952  (Kind: ikWonder; Preq: adPlastics; Cost: 500; Maint: 0; Expiration:  1),


953  // woShinkansen


954  (Kind: ikWonder; Preq: adNuclearFission; Cost: 400; Maint: 0;


955  Expiration:  1), // woManhattan


956  (Kind: ikWonder; Preq: adSpaceFlight; Cost: 800; Maint: 0; Expiration:  1),


957  // woMir


958  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {21}


959  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {22}


960  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {23}


961  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {24}


962  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {25}


963  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {26}


964  (Kind: ikNA; Preq: preNA; Cost: 0; Maint: 0; Expiration: 0), // {27}


965  (Kind: ikTrGoods; Preq: preNone; Cost: 0; Maint: 0; Expiration: 0), // imTrGoods


966  (Kind: ikCommon; Preq: adWarriorCode; Cost: 40; Maint: 1; Expiration: 0), // imBarracks


967  (Kind: ikCommon; Preq: adPottery; Cost: 60; Maint: 1; Expiration: 0), // imGranary


968  (Kind: ikCommon; Preq: adCeremonialBurial; Cost: 40; Maint: 1; Expiration: 0), // imTemple


969  (Kind: ikCommon; Preq: adCurrency; Cost: 60; Maint: 1; Expiration: 0), // imMarket


970  (Kind: ikCommon; Preq: adWriting; Cost: 80; Maint: 3; Expiration: 0), // imLibrary


971  (Kind: ikCommon; Preq: adCodeOfLaws; Cost: 80; Maint: 2; Expiration: 0), // imCourt


972  (Kind: ikCommon; Preq: adMasonry; Cost: 80; Maint: 1; Expiration: 0), // imWalls


973  (Kind: ikCommon; Preq: adConstruction; Cost: 80; Maint: 1; Expiration: 0), // imAqueduct


974  (Kind: ikCommon; Preq: adBanking; Cost: 120; Maint: 2; Expiration: 0), // imBank


975  (Kind: ikCommon; Preq: adMonotheism; Cost: 100; Maint: 1; Expiration: 0), // imCathedral


976  (Kind: ikCommon; Preq: adUniversity; Cost: 160; Maint: 5; Expiration: 0), // imUniversity


977  (Kind: ikCommon; Preq: adSeafaring; Cost: 60; Maint: 1; Expiration: 0), // imHarbor


978  (Kind: ikCommon; Preq: adPoetry; Cost: 60; Maint: 2; Expiration: 0), // imTheater


979  (Kind: ikCommon; Preq: adIndustrialization; Cost: 200; Maint: 3; Expiration: 0), // imFactory


980  (Kind: ikCommon; Preq: adRobotics; Cost: 320; Maint: 5; Expiration: 0), // imMfgPlant


981  (Kind: ikCommon; Preq: adRecycling; Cost: 320; Maint: 4; Expiration: 0), // imRecycling


982  (Kind: ikCommon; Preq: adElectricity; Cost: 120; Maint: 2; Expiration: 0), // imPower


983  (Kind: ikCommon; Preq: adEnvironmentalism; Cost: 120; Maint: 1; Expiration: 0), // imHydro


984  (Kind: ikCommon; Preq: adNuclearPower; Cost: 240; Maint: 2; Expiration: 0), // imNuclear


985  (Kind: ikCommon; Preq: adRefining; Cost: 160; Maint: 2; Expiration: 0), // imPlatform


986  (Kind: ikCommon; Preq: preNone; Cost: 40; Maint: 1; Expiration: 0), // imTownHall


987  (Kind: ikCommon; Preq: adSanitation; Cost: 120; Maint: 2; Expiration: 0), // imSewer


988  (Kind: ikCommon; Preq: adRefrigeration; Cost: 80; Maint: 2; Expiration: 0), // imSupermarket


989  (Kind: ikCommon; Preq: adAutomobile; Cost: 160; Maint: 4; Expiration: 0), // imHighways


990  (Kind: ikCommon; Preq: adComputers; Cost: 240; Maint: 7; Expiration: 0), // imResLab


991  (Kind: ikCommon; Preq: adAdvancedRocketry; Cost: 100; Maint: 1; Expiration: 0),


992  // imMissileBat


993  (Kind: ikCommon; Preq: adMetallurgy; Cost: 80; Maint: 1; Expiration: 0), // imCoastalFort


994  (Kind: ikCommon; Preq: adAdvancedFlight; Cost: 160; Maint: 1; Expiration: 0), // imAirport


995  (Kind: ikCommon; Preq: adAmphibiousWarfare; Cost: 80; Maint: 1; Expiration: 0), // imDockyard


996  (Kind: ikNatLocal; Preq: preNone; Cost: 100; Maint: 0; Expiration: 0), // imPalace


997  (Kind: ikNatLocal; Preq: adEngineering; Cost: 400; Maint: 4; Expiration: 0), // imGrWall


998  (Kind: ikNatLocal; Preq: adConstruction; Cost: 200; Maint: 4; Expiration: 0), // imColosseum


999  (Kind: ikNatLocal; Preq: adAstronomy; Cost: 300; Maint: 4; Expiration: 0), // imObservatory


1000  (Kind: ikNatLocal; Preq: adTactics; Cost: 100; Maint: 4; Expiration: 0), // imMilAcademy


1001  (Kind: ikNatLocal; Preq: adSteel; Cost: 200; Maint: 2; Expiration: 0), // imBunker


1002  (Kind: ikNatLocal; Preq: adSyntheticFood; Cost: 120; Maint: 2; Expiration: 0), // imAlgae


1003  (Kind: ikNatGlobal; Preq: adTheCorporation; Cost: 320; Maint: 4; Expiration: 0), // imStockEx


1004  (Kind: ikNatLocal; Preq: adSpaceFlight; Cost: 400; Maint: 0; Expiration: 0), // imSpacePort


1005  (Kind: ikShipPart; Preq: adTransstellarColonization; Cost: 240; Maint: 0; Expiration: 0),


1006  // imShipComp


1007  (Kind: ikShipPart; Preq: adImpulseDrive; Cost: 600; Maint: 0; Expiration: 0), // imShipPow


1008  (Kind: ikShipPart; Preq: adSelfContainedEnvironment; Cost: 800; Maint: 0; Expiration: 0));


1009  // imShipHab


1010 


1011  nImpReplacement = 5;


1012  ImpReplacement: array [0 .. nImpReplacement  1] of record


1013  NewImp: Integer;


1014  OldImp: Integer;


1015  end


1016  = ((NewImp: imSewer; OldImp: imAqueduct), (NewImp: imCourt; OldImp: imTownHall),


1017  (NewImp: imPalace; OldImp: imTownHall), (NewImp: imPalace; OldImp: imCourt),


1018  (NewImp: imMilAcademy; OldImp: imBarracks));


1019 


1020  // colony ship


1021  nShipPart = 3;


1022  spComp = 0;


1023  spPow = 1;


1024  spHab = 2;


1025  ShipNeed: array [0 .. nShipPart  1] of Integer = (6, 4, 2);


1026  ShipImpIndex: array [0 .. nShipPart  1] of Integer = (imShipComp, imShipPow, imShipHab);


1027 


1028  GovPreq: array [1 .. nGov  1] of Integer = { government prerequisites }


1029  (preNone, adMonarchy, adTheRepublic, adTheology, adCommunism, adDemocracy,


1030  adInternet);


1031 


1032  AgePreq: array [1 .. 3] of Integer = (adScience, adMassProduction,


1033  adTransstellarColonization);


1034 


1035  Terrain: array [0 .. 11] of record


1036  MoveCost: Integer;


1037  Defense: Integer;


1038  ClearTerrain: Integer;


1039  IrrEff: Integer;


1040  IrrClearWork: Integer;


1041  AfforestTerrain: Integer;


1042  MineEff: Integer;


1043  MineAfforestWork: Integer;


1044  TransTerrain: Integer;


1045  TransWork: Integer;


1046  FoodRes: array [0 .. 2] of Integer;


1047  ProdRes: array [0 .. 2] of Integer;


1048  TradeRes: array [0 .. 2] of Integer;


1049  Filler: array [0 .. 12] of Integer;


1050  end


1051  = ((MoveCost: 1; Defense: 4; ClearTerrain:  1; IrrEff: 0; IrrClearWork: 0;


1052  AfforestTerrain:  1; MineEff: 0; MineAfforestWork: 0; TransTerrain:  1;


1053  TransWork: 0; FoodRes: (0, 0, 0); ProdRes: (0, 0, 0);


1054  TradeRes: (0, 0, 0); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Ocn }


1055  (MoveCost: 1; Defense: 4; ClearTerrain:  1; IrrEff: 0; IrrClearWork: 0;


1056  AfforestTerrain:  1; MineEff: 0; MineAfforestWork: 0; TransTerrain:  1;


1057  TransWork: 0; FoodRes: (1, 5, 1); ProdRes: (0, 0, 5);


1058  TradeRes: (3, 3, 3); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Sho }


1059  (MoveCost: 1; Defense: 4; ClearTerrain:  1; IrrEff: 1; IrrClearWork: 600;


1060  AfforestTerrain: fForest; MineEff: 0; MineAfforestWork: 1800;


1061  TransTerrain: fHills; TransWork: 3000; FoodRes: (3, 2, 2); ProdRes: (0, 1, 0);


1062  TradeRes: (1, 1, 1); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Gra }


1063  (MoveCost: 1; Defense: 4; ClearTerrain: fGrass; IrrEff: 0; IrrClearWork: 1800;


1064  AfforestTerrain:  1; MineEff: 1; MineAfforestWork: 600;


1065  TransTerrain: fPrairie; TransWork: 3000; FoodRes: (0, 3, 0);


1066  ProdRes: (1, 1, 4); TradeRes: (1, 1, 1); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Dst }


1067  (MoveCost: 1; Defense: 4; ClearTerrain:  1; IrrEff: 1; IrrClearWork: 600;


1068  AfforestTerrain: fForest; MineEff: 0; MineAfforestWork: 2400;


1069  TransTerrain:  1; TransWork: 0; FoodRes: (1, 3, 1); ProdRes: (1, 1, 3);


1070  TradeRes: (1, 1, 1); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Pra }


1071  (MoveCost: 1; Defense: 4; ClearTerrain:  1; IrrEff: 1; IrrClearWork: 600;


1072  AfforestTerrain:  1; MineEff: 0; MineAfforestWork: 0; TransTerrain: fGrass;


1073  TransWork: 3000; FoodRes: (1, 1, 1); ProdRes: (0, 0, 4);


1074  TradeRes: (1, 6, 1); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Tun }


1075  (MoveCost: 2; Defense: 4; ClearTerrain:  1; IrrEff: 0; IrrClearWork: 0;


1076  AfforestTerrain:  1; MineEff: 3; MineAfforestWork: 1800; TransTerrain:  1;


1077  TransWork: 0; FoodRes: (0, 3, 0); ProdRes: (1, 1, 0);


1078  TradeRes: (0, 4, 0); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Arc }


1079  (MoveCost: 2; Defense: 6; ClearTerrain: fGrass; IrrEff: 0; IrrClearWork: 2400;


1080  AfforestTerrain: fForest; MineEff: 0; MineAfforestWork: 2400;


1081  TransTerrain: fHills; TransWork: 3000; FoodRes: (1, 1, 1); ProdRes: (0, 4, 1);


1082  TradeRes: (1, 1, 5); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Swa }


1083  (MoveCost: 0; Defense: 0; ClearTerrain: 0; IrrEff: 0;


1084  IrrClearWork: 0; AfforestTerrain: 0; MineEff: 0; MineAfforestWork: 0;


1085  TransTerrain: 0; TransWork: 0; FoodRes: (0, 0, 0); ProdRes: (0, 0, 0);


1086  TradeRes: (0, 0, 0); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), {  }


1087  (MoveCost: 2; Defense: 6; ClearTerrain: fPrairie; IrrEff: 0;


1088  IrrClearWork: 600; AfforestTerrain:  1; MineEff: 0; MineAfforestWork: 0;


1089  TransTerrain:  1; TransWork: 0; FoodRes: (1, 3, 1); ProdRes: (2, 2, 2);


1090  TradeRes: (1, 1, 4); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { For }


1091  (MoveCost: 2; Defense: 8; ClearTerrain:  1; IrrEff: 1; IrrClearWork: 600;


1092  AfforestTerrain:  1; MineEff: 3; MineAfforestWork: 1200;


1093  TransTerrain: fGrass; TransWork: 6000; FoodRes: (1, 1, 1); ProdRes: (0, 0, 2);


1094  TradeRes: (0, 4, 0); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Hil }


1095  (MoveCost: 3; Defense: 12; ClearTerrain:  1; IrrEff: 0; IrrClearWork: 0;


1096  AfforestTerrain:  1; MineEff: 2; MineAfforestWork: 1200; TransTerrain:  1;


1097  TransWork: 0; FoodRes: (0, 0, 0); ProdRes: (1, 4, 1);


1098  TradeRes: (0, 0, 7); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); { Mou }


1099 


1100  // settler work required MP


1101  PillageWork = 100;


1102  CityWork = 900;


1103  FarmWork = 3; // *IrrClearWork


1104  RoadWork = 300; // *MoveCost


1105  RoadBridgeWork = 900;


1106  RRWork = 600; // *MoveCost


1107  RRBridgeWork = 900;


1108  CanalWork = 1800;


1109  FortWork = 600; // *MoveCost


1110  BaseWork = 600; // *MoveCost


1111  PollWork = 1800;


1112 


1113  // upgrades for new unit models


1114  // upgrade[domain,0].preq is domain precondition advance


1115  // cost values accumulate if prerequisite is future tech / are maximized if not


1116  nUpgrade = 15;


1117  upgrade: array [0 .. nDomains  1, 0 .. nUpgrade  1] of record


1118  Preq: Integer;


1119  Strength: Integer;


1120  Trans: Integer;


1121  Cost: integer;


1122  end


1123  = (((Preq: adWarriorCode; Strength: 4; Trans: 0; Cost: 3),


1124  (Preq: adBronzeWorking; Strength: 2; Trans: 0; Cost: 4),


1125  (Preq: adIronWorking; Strength: 2; Trans: 0; Cost: 5),


1126  (Preq: adChivalry; Strength: 2; Trans: 0; Cost: 5),


1127  (Preq: adMonotheism; Strength: 3; Trans: 0; Cost: 7),


1128  (Preq: adGunpowder; Strength: 3; Trans: 0; Cost: 8),


1129  (Preq: adExplosives; Strength: 4; Trans: 0; Cost: 9),


1130  (Preq: adTactics; Strength: 5; Trans: 0; Cost: 10),


1131  (Preq: adRadio; Strength: 6; Trans: 0; Cost: 11),


1132  (Preq: adDemocracy; Strength: 6; Trans: 0; Cost: 5),


1133  (Preq: adMobileWarfare; Strength: 7; Trans: 0; Cost: 12),


1134  (Preq: adRobotics; Strength: 8; Trans: 0; Cost: 15),


1135  (Preq: adComposites; Strength: 8; Trans: 0; Cost: 15),


1136  (Preq: adTheLaser; Strength: 8; Trans: 0; Cost: 14),


1137  (Preq: futMaterialTechnology; Strength: 10; Trans: 0; Cost: 2)),


1138  ((Preq: adMapMaking; Strength: 4; Trans: 1; Cost: 8),


1139  (Preq: adNavigation; Strength: 4; Trans: 0; Cost: 10),


1140  (Preq: adEngineering; Strength: 0; Trans: 1; Cost: 8),


1141  (Preq: adGunpowder; Strength: 8; Trans: 0; Cost: 12),


1142  (Preq: adMagnetism; Strength: 12; Trans: 1; Cost: 20),


1143  (Preq: adExplosives; Strength: 16; Trans: 0; Cost: 24),


1144  (Preq: adSteamEngine; Strength: 24; Trans: 0; Cost: 28),


1145  (Preq: adAmphibiousWarfare; Strength: 24; Trans: 1; Cost: 18),


1146  (Preq: adAdvancedRocketry; Strength: 32; Trans: 0; Cost: 38),


1147  (Preq: futMaterialTechnology; Strength: 14; Trans: 0; Cost: 4),


1148  (Preq: futArtificialIntelligence; Strength: 14; Trans: 0; Cost: 4),


1149  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1150  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1151  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1152  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0)),


1153  ((Preq: adFlight; Strength: 12; Trans: 1; Cost: 14),


1154  (Preq: adTactics; Strength: 6; Trans: 0; Cost: 17),


1155  (Preq: adElectronics; Strength: 6; Trans: 0; Cost: 20),


1156  (Preq: adMin; Strength: 8; Trans: 0; Cost: 24),


1157  (Preq: adComposites; Strength: 8; Trans: 0; Cost: 26),


1158  (Preq: adSmartWeapons; Strength: 11; Trans: 0; Cost: 32),


1159  (Preq: futArtificialIntelligence; Strength: 7; Trans: 0; Cost: 4),


1160  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1161  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1162  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1163  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1164  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1165  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1166  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0),


1167  (Preq: preNA; Strength: 0; Trans: 0; Cost: 0)));


1168 


1169  { model features }


1170  nFeature = 27;


1171  mcWeapons = 0;


1172  mcArmor = 1;


1173  mcMob = 2;


1174  mcSeaTrans = 3;


1175  mcCarrier = 4;


1176  mcTurbines = 5;


1177  mcBombs = 6;


1178  mcFuel = 7;


1179  mcAirTrans = 8;


1180  mcNav = 9;


1181  mcRadar = 10;


1182  mcSub = 11;


1183  mcArtillery = 12;


1184  mcAlpine = 13;


1185  mcSupplyShip = 14;


1186  mcOver = 15;


1187  mcAirDef = 16;


1188  mcSpy = 17;


1189  mcSE = 18;


1190  mcNP = 19;


1191  mcJet = 20;


1192  mcStealth = 21;


1193  mcFanatic = 22;


1194  mcFirst = 23;


1195  mcWill = 24;


1196  mcAcademy = 25;


1197  mcLine = 26;


1198  mcFirstNonCap = mcNav;


1199  AutoFeature: set of mcFirstNonCap .. nFeature  1 = [mcNav, mcSE, mcNP, mcJet,


1200  mcAcademy];


1201  // unit class advances, automatically applied if available


1202 


1203  Feature: array [0 .. nFeature  1] of { unit model features }


1204  record


1205  Domains: Integer;


1206  Preq: Integer;


1207  Weight: Integer;


1208  Cost: Integer;


1209  end


1210  = ((Domains: 7; Preq: preNone; Weight: 1; Cost: 1), { mcOffense }


1211  (Domains: 7; Preq: preNone; Weight: 1; Cost: 1), { mcDefense }


1212  (Domains: 1; Preq: adHorsebackRiding; Weight: 1; Cost: 1), { mcMob }


1213  (Domains: 2; Preq: preNone; Weight: 2; Cost: 1), { mcSeaTrans }


1214  (Domains: 2; Preq: adAdvancedFlight; Weight: 2; Cost: 2), { mcCarrier }


1215  (Domains: 2; Preq: adPhysics; Weight: 3; Cost: 1), { mcTurbines }


1216  (Domains: 4; Preq: adAdvancedFlight; Weight: 1; Cost: 1), { mcBombs }


1217  (Domains: 4; Preq: preNone; Weight: 1; Cost: 1), { mcFuel }


1218  (Domains: 4; Preq: adCombinedArms; Weight: 2; Cost: 1), { mcAirTrans }


1219  (Domains: 2; Preq: adNavigation; Weight: 0; Cost: 0), { mcNav }


1220  (Domains: 2; Preq: adRadio; Weight: 0; Cost: 1), { mcRadar }


1221  (Domains: 2; Preq: adCombustionEngine; Weight: 2; Cost: 1), { mcSub }


1222  (Domains: 3; Preq: adBallistics; Weight: 1; Cost: 1), { mcArtillery }


1223  (Domains: 1; Preq: adTactics; Weight: 2; Cost: 1), { mcAlpine }


1224  (Domains: 2; Preq: adMedicine; Weight: 1; Cost: 1), { mcSupplyShip }


1225  (Domains: 1; Preq: adBridgeBuilding; Weight: 0; Cost: 2), { mcOver }


1226  (Domains: 2; Preq: adAdvancedRocketry; Weight: 1; Cost: 1), { mcAirDef }


1227  (Domains: 4; Preq: adIntelligence; Weight: 2; Cost: 1), { mcSpy }


1228  (Domains: 2; Preq: adSteamEngine; Weight: 0; Cost: 0), { mcSE }


1229  (Domains: 2; Preq: adNuclearPower; Weight: 0; Cost: 0), { mcNP }


1230  (Domains: 4; Preq: adRocketry; Weight: 0; Cost: 0), { mcJet }


1231  (Domains: 4; Preq: adStealth; Weight: 1; Cost: 2), { mcStealth }


1232  (Domains: 5; Preq: adCommunism; Weight: 0; Cost: 1), { mcFanatic }


1233  (Domains: 1; Preq: preSun; Weight: 0; Cost: 1), { mcFirst }


1234  (Domains: 1; Preq: preSun; Weight: 0; Cost: 1), { mcWill }


1235  (Domains: 1; Preq: preSun; Weight: 0; Cost: 0), { mcAcademy }


1236  (Domains: 7; Preq: adMassProduction; Weight: 0; Cost: 0)); { mcLine }


1237 


1238  WeightPreq7: array [0 .. nDomains  1] of Integer = (adHorsebackRiding, adSeafaring,


1239  adAdvancedFlight);


1240  WeightPreq10: array [0 .. nDomains  1] of Integer = (adAutomobile, adSteel, preNA);


1241 


1242  INFIN = 999999;


1243 


1244  // for backward compatibility


1245  fRare = fDeadLands;


1246  fRare1 = fCobalt;


1247  fRare2 = fUranium;


1248  mkCaravan = mkFreight;


1249  mkDiplomat = mkCommando;


1250  gLybertarianism = gFuture;


1251  trCeaseFire = 1;


1252  adIntelligenArms = adSmartWeapons;


1253  adIntelligentArms = adSmartWeapons;


1254  adRadioCommunication = adRadio;


1255  adLybertarianism = adInternet;


1256  futResearchTechnology = futComputingTechnology;


1257  futProductionTechnology = futNanoTechnology;


1258  futArmorTechnology = futMaterialTechnology;


1259  futMissileTechnology = futArtificialIntelligence;


1260  imNatObs = imObservatory;


1261  imElite = imMilAcademy;


1262  mcOffense = mcWeapons;


1263  mcDefense = mcArmor;


1264  mcLongRange = mcArtillery;


1265  mcHospital = mcSupplyShip;


1266 


1267  // Wonders CityID constants


1268  WonderNotBuiltYet = 1;


1269  WonderDestroyed = 2;


1270 


1271  type


1272  TServerCall = function (Command, Player, Subject: Integer; var Data)


1273  : Integer; stdcall;


1274  TClientCall = procedure (Command, Player: Integer; var Data); stdcall;


1275 


1276  TUn = packed record


1277  Loc: LongInt; { location }


1278  Status: LongInt; // free for AI use


1279  SavedStatus: LongInt; // for server internal use only


1280  ID: Word; // unit number, never changes, unique within this nation


1281  mix: SmallInt; { model index }


1282  Home: SmallInt; { home city index, 1 if none }


1283  Master: SmallInt; { index of transporting unit, 1 if none }


1284  Movement: SmallInt; { movement left for this turn }


1285  Health: ShortInt; // = 100Damage


1286  Fuel: ShortInt;


1287  Job: Byte; { current terrain improvement job }


1288  Exp: Byte; { micro experience, the level is Exp div ExpCost }


1289  TroopLoad: Byte; { number of transported ground units }


1290  AirLoad: Byte; // number of transported air units


1291  Flags: Cardinal;


1292  end;


1293  PUn = ^TUn;


1294 


1295  { TCity }


1296 


1297  TCity = packed record


1298  Loc: LongInt; { location }


1299  Status: LongInt; // free for AI use


1300  SavedStatus: LongInt; // for server internal use only


1301  ID: Word; // founding player shl 12 + number, never changes, unique within the whole game


1302  Size: Word;


1303  Project: SmallInt; // current production project, see city project flags


1304  Project0: SmallInt; // for server use only


1305  Food: SmallInt; // collected food in storage


1306  Pollution: SmallInt; // collected pollution in dump


1307  Prod: SmallInt; // for project collected production points


1308  Prod0: SmallInt;


1309  // for project collected production points in the beginning of the turn


1310  Flags: Cardinal; // what happened within the last turnaround


1311  Tiles: Cardinal; { currently by city exploited tiles, bitset with index


1312  (dy+3) shl 2+(dx+3) shr 1, (dx,dy) relative to central tile }


1313  N1: Cardinal; // reserved for future use


1314  Built: array [0 .. (nImp + 3) div 4 * 4  1] of ShortInt;


1315  // array value =1 indicates built improvement


1316  end;


1317  PCity = ^TCity;


1318 


1319  TModel = packed record


1320  Status: LongInt; // free for AI use


1321  SavedStatus: LongInt; // for server internal use only


1322  ID: Word; // developing player shl 12 + number, never changes, unique within the whole game


1323  IntroTurn: Word;


1324  Built: Word; // units built with this model


1325  Lost: Word; // units of this model lost in combat


1326  Kind: Byte;


1327  Domain: Byte;


1328  Attack: Word;


1329  Defense: Word;


1330  Speed: Word;


1331  Cost: Word;


1332  MStrength: Word;


1333  // construction time multipliers, only valid if kind is mkSelfDeveloped or mkEnemyDeveloped


1334  MTrans: Byte;


1335  MCost: Byte;


1336  Weight: Byte;


1337  MaxWeight: Byte;


1338  // weight and maximum weight (construction time)


1339  Upgrades: Cardinal; // bitarray indicating all upgrades


1340  Flags: Cardinal;


1341  Cap: array [0 .. (nFeature + 3) div 4 * 4  1] of Byte; // special features


1342  end;


1343 


1344  TUnitInfo = packed record


1345  Loc: LongInt;


1346  mix: Word; // index of unit model for its owner


1347  emix: Word; // index in enemy model list


1348  Owner: Byte;


1349  Health: ShortInt; // = 100Damage


1350  Fuel: ShortInt;


1351  Job: Byte; // current terrain improvement job


1352  Exp: Byte; { micro experience, the level is Exp div ExpCost }


1353  Load: Byte; { number of transported units }


1354  Flags: Word;


1355  end;


1356  PUnitInfo = ^TUnitInfo;


1357 


1358  TCityInfo = packed record


1359  Loc: LongInt;


1360  Status: LongInt; // free for AI use


1361  SavedStatus: LongInt; // for server internal use only


1362  Owner: Word; // last known owner, even if not alive anymore!


1363  ID: Word; // founding player <<12 + number, never changes, unique within the whole game


1364  Size: Word;


1365  Flags: Word;


1366  end;


1367  PCityInfo = ^TCityInfo;


1368 


1369  TModelInfo = packed record


1370  Owner: Word; // Player which owns the model


1371  mix: Word; // index of unit model for its owner


1372  ID: Word; // developing player shl 12 + number, never changes, unique within the whole game


1373  Kind: Byte;


1374  Domain: Byte;


1375  Attack: Word;


1376  Defense: Word;


1377  Speed: Word;


1378  Cost: Word;


1379  TTrans: Byte; // ground unit transport capability


1380  ATrans_Fuel: Byte; // air unit transport capability resp. fuel


1381  Bombs: Word; // additional attack with bombs


1382  Cap: Cardinal; // special features, bitset with index FeaturemcFirstNonCap


1383  MaxUpgrade: Byte; // maximum used upgrade


1384  Weight: Byte;


1385  Lost: Word;


1386  end;


1387 


1388  TBattle = packed record


1389  Enemy: Byte;


1390  Flags: Byte;


1391  Turn: Word;


1392  mix: Word;


1393  mixEnemy: Word;


1394  ToLoc: Integer;


1395  FromLoc: Integer;


1396  end;


1397 


1398  TWonderInfo = record


1399  CityID: Integer; // 2 if destroyed, 1 if never completed, >=0 ID of city


1400  EffectiveOwner: Integer;


1401  // owning player if effective, 1 if expired or not built


1402  end;


1403 


1404  TShipInfo = record


1405  Parts: array [0 .. nShipPart  1] of Integer;


1406  end;


1407 


1408  TEnemyReport = record


1409  TurnOfContact: Integer;


1410  TurnOfCivilReport: Integer;


1411  TurnOfMilReport: Integer;


1412  Attitude: Integer;


1413  Credibility: Integer; // 0..100, last update: ToC


1414  Treaty: array [0 .. nPl  1] of Integer;


1415  // diplomatic status with other nations, last update: ToCR


1416  Government: Integer; // gAnarchy..gDemocracy, last update: ToCR


1417  Money: Integer; // last update: ToCR


1418  ResearchTech: Integer; // last update: ToCR


1419  ResearchDone: Integer; // last update: ToCR


1420  Tech: array [0 .. (nAdv + 3) div 4 * 4  1] of ShortInt;


1421  // tech status indicator, last update: ToCR


1422  nModelCounted: Integer;


1423  // number of models with info in UnCount, last update: ToMR


1424  UnCount: array [0 .. INFIN] of Word;


1425  // number of available units for each model, last update: ToMR


1426  end;


1427 


1428  TMoveAdviceData = record


1429  ToLoc: Integer;


1430  nStep: Integer;


1431  MoreTurns: Integer;


1432  MaxHostile_MovementLeft: Integer;


1433  dx: array [0 .. 24] of Integer;


1434  dy: array [0 .. 24] of Integer;


1435  end;


1436 


1437  TPlaneReturnData = record


1438  Loc: Integer;


1439  Fuel: Integer;


1440  Movement: Integer;


1441  end;


1442 


1443  TTileInfo = record


1444  Food: Integer;


1445  Prod: Integer;


1446  Trade: Integer;


1447  ExplCity: Integer;


1448  end;


1449 


1450  TCityReport = record


1451  HypoTiles: Integer;


1452  HypoTax: Integer;


1453  HypoLux: Integer;


1454  Working: Integer;


1455  Happy: Integer;


1456  FoodRep: Integer;


1457  ProdRep: Integer;


1458  Trade: Integer;


1459  PollRep: Integer;


1460  Corruption: Integer;


1461  Tax: Integer;


1462  Lux: Integer;


1463  Science: Integer;


1464  Support: Integer;


1465  Eaten: Integer;


1466  ProdCost: Integer;


1467  Storage: Integer;


1468  Deployed: Integer;


1469  end;


1470 


1471  TCityReportNew = record


1472  HypoTiles: Integer;


1473  // tiles that should be considered as exploited (for the current adjustment, set this to 1 or to TCity.Tiles of the city)


1474  HypoTaxRate: Integer;


1475  HypoLuxuryRate: Integer;


1476  // tax and luxury rate that should be assumed (for current rates, set this to 1 or to RO.TaxRate resp. RO.LuxRate)


1477  Morale: Integer;


1478  FoodSupport: Integer;


1479  MaterialSupport: Integer;


1480  // food and material taken for unit support


1481  ProjectCost: Integer; // material cost of current project


1482  Storage: Integer; // size of food storage


1483  Deployed: Integer; // number of units causing unrest (unrest=2*deployed)


1484  CollectedControl: Integer;


1485  CollectedFood: Integer;


1486  CollectedMaterial: Integer;


1487  CollectedTrade: Integer;


1488  // raw control, food, material and trade as collected by the citizens


1489  Working: Integer; // number of exploited tiles including city tile


1490  FoodSurplus: Integer;


1491  Production: Integer;


1492  AddPollution: Integer;


1493  // food surplus, production gain and pollution after all effects


1494  Corruption: Integer;


1495  Tax: Integer;


1496  Science: Integer;


1497  Luxury: Integer;


1498  // corruption, tax, science and wealth after all effects


1499  HappinessBalance: Integer;


1500  // = (Morale+Wealth+Control)  (Size+Unrest), value < 0 means disorder


1501  end;


1502 


1503  TCityTileAdviceData = record


1504  ResourceWeights: Cardinal;


1505  Tiles: Cardinal;


1506  CityReport: TCityReport;


1507  end;


1508 


1509  TGetCityData = record


1510  Owner: Integer;


1511  c: TCity;


1512  end;


1513 


1514  TCityAreaInfo = record


1515  Available: array [0 .. 26] of Integer;


1516  end;


1517 


1518  TUnitReport = record


1519  FoodSupport: Integer;


1520  ProdSupport: Integer;


1521  ReportFlags: Integer;


1522  end;


1523 


1524  TJobProgressData = array [0 .. nJob  1] of record


1525  Required, Done,


1526  NextTurnPlus: Integer;


1527  end;


1528 


1529  TBattleForecast = record


1530  pAtt: Integer;


1531  mixAtt: Integer;


1532  HealthAtt: Integer;


1533  ExpAtt: Integer;


1534  FlagsAtt: Integer;


1535  Movement: Integer;


1536  EndHealthDef: Integer;


1537  EndHealthAtt: Integer;


1538  end;


1539 


1540  TBattleForecastEx = record


1541  pAtt: Integer;


1542  mixAtt: Integer;


1543  HealthAtt: Integer;


1544  ExpAtt: Integer;


1545  FlagsAtt: Integer;


1546  Movement: Integer;


1547  EndHealthDef: Integer;


1548  EndHealthAtt: Integer; // must be same as in TBattleForecast


1549  AStr: Integer;


1550  DStr: Integer;


1551  ABaseDamage: Integer;


1552  DBaseDamage: Integer;


1553  end;


1554 


1555  TShowMove = record


1556  Owner: Integer;


1557  Health: Integer;


1558  mix: Integer;


1559  emix: Integer;


1560  Flags: Integer;


1561  FromLoc: Integer;


1562  dx: Integer;


1563  dy: Integer;


1564  EndHealth: Integer;


1565  EndHealthDef: Integer;


1566  Fuel: Integer;


1567  Exp: Integer;


1568  Load: Integer;


1569  end;


1570 


1571  TShowShipChange = record


1572  Reason: Integer;


1573  Ship1Owner: Integer;


1574  Ship2Owner: Integer;


1575  Ship1Change: array [0 .. nShipPart  1] of Integer;


1576  Ship2Change: array [0 .. nShipPart  1] of Integer;


1577  end;


1578 


1579  TOffer = record


1580  nDeliver: Integer;


1581  nCost: Integer;


1582  Price: array [0 .. 11] of Cardinal;


1583  end;


1584 


1585  TChart = array [0 .. INFIN] of Integer;


1586  TEditTileData = record


1587  Loc: Integer;


1588  NewTile: Integer;


1589  end;


1590  TCreateUnitData = record


1591  Loc: Integer;


1592  p: Integer;


1593  mix: Integer;


1594  end;


1595 


1596  TTileList = array [0 .. INFIN] of Cardinal;


1597  PTileList = ^TTileList;


1598  TTileObservedLastList = array [0 .. INFIN] of SmallInt;


1599  TOwnerList = array [0 .. INFIN] of ShortInt;


1600  TByteList = array [0 .. INFIN] of Byte;


1601  TIntList = array [0 .. INFIN] of integer;


1602  TCityList = array [0 .. INFIN] of TCity;


1603  TUnList = array [0 .. INFIN] of TUn;


1604  TModelList = array [0 .. INFIN] of TModel;


1605  TEnemyUnList = array [0 .. INFIN] of TUnitInfo;


1606  TEnemyCityList = array [0 .. INFIN] of TCityInfo;


1607  TEnemyModelList = array [0 .. INFIN] of TModelInfo;


1608  TBattleList = array [0 .. INFIN] of TBattle;


1609 


1610  TPlayerContext = record


1611  Data: Pointer;


1612  Map: ^TTileList;


1613  { the playground, a list of tiles with index = location, see tile flags }


1614  MapObservedLast: ^TTileObservedLastList;


1615  // turn in which the tile was observed last, index = location


1616  Territory: ^TOwnerList; // nation to which's territory a tile belongs, 1 indicates none


1617  Un: ^TUnList; { units }


1618  City: ^TCityList; { cities }


1619  Model: ^TModelList; { unit models }


1620  EnemyUn: ^TEnemyUnList; // known units of enemy players


1621  EnemyCity: ^TEnemyCityList; // known cities of enemy players


1622  EnemyModel: ^TEnemyModelList; // known unit models of enemy players


1623  EnemyReport: array [0 .. nPl  1] of ^TEnemyReport;


1624 


1625  TestFlags: Integer; // options turned on in the "Manipulation" menu


1626  Turn: Integer; // current turn


1627  Alive: Integer; { bitset of IDs of players still alive, flag 1 shl p for player p }


1628  Happened: Integer; // flags indicate what happened within the last turnaround


1629  AnarchyStart: Integer; // start turn of anarchy, <0 if not in anarchy


1630  Credibility: Integer; // own credibility


1631  MaxCredibility: Integer; // maximum credibility still to achieve


1632  nUn: Integer; { number of units }


1633  nCity: Integer; { number of cities }


1634  nModel: Integer; { number of developed unit models }


1635  nEnemyUn: Integer;


1636  nEnemyCity: Integer;


1637  nEnemyModel: Integer;


1638  Government: Integer; { gAnarchy..gDemocracy }


1639  Money: Integer;


1640  TaxRate: Integer;


1641  LuxRate: Integer;


1642  Research: Integer;


1643  { collected research points for currently researched tech }


1644  ResearchTech: Integer; // currently researched tech


1645  DevModel: TModel; { unit model currently under development }


1646  Tech: array [0 .. (nAdv + 3) div 4 * 4  1] of ShortInt; { tech status indicator }


1647  Attitude: array [0 .. nPl  1] of Integer; // attitude to other nations


1648  Treaty: array [0 .. nPl  1] of Integer; // treaty with other nations


1649  EvaStart: array [0 .. nPl  1] of Integer; // peace treaty: start of evacuation period


1650  Tribute: array [0 .. nPl  1] of Integer; // no longer in use


1651  TributePaid: array [0 .. nPl  1] of Integer; // no longer in use


1652  Wonder: array [0 .. 27] of TWonderInfo;


1653  Ship: array [0 .. nPl  1] of TShipInfo;


1654  NatBuilt: array [28 .. (nImp + 3) div 4 * 4  1] of ShortInt;


1655  nBattleHistory: Integer;


1656  BattleHistory: ^TBattleList; // complete list of all my battles in the whole game


1657  BorderHelper: ^TByteList;


1658  LastCancelTreaty: array [0 .. nPl  1] of Integer; // turn of last treaty cancel


1659  OracleIncome: Integer;


1660  DefaultDebugMap: ^TIntList;


1661  Filler: array [0 .. 879] of Byte;


1662  end;


1663 


1664  TInitModuleData = record


1665  Server: TServerCall;


1666  DataVersion: Integer;


1667  DataSize: Integer;


1668  Flags: Integer;


1669  end;


1670 


1671  TNewGameData = record


1672  lx: Integer;


1673  ly: Integer;


1674  LandMass: Integer;


1675  MaxTurn: Integer;


1676  Difficulty: array [0 .. nPl  1] of Integer;


1677  { difficulty levels of the players, if it's 0 this player is the supervisor,


1678  1 for unused slots }


1679  RO: array [0 .. nPl  1] of ^TPlayerContext;


1680  AssemblyPath: array [0 .. 255] of Char;


1681  SuperVisorRO: array [0 .. nPl  1] of ^TPlayerContext;


1682  end;


1683 


1684  TNewGameExData = record


1685  lx: Integer;


1686  ly: Integer;


1687  LandMass: Integer;


1688  MaxTurn: Integer;


1689  RND: Integer;


1690  Difficulty: array [0 .. nPl  1] of Integer;


1691  { difficulty levels of the players, if it's 0 this player is the supervisor,


1692  1 for unused slots }


1693  Controlled: Integer;


1694  end;


1695 


1696  TShowNegoData = record


1697  pSender: Integer;


1698  pTarget: Integer;


1699  Action: Integer;


1700  Offer: TOffer;


1701  end;


1702 


1703  const


1704  { predefined unit models: }


1705  nSpecialModel = 9;


1706  SpecialModel: array [0 .. nSpecialModel  1] of TModel = ((Status: 0;


1707  SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0; Kind: mkSettler;


1708  Domain: dGround; Attack: 0; Defense: 10; Speed: 150; Cost: 40; MStrength: 0;


1709  MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0; Upgrades: 0; Flags: 0;


1710  Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1711  0, 0, 0, 0, 0)), { Settlers }


1712  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1713  Kind: mkSettler; Domain: dGround; Attack: 0; Defense: 20; Speed: 300;


1714  Cost: 40; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;


1715  Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1716  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Engineers }


1717  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1718  Kind: mkSelfDeveloped; Domain: dGround; Attack: 6; Defense: 6; Speed: 150;


1719  Cost: 10; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;


1720  Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1721  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Militia }


1722  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1723  Kind: mkSpecial_TownGuard; Domain: dGround; Attack: 4; Defense: 6;


1724  Speed: 150; Cost: 20; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0;


1725  MaxWeight: 0; Upgrades: 0; Flags: 0;


1726  Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1727  0, 0, 0, 0, 0)), { Town Guard }


1728  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1729  Kind: mkDiplomat; Domain: dGround; Attack: 12; Defense: 12; Speed: 250;


1730  Cost: 20; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;


1731  Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1732  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Special Commando }


1733  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1734  Kind: mkCaravan; Domain: dGround; Attack: 0; Defense: 6; Speed: 150;


1735  Cost: 60; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;


1736  Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1737  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Freight }


1738  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1739  Kind: mkSpecial_Boat; Domain: dSea; Attack: 0; Defense: 3; Speed: 250;


1740  Cost: 20; MStrength: 0; MTrans: 1; MCost: 0; Weight: 0; MaxWeight: 0;


1741  Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1742  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Longboat }


1743  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1744  Kind: mkSlaves; Domain: dGround; Attack: 0; Defense: 15; Speed: 150;


1745  Cost: 40; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;


1746  Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1747  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Slaves }


1748  { (Status:0;SavedStatus:0;ID:0;IntroTurn:0;Built:0;Lost:0;


1749  Kind:mkSpecial_Carriage;Domain:dGround;Attack:50;Defense:30;Speed:250;Cost:50;


1750  MStrength:0;MTrans:0;MCost:0;Weight:0;MaxWeight:0;Upgrades:0;Flags:0;


1751  Cap:(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)), }


1752  { (Status:0;SavedStatus:0;ID:0;IntroTurn:0;Built:0;Lost:0;


1753  Kind:mkSpecial_SubCabin;Domain:dSea;Attack:16;Defense:1;Speed:350;Cost:40;


1754  MStrength:0;MTrans:0;MCost:0;Weight:0;MaxWeight:0;Upgrades:0;Flags:0;


1755  Cap:(0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)), }


1756  (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;


1757  Kind: mkSpecial_Glider; Domain: dAir; Attack: 6; Defense: 6; Speed: 450;


1758  Cost: 30; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;


1759  Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


1760  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));


1761 


1762  SpecialModelPreq: array [0 .. nSpecialModel  1] of integer = (preNone,


1763  adExplosives, preNone, preNone, (* adWri, *) adIntelligence, adTrade,


1764  (* adTheCorporation,adHorsebackRiding,adAutomobile,adNavigation,


1765  adCombustionEngine, *) adMapMaking, preBuilder,


1766  { preLeo,preLighthouse, } preLeo);


1767 


1768  var


1769  DelphiRandSeed: Integer;


1770 


1771  procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);


1772  procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);


1773  function IsSameModel(const mi1, mi2: TModelInfo): Boolean;


1774  function SpecialTile(Loc, TerrType, lx: Integer): Integer;


1775  function DelphiRandom(const pi_Max: Integer): Integer; overload;


1776  function DelphiRandom: Extended; overload;


1777  procedure DelphiRandomize;


1778 


1779 


1780  implementation


1781 


1782  procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo);


1783  begin


1784  ui.Owner := p;


1785  ui.Loc := u.Loc;


1786  ui.Health := u.Health;


1787  ui.Fuel := u.Fuel;


1788  ui.Job := u.Job;


1789  ui.Exp := u.Exp;


1790  ui.Load := u.TroopLoad + u.AirLoad;


1791  ui.mix := u.mix;


1792  ui.Flags := u.Flags;


1793  end;


1794 


1795  procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo);


1796  var


1797  i: Integer;


1798  begin


1799  mi.Owner := p;


1800  mi.mix := mix;


1801  mi.ID := m.ID;


1802  mi.Domain := m.Domain;


1803  if m.Kind = mkEnemyDeveloped then


1804  mi.Kind := mkSelfDeveloped // important for IsSameModel()


1805  else


1806  mi.Kind := m.Kind;


1807  mi.Attack := m.Attack;


1808  mi.Defense := m.Defense;


1809  mi.Speed := m.Speed;


1810  mi.Cost := m.Cost;


1811  if mi.Domain = dAir then


1812  begin


1813  mi.TTrans := m.Cap[mcAirTrans] * m.MTrans;


1814  mi.ATrans_Fuel := m.Cap[mcFuel];


1815  end


1816  else


1817  begin


1818  mi.TTrans := m.Cap[mcSeaTrans] * m.MTrans;


1819  mi.ATrans_Fuel := m.Cap[mcCarrier] * m.MTrans;


1820  end;


1821  mi.Bombs := m.Cap[mcBombs] * m.MStrength * 2;


1822  mi.Cap := 0;


1823  for i := mcFirstNonCap to nFeature  1 do


1824  if m.Cap[i] > 0 then


1825  mi.Cap := mi.Cap or (1 shl (i  mcFirstNonCap));


1826  mi.MaxUpgrade := 0;


1827  for i := 1 to nUpgrade  1 do


1828  if m.Upgrades and (1 shl i) <> 0 then


1829  mi.MaxUpgrade := i;


1830  mi.Weight := m.Weight;


1831  mi.Lost := 0;


1832  end;


1833 


1834  function IsSameModel(const mi1, mi2: TModelInfo): Boolean;


1835  type


1836  TModelInfo_Compare = array [0 .. 5] of Cardinal;


1837  var


1838  Compare1, Compare2: ^TModelInfo_Compare;


1839  begin


1840  Compare1 := @mi1;


1841  Compare2 := @mi2;


1842  result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and


1843  (Compare1[2] = Compare2[2]) and (Compare1[3] = Compare2[3]) and


1844  (Compare1[4] = Compare2[4]) and (Compare1[5] = Compare2[5])


1845  end;


1846 


1847  function SpecialTile(Loc, TerrType, lx: Integer): Integer;


1848  var


1849  x, y, qx, qy, a: Integer;


1850  begin


1851  if TerrType = fOcean then


1852  result := 0


1853  else


1854  begin


1855  y := Loc div lx;


1856  x := Loc  y * lx;


1857  if TerrType = fGrass then { formula for productive grassland }


1858  if Odd((lymax + x  y shr 1) shr 1 + x + (y + 1) shr 1) then


1859  result := 1


1860  else


1861  result := 0


1862  else { formula for special resources }


1863  begin


1864  a := 4 * x  y + 9980;


1865  qx := a div 10;


1866  if (qx * 10 = a) and (qx and 3 <> 0) then


1867  begin


1868  qy := (y + x) div 5;


1869  if qy and 3 <> qx shr 2 and 1 * 2 then


1870  if (TerrType = fArctic) or (TerrType = fSwamp) then


1871  result := 1


1872  else if TerrType = fShore then


1873  begin


1874  if (qx + qy) and 1 = 0 then


1875  if qx and 3 = 2 then


1876  result := 2


1877  else


1878  result := 1


1879  else


1880  result := 0


1881  end


1882  else


1883  result := (qx + qy) and 1 + 1


1884  else


1885  result := 0;


1886  end


1887  else


1888  result := 0;


1889  end


1890  end;


1891  end;


1892 


1893  procedure InitUnit;


1894  begin


1895  Assert(SizeOf(TPlayerContext) = 1936 + 28 * SizeOf(Pointer));


1896  Assert(SizeOf(TModel)  2 * SizeOf(LongInt)  4 * SizeOf(Word)


1897  = sIntSetDevModel and $F * 4);


1898  end;


1899 


1900  function DelphiRandom(const pi_Max: Integer): Integer;


1901  var


1902  Temp: LongInt;


1903  begin


1904  Temp := LongInt(Int64(134775813) * Int64(DelphiRandSeed) + 1);


1905  DelphiRandSeed := LongInt(Temp);


1906  Result := (UInt64(Cardinal(pi_Max)) * UInt64(Cardinal(Temp))) shr 32;


1907  end;


1908 


1909  function DelphiRandom: Extended; overload;


1910  begin


1911  Result := DelphiRandom(High(LongInt)) / High(LongInt);


1912  end;


1913 


1914  procedure DelphiRandomize;


1915  begin


1916  Randomize;


1917  DelphiRandSeed := RandSeed;


1918  end;


1919 


1920  initialization


1921 


1922  InitUnit;


1923 


1924  end.

