Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CivGame/CivState/Definitions/UnitEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public enum UnitEnum
Transport = 24,
Nuclear = 25,
Diplomat = 26,
Caravan = 27
Caravan = 27,
Max
}
}
6 changes: 3 additions & 3 deletions src/CivGame/CivState/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public class Player
// Units
public short UnitCount = 0;
public short SettlerCount = 0;
public short[] ActiveUnits = new short[28];
public short[] ActiveUnits = new short[(int)UnitEnum.Max];
public short[] UnitsDestroyed = new short[8];
public Unit[] Units = new Unit[129];
public short[] UnitsInProduction = new short[28];
public short[] LostUnits = new short[28];
public short[] UnitsInProduction = new short[(int)UnitEnum.Max];
public short[] LostUnits = new short[(int)UnitEnum.Max];

// Strategic locations
public StrategicLocation[] StrategicLocations = new StrategicLocation[16];
Expand Down
4 changes: 2 additions & 2 deletions src/CivGame/Game/CityWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ public ushort F0_1d12_0045_ProcessCityState(short cityID, short flag)
}
}

if (city.CurrentProductionID == 25 && this.oParent.CivState.Players[this.Var_6548_PlayerID].ActiveUnits[25] == 1)
if (city.CurrentProductionID == 25 && this.oParent.CivState.Players[this.Var_6548_PlayerID].ActiveUnits[(int)UnitEnum.Nuclear] == 1)
{
this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ContactPlayerCountdown = -1;
}
Expand Down Expand Up @@ -1362,7 +1362,7 @@ public ushort F0_1d12_0045_ProcessCityState(short cityID, short flag)
0, this.oParent.CivState.Players[this.Var_6548_PlayerID].Coins / 3);
}

if (city.CurrentProductionID >= 0 && city.StatusFlag == 0x19 && this.oParent.CivState.Players[this.Var_6548_PlayerID].ActiveUnits[25] == 0 && city.ShieldsCount != 0)
if (city.CurrentProductionID >= 0 && city.StatusFlag == 0x19 && this.oParent.CivState.Players[this.Var_6548_PlayerID].ActiveUnits[(int)UnitEnum.Nuclear] == 0 && city.ShieldsCount != 0)
{
// Instruction address 0x1d12:0x260d, size: 5
local_cc = this.oParent.Segment_2dc4.F0_2dc4_007c_CheckValueRange(
Expand Down
22 changes: 11 additions & 11 deletions src/CivGame/Game/MeetWithKing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
if (this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].Ranking != 7 ||
this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].CityCount <= 4 ||
this.oParent.CivState.Players[playerID].CityCount <= 1 ||
this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[25] != 0 ||
this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[(int)UnitEnum.Nuclear] != 0 ||
this.oParent.CivState.TurnCount <= 200)
{
this.oCPU.AX.Word = 0;
Expand Down Expand Up @@ -263,7 +263,7 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
if (this.oCPU.Flags.LE) goto L02a0;

L0267:
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[25];
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[(int)UnitEnum.Nuclear];

this.oCPU.AX.Word = this.oCPU.OR_UInt16(this.oCPU.AX.Word, this.oCPU.AX.Word);
if (this.oCPU.Flags.NE) goto L02a0;
Expand All @@ -282,7 +282,7 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].ActiveUnits[25] == 0)
if (this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear] == 0)
goto L02c1;

this.oCPU.SI.Word = (ushort)playerID;
Expand All @@ -299,9 +299,9 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].ActiveUnits[25] == 0) goto L02fb;
if (this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear] == 0) goto L02fb;

this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[25];
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[(int)UnitEnum.Nuclear];

this.oCPU.AX.Word = this.oCPU.OR_UInt16(this.oCPU.AX.Word, this.oCPU.AX.Word);
if (this.oCPU.Flags.NE) goto L02fb;
Expand All @@ -318,10 +318,10 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)this.oParent.CivState.HumanPlayerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[25] == 0)
if (this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[(int)UnitEnum.Nuclear] == 0)
goto L034c;

this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[playerID].ActiveUnits[25];
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear];

this.oCPU.AX.Word = this.oCPU.OR_UInt16(this.oCPU.AX.Word, this.oCPU.AX.Word);
if (this.oCPU.Flags.NE) goto L0321;
Expand All @@ -332,7 +332,7 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
this.oCPU.AX.Word = 0x38;
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)this.oParent.CivState.HumanPlayerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;
this.oCPU.CX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[25];
this.oCPU.CX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[(int)UnitEnum.Nuclear];
this.oCPU.AX.Word = this.oCPU.ReadUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0x6));
this.oCPU.CWD(this.oCPU.AX, this.oCPU.DX);
this.oCPU.AX.Word = this.oCPU.SUB_UInt16(this.oCPU.AX.Word, this.oCPU.DX.Word);
Expand All @@ -341,7 +341,7 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
this.oCPU.AX.Word = 0x38;
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.SI.Word = this.oCPU.AX.Word;
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[playerID].ActiveUnits[25];
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear];
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, this.oCPU.BX.Word);
this.oCPU.CWD(this.oCPU.AX, this.oCPU.DX);
this.oCPU.IDIV_UInt16(this.oCPU.AX, this.oCPU.DX, this.oCPU.CX.Word);
Expand Down Expand Up @@ -427,7 +427,7 @@ public void F6_0000_0000(short playerID, int xPos, int yPos, ushort param4)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].ActiveUnits[25] == 0)
if (this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear] == 0)
goto L0464;

