source: branches/delphi/AI/Protocol.pas

Last change on this file was 22, checked in by chronos, 7 years ago
  • Added: Delphi AI development kit.
File size: 61.6 KB
Line 
1{$INCLUDE switches.inc}
2{$HINTS OFF}
3unit Protocol;
4
5interface
6
7const
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 re-entering
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 = 3; { maximum difficulty level }
55 StorageSize: array [1 .. MaxDiff] of integer = (30, 40, 50);
56 TechFormula_M: array [1 .. MaxDiff] of single = (2.0, 2.3, 2.6);
57 TechFormula_D: array [1 .. MaxDiff] of single = (102.0, 80.0, 64.0);
58 BuildCostMod: array [1 .. MaxDiff] of integer = (9, 12, 15); // 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 command-sExecute 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;
86 sGetChart = $0100; // + type shl 4
87 sGetTechCost = $0180;
88 sGetAICredits = $01D0;
89 sGetVersion = $01E0;
90 sGetGameChanged = $01F0;
91 sGetTileInfo = $0200;
92 sGetCityTileInfo = $0210;
93 sGetHypoCityTileInfo = $0220;
94 sGetJobProgress = $0230;
95 sGetModels = $0270;
96 sGetUnits = $0280;
97 sGetDefender = $0290;
98 sGetBattleForecast = $02A0;
99 sGetUnitReport = $02B0;
100 sGetMoveAdvice = $02C0;
101 sGetPlaneReturn = $02D0;
102 sGetBattleForecastEx = $02E0;
103 sGetCity = $0300;
104 sGetCityReport = $0310;
105 sGetCityAreaInfo = $0320;
106 sGetEnemyCityReport = $0330;
107 sGetEnemyCityAreaInfo = $0340;
108 sGetCityTileAdvice = $0350;
109 sGetCityReportNew = $0360;
110 sGetEnemyCityReportNew = $0370;
111
112 // Map Editor Commands
113 sEditTile = $0710;
114 sRandomMap = $0780;
115 sMapGeneratorRequest = $0790;
116
117 // Server Internal Commands
118 sctInternal = sctInfo;
119 // sctInfo - without sExecute flag, sctInternal - with sExecute flag
120 sIntTellAboutNation = $4000;
121 sIntHaveContact = $4010;
122 sIntCancelTreaty = $4020;
123 sIntTellAboutModel = $4100; { +told player shl 4 }
124 sIntDiscoverZOC = $4201;
125 sIntExpandTerritory = $4218;
126 sIntBuyMaterial = $4301;
127 sIntPayPrices = $4402;
128 sIntSetDevModel = $450D;
129 sIntSetModelStatus = $4601;
130 sIntSetUnitStatus = $4611;
131 sIntSetCityStatus = $4621;
132 sIntSetECityStatus = $4631;
133 sIntDataChange = $4700;
134
135 // Client Deactivation Commands
136 sctEndClient = $0800;
137 sTurn = $4800;
138 sBreak = $4810;
139 sResign = $4820;
140 sNextRound = $4830;
141 sReload = $4841;
142 sSaveMap = $4880;
143 sAbandonMap = $4890;
144 // diplomacy commands equal to client, see below
145
146 // General Commands
147 sctGeneral = $1000;
148 sClearTestFlag = $5000;
149 sSetTestFlag = $5010;
150 sSetGovernment = $5100;
151 sSetRates = $5110;
152 sRevolution = $5120;
153 sSetResearch = $5200;
154 sStealTech = $5210;
155 sSetAttitude = $5300; // + concerned player shl 4
156 sCancelTreaty = $5400;
157
158 // Model Related Commands
159 sctModel = $1800;
160 sCreateDevModel = $5800;
161 sSetDevModelCap = $5C00; { +value shl 4 }
162 { reserves $5CXX, $5DXX, $5EXX, $5FXX }
163
164 // Unit Related Commands
165 sctUnit = $2000;
166 sRemoveUnit = $6000;
167 sSetUnitHome = $6010;
168 sSetSpyMission = $6100; // + mission shl 4
169 sLoadUnit = $6200;
170 sUnloadUnit = $6210;
171 sSelectTransport = $6220;
172 sCreateUnit = $6301; // + player shl 4
173 sMoveUnit = $6400; { +dx and 7 shl 4 +dy and 7 shl 7 }
174 { reserves $64XX, $65XX, $66XX, $67XX }
175
176 // Settlers Related Commands
177 sctSettlers = $2800;
178 sAddToCity = $6810;
179 sStartJob = $6C00; { +job shl 4 }
180 { reserves $6CXX, $6DXX, $6EXX, $6FXX }
181
182 // City Related Commands
183 sctCity = $3000;
184 sSetCityProject = $7001;
185 sBuyCityProject = $7010;
186 sSellCityProject = $7020;
187 sSellCityImprovement = $7101;
188 sRebuildCityImprovement = $7111;
189 sSetCityTiles = $7201;
190
191 // free command space
192 sctUnused = $3800;
193
194 { client commands }
195 cInitModule = $0000;
196 cReleaseModule = $0100;
197 cBroadcast = $0200;
198 cHelpOnly = $0700;
199 cStartHelp = $0710;
200
201 cNewGame = $0800;
202 cLoadGame = $0810;
203 cMovie = $0820;
204 cNewGameEx = $0840;
205 cLoadGameEx = $0850;
206 cNewMap = $0880;
207 cReplay = $08E0;
208 cGetReady = $08F0;
209 cBreakGame = $0900;
210
211 cTurn = $2000;
212 cResume = $2010;
213 cContinue = $2080;
214 cMovieTurn = $2100;
215 cMovieEndTurn = $2110;
216 cEditMap = $2800;
217
218 // cShowTileM=$3000;cShowTileA=$3010;cShowFoundCity=$3020;
219 cShowUnitChanged = $3030;
220 cShowAfterMove = $3040;
221 cShowAfterAttack = $3050;
222 cShowCityChanged = $3090;
223 // cShowMove=$3100;cShowCapture=$3110;
224 // cShowAttackBegin=$3200;cShowAttackWon=$3210;cShowAttackLost=$3220;
225 cShowMoving = $3140;
226 cShowCapturing = $3150;
227 cShowAttacking = $3240;
228 cShowMissionResult = $3300;
229 cShowShipChange = $3400;
230 cShowGreatLibTech = $3500;
231 cShowTurnChange = $3700;
232 cShowCancelTreaty = $3800;
233 cShowEndContact = $3810;
234 cShowCancelTreatyByAlliance = $3820;
235 cShowSupportAllianceAgainst = $3830;
236 cShowPeaceViolation = $3880;
237 cShowGame = $3F00;
238 cShowSuperView = $3F80;
239
240 // diplomacy commands equal to server, see below
241
242 cDebugMessage = $7000;
243 cShowNego = $7010;
244
245 // commands same for server and client
246 scContact = $4900; // + concerned player shl 4 for server call
247 scReject = $4A00;
248 scDipStart = $4B00;
249 scDipNotice = $4B10;
250 scDipAccept = $4B20;
251 scDipCancelTreaty = $4B30;
252 scDipOffer = $4B4E;
253 scDipBreak = $4BF0;
254
255 // advisor commands
256 aInitModule = $0000;
257 aReleaseModule = $0100;
258 aNewGame = $0800;
259 aBreakGame = $0900;
260 aGiveStrategyAdvice = $4000;
261 aGiveCityAdvice = $4100;
262
263 { server return codes: flags }
264 rExecuted = $40000000;
265 rEffective = $20000000;
266 rUnitRemoved = $10000000;
267 rEnemySpotted = $08000000;
268
269 { server return codes: command executed }
270 // note: the same return code might have a different meaning for different server functions!
271 eOK = $60000000; // ok
272 eEnemySpotted = $68000000; // unit move ok, new enemy unit/city spotted
273 eDied = $70000000; // move executed, unit died due to hostile terrain
274 eEnemySpotted_Died = $78000000;
275 // unit move ok, new enemy unit/city spotted, unit died due to hostile terrain
276 eLoaded = $60000002; // unit move caused loading to transport ship
277 eLost = $70000004; // attack executed, battle lost, unit is dead
278 eWon = $60000005; // attack executed, battle won, defender destroyed
279 eBloody = $70000005; // attack executed, defender destroyed, unit is dead
280 eBombarded = $60000006; // empty enemy city bombarded
281 eExpelled = $60000007; // friendly unit expelled
282 eMissionDone = $70000008;
283 // spy moved into city: mission done, spy no longer exists
284 eJobDone = $60000001; // settler job started and already done
285 eJobDone_Died = $70000001;
286 // settler job started and already done, unit died due to hostile terrain
287 eCity = $70000002; // city founded, settler no more exists
288 eRemoved = $70000000; // sRemoveUnit: unit removed
289 eUtilized = $70000001; // sRemoveUnit: unit utilized for city project
290
291 eNotChanged = $40000000;
292 // ok, but no effect (e.g. current city project set again)
293
294 { server return codes: command not executed }
295 eHiddenUnit = $20000013;
296 // unit move: not possible, destination tile occupied by hidden foreign submarine
297 eStealthUnit = $2000001A;
298 // unit move: not possible, destination tile occupied by foreign stealth unit
299 eZOC_EnemySpotted = $28000014;
300 // unit move: not possible, new enemy unit spotted, ZOC violation
301
302 eInvalid = $0000; // command not allowed now or parameter out of allowed range
303 eUnknown = $0001; // unknown command
304 eNoTurn = $0002; // command only allowed during player's turn
305 eViolation = $0003; // general violation of game rules
306 eNoPreq = $0004; // the prerequisites for this command are not fully met
307
308 eNoTime_Move = $0008; // normal unit move: too few movement points left
309 eNoTime_Load = $0009; // load unit: too few movement points left
310 eNoTime_Attack = $000A; // attack: no movement points left
311 eNoTime_Bombard = $000B; // bombard city: too few movement points left
312 eNoTime_Expel = $000C; // expel spy: too few movement points left
313
314 eDomainMismatch = $0011;
315 // move/attack: action not allowed for this unit domain
316 eNoCapturer = $0012;
317 // unit move: this type of unit is not allowed to capture a city
318 eZOC = $0014; // unit move: not possible, ZOC violation
319 eTreaty = $0015; // move/attack: not possible, peace treaty violation
320 eDeadLands = $0016; // sStartJob: not possible, dead lands
321 eNoRoad = $0017; // unit move: not possible, no road
322 eNoNav = $0019; // unit move: not possible, open sea without navigation
323 eNoLoadCapacity = $001B; // load to transport: no more transport capacity
324 eNoBombarder = $001C; // bombardment impossible because no attack power
325
326 eMaxSize = $0020;
327 // add to city: bigger size not allowed due to missing aqueduct/sewer
328 eNoCityTerrain = $0022; // found city: not possible in this terrain
329 eNoBridgeBuilding = $0023;
330 eInvalidOffer = $0030;
331 eOfferNotAcceptable = $0031;
332 eCancelTreatyRush = $0032;
333 eAnarchy = $0038; // no negotiation in anarchy
334 eColdWar = $003F;
335 eNoModel = $0040; // sCreateDevModel must be called before!
336 eTileNotAvailable = $0050;
337 eNoWorkerAvailable = $0051;
338 eOnlyOnce = $0058;
339 // sell/rebuild city improvement: only once per city and turn!
340 eObsolete = $0059; // city project: more advanced improvement already exists
341 eOutOfControl = $005A;
342 // buy/sell/rebuild improvement: not in anarchy, not in captured cities
343
344 eNoWay = $0100; // sGetMoveAdvice: no way found
345
346 // chart types
347 nStat = 6;
348 stPop = 0;
349 stTerritory = 1;
350 stMil = 2;
351 stScience = 3;
352 stExplore = 4;
353 stWork = 5;
354
355 { tile flags: terrain type }
356 fTerrain = $1F; // mask for terrain type
357 fOcean = $00;
358 fShore = $01;
359 fGrass = $02;
360 fDesert = $03;
361 fPrairie = $04;
362 fTundra = $05;
363 fArctic = $06;
364 fSwamp = $07;
365 fForest = $09;
366 fHills = $0A;
367 fMountains = $0B;
368 fUNKNOWN = fTerrain;
369
370 { tile flags: terrain improvements }
371 fTerImp = $0000F000; // mask for terrain improvement
372 tiNone = $00000000;
373 tiIrrigation = $00001000;
374 tiFarm = $00002000;
375 tiMine = $00003000;
376 tiFort = $00004000;
377 tiBase = $00005000;
378
379 { tile flags: add ons }
380 fSpecial = $00000060;
381 fSpecial1 = $00000020;
382 fSpecial2 = $00000040;
383 fRiver = $00000080;
384 fRoad = $00000100;
385 fRR = $00000200;
386 fCanal = $00000400;
387 fPoll = $00000800;
388 fPrefStartPos = $00200000;
389 fStartPos = $00400000; // map editor only
390 fDeadLands = $01000000;
391 fModern = $06000000;
392 fCobalt = $02000000;
393 fUranium = $04000000;
394 fMercury = $06000000;
395
396 { tile flags: redundant helper info }
397 fGrWall = $00010000; // tile protected by great wall
398 fSpiedOut = $00020000;
399 fStealthUnit = $00040000;
400 fHiddenUnit = $00080000;
401 fObserved = $00100000; // set if tile information is from this turn
402 fOwned = $00200000; // set if unit/city here is own one
403 fUnit = $00400000;
404 fCity = $00800000;
405 fOwnZoCUnit = $10000000; // own ZoC unit present at this tile
406 fInEnemyZoC = $20000000;
407 // tile is adjacent to known foreign ZoC unit (not allied)
408 fPeace = $40000000;
409 // tile belongs to territory of nation that we are in peace with but not allied
410
411 // city project flags
412 cpIndex = $1FF;
413 cpConscripts = $200; // produce unit as conscripts
414 cpDisbandCity = $400;
415 // allow to disband city when settlers/conscripts are produced
416 cpImp = $800; // 0: index refers to model, 1: index refers to city improvement
417 cpRepeat = $1000;
418 cpCompleted = $2000;
419 cpAuto = $F000; // for internal use only
420
421 // tech status indicators
422 tsNA = -2;
423 tsSeen = -1;
424 tsResearched = 0;
425 tsGrLibrary = 1;
426 tsCheat = 15;
427 tsApplicable = tsResearched;
428
429 // nation treaties
430 trNoContact = -1;
431 trNone = 0;
432 trCeaseFire = 1;
433 trPeace = 2;
434 trFriendlyContact = 3;
435 trAlliance = 4;
436
437 // attitudes
438 nAttitude = 7;
439 atHostile = 0;
440 atIcy = 1;
441 atUncoop = 2;
442 atNeutral = 3;
443 atReceptive = 4;
444 atCordial = 5;
445 atEnth = 6;
446
447 // offer prices
448 opChoose = $00000000;
449 opCivilReport = $11000000; // + turn + concerned player shl 16
450 opMilReport = $12000000; // + turn + concerned player shl 16
451 opMap = $1F000000;
452 opTreaty = $20000000; // + suggested nation treaty
453 opShipParts = $30000000; // + number + part type shl 16
454 opMoney = $40000000; // + value
455 opTribute = $48000000; // obsolete
456 opTech = $50000000; // + advance
457 opAllTech = $51000000;
458 opModel = $58000000; // + model index
459 opAllModel = $59000000;
460
461 opMask = $FF000000;
462
463 // improvement kinds
464 ikTrGoods = 0;
465 ikCommon = 1;
466 ikNatLocal = 2;
467 ikNatGlobal = 3;
468 ikWonder = 4;
469 ikShipPart = 5;
470 ikNA = $7F;
471
472 { model domains }
473 nDomains = 3;
474 dGround = 0;
475 dSea = 1;
476 dAir = 2;
477
478 { model kinds }
479 mkSelfDeveloped = $00;
480 mkEnemyDeveloped = $01;
481 mkSpecial_Boat = $08;
482 mkSpecial_SubCabin = $0A;
483 mkSpecial_TownGuard = $10;
484 mkSpecial_Glider = $11;
485 mkScout = $20;
486 mkSlaves = $21;
487 mkSettler = $22;
488 mkCommando = $23;
489 mkFreight = $24;
490
491 { unit flags }
492 unFortified = $01;
493 unBombsLoaded = $02;
494 unMountainDelay = $04;
495 unConscripts = $08;
496 unWithdrawn = $10;
497 unMulti = $80;
498
499 // unit report flags
500 urfAlwaysSupport = $01;
501 urfDeployed = $02;
502
503 // unit moves
504 umCapturing = $0100;
505 umSpyMission = $0200;
506 umBombarding = $0400;
507 umExpelling = $0800;
508 umShipLoading = $1000;
509 umShipUnloading = $2000;
510 umPlaneLoading = $4000;
511 umPlaneUnloading = $8000;
512
513 { model flags }
514 mdZOC = $01;
515 mdCivil = $02;
516 mdDoubleSupport = $04;
517
518 { player happened flags }
519 phTech = $01;
520 phStealTech = $02;
521 phChangeGov = $08;
522 phGliderLost = $100;
523 phPlaneLost = $200;
524 phPeaceViolation = $400;
525 phPeaceEvacuation = $800;
526 phShipComplete = $2000;
527 phTimeUp = $4000;
528 phExtinct = $8000;
529 phGameEnd = $F000;
530
531 { city happened flags }
532 chDisorder = $01;
533 chProduction = $02;
534 chPopIncrease = $04;
535 chPopDecrease = $08;
536 chUnitLost = $10;
537 chImprovementLost = $20;
538 chProductionSabotaged = $40;
539 chNoGrowthWarning = $80;
540 chPollution = $100;
541 chSiege = $200;
542 chOldWonder = $400;
543 chNoSettlerProd = $800;
544 chFounded = $1000;
545 chAfterCapture = $2000;
546 chCaptured = $F0000;
547 chImprovementSold = $80000000;
548
549 { city info flags }
550 ciCapital = $01;
551 ciWalled = $02;
552 ciCoastalFort = $04;
553 ciMissileBat = $08;
554 ciBunker = $10;
555 ciSpacePort = $20;
556
557 { city tile available values }
558 faAvailable = 0;
559 faNotAvailable = 1;
560 faSiege = 2;
561 faTreaty = 4;
562 faInvalid = $FF;
563
564 // battle history flags
565 bhEnemyAttack = $01;
566 bhMyUnitLost = $02;
567 bhEnemyUnitLost = $04;
568
569 { move advice special destinations }
570 maNextCity = -1;
571
572 { goverment forms }
573 nGov = 8;
574 gAnarchy = 0;
575 gDespotism = 1;
576 gMonarchy = 2;
577 gRepublic = 3;
578 gFundamentalism = 4;
579 gCommunism = 5;
580 gDemocracy = 6;
581 gFuture = 7;
582
583 // colony ship
584 nShipPart = 3;
585 spComp = 0;
586 spPow = 1;
587 spHab = 2;
588 ShipNeed: array [0 .. nShipPart - 1] of integer = (6, 4, 2);
589
590 // ship change reasons
591 scrProduction = 0;
592 scrDestruction = 1;
593 scrTrade = 2;
594 scrCapture = 3;
595
596 { unit jobs }
597 nJob = 15;
598 jNone = 0;
599 jRoad = 1;
600 jRR = 2;
601 jClear = 3;
602 jIrr = 4;
603 jFarm = 5;
604 jAfforest = 6;
605 jMine = 7;
606 jCanal = 8;
607 jTrans = 9;
608 jFort = 10;
609 jPoll = 11;
610 jBase = 12;
611 jPillage = 13;
612 jCity = 14;
613
614 // job preconditions are:
615 // technology JobPreq is available, no city, plus the following:
616 // jRoad: no river when bridge building unavailable
617 // jRR: road
618 // jClear: Terrain.ClearTerrain, Hanging Gardens for desert
619 // jIrr: Terrain.IrrEff
620 // jFarm: irrigation
621 // jAfforest: Terrain.AfforestTerrain
622 // jMine: Terrain.MineEff
623 // jCanal: no Mountains, no Arctic
624 // jTrans: Terrain.TransWork
625 // jPoll: pollution
626 // jPillage: any tile improvement
627 // jCity, jFort, jBase: none
628
629 // spy mission
630 nSpyMission = 5;
631 smSabotageProd = 0;
632 smStealMap = 1;
633 smStealForeignReports = 2;
634 smStealCivilReport = 3;
635 smStealMilReport = 4;
636
637 // resource weights
638 rwOff = $00000000;
639 rwMaxGrowth = $3F514141; // 120*F + 1/8*P + 1/16*T + 1/16*S
640 rwMaxProd = $413F1F01; // 1/16*F + 120*P + 30*T + 1*S
641 rwMaxScience = $41040408; // 1/16*F + 4*P + 4*T + 8*S
642 rwForceProd = $F1080201; // F^1/2 * (8*P + 2*T + 1*S)
643 rwForceScience = $F1010101; // F^1/2 * (1*P + 1*T + 1*S)
644
645 { advances }
646 adAdvancedFlight = 0;
647 adAmphibiousWarfare = 1;
648 adAstronomy = 2;
649 adAtomicTheory = 3;
650 adAutomobile = 4;
651 adBallistics = 5;
652 adBanking = 6;
653 adBridgeBuilding = 7;
654 adBronzeWorking = 8;
655 adCeremonialBurial = 9;
656 adChemistry = 10;
657 adChivalry = 11;
658 adComposites = 12;
659 adCodeOfLaws = 13;
660 adCombinedArms = 14;
661 adCombustionEngine = 15;
662 adCommunism = 16;
663 adComputers = 17;
664 adConscription = 18;
665 adConstruction = 19;
666 adTheCorporation = 20;
667 adSpaceFlight = 21;
668 adCurrency = 22;
669 adDemocracy = 23;
670 adEconomics = 24;
671 adElectricity = 25;
672 adElectronics = 26;
673 adEngineering = 27;
674 adEnvironmentalism = 28;
675 adWheel = 29;
676 adExplosives = 30;
677 adFlight = 31;
678 adIntelligence = 32;
679 adGunpowder = 33;
680 adHorsebackRiding = 34;
681 adImpulseDrive = 35;
682 adIndustrialization = 36;
683 adSmartWeapons = 37;
684 adInvention = 38;
685 adIronWorking = 39;
686 adTheLaser = 40;
687 adNuclearPower = 41;
688 adLiterature = 42;
689 adInternet = 43;
690 adMagnetism = 44;
691 adMapMaking = 45;
692 adMasonry = 46;
693 adMassProduction = 47;
694 adMathematics = 48;
695 adMedicine = 49;
696 adMetallurgy = 50;
697 adMin = 51;
698 adMobileWarfare = 52;
699 adMonarchy = 53;
700 adMysticism = 54;
701 adNavigation = 55;
702 adNuclearFission = 56;
703 adPhilosophy = 57;
704 adPhysics = 58;
705 adPlastics = 59;
706 adPoetry = 60;
707 adPottery = 61;
708 adRadio = 62;
709 adRecycling = 63;
710 adRefrigeration = 64;
711 adMonotheism = 65;
712 adTheRepublic = 66;
713 adRobotics = 67;
714 adRocketry = 68;
715 adRailroad = 69;
716 adSanitation = 70;
717 adScience = 71;
718 adWriting = 72;
719 adSeafaring = 73;
720 adSelfContainedEnvironment = 74;
721 adStealth = 75;
722 adSteamEngine = 76;
723 adSteel = 77;
724 adSyntheticFood = 78;
725 adTactics = 79;
726 adTheology = 80;
727 adTheoryOfGravity = 81;
728 adTrade = 82;
729 adTransstellarColonization = 83;
730 adUniversity = 84;
731 adAdvancedRocketry = 85;
732 adWarriorCode = 86;
733 adAlphabet = 87;
734 adPolytheism = 88;
735 adRefining = 89;
736 futComputingTechnology = 90;
737 futNanoTechnology = 91;
738 futMaterialTechnology = 92;
739 futArtificialIntelligence = 93;
740
741 adMilitary = $800; // Military Research
742
743 { wonders }
744 woPyramids = 00;
745 woZeus = 01;
746 woGardens = 02;
747 woColossus = 03;
748 woLighthouse = 04;
749 woGrLibrary = 05;
750 woOracle = 06;
751 woSun = 07;
752 woLeo = 08;
753 woMagellan = 09;
754 woMich = 10; { 11; }
755 woNewton = 12;
756 woBach = 13;
757 { 14; } woLiberty = 15;
758 woEiffel = 16;
759 woHoover = 17;
760 woShinkansen = 18;
761 woManhattan = 19;
762 woMir = 20;
763
764 { city improvements }
765 imTrGoods = 28;
766 imBarracks = 29;
767 imGranary = 30;
768 imTemple = 31;
769 imMarket = 32;
770 imLibrary = 33;
771 imCourt = 34;
772 imWalls = 35;
773 imAqueduct = 36;
774 imBank = 37;
775 imCathedral = 38;
776 imUniversity = 39;
777 imHarbor = 40;
778 imTheater = 41;
779 imFactory = 42;
780 imMfgPlant = 43;
781 imRecycling = 44;
782 imPower = 45;
783 imHydro = 46;
784 imNuclear = 47;
785 imPlatform = 48;
786 imTownHall = 49;
787 imSewer = 50;
788 imSupermarket = 51;
789 imHighways = 52;
790 imResLab = 53;
791 imMissileBat = 54;
792 imCoastalFort = 55;
793 imAirport = 56;
794 imDockyard = 57;
795 imPalace = 58;
796 imGrWall = 59;
797 imColosseum = 60;
798 imObservatory = 61;
799 imMilAcademy = 62;
800 imBunker = 63;
801 imAlgae = 64;
802 imStockEx = 65;
803 imSpacePort = 66;
804 imShipComp = 67;
805 imShipPow = 68;
806 imShipHab = 69;
807
808 SettlerFood: array [0 .. nGov - 1] of integer = (1, 1, 1, 2, 1, 2, 2, 2);
809 CorrLevel: array [0 .. nGov - 1] of integer = (3, 3, 1, 2, 1, 0, 0, 0);
810 SupportFree: array [0 .. nGov - 1] of integer = (2, 2, 1, 0, 2, 1, 0, 0);
811 // in 1/2*city size
812
813 // special prerequisite values
814 preNone = -1;
815 preLighthouse = -2;
816 preSun = -3;
817 preLeo = -4;
818 preBuilder = -5;
819 preNA = -$FF;
820
821 JobPreq: array [0 .. nJob - 1] of integer = (preNone, preNone, adRailroad,
822 preNone, preNone, adRefrigeration, preNone, preNone, adExplosives,
823 adExplosives, adConstruction, preNone, adMedicine, preNone, preNone);
824
825 AdvPreq: array [0 .. nAdv - 1, 0 .. 2] of integer = { advance prerequisites }
826 ((adFlight, adRobotics, preNone), // adAdvancedFlight
827 (adNavigation, adTactics, preNone), // adAmphibiousWarfare
828 (adMysticism, adAlphabet, preNone), // adAstronomy
829 (adTheoryOfGravity, preNone, preNone), // adAtomicTheory
830 (adCombustionEngine, adSteel, preNone), // adAutomobile
831 (adMathematics, adMetallurgy, preNone), // adBallistics
832 (adCurrency, adEngineering, preNone), // adBanking
833 (adConstruction, adWheel, preNone), // adBridgeBuilding
834 (preNone, preNone, preNone), // adBronzeWorking
835 (preNone, preNone, preNone), // adCeremonialBurial
836 (adScience, preNone, preNone), // adChemistry
837 (adMonarchy, adWarriorCode, preNone), // adChivalry
838 (adMetallurgy, adPlastics, preNone), // adComposites
839 (adWriting, preNone, preNone), // adCodeOfLaws
840 (adAdvancedFlight, adMobileWarfare, preNone), // adCombinedArms
841 (adRefining, adExplosives, preNone), // adCombustionEngine
842 (adPhilosophy, adIndustrialization, preNone), // adCommunism
843 (adMin, preNone, preNone), // adComputers
844 (adTheRepublic, adTactics, preNone), // adConscription
845 (adMasonry, adAlphabet, preNone), // adConstruction
846 (adEconomics, adDemocracy, preNone), // adTheCorporation
847 (adAdvancedFlight, adAdvancedRocketry, preNone), // adSpaceFlight
848 (adBronzeWorking, preNone, preNone), // adCurrency
849 (adConscription, adIndustrialization, preNone), // adDemocracy
850 (adBanking, adUniversity, preNone), // adEconomics
851 (adMagnetism, preNone, preNone), // adElectricity
852 (adRadio, adAtomicTheory, preNone), // adElectronics
853 (adConstruction, adBronzeWorking, preNone), // adEngineering
854 (adIndustrialization, preNone, preNone), // adEnvironmentalism
855 (preNone, preNone, preNone), // adWheel
856 (adChemistry, adEngineering, preNone), // adExplosives
857 (adCombustionEngine, adPhysics, preNone), // adFlight
858 (adTactics, adInvention, preNone), // adIntelligence
859 (adMedicine, adIronWorking, preNone), // adGunpowder
860 (preNone, preNone, preNone), // adHorsebackRiding
861 (adSpaceFlight, adNuclearPower, preNone), // adImpulseDrive
862 (adRailroad, adBanking, preNone), // adIndustrialization
863 (adAdvancedRocketry, adTheLaser, preNone), // adIntelligenArms
864 (adWriting, adWheel, preNone), // adInvention
865 (adBronzeWorking, adInvention, preNone), // adIronWorking
866 (adMin, adPhysics, preNone), // adTheLaser
867 (adNuclearFission, preNone, preNone), // adNuclearPower
868 (adPoetry, adTrade, preNone), // adLiterature
869 (adDemocracy, adComputers, preNone), // adLybertarianism
870 (adPhysics, adIronWorking, preNone), // adMagnetism
871 (adAlphabet, preNone, preNone), // adMapMaking
872 (preNone, preNone, preNone), // adMasonry
873 (adAutomobile, adElectronics, adTheCorporation), // adMassProduction
874 (adCurrency, adAlphabet, preNone), // adMathematics
875 (adMysticism, adPottery, preNone), // adMedicine
876 (adGunpowder, preNone, preNone), // adMetallurgy
877 (adRobotics, adPlastics, preNone), // adMin
878 (adAutomobile, adTactics, preNone), // adMobileWarfare
879 (adPolytheism, preNone, preNone), // adMonarchy
880 (adCeremonialBurial, preNone, preNone), // adMysticism
881 (adSeafaring, adAstronomy, preNone), // adNavigation
882 (adAtomicTheory, adMassProduction, preNone), // adNuclearFission
883 (adMathematics, adLiterature, preNone), // adPhilosophy
884 (adScience, preNone, preNone), // adPhysics
885 (adMassProduction, adRefining, preNone), // adPlastics
886 (adMysticism, adWarriorCode, preNone), // adPoetry
887 (preNone, preNone, preNone), // adPottery
888 (adElectricity, adEngineering, preNone), // adRadio
889 (adEnvironmentalism, adPlastics, preNone), // adRecycling
890 (adElectricity, preNone, preNone), // adRefrigeration
891 (adPolytheism, adAstronomy, preNone), // adMonotheism
892 (adLiterature, preNone, preNone), // adTheRepublic
893 (adMassProduction, adEconomics, preNone), // adRobotics
894 (adBallistics, adExplosives, preNone), // adRocketry
895 (adSteamEngine, adBridgeBuilding, preNone), // adRailroad
896 (adEnvironmentalism, adMedicine, preNone), // adSanitation
897 (adMetallurgy, adTheology, adPhilosophy), // adScience
898 (adAlphabet, preNone, preNone), // adWriting
899 (adPottery, adMapMaking, preNone), // adSeafaring
900 (adRecycling, adSyntheticFood, preNone), // adSelfContainedEnvironment
901 (adComposites, adRadio, preNone), // adStealth
902 (adScience, adEngineering, preNone), // adSteamEngine
903 (adIronWorking, adRailroad, preNone), // adSteel
904 (adChemistry, adRefrigeration, preNone), // adSyntheticFood
905 (adWarriorCode, adUniversity, preNone), // adTactics
906 (adMonotheism, adPoetry, preNone), // adTheology
907 (adAstronomy, adPhysics, preNone), // adTheoryOfGravity
908 (adCurrency, adCodeOfLaws, preNone), // adTrade
909 (adImpulseDrive, adSelfContainedEnvironment, preNone),
910 // adTransstellarColonization
911 (adScience, preNone, preNone), // adUniversity
912 (adComputers, adRocketry, preNone), // adAdvancedRocketry
913 (preNone, preNone, preNone), // adWarriorCode
914 (preNone, preNone, preNone), // adAlphabet
915 (adCeremonialBurial, adHorsebackRiding, preNone), // adPolytheism
916 (adChemistry, preNone, preNone), // adRefining
917 (adComputers, preNone, preNone), // futResearchTechnology
918 (adRobotics, preNone, preNone), // futProductionTechnology
919 (adComposites, preNone, preNone), // futArmorTechnology
920 (adSmartWeapons, preNone, preNone)); // futMissileTechnology
921
922Imp:
923array [0 .. nImp - 1] of // city improvements
924 record Kind, Preq, Cost, Maint, Expiration: integer;
925end
926= ((Kind: ikWonder; Preq: adMathematics; Cost: 400; Maint: 0;
927 Expiration: adDemocracy), // woPyramids
928 (Kind: ikWonder; Preq: adPolytheism; Cost: 200; Maint: 0;
929 Expiration: adElectronics), // woZeus
930 (Kind: ikWonder; Preq: adInvention; Cost: 200; Maint: 0;
931 Expiration: adNuclearFission), // woGardens
932 (Kind: ikWonder; Preq: adBronzeWorking; Cost: 200; Maint: 0; Expiration: - 1),
933 // woColossus
934 (Kind: ikWonder; Preq: adMapMaking; Cost: 200; Maint: 0; Expiration: adSteel),
935 // woLighthouse
936 (Kind: ikWonder; Preq: adLiterature; Cost: 400; Maint: 0;
937 Expiration: adPlastics), // woGrLibrary
938 (Kind: ikWonder; Preq: adMysticism; Cost: 200; Maint: 0; Expiration: - 1),
939 // woOracle
940 (Kind: ikWonder; Preq: adChivalry; Cost: 300; Maint: 0;
941 Expiration: adSpaceFlight), // woSun
942 (Kind: ikWonder; Preq: adPhilosophy; Cost: 500; Maint: 0; Expiration: - 1),
943 // woLeo
944 (Kind: ikWonder; Preq: adNavigation; Cost: 300; Maint: 0; Expiration: - 1),
945 // woMagellan
946 (Kind: ikWonder; Preq: adMonotheism; Cost: 400; Maint: 0; Expiration: - 1),
947 // woMich
948 (Kind: ikNA; Preq: preNA), // {11}
949 (Kind: ikWonder; Preq: adTheoryOfGravity; Cost: 400; Maint: 0;
950 Expiration: - 1), // woNewton
951 (Kind: ikWonder; Preq: adTheology; Cost: 400; Maint: 0; Expiration: - 1),
952 // woBach
953 (Kind: ikNA; Preq: preNA), // {14}
954 (Kind: ikWonder; Preq: adDemocracy; Cost: 500; Maint: 0; Expiration: - 1),
955 // woLiberty
956 (Kind: ikWonder; Preq: adSteel; Cost: 800; Maint: 0; Expiration: - 1),
957 // woEiffel
958 (Kind: ikWonder; Preq: adElectronics; Cost: 800; Maint: 0; Expiration: - 1),
959 // woHoover
960 (Kind: ikWonder; Preq: adPlastics; Cost: 500; Maint: 0; Expiration: - 1),
961 // woShinkansen
962 (Kind: ikWonder; Preq: adNuclearFission; Cost: 400; Maint: 0;
963 Expiration: - 1), // woManhattan
964 (Kind: ikWonder; Preq: adSpaceFlight; Cost: 800; Maint: 0; Expiration: - 1),
965 // woMir
966 (Kind: ikNA; Preq: preNA), // {21}
967 (Kind: ikNA; Preq: preNA), // {22}
968 (Kind: ikNA; Preq: preNA), // {23}
969 (Kind: ikNA; Preq: preNA), // {24}
970 (Kind: ikNA; Preq: preNA), // {25}
971 (Kind: ikNA; Preq: preNA), // {26}
972 (Kind: ikNA; Preq: preNA), // {27}
973 (Kind: ikTrGoods; Preq: preNone; Cost: 0; Maint: 0), // imTrGoods
974 (Kind: ikCommon; Preq: adWarriorCode; Cost: 40; Maint: 1), // imBarracks
975 (Kind: ikCommon; Preq: adPottery; Cost: 60; Maint: 1), // imGranary
976 (Kind: ikCommon; Preq: adCeremonialBurial; Cost: 40; Maint: 1), // imTemple
977 (Kind: ikCommon; Preq: adCurrency; Cost: 60; Maint: 1), // imMarket
978 (Kind: ikCommon; Preq: adWriting; Cost: 80; Maint: 3), // imLibrary
979 (Kind: ikCommon; Preq: adCodeOfLaws; Cost: 80; Maint: 2), // imCourt
980 (Kind: ikCommon; Preq: adMasonry; Cost: 80; Maint: 1), // imWalls
981 (Kind: ikCommon; Preq: adConstruction; Cost: 80; Maint: 1), // imAqueduct
982 (Kind: ikCommon; Preq: adBanking; Cost: 120; Maint: 2), // imBank
983 (Kind: ikCommon; Preq: adMonotheism; Cost: 100; Maint: 1), // imCathedral
984 (Kind: ikCommon; Preq: adUniversity; Cost: 160; Maint: 5), // imUniversity
985 (Kind: ikCommon; Preq: adSeafaring; Cost: 60; Maint: 1), // imHarbor
986 (Kind: ikCommon; Preq: adPoetry; Cost: 60; Maint: 2), // imTheater
987 (Kind: ikCommon; Preq: adIndustrialization; Cost: 200; Maint: 3), // imFactory
988 (Kind: ikCommon; Preq: adRobotics; Cost: 320; Maint: 5), // imMfgPlant
989 (Kind: ikCommon; Preq: adRecycling; Cost: 320; Maint: 4), // imRecycling
990 (Kind: ikCommon; Preq: adElectricity; Cost: 120; Maint: 2), // imPower
991 (Kind: ikCommon; Preq: adEnvironmentalism; Cost: 120; Maint: 1), // imHydro
992 (Kind: ikCommon; Preq: adNuclearPower; Cost: 240; Maint: 2), // imNuclear
993 (Kind: ikCommon; Preq: adRefining; Cost: 160; Maint: 2), // imPlatform
994 (Kind: ikCommon; Preq: preNone; Cost: 40; Maint: 1), // imTownHall
995 (Kind: ikCommon; Preq: adSanitation; Cost: 120; Maint: 2), // imSewer
996 (Kind: ikCommon; Preq: adRefrigeration; Cost: 80; Maint: 2), // imSupermarket
997 (Kind: ikCommon; Preq: adAutomobile; Cost: 160; Maint: 4), // imHighways
998 (Kind: ikCommon; Preq: adComputers; Cost: 240; Maint: 7), // imResLab
999 (Kind: ikCommon; Preq: adAdvancedRocketry; Cost: 100; Maint: 1),
1000 // imMissileBat
1001 (Kind: ikCommon; Preq: adMetallurgy; Cost: 80; Maint: 1), // imCoastalFort
1002 (Kind: ikCommon; Preq: adAdvancedFlight; Cost: 160; Maint: 1), // imAirport
1003 (Kind: ikCommon; Preq: adAmphibiousWarfare; Cost: 80; Maint: 1), // imDockyard
1004 (Kind: ikNatLocal; Preq: preNone; Cost: 100; Maint: 0), // imPalace
1005 (Kind: ikNatLocal; Preq: adEngineering; Cost: 400; Maint: 4), // imGrWall
1006 (Kind: ikNatLocal; Preq: adConstruction; Cost: 200; Maint: 4), // imColosseum
1007 (Kind: ikNatLocal; Preq: adAstronomy; Cost: 300; Maint: 4), // imObservatory
1008 (Kind: ikNatLocal; Preq: adTactics; Cost: 100; Maint: 4), // imMilAcademy
1009 (Kind: ikNatLocal; Preq: adSteel; Cost: 200; Maint: 2), // imBunker
1010 (Kind: ikNatLocal; Preq: adSyntheticFood; Cost: 120; Maint: 2), // imAlgae
1011 (Kind: ikNatGlobal; Preq: adTheCorporation; Cost: 320; Maint: 4), // imStockEx
1012 (Kind: ikNatLocal; Preq: adSpaceFlight; Cost: 400; Maint: 0), // imSpacePort
1013 (Kind: ikShipPart; Preq: adTransstellarColonization; Cost: 240; Maint: 0),
1014 // imShipComp
1015 (Kind: ikShipPart; Preq: adImpulseDrive; Cost: 600; Maint: 0), // imShipPow
1016 (Kind: ikShipPart; Preq: adSelfContainedEnvironment; Cost: 800; Maint: 0));
1017// imShipHab
1018
1019nImpReplacement = 5;
1020ImpReplacement:
1021array [0 .. nImpReplacement - 1] of record NewImp, OldImp: integer;
1022end
1023= ((NewImp: imSewer; OldImp: imAqueduct), (NewImp: imCourt; OldImp: imTownHall),
1024 (NewImp: imPalace; OldImp: imTownHall), (NewImp: imPalace; OldImp: imCourt),
1025 (NewImp: imMilAcademy; OldImp: imBarracks));
1026
1027GovPreq:
1028array [1 .. nGov - 1] of integer = { government prerequisites }
1029 (preNone, adMonarchy, adTheRepublic, adTheology, adCommunism, adDemocracy,
1030 adInternet);
1031
1032AgePreq:
1033array [1 .. 3] of integer = (adScience, adMassProduction,
1034 adTransstellarColonization);
1035
1036Terrain:
1037array [0 .. 11] of record MoveCost, Defense, ClearTerrain, IrrEff, IrrClearWork,
1038 AfforestTerrain, MineEff, MineAfforestWork, TransTerrain, TransWork: integer;
1039FoodRes, ProdRes, TradeRes: array [0 .. 2] of integer;
1040Filler:
1041array [0 .. 12] of integer;
1042end
1043= ((MoveCost: 1; Defense: 4; ClearTerrain: - 1; IrrEff: 0; IrrClearWork: 0;
1044 AfforestTerrain: - 1; MineEff: 0; MineAfforestWork: 0; TransTerrain: - 1;
1045 TransWork: 0; FoodRes: (0, 0, 0); ProdRes: (0, 0, 0);
1046 TradeRes: (0, 0, 0)), { Ocn }
1047 (MoveCost: 1; Defense: 4; ClearTerrain: - 1; IrrEff: 0; IrrClearWork: 0;
1048 AfforestTerrain: - 1; MineEff: 0; MineAfforestWork: 0; TransTerrain: - 1;
1049 TransWork: 0; FoodRes: (1, 5, 1); ProdRes: (0, 0, 5);
1050 TradeRes: (3, 3, 3)), { Sho }
1051 (MoveCost: 1; Defense: 4; ClearTerrain: - 1; IrrEff: 1; IrrClearWork: 600;
1052 AfforestTerrain: fForest; MineEff: 0; MineAfforestWork: 1800;
1053 TransTerrain: fHills; TransWork: 3000; FoodRes: (3, 2, 2); ProdRes: (0, 1, 0);
1054 TradeRes: (1, 1, 1)), { Gra }
1055 (MoveCost: 1; Defense: 4; ClearTerrain: fGrass; IrrEff: 0; IrrClearWork: 1800;
1056 AfforestTerrain: - 1; MineEff: 1; MineAfforestWork: 600;
1057 TransTerrain: fPrairie; TransWork: 3000; FoodRes: (0, 3, 0);
1058 ProdRes: (1, 1, 4); TradeRes: (1, 1, 1)), { Dst }
1059 (MoveCost: 1; Defense: 4; ClearTerrain: - 1; IrrEff: 1; IrrClearWork: 600;
1060 AfforestTerrain: fForest; MineEff: 0; MineAfforestWork: 2400;
1061 TransTerrain: - 1; TransWork: 0; FoodRes: (1, 3, 1); ProdRes: (1, 1, 3);
1062 TradeRes: (1, 1, 1)), { Pra }
1063 (MoveCost: 1; Defense: 4; ClearTerrain: - 1; IrrEff: 1; IrrClearWork: 600;
1064 AfforestTerrain: - 1; MineEff: 0; MineAfforestWork: 0; TransTerrain: fGrass;
1065 TransWork: 3000; FoodRes: (1, 1, 1); ProdRes: (0, 0, 4);
1066 TradeRes: (1, 6, 1)), { Tun }
1067 (MoveCost: 2; Defense: 4; ClearTerrain: - 1; IrrEff: 0; IrrClearWork: 0;
1068 AfforestTerrain: - 1; MineEff: 3; MineAfforestWork: 1800; TransTerrain: - 1;
1069 TransWork: 0; FoodRes: (0, 3, 0); ProdRes: (1, 1, 0);
1070 TradeRes: (0, 4, 0)), { Arc }
1071 (MoveCost: 2; Defense: 6; ClearTerrain: fGrass; IrrEff: 0; IrrClearWork: 2400;
1072 AfforestTerrain: fForest; MineEff: 0; MineAfforestWork: 2400;
1073 TransTerrain: fHills; TransWork: 3000; FoodRes: (1, 1, 1); ProdRes: (0, 4, 1);
1074 TradeRes: (1, 1, 5)), { Swa }
1075 (), { - }
1076 (MoveCost: 2; Defense: 6; ClearTerrain: fPrairie; IrrEff: 0;
1077 IrrClearWork: 600; AfforestTerrain: - 1; MineEff: 0; MineAfforestWork: 0;
1078 TransTerrain: - 1; TransWork: 0; FoodRes: (1, 3, 1); ProdRes: (2, 2, 2);
1079 TradeRes: (1, 1, 4)), { For }
1080 (MoveCost: 2; Defense: 8; ClearTerrain: - 1; IrrEff: 1; IrrClearWork: 600;
1081 AfforestTerrain: - 1; MineEff: 3; MineAfforestWork: 1200;
1082 TransTerrain: fGrass; TransWork: 6000; FoodRes: (1, 1, 1); ProdRes: (0, 0, 2);
1083 TradeRes: (0, 4, 0)), { Hil }
1084 (MoveCost: 3; Defense: 12; ClearTerrain: - 1; IrrEff: 0; IrrClearWork: 0;
1085 AfforestTerrain: - 1; MineEff: 2; MineAfforestWork: 1200; TransTerrain: - 1;
1086 TransWork: 0; FoodRes: (0, 0, 0); ProdRes: (1, 4, 1);
1087 TradeRes: (0, 0, 7))); { Mou }
1088
1089// settler work required MP
1090PillageWork = 100;
1091CityWork = 900;
1092FarmWork = 3; // *IrrClearWork
1093RoadWork = 300; // *MoveCost
1094RoadBridgeWork = 900;
1095RRWork = 600; // *MoveCost
1096RRBridgeWork = 900;
1097CanalWork = 1800;
1098FortWork = 600; // *MoveCost
1099BaseWork = 600; // *MoveCost
1100PollWork = 1800;
1101
1102// upgrades for new unit models
1103// upgrade[domain,0].preq is domain precondition advance
1104// cost values accumulate if prerequisite is future tech / are maximized if not
1105nUpgrade = 15;
1106upgrade:
1107array [0 .. nDomains - 1, 0 .. nUpgrade - 1] of record Preq, Strength, Trans,
1108 Cost: integer
1109end
1110= (((Preq: adWarriorCode; Strength: 4; Trans: 0;
1111 Cost: 3), (Preq: adBronzeWorking; Strength: 2; Trans: 0;
1112 Cost: 4), (Preq: adIronWorking; Strength: 2; Trans: 0;
1113 Cost: 5), (Preq: adChivalry; Strength: 2; Trans: 0;
1114 Cost: 5), (Preq: adMonotheism; Strength: 3; Trans: 0;
1115 Cost: 7), (Preq: adGunpowder; Strength: 3; Trans: 0;
1116 Cost: 8), (Preq: adExplosives; Strength: 4; Trans: 0;
1117 Cost: 9), (Preq: adTactics; Strength: 5; Trans: 0; Cost: 10), (Preq: adRadio;
1118 Strength: 6; Trans: 0; Cost: 11), (Preq: adDemocracy; Strength: 6; Trans: 0;
1119 Cost: 5), (Preq: adMobileWarfare; Strength: 7; Trans: 0;
1120 Cost: 12), (Preq: adRobotics; Strength: 8; Trans: 0;
1121 Cost: 15), (Preq: adComposites; Strength: 8; Trans: 0;
1122 Cost: 15), (Preq: adTheLaser; Strength: 8; Trans: 0;
1123 Cost: 14), (Preq: futMaterialTechnology; Strength: 10; Trans: 0; Cost: 2)),
1124 ((Preq: adMapMaking; Strength: 4; Trans: 1; Cost: 8), (Preq: adNavigation;
1125 Strength: 4; Trans: 0; Cost: 10), (Preq: adEngineering; Strength: 0; Trans: 1;
1126 Cost: 8), (Preq: adGunpowder; Strength: 8; Trans: 0;
1127 Cost: 12), (Preq: adMagnetism; Strength: 12; Trans: 1;
1128 Cost: 20), (Preq: adExplosives; Strength: 16; Trans: 0;
1129 Cost: 24), (Preq: adSteamEngine; Strength: 24; Trans: 0;
1130 Cost: 28), (Preq: adAmphibiousWarfare; Strength: 24; Trans: 1;
1131 Cost: 18), (Preq: adAdvancedRocketry; Strength: 32; Trans: 0;
1132 Cost: 38), (Preq: futMaterialTechnology; Strength: 14; Trans: 0;
1133 Cost: 4), (Preq: futArtificialIntelligence; Strength: 14; Trans: 0;
1134 Cost: 4), (Preq: preNA), (Preq: preNA), (Preq: preNA), (Preq: preNA)),
1135 ((Preq: adFlight; Strength: 12; Trans: 1; Cost: 14), (Preq: adTactics;
1136 Strength: 6; Trans: 0; Cost: 17), (Preq: adElectronics; Strength: 6; Trans: 0;
1137 Cost: 20), (Preq: adMin; Strength: 8; Trans: 0; Cost: 24),
1138 (Preq: adComposites; Strength: 8; Trans: 0; Cost: 26), (Preq: adSmartWeapons;
1139 Strength: 11; Trans: 0; Cost: 32), (Preq: futArtificialIntelligence;
1140 Strength: 7; Trans: 0; Cost: 4), (Preq: preNA), (Preq: preNA), (Preq: preNA),
1141 (Preq: preNA), (Preq: preNA), (Preq: preNA), (Preq: preNA), (Preq: preNA)));
1142
1143{ model features }
1144nFeature = 27;
1145mcWeapons = 0;
1146mcArmor = 1;
1147mcMob = 2;
1148mcSeaTrans = 3;
1149mcCarrier = 4;
1150mcTurbines = 5;
1151mcBombs = 6;
1152mcFuel = 7;
1153mcAirTrans = 8;
1154mcNav = 9;
1155mcRadar = 10;
1156mcSub = 11;
1157mcArtillery = 12;
1158mcAlpine = 13;
1159mcSupplyShip = 14;
1160mcOver = 15;
1161mcAirDef = 16;
1162mcSpy = 17;
1163mcSE = 18;
1164mcNP = 19;
1165mcJet = 20;
1166mcStealth = 21;
1167mcFanatic = 22;
1168mcFirst = 23;
1169mcWill = 24;
1170mcAcademy = 25;
1171mcLine = 26;
1172mcFirstNonCap = mcNav;
1173AutoFeature:
1174Set of mcFirstNonCap .. nFeature - 1 = [mcNav, mcSE, mcNP, mcJet, mcAcademy];
1175// unit class advances, automatically applied if available
1176
1177Feature:
1178array [0 .. nFeature - 1] of { unit model features }
1179 record Domains, Preq, Weight, Cost: integer;
1180end
1181= ((Domains: 7; Preq: preNone; Weight: 1; Cost: 1), { mcOffense }
1182 (Domains: 7; Preq: preNone; Weight: 1; Cost: 1), { mcDefense }
1183 (Domains: 1; Preq: adHorsebackRiding; Weight: 1; Cost: 1), { mcMob }
1184 (Domains: 2; Preq: preNone; Weight: 2; Cost: 1), { mcSeaTrans }
1185 (Domains: 2; Preq: adAdvancedFlight; Weight: 2; Cost: 2), { mcCarrier }
1186 (Domains: 2; Preq: adPhysics; Weight: 3; Cost: 1), { mcTurbines }
1187 (Domains: 4; Preq: adAdvancedFlight; Weight: 1; Cost: 1), { mcBombs }
1188 (Domains: 4; Preq: preNone; Weight: 1; Cost: 1), { mcFuel }
1189 (Domains: 4; Preq: adCombinedArms; Weight: 2; Cost: 1), { mcAirTrans }
1190 (Domains: 2; Preq: adNavigation; Weight: 0; Cost: 0), { mcNav }
1191 (Domains: 2; Preq: adRadio; Weight: 0; Cost: 1), { mcRadar }
1192 (Domains: 2; Preq: adCombustionEngine; Weight: 2; Cost: 1), { mcSub }
1193 (Domains: 3; Preq: adBallistics; Weight: 1; Cost: 1), { mcArtillery }
1194 (Domains: 1; Preq: adTactics; Weight: 2; Cost: 1), { mcAlpine }
1195 (Domains: 2; Preq: adMedicine; Weight: 1; Cost: 1), { mcSupplyShip }
1196 (Domains: 1; Preq: adBridgeBuilding; Weight: 0; Cost: 2), { mcOver }
1197 (Domains: 2; Preq: adAdvancedRocketry; Weight: 1; Cost: 1), { mcAirDef }
1198 (Domains: 4; Preq: adIntelligence; Weight: 2; Cost: 1), { mcSpy }
1199 (Domains: 2; Preq: adSteamEngine; Weight: 0; Cost: 0), { mcSE }
1200 (Domains: 2; Preq: adNuclearPower; Weight: 0; Cost: 0), { mcNP }
1201 (Domains: 4; Preq: adRocketry; Weight: 0; Cost: 0), { mcJet }
1202 (Domains: 4; Preq: adStealth; Weight: 1; Cost: 2), { mcStealth }
1203 (Domains: 5; Preq: adCommunism; Weight: 0; Cost: 1), { mcFanatic }
1204 (Domains: 1; Preq: preSun; Weight: 0; Cost: 1), { mcFirst }
1205 (Domains: 1; Preq: preSun; Weight: 0; Cost: 1), { mcWill }
1206 (Domains: 1; Preq: preSun; Weight: 0; Cost: 0), { mcAcademy }
1207 (Domains: 7; Preq: adMassProduction; Weight: 0; Cost: 0)); { mcLine }
1208
1209WeightPreq7:
1210array [0 .. nDomains - 1] of integer = (adHorsebackRiding, adSeafaring,
1211 adAdvancedFlight);
1212WeightPreq10:
1213array [0 .. nDomains - 1] of integer = (adAutomobile, adSteel, preNA);
1214
1215INFIN = 999999;
1216
1217// for backward compatibility
1218fRare = fDeadLands;
1219fRare1 = fCobalt;
1220fRare2 = fUranium;
1221mkCaravan = mkFreight;
1222mkDiplomat = mkCommando;
1223gLybertarianism = gFuture;
1224adIntelligenArms = adSmartWeapons;
1225adIntelligentArms = adSmartWeapons;
1226adRadioCommunication = adRadio;
1227adLybertarianism = adInternet;
1228futResearchTechnology = futComputingTechnology;
1229futProductionTechnology = futNanoTechnology;
1230futArmorTechnology = futMaterialTechnology;
1231futMissileTechnology = futArtificialIntelligence;
1232imNatObs = imObservatory;
1233imElite = imMilAcademy;
1234mcOffense = mcWeapons;
1235mcDefense = mcArmor;
1236mcLongRange = mcArtillery;
1237mcHospital = mcSupplyShip;
1238
1239type
1240 TServerCall = function(Command, Player, Subject: integer; var Data)
1241 : integer; stdcall;
1242 TClientCall = procedure(Command, Player: integer; var Data); stdcall;
1243 TGiveAdviceCall = procedure(Text: PChar;
1244 Nation, CityID, Loc: integer); stdcall;
1245
1246 TUn = packed record
1247 Loc, { location }
1248 Status, // free for AI use
1249 SavedStatus: LongInt; // for server internal use only
1250 ID: word; // unit number, never changes, unique within this nation
1251 mix, { model index }
1252 Home, { home city index, -1 if none }
1253 Master, { index of transporting unit, -1 if none }
1254 Movement: SmallInt; { movement left for this turn }
1255 Health, // = 100-Damage
1256 Fuel: ShortInt;
1257 Job, { current terrain improvement job }
1258 Exp, { micro experience, the level is Exp div ExpCost }
1259 TroopLoad, { number of transported ground units }
1260 AirLoad: Byte; // number of transported air units
1261 Flags: Cardinal;
1262 end;
1263
1264 TCity = packed record
1265 Loc, { location }
1266 Status, // free for AI use
1267 SavedStatus: LongInt; // for server internal use only
1268 ID, // founding player shl 12 + number, never changes, unique within the whole game
1269 Size: word;
1270 Project, // current production project, see city project flags
1271 Project0, // for server use only
1272 Food, // collected food in storage
1273 Pollution, // collected pollution in dump
1274 Prod, // for project collected production points
1275 Prod0: SmallInt;
1276 // for project collected production points in the beginning of the turn
1277 Flags, // what happened within the last turnaround
1278 Tiles, { currently by city exploited tiles, bitset with index
1279 (dy+3) shl 2+(dx+3) shr 1, (dx,dy) relative to central tile }
1280 N1: Cardinal; // reserved for future use
1281 Built: array [0 .. (nImp + 3) div 4 * 4 - 1] of ShortInt;
1282 // array value =1 indicates built improvement
1283 end;
1284
1285 TModel = packed record
1286 Status, // free for AI use
1287 SavedStatus: LongInt; // for server internal use only
1288 ID, // developing player shl 12 + number, never changes, unique within the whole game
1289 IntroTurn, Built, // units built with this model
1290 Lost: word; // units of this model lost in combat
1291 Kind, Domain: Byte;
1292 Attack, Defense, Speed, Cost, MStrength: word;
1293 // construction time multipliers, only valid if kind is mkSelfDeveloped or mkEnemyDeveloped
1294 MTrans, MCost, Weight, MaxWeight: Byte;
1295 // weight and maximum weight (construction time)
1296 Upgrades, // bitarray indicating all upgrades
1297 Flags: Cardinal;
1298 Cap: array [0 .. (nFeature + 3) div 4 * 4 - 1] of Byte; // special features
1299 end;
1300
1301 TUnitInfo = packed record
1302 Loc: LongInt;
1303 mix, // index of unit model for its owner
1304 emix: word; // index in enemy model list
1305 Owner: Byte;
1306 Health, // = 100-Damage
1307 Fuel: ShortInt;
1308 Job, // current terrain improvement job
1309 Exp, { micro experience, the level is Exp div ExpCost }
1310 Load: Byte; { number of transported units }
1311 Flags: word end;
1312
1313 TCityInfo = packed record Loc, Status, // free for AI use
1314 SavedStatus: LongInt; // for server internal use only
1315 Owner, // last known owner, even if not alive anymore!
1316 ID, // founding player <<12 + number, never changes, unique within the whole game
1317 Size, Flags: word;
1318 end;
1319
1320 TModelInfo = packed record
1321 Owner, // Player which owns the model
1322 mix, // index of unit model for its owner
1323 ID: word; // developing player shl 12 + number, never changes, unique within the whole game
1324 Kind, Domain: Byte;
1325 Attack, Defense, Speed, Cost: word;
1326 TTrans, // ground unit transport capability
1327 ATrans_Fuel: Byte; // air unit transport capability resp. fuel
1328 Bombs: word; // additional attack with bombs
1329 Cap: Cardinal; // special features, bitset with index Feature-mcFirstNonCap
1330 MaxUpgrade, // maximum used upgrade
1331 Weight: Byte;
1332 Lost: word;
1333 end;
1334
1335 TBattle = packed record
1336 Enemy, Flags: Byte;
1337 Turn, mix, mixEnemy: word;
1338 ToLoc, FromLoc: integer;
1339 end;
1340
1341 TWonderInfo = record
1342 CityID, // -2 if destroyed, -1 if never completed, >=0 ID of city
1343 EffectiveOwner: integer
1344 // owning player if effective, -1 if expired or not built
1345 end;
1346
1347 TShipInfo = record Parts: array [0 .. nShipPart - 1] of integer;
1348 end;
1349
1350 TEnemyReport = record
1351 TurnOfContact, TurnOfCivilReport, TurnOfMilReport, Attitude,
1352 Credibility: integer; // 0..100, last update: ToC
1353 Treaty: array [0 .. nPl - 1] of integer;
1354 // diplomatic status with other nations, last update: ToCR
1355 Government, // gAnarchy..gDemocracy, last update: ToCR
1356 Money, // last update: ToCR
1357 ResearchTech, ResearchDone: integer; // last update: ToCR
1358 Tech: array [0 .. (nAdv + 3) div 4 * 4 - 1] of ShortInt;
1359 // tech status indicator, last update: ToCR
1360 nModelCounted: integer;
1361 // number of models with info in UnCount, last update: ToMR
1362 UnCount: array [0 .. INFIN] of word;
1363 // number of available units for each model, last update: ToMR
1364 end;
1365
1366 TMoveAdviceData = record
1367 ToLoc, nStep, MoreTurns, MaxHostile_MovementLeft: integer;
1368 dx, dy: array [0 .. 24] of integer;
1369 end;
1370
1371 TPlaneReturnData = record
1372 Loc, Fuel, Movement: integer;
1373 end;
1374
1375 TTileInfo = record
1376 Food, Prod, Trade, ExplCity: integer end;
1377 TCityReport = record HypoTiles, HypoTax, HypoLux, Working, Happy, FoodRep,
1378 ProdRep, Trade, PollRep, Corruption, Tax, Lux, Science, Support, Eaten,
1379 ProdCost, Storage, Deployed: integer;
1380 end;
1381
1382 TCityReportNew = record
1383 HypoTiles,
1384 // tiles that should be considered as exploited (for the current adjustment, set this to -1 or to TCity.Tiles of the city)
1385 HypoTaxRate, HypoLuxuryRate,
1386 // tax and luxury rate that should be assumed (for current rates, set this to -1 or to RO.TaxRate resp. RO.LuxRate)
1387 Morale, FoodSupport, MaterialSupport,
1388 // food and material taken for unit support
1389 ProjectCost, // material cost of current project
1390 Storage, // size of food storage
1391 Deployed, // number of units causing unrest (unrest=2*deployed)
1392 CollectedControl, CollectedFood, CollectedMaterial, CollectedTrade,
1393 // raw control, food, material and trade as collected by the citizens
1394 Working, // number of exploited tiles including city tile
1395 FoodSurplus, Production, AddPollution,
1396 // food surplus, production gain and pollution after all effects
1397 Corruption, Tax, Science, Luxury,
1398 // corruption, tax, science and wealth after all effects
1399 HappinessBalance: integer;
1400 // = (Morale+Wealth+Control) - (Size+Unrest), value < 0 means disorder
1401 end;
1402
1403 TCityTileAdviceData = record
1404 ResourceWeights, Tiles: Cardinal;
1405 CityReport: TCityReport;
1406 end;
1407
1408 TGetCityData = record
1409 Owner: integer;
1410 c: TCity end;
1411 TCityAreaInfo = record Available: array [0 .. 26] of integer;
1412 end;
1413
1414 TUnitReport = record
1415 FoodSupport, ProdSupport, ReportFlags: integer;
1416 end;
1417
1418 TJobProgressData = array [0 .. nJob - 1] of record Required, Done,
1419 NextTurnPlus: integer;
1420end;
1421TBattleForecast = record pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement,
1422 EndHealthDef, EndHealthAtt: integer;
1423end;
1424TBattleForecastEx = record pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement,
1425 EndHealthDef, EndHealthAtt: integer; // must be same as in TBattleForecast
1426AStr, DStr, ABaseDamage, DBaseDamage: integer;
1427end;
1428TShowMove = record Owner, Health, mix, emix, Flags, FromLoc, dx, dy, EndHealth,
1429 EndHealthDef, Fuel, Exp, Load: integer;
1430end;
1431TShowShipChange = record Reason, Ship1Owner, Ship2Owner: integer;
1432Ship1Change, Ship2Change: array [0 .. nShipPart - 1] of integer;
1433end;
1434TOffer = record nDeliver, nCost: integer;
1435Price:
1436array [0 .. 11] of Cardinal;
1437end;
1438TChart = array [0 .. INFIN] of integer;
1439TEditTileData = record Loc, NewTile: integer
1440end;
1441TCreateUnitData = record Loc, p, mix: integer;
1442end;
1443
1444TTileList = array [0 .. INFIN] of Cardinal;
1445TTileObservedLastList = array [0 .. INFIN] of SmallInt;
1446TOwnerList = array [0 .. INFIN] of ShortInt;
1447TByteList = array [0 .. INFIN] of Byte;
1448TCityList = array [0 .. INFIN] of TCity;
1449TUnList = array [0 .. INFIN] of TUn;
1450TModelList = array [0 .. INFIN] of TModel;
1451TEnemyUnList = array [0 .. INFIN] of TUnitInfo;
1452TEnemyCityList = array [0 .. INFIN] of TCityInfo;
1453TEnemyModelList = array [0 .. INFIN] of TModelInfo;
1454TBattleList = array [0 .. INFIN] of TBattle;
1455
1456TPlayerContext = record Data: pointer;
1457Map:
1458^TTileList;
1459{ the playground, a list of tiles with index = location, see tile flags }
1460MapObservedLast:
1461^TTileObservedLastList;
1462// turn in which the tile was observed last, index = location
1463Territory:
1464^TOwnerList; // nation to which's territory a tile belongs, -1 indicates none
1465Un:
1466^TUnList; { units }
1467City:
1468^TCityList; { cities }
1469Model:
1470^TModelList; { unit models }
1471EnemyUn:
1472^TEnemyUnList; // known units of enemy players
1473EnemyCity:
1474^TEnemyCityList; // known cities of enemy players
1475EnemyModel:
1476^TEnemyModelList; // known unit models of enemy players
1477EnemyReport:
1478array [0 .. nPl - 1] of ^TEnemyReport;
1479
1480TestFlags, // options turned on in the "Manipulation" menu
1481Turn, // current turn
1482Alive, { bitset of IDs of players still alive, flag 1 shl p for player p }
1483Happened, // flags indicate what happened within the last turnaround
1484AnarchyStart, // start turn of anarchy, <0 if not in anarchy
1485Credibility, // own credibility
1486MaxCredibility, // maximum credibility still to achieve
1487nUn, { number of units }
1488nCity, { number of cities }
1489nModel, { number of developed unit models }
1490nEnemyUn, nEnemyCity, nEnemyModel, Government, { gAnarchy..gDemocracy }
1491Money, TaxRate, LuxRate, Research,
1492{ collected research points for currently researched tech }
1493ResearchTech: integer; // currently researched tech
1494DevModel:
1495TModel; { unit model currently under development }
1496Tech:
1497array [0 .. (nAdv + 3) div 4 * 4 - 1] of ShortInt; { tech status indicator }
1498Attitude:
1499array [0 .. nPl - 1] of integer; // attitude to other nations
1500Treaty:
1501array [0 .. nPl - 1] of integer; // treaty with other nations
1502EvaStart:
1503array [0 .. nPl - 1] of integer; // peace treaty: start of evacuation period
1504Tribute:
1505array [0 .. nPl - 1] of integer; // no longer in use
1506TributePaid:
1507array [0 .. nPl - 1] of integer; // no longer in use
1508Wonder:
1509array [0 .. 27] of TWonderInfo;
1510Ship:
1511array [0 .. nPl - 1] of TShipInfo;
1512NatBuilt:
1513array [28 .. (nImp + 3) div 4 * 4 - 1] of ShortInt;
1514nBattleHistory:
1515integer;
1516BattleHistory:
1517^TBattleList; // complete list of all my battles in the whole game
1518BorderHelper:
1519^TByteList;
1520LastCancelTreaty:
1521array [0 .. nPl - 1] of integer; // turn of last treaty cancel
1522OracleIncome:
1523integer;
1524Filler:
1525array [0 .. 883] of Byte;
1526end;
1527
1528TInitModuleData = record Server: TServerCall;
1529DataVersion, DataSize, Flags: integer;
1530end;
1531TInitAdvisorData = record Server: TServerCall;
1532GiveAdvice:
1533TGiveAdviceCall;
1534end;
1535TNewGameData = record lx, ly, LandMass, MaxTurn: integer;
1536Difficulty:
1537array [0 .. nPl - 1] of integer;
1538{ difficulty levels of the players, if it's 0 this player is the supervisor,
1539 -1 for unused slots }
1540RO:
1541array [0 .. nPl - 1] of ^TPlayerContext;
1542end;
1543TNewGameExData = record lx, ly, LandMass, MaxTurn, RND: integer;
1544Difficulty:
1545array [0 .. nPl - 1] of integer;
1546{ difficulty levels of the players, if it's 0 this player is the supervisor,
1547 -1 for unused slots }
1548Controlled:
1549integer;
1550end;
1551TShowNegoData = record pSender, pTarget, Action: integer;
1552Offer:
1553TOffer;
1554end;
1555
1556const
1557 { predefined unit models: }
1558 nSpecialModel = 9;
1559 SpecialModel: array [0 .. nSpecialModel - 1] of TModel = ((Status: 0;
1560 SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0; Kind: mkSettler;
1561 Domain: dGround; Attack: 0; Defense: 10; Speed: 150; Cost: 40; MStrength: 0;
1562 MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0; Upgrades: 0; Flags: 0;
1563 Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1564 0, 0, 0, 0, 0)), { Settlers }
1565 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1566 Kind: mkSettler; Domain: dGround; Attack: 0; Defense: 20; Speed: 300;
1567 Cost: 40; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;
1568 Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1569 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Engineers }
1570 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1571 Kind: mkSelfDeveloped; Domain: dGround; Attack: 6; Defense: 6; Speed: 150;
1572 Cost: 10; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;
1573 Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1574 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Militia }
1575 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1576 Kind: mkSpecial_TownGuard; Domain: dGround; Attack: 4; Defense: 6;
1577 Speed: 150; Cost: 20; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0;
1578 MaxWeight: 0; Upgrades: 0; Flags: 0;
1579 Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1580 0, 0, 0, 0, 0)), { Town Guard }
1581 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1582 Kind: mkDiplomat; Domain: dGround; Attack: 12; Defense: 12; Speed: 250;
1583 Cost: 20; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;
1584 Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1585 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Special Commando }
1586 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1587 Kind: mkCaravan; Domain: dGround; Attack: 0; Defense: 6; Speed: 150;
1588 Cost: 60; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;
1589 Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Freight }
1591 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1592 Kind: mkSpecial_Boat; Domain: dSea; Attack: 0; Defense: 3; Speed: 250;
1593 Cost: 20; MStrength: 0; MTrans: 1; MCost: 0; Weight: 0; MaxWeight: 0;
1594 Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Longboat }
1596 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1597 Kind: mkSlaves; Domain: dGround; Attack: 0; Defense: 15; Speed: 150;
1598 Cost: 40; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;
1599 Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1600 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), { Slaves }
1601 { (Status:0;SavedStatus:0;ID:0;IntroTurn:0;Built:0;Lost:0;
1602 Kind:mkSpecial_Carriage;Domain:dGround;Attack:50;Defense:30;Speed:250;Cost:50;
1603 MStrength:0;MTrans:0;MCost:0;Weight:0;MaxWeight:0;Upgrades:0;Flags:0;
1604 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)), }
1605 { (Status:0;SavedStatus:0;ID:0;IntroTurn:0;Built:0;Lost:0;
1606 Kind:mkSpecial_SubCabin;Domain:dSea;Attack:16;Defense:1;Speed:350;Cost:40;
1607 MStrength:0;MTrans:0;MCost:0;Weight:0;MaxWeight:0;Upgrades:0;Flags:0;
1608 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)), }
1609 (Status: 0; SavedStatus: 0; ID: 0; IntroTurn: 0; Built: 0; Lost: 0;
1610 Kind: mkSpecial_Glider; Domain: dAir; Attack: 6; Defense: 6; Speed: 450;
1611 Cost: 30; MStrength: 0; MTrans: 0; MCost: 0; Weight: 0; MaxWeight: 0;
1612 Upgrades: 0; Flags: 0; Cap: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1613 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
1614
1615 SpecialModelPreq: array [0 .. nSpecialModel - 1] of integer = (preNone,
1616 adExplosives, preNone, preNone, (* adWri, *) adIntelligence, adTrade,
1617 (* adTheCorporation,adHorsebackRiding,adAutomobile,adNavigation,
1618 adCombustionEngine, *) adMapMaking, preBuilder,
1619 { preLeo,preLighthouse, } preLeo);
1620
1621procedure MakeUnitInfo(p: integer; const u: TUn; var ui: TUnitInfo);
1622 procedure MakeModelInfo(p, mix: integer; const m: TModel; var mi: TModelInfo);
1623 function IsSameModel(const mi1, mi2: TModelInfo): boolean;
1624 function SpecialTile(Loc, TerrType, lx: integer): integer;
1625
1626implementation
1627
1628procedure MakeUnitInfo(p: integer; const u: TUn; var ui: TUnitInfo);
1629begin
1630 ui.Owner := p;
1631 ui.Loc := u.Loc;
1632 ui.Health := u.Health;
1633 ui.Fuel := u.Fuel;
1634 ui.Job := u.Job;
1635 ui.Exp := u.Exp;
1636 ui.Load := u.TroopLoad + u.AirLoad;
1637 ui.mix := u.mix;
1638 ui.Flags := u.Flags;
1639end;
1640
1641procedure MakeModelInfo(p, mix: integer; const m: TModel; var mi: TModelInfo);
1642var
1643 i: integer;
1644begin
1645 mi.Owner := p;
1646 mi.mix := mix;
1647 mi.Domain := m.Domain;
1648 if m.Kind = mkEnemyDeveloped then
1649 mi.Kind := mkSelfDeveloped // important for IsSameModel()
1650 else
1651 mi.Kind := m.Kind;
1652 mi.Attack := m.Attack;
1653 mi.Defense := m.Defense;
1654 mi.Speed := m.Speed;
1655 mi.Cost := m.Cost;
1656 if mi.Domain = dAir then
1657 begin
1658 mi.TTrans := m.Cap[mcAirTrans] * m.MTrans;
1659 mi.ATrans_Fuel := m.Cap[mcFuel];
1660 end
1661 else
1662 begin
1663 mi.TTrans := m.Cap[mcSeaTrans] * m.MTrans;
1664 mi.ATrans_Fuel := m.Cap[mcCarrier] * m.MTrans;
1665 end;
1666 mi.Bombs := m.Cap[mcBombs] * m.MStrength * 2;
1667 mi.Cap := 0;
1668 for i := mcFirstNonCap to nFeature - 1 do
1669 if m.Cap[i] > 0 then
1670 mi.Cap := mi.Cap or (1 shl (i - mcFirstNonCap));
1671 mi.MaxUpgrade := 0;
1672 for i := 1 to nUpgrade - 1 do
1673 if m.Upgrades and (1 shl i) <> 0 then
1674 mi.MaxUpgrade := i;
1675 mi.Weight := m.Weight;
1676 mi.Lost := 0;
1677end;
1678
1679function IsSameModel(const mi1, mi2: TModelInfo): boolean;
1680type
1681 TModelInfo_Compare = array [0 .. 5] of Cardinal;
1682var
1683 Compare1, Compare2: ^TModelInfo_Compare;
1684begin
1685 Compare1 := @mi1;
1686 Compare2 := @mi2;
1687 result := (Compare1[1] and $FFFF0000 = Compare2[1] and $FFFF0000) and
1688 (Compare1[2] = Compare2[2]) and (Compare1[3] = Compare2[3]) and
1689 (Compare1[4] = Compare2[4]) and (Compare1[5] = Compare2[5])
1690end;
1691
1692function SpecialTile(Loc, TerrType, lx: integer): integer;
1693var
1694 x, y, qx, qy, a: integer;
1695begin
1696 if TerrType = fOcean then
1697 result := 0
1698 else
1699 begin
1700 y := Loc div lx;
1701 x := Loc - y * lx;
1702 if TerrType = fGrass then { formula for productive grassland }
1703 if Odd((lymax + x - y shr 1) shr 1 + x + (y + 1) shr 1) then
1704 result := 1
1705 else
1706 result := 0
1707 else { formula for special resources }
1708 begin
1709 a := 4 * x - y + 9980;
1710 qx := a div 10;
1711 if (qx * 10 = a) and (qx and 3 <> 0) then
1712 begin
1713 qy := (y + x) div 5;
1714 if qy and 3 <> qx shr 2 and 1 * 2 then
1715 if (TerrType = fArctic) or (TerrType = fSwamp) then
1716 result := 1
1717 else if TerrType = fShore then
1718 begin
1719 if (qx + qy) and 1 = 0 then
1720 if qx and 3 = 2 then
1721 result := 2
1722 else
1723 result := 1
1724 else
1725 result := 0
1726 end
1727 else
1728 result := (qx + qy) and 1 + 1
1729 else
1730 result := 0;
1731 end
1732 else
1733 result := 0;
1734 end
1735 end;
1736end;
1737
1738begin
1739 assert(sizeof(TPlayerContext) = 2048);
1740 assert(sizeof(TModel) - 2 * sizeof(LongInt) - 4 * sizeof(word)
1741 = sIntSetDevModel and $F * 4);
1742
1743end.
Note: See TracBrowser for help on using the repository browser.