source: tags/1.3.6/Protocol.pas

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