this.oCPU.SI.Word = (ushort)this.oParent.CivState.HumanPlayerID;
Expand Down Expand Up @@ -2284,7 +2284,7 @@ public void F6_0000_1874(short playerID)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].ActiveUnits[25] != 0)
if (this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear] != 0)
{
// Instruction address 0x0000:0x1a32, size: 5
this.oParent.MSCAPI.strcat(0xba06, "Our words are backed\nwith NUCLEAR WEAPONS!\n");
Expand Down
2 changes: 1 addition & 1 deletion src/CivGame/Game/Segment_1238.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ public void F0_1238_0da1()
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)this.oParent.CivState.HumanPlayerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[25] != 0 ||
if (this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[(int)UnitEnum.Nuclear] != 0 ||
oParent.CivState.TurnCount <= 200) goto L0fe4;

this.oParent.Var_8078 = 1;
Expand Down
10 changes: 5 additions & 5 deletions src/CivGame/Game/Segment_1ade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ public ushort F0_1ade_0421(short playerID, short cityID)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].UnitsInProduction[27] > 0)
if (this.oParent.CivState.Players[playerID].UnitsInProduction[(int)UnitEnum.Caravan] > 0)
goto L0ed5;

// Instruction address 0x1ade:0x0e04, size: 5
Expand Down Expand Up @@ -1666,7 +1666,7 @@ public ushort F0_1ade_0421(short playerID, short cityID)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].ActiveUnits[0] != 0x0)
if (this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Settlers] != 0x0)
goto L0f53;

this.oCPU.CMP_UInt16(this.oCPU.ReadUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0x11a)), 0x1);
Expand All @@ -1686,10 +1686,10 @@ public ushort F0_1ade_0421(short playerID, short cityID)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.SI.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].ActiveUnits[25] >= 4)
if (this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear] >= 4)
goto L0f53;

if (this.oParent.CivState.Players[playerID].UnitsInProduction[25] >= 2)
if (this.oParent.CivState.Players[playerID].UnitsInProduction[(int)UnitEnum.Nuclear] >= 2)
goto L0f53;

L1009:
Expand All @@ -1707,7 +1707,7 @@ public ushort F0_1ade_0421(short playerID, short cityID)
this.oCPU.BX.Word = this.oCPU.AX.Word;

//this.oCPU.AX.Word = this.oCPU.ReadUInt16(this.oCPU.DS.Word, (ushort)(this.oCPU.BX.Word + 0xb3dc));
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[15];
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[this.oParent.CivState.HumanPlayerID].ActiveUnits[(int)UnitEnum.Bomber];

this.oCPU.CWD(this.oCPU.AX, this.oCPU.DX);
this.oCPU.AX.Word = this.oCPU.SUB_UInt16(this.oCPU.AX.Word, this.oCPU.DX.Word);
Expand Down
4 changes: 2 additions & 2 deletions src/CivGame/Game/Segment_2517.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1138,14 +1138,14 @@ public ushort F0_2517_0b1d(short playerID1, short playerID2)
goto L0b64;

L0b9b:
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[playerID2].ActiveUnits[25];
this.oCPU.AX.Word = (ushort)this.oParent.CivState.Players[playerID2].ActiveUnits[(int)UnitEnum.Nuclear];

this.oCPU.CX.Word = this.oCPU.AX.Word;
this.oCPU.AX.Word = 0x38;
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID1);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID1].ActiveUnits[25] < (short)this.oCPU.CX.Word)
if (this.oParent.CivState.Players[playerID1].ActiveUnits[(int)UnitEnum.Nuclear] < (short)this.oCPU.CX.Word)
goto L0b64;

this.oCPU.WriteUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0xa), 0x0);
Expand Down
4 changes: 2 additions & 2 deletions src/CivGame/Game/Segment_25fb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@ public ushort F0_25fb_0c9d(short playerID, short unitID)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, this.oCPU.ReadUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0x3a)));
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[this.oCPU.ReadUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0x3a))].ActiveUnits[25] != 0)
if (this.oParent.CivState.Players[this.oCPU.ReadUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0x3a))].ActiveUnits[(int)UnitEnum.Nuclear] != 0)
goto L1083;

this.oCPU.CMP_UInt16(this.oCPU.ReadUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0x5e)), this.oCPU.DI.Word);
Expand Down Expand Up @@ -1881,7 +1881,7 @@ public ushort F0_25fb_0c9d(short playerID, short unitID)
this.oCPU.IMUL_UInt16(this.oCPU.AX, this.oCPU.DX, (ushort)playerID);
this.oCPU.BX.Word = this.oCPU.AX.Word;

if (this.oParent.CivState.Players[playerID].ActiveUnits[25] <= 1)
if (this.oParent.CivState.Players[playerID].ActiveUnits[(int)UnitEnum.Nuclear] <= 1)
goto L16b3;

this.oCPU.AX.Word = this.oCPU.ReadUInt16(this.oCPU.SS.Word, (ushort)(this.oCPU.BP.Word - 0x34));
Expand Down
Loading