[Civ2] Civilization II MGE User Interface Additions (CIV2UIA)

EDIT: Please ignore this post. I am having conflicting reports on whether MGE itself that is fundamentally incompatible with Deity+1. I cannot run it, with MGE, but some forum posts here say otherwise. I have no clue whether it's my executable that's the problem here... is anyone able to provide more info?

I always thought it was classic only, and treated it as such. That seemed to be the consensus in the community. It's been a few years since I've bothered with it, but based on the description in my video, the deity+ levels might work.

If you're eager for a more capable AI, maybe have a look at Test of Time Patch Project. We're doing events with the Lua programming language, and it might be possible to 'nudge' the AI into more capable play. (For example, by eliminating most production options for it in the build queue, so it only builds 'good' things.) Thus far, the efforts have been for building scenarios, but improving the AI in some areas seems possible.
 
I ask @FoxAhead if there's a way to keep the units in their original color instead of this grey shadow when you press "sleep" button. Estetically, It is a punch in the face seeing these grey figures around the map instead of the original color.
 
This is something we've been looking for. Something that runs on Windows 98 SE, and is able to fix massive CPU-usage problem among other things as well.

One of our team members has tested this launcher on his Windows 98 SE -laptop.

Other fixes tested so far:

Tim's patch crashes.
civ2patch gives the following error message: "Failed to allocate memory for dll injection."
civ2mge_cpu_fix_1 gives the following error message: "File XDELTA3.EXE is linked to a missing export function KERNEL32.DLL GetFileSizeEx."

But this one looks promising. Unfortunately, version 1.4 is the last one that worked. All of the newer versions crash with the two following messages:

Civ2uialauncher

Program has executed an illegal function and it will be ended.

If the problem does not disappear, contact the manufacturer of this program.

CIV2UIALAUNCHER caused an interrupt eedfadeH at module <unknown> at memory location 0000:00000000.
Registrys:
EAX=00000000 CS=0000 EIP=00000000 EFLGS=00000000
EBX=00000000 SS=0000 ESP=00000000 EBP=00000000
ECX=00000000 DS=0000 ESI=00000000 FS=0000
EDX=00000000 ES=0000 EDI=00000000 GS=0000
Bytes at memory location CS:EIP:
Heap dump:

&

Exception EOleException in module CIV2UIALAUNCHER.EXE at 0006FCD5. Class is not registered.

The laptop used for testing has 98lite Professional without web integration and it has Windows 95 shell.

We'll be following the progress of this project!
 
This is something we've been looking for. Something that runs on Windows 98 SE, and is able to fix massive CPU-usage problem among other things as well.

One of our team members has tested this launcher on his Windows 98 SE -laptop.

Other fixes tested so far:

Tim's patch crashes.
civ2patch gives the following error message: "Failed to allocate memory for dll injection."
civ2mge_cpu_fix_1 gives the following error message: "File XDELTA3.EXE is linked to a missing export function KERNEL32.DLL GetFileSizeEx."

But this one looks promising. Unfortunately, version 1.4 is the last one that worked. All of the newer versions crash with the two following messages:

Civ2uialauncher

Program has executed an illegal function and it will be ended.

If the problem does not disappear, contact the manufacturer of this program.

CIV2UIALAUNCHER caused an interrupt eedfadeH at module <unknown> at memory location 0000:00000000.
Registrys:
EAX=00000000 CS=0000 EIP=00000000 EFLGS=00000000
EBX=00000000 SS=0000 ESP=00000000 EBP=00000000
ECX=00000000 DS=0000 ESI=00000000 FS=0000
EDX=00000000 ES=0000 EDI=00000000 GS=0000
Bytes at memory location CS:EIP:
Heap dump:

&

Exception EOleException in module CIV2UIALAUNCHER.EXE at 0006FCD5. Class is not registered.

The laptop used for testing has 98lite Professional without web integration and it has Windows 95 shell.

We'll be following the progress of this project!
It seems that your system doesn't have ActiveX installed. May be it was stripped by 98lite? ActiveX module is used in this project for shortcut creation feature (button "Create shortcut...").
 
Is there any chance you would consider fixing the infamous Copper & Dye bug?

Back in the days, Samson released a fixed executable of Civilization II 2.4.2 which fixed it. Nowadays, most people are playing MGE, since it's the version that tends to be refitted for modern OSes. In MGE, the bug is so prevalent, it hurts the eyes. Make Caravans great again!
I swear I spent a lot of time inspecting this subroutine for commodities calculation, read Samson topics, comparing 2.4.2 version and its patch. But still doesn't figure out why is there a bug. At this point I don't have any ideas. May be later. If some one want to catch up here is the address of procedure: sub_43D400. And decompilation:
Spoiler Code :
Code:
void __cdecl sub_43D400(int aCity)
{
  int v1; // ebx
  int v2; // eax
  int v3; // eax
  int v4; // ecx
  int v5; // eax
  int v6; // ecx
  int v7; // eax
  int v8; // [esp+Ch] [ebp-13Ch]
  int v9; // [esp+10h] [ebp-138h]
  int v10; // [esp+14h] [ebp-134h]
  int vOwner; // [esp+18h] [ebp-130h]
  int m; // [esp+1Ch] [ebp-12Ch]
  int vRoads; // [esp+20h] [ebp-128h]
  int vTerrains[11]; // [esp+24h] [ebp-124h]
  int vSupArr[16]; // [esp+50h] [ebp-F8h] BYREF
  int v16; // [esp+90h] [ebp-B8h]
  int v17; // [esp+94h] [ebp-B4h]
  int vRivers; // [esp+98h] [ebp-B0h]
  int vCitySizeFactor; // [esp+9Ch] [ebp-ACh]
  int vWLongitude; // [esp+A0h] [ebp-A8h]
  int v21; // [esp+A4h] [ebp-A4h]
  int vMassIndex; // [esp+A8h] [ebp-A0h]
  int vNLatitude; // [esp+ACh] [ebp-9Ch]
  int v24; // [esp+B0h] [ebp-98h]
  int vY; // [esp+B4h] [ebp-94h]
  int vSLatitude; // [esp+B8h] [ebp-90h]
  int vX; // [esp+BCh] [ebp-8Ch]
  int vTechs; // [esp+C0h] [ebp-88h]
  int j; // [esp+C4h] [ebp-84h]
  int v30; // [esp+C8h] [ebp-80h]
  int Y; // [esp+CCh] [ebp-7Ch]
  int k; // [esp+D0h] [ebp-78h]
  int vTerrain; // [esp+D4h] [ebp-74h]
  int v34; // [esp+D8h] [ebp-70h]
  int X; // [esp+DCh] [ebp-6Ch]
  int vLongitude; // [esp+E0h] [ebp-68h]
  int i; // [esp+E4h] [ebp-64h]
  int vELongitude; // [esp+E8h] [ebp-60h]
  int v39; // [esp+ECh] [ebp-5Ch]
  int vDemArr[16]; // [esp+F0h] [ebp-58h] BYREF
  int Max; // [esp+130h] [ebp-18h]
  int v42; // [esp+134h] [ebp-14h]
  int vLatitude; // [esp+138h] [ebp-10h]
  int v44; // [esp+13Ch] [ebp-Ch]
  int v45; // [esp+140h] [ebp-8h]
  int v56; // [esp+144h] [ebp-4h]

  if ( (V_Cities_stru_64F340[aCity].Attributes & 0x20000) != 0
    || V_GameParameters_stru_655AE8._RevealMap
    || (((_BYTE)aCity + LOBYTE(V_GameParameters_stru_655AE8.Turn)) & 0xF) == 0 )
  {
    V_Cities_stru_64F340[aCity].Attributes &= ~0x20000u;
    vX = V_Cities_stru_64F340[aCity].X;
    vY = V_Cities_stru_64F340[aCity].Y;
    vOwner = V_Cities_stru_64F340[aCity].Owner;
    vMassIndex = j_Q_MapGetMassIndex_sub_5B8A81(vX, vY);
    vCitySizeFactor = (V_Cities_stru_64F340[aCity].Size + 2) / 5;
    vTechs = V_Civs_stru_64C6A0[V_Cities_stru_64F340[aCity].Owner].Techs;
    vLatitude = vY - (V_MapHeader_word_6D1160.SizeY >> 1);
    vLongitude = vX - (V_MapHeader_word_6D1160.SizeX >> 1);
    vWLongitude = 0;
    vELongitude = 0;
    vSLatitude = 0;
    vNLatitude = 0;
    if ( vLatitude < 0 )
    {
      vNLatitude = -vLatitude;
    }
    if ( vLatitude > 0 )
    {
      vSLatitude = vLatitude;
    }
    if ( vLongitude > 0 )
    {
      vELongitude = vLongitude;
    }
    if ( vLongitude < 0 )
    {
      vWLongitude = -vLongitude;
    }
    if ( vLatitude <= 0 )
    {
      vLatitude = -vLatitude;
    }
    if ( vLongitude <= 0 )
    {
      vLongitude = -vLongitude;
    }
    vRivers = 0;
    for ( i = 0; i < 0xB; ++i )
    {
      vTerrains[i] = 0;
    }
    for ( i = 0; i < 0x10; ++i )
    {
      V_Dem_dword_63F540[i] = 0;
      V_Sup_dword_63F668[i] = V_Dem_dword_63F540[i];
      vDemArr[i] = i;
      vSupArr[i] = vDemArr[i];
    }
    for ( i = 0; i < 0x15; ++i )
    {
      X = j_Q_WrapMapX_sub_5AE052(vX + V_CitySpiralDX_byte_628370[i]);
      Y = vY + V_CitySpiralDY_byte_6283A0[i];
      if ( j_Q_IsInMapBounds_sub_4087C0(X, Y) )
      {
        vTerrain = j_Q_MapGetTerrain_sub_5B89BB(X, Y);
        ++vTerrains[vTerrain];
        if ( j_Q_MapGetSpecial_sub_5B8EE1(X, Y) )
        {
          vTerrains[vTerrain] += 3;
        }
        if ( (j_Q_MapGetSquare_sub_5B8931(X, Y)->TerrainType & 0x80u) != 0 )// River
        {
          ++vRivers;
        }
        if ( (j_Q_MapGetImprovements_sub_5B94D5(X, Y) & 0x10) != 0 )// Road
        {
          ++vRoads;
        }
      }
    }
    vTerrains[6] += vTerrains[7];
    vTerrains[7] = 0;
    V_Sup_dword_63F668[0] = 3 * vRivers + 3 * vTerrains[9] + 6 * vTerrains[6] + 4 * vTerrains[3];
    if ( vTechs < 0x10 )
    {
      V_Sup_dword_63F668[0] *= 2;
    }
    if ( vTechs < 0x18 )
    {
      V_Sup_dword_63F668[0] *= 2;
    }
    if ( vTechs <= 0x30 )
    {
      if ( V_Cities_stru_64F340[aCity].Size < 3 )
      {
        V_Sup_dword_63F668[0] *= 2;
      }
    }
    else
    {
      V_Sup_dword_63F668[0] /= 2;
    }
    if ( V_Cities_stru_64F340[aCity].Size >= 8 )
    {
      V_Sup_dword_63F668[0] /= 2;
    }
    v16 = vTerrains[6] + 2;
    if ( V_MapHeader_word_6D1160.SizeY / 3 < vLatitude )
    {
      ++v16;
    }
    V_Sup_dword_63F668[1] = v16 * (vTerrains[2] + vRivers / 2 + 2 * vTerrains[4]);
    V_Sup_dword_63F668[2] = 8 * vTerrains[0xA] - vLatitude;
    if ( V_Cities_stru_64F340[aCity].Size > 9 )
    {
      V_Sup_dword_63F668[2] >>= 1;
    }
    if ( vTechs > 0x20 )
    {
      V_Sup_dword_63F668[2] >>= 1;
    }
    v1 = vTerrains[0] + 3 * vTerrains[1] - vRivers;
    V_Sup_dword_63F668[3] = j_Q_Clamp_sub_5ADFA0(vTechs / 0xA, 1, 2) * v1;
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x25) )
    {
      V_Sup_dword_63F668[3] = (3 * V_Sup_dword_63F668[3]) >> 1;
    }
    if ( vTechs < 8 )
    {
      V_Sup_dword_63F668[3] >>= 1;
    }
    if ( vTechs < 0x10 )
    {
      V_Sup_dword_63F668[3] >>= 1;
    }
    V_Sup_dword_63F668[4] = 3 * vTerrains[0xA] + 4 * vTerrains[0] + 2 * vTerrains[8] - vTechs / 6;
    if ( !j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x41) )
    {
      V_Sup_dword_63F668[4] /= 3;
    }
    if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 9) )
    {
      V_Sup_dword_63F668[4] += V_Sup_dword_63F668[4] >> 1;
    }
    if ( (vMassIndex & 1) != 0 && vMassIndex <= 5 )
    {
      V_Sup_dword_63F668[4] += V_Sup_dword_63F668[4] >> 1;
    }
    V_Sup_dword_63F668[5] = 5 * vTerrains[4] * (vTerrains[8] + vTerrains[3] + vTerrains[1] + vTerrains[9] + 1);
    v2 = vCitySizeFactor / 2;
    if ( vCitySizeFactor / 2 >= 2 )
    {
      v2 = 2;
    }
    V_Sup_dword_63F668[5] = j_Q_MultOnPowOf2_sub_5AE3EC(V_Sup_dword_63F668[5], v2 - 1);
    if ( (vMassIndex & 1) != 0 && vMassIndex > 1 )
    {
      V_Sup_dword_63F668[5] += V_Sup_dword_63F668[5] >> 1;
    }
    if ( vTechs < 0x14 )
    {
      V_Sup_dword_63F668[5] >>= 1;
    }
    V_Sup_dword_63F668[6] = 5 * vTerrains[4] + 5 * vTerrains[5];
    if ( vMassIndex )
    {
      if ( (vMassIndex & 1) == 0 )
      {
        V_Sup_dword_63F668[6] *= 2;
      }
    }
    V_Sup_dword_63F668[7] = 2 * (vRivers + 5 * vTerrains[2] - vTerrains[1]);
    if ( vMassIndex )
    {
      if ( (vMassIndex & 3) == 0 )
      {
        V_Sup_dword_63F668[7] *= 2;
      }
    }
    v56 = 5 * vRivers - vTerrains[2];
    Max = 4 * vTerrains[1];
    v56 = j_Q_Clamp_sub_5ADFA0(v56, 0, 4 * vTerrains[1]);
    Max = j_Q_Clamp_sub_5ADFA0(Max, 0, v56);
    V_Sup_dword_63F668[8] = v56 + ((V_MapHeader_word_6D1160.SizeX >> 1) - vLongitude) / 2 + Max;
    if ( vSLatitude )
    {
      V_Sup_dword_63F668[8] >>= 1;
    }
    v3 = j_Q_Clamp_sub_5ADFA0(vCitySizeFactor - 1, 0xFFFFFFFE, 1);
    V_Sup_dword_63F668[8] = j_Q_MultOnPowOf2_sub_5AE3EC(V_Sup_dword_63F668[8], v3);
    if ( (((_BYTE)vMassIndex - 2) & 3) == 0 )
    {
      V_Sup_dword_63F668[8] += V_Sup_dword_63F668[8] >> 1;
    }
    if ( V_Civs_stru_64C6A0[vOwner].Leader == 9 )
    {
      V_Sup_dword_63F668[8] *= 2;
    }
    if ( V_Cities_stru_64F340[aCity].Size > 0xA )
    {
      V_Sup_dword_63F668[8] >>= 1;
    }
    V_Sup_dword_63F668[9] = (vTerrains[4] + 1) * (vTerrains[9] + 2 * vTerrains[3] + 1);
    if ( V_Sup_dword_63F668[9] )
    {
      V_Sup_dword_63F668[9] += 2 * vELongitude;
      if ( vMassIndex )
      {
        if ( !(vMassIndex % 5) )
        {
          V_Sup_dword_63F668[9] *= 2;
        }
      }
    }
    if ( V_Civs_stru_64C6A0[vOwner].Leader == 0xB )
    {
      V_Sup_dword_63F668[9] *= 2;
    }
    V_Sup_dword_63F668[0xA] = 8 * vTerrains[5];
    if ( 8 * vTerrains[5] )
    {
      V_Sup_dword_63F668[0xA] += vLongitude + vTerrains[4];
      if ( !j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x27) )
      {
        V_Sup_dword_63F668[0xA] >>= 1;
      }
      if ( vMassIndex > 8 )
      {
        V_Sup_dword_63F668[0xA] += V_Sup_dword_63F668[0xA] >> 1;
      }
      if ( V_Cities_stru_64F340[aCity].Size < 5 )
      {
        V_Sup_dword_63F668[0xA] >>= 1;
      }
    }
    if ( V_Civs_stru_64C6A0[vOwner].Leader == 0xA )
    {
      V_Sup_dword_63F668[9] *= 2;
    }
    V_Sup_dword_63F668[0xB] = (vRivers + vTerrains[0xA]) / 2 * (3 * vTerrains[9] + 2 * vTerrains[8] + 2 * vTerrains[0]);
    if ( V_Sup_dword_63F668[0xB] )
    {
      if ( vLatitude < 0xA )
      {
        V_Sup_dword_63F668[0xB] *= 2;
      }
      V_Sup_dword_63F668[0xB] -= vLatitude;
      if ( stru_666130.Unknown_00[8 * vMassIndex] <= 0x19 )
      {
        V_Sup_dword_63F668[0xB] += V_Sup_dword_63F668[0xB] >> 1;
      }
      if ( stru_666130.Unknown_00[8 * vMassIndex] > 0x12C )
      {
        V_Sup_dword_63F668[0xB] >>= 1;
      }
      if ( vMassIndex == 1 )
      {
        V_Sup_dword_63F668[0xB] >>= 1;
      }
    }
    V_Sup_dword_63F668[0xC] = vTerrains[1] + (vTerrains[0] + 1) * (vTerrains[8] + 1) * (vTerrains[5] + 1);
    if ( V_Sup_dword_63F668[0xC] )
    {
      V_Sup_dword_63F668[0xC] *= j_Q_Clamp_sub_5ADFA0(vCitySizeFactor, 1, 4);
      V_Sup_dword_63F668[0xC] /= 2;
      if ( vMassIndex == 7 )
      {
        V_Sup_dword_63F668[0xC] += V_Sup_dword_63F668[0xC] >> 1;
      }
    }
    V_Sup_dword_63F668[0xD] = (vRivers + 2) * (vTerrains[4] / 2 + vTerrains[5] + 1);
    if ( vTerrains[5] > 2 )
    {
      V_Sup_dword_63F668[0xD] *= 2;
    }
    if ( V_Cities_stru_64F340[aCity].Size >= 5 )
    {
      V_Sup_dword_63F668[0xD] *= 2;
    }
    if ( V_Cities_stru_64F340[aCity].Size >= 0xA )
    {
      V_Sup_dword_63F668[0xD] *= 2;
    }
    V_Sup_dword_63F668[0xE] = 8 * vTerrains[6] + 0xA * vTerrains[0] + 6 * vTerrains[8] + 0xC * vTerrains[7];
    if ( !V_TechDiscovered_byte_655B82[0xE] )
    {
      V_Sup_dword_63F668[0xE] >>= 3;
    }
    if ( V_Sup_dword_63F668[0xE] )
    {
      if ( vMassIndex == 0x11 )
      {
        V_Sup_dword_63F668[0xE] *= 3;
      }
      else if ( vMassIndex > 1 && (((_BYTE)vMassIndex - 1) & 7) == 0 )
      {
        V_Sup_dword_63F668[0xE] += V_Sup_dword_63F668[0xE] >> 1;
      }
      V_Sup_dword_63F668[0xE] *= j_Q_Clamp_sub_5ADFA0(vCitySizeFactor / 2 - 2, 1, 2);
    }
    else
    {
      V_Sup_dword_63F668[0xE] = 0xFFFFFFFF;
    }
    V_Sup_dword_63F668[0xF] = (vTerrains[5] + 1) * (vRivers + vTerrains[4] + 1) * (vTerrains[0] + vTerrains[6] + 1);
    if ( !j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x3A) )
    {
      V_Sup_dword_63F668[0xF] = 0;
    }
    if ( V_Sup_dword_63F668[0xF] )
    {
      if ( vMassIndex )
      {
        if ( !(vMassIndex % 0xA) )
        {
          V_Sup_dword_63F668[0xF] += V_Sup_dword_63F668[0xF] >> 1;
        }
      }
      v4 = vCitySizeFactor;
      if ( vCitySizeFactor >= 6 )
      {
        v4 = 6;
      }
      V_Sup_dword_63F668[0xF] *= v4;
      V_Sup_dword_63F668[0xF] /= 6;
    }
    else
    {
      V_Sup_dword_63F668[0xF] = 0xFFFFFFFF;
    }
    V_Dem_dword_63F540[0] = vTerrains[3] + 3 * vLatitude / 2 + 5 * (vTerrains[7] + vTerrains[6]) + 2 * vTerrains[5];
    V_Dem_dword_63F540[3] = 4 * vTerrains[4] + 4 * vTerrains[3];
    V_Dem_dword_63F540[3] += V_Dem_dword_63F540[0] * (vTechs / 0xA) / 8;
    if ( V_Cities_stru_64F340[aCity].Size < 3 )
    {
      V_Dem_dword_63F540[0] *= 2;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x25) )
    {
      V_Dem_dword_63F540[0] /= 3;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x30) )
    {
      V_Dem_dword_63F540[0] = 1;
    }
    if ( vTechs < 0xA )
    {
      V_Dem_dword_63F540[0] *= 2;
    }
    if ( vTechs < 0x14 )
    {
      V_Dem_dword_63F540[0] *= 2;
    }
    if ( vTechs >= 0x30 )
    {
      V_Dem_dword_63F540[0] /= 2;
    }
    if ( (V_MapHeader_word_6D1160.SizeY >> 2) - vLatitude <= 0 )
    {
      v10 = vLatitude - (V_MapHeader_word_6D1160.SizeY >> 2);
    }
    else
    {
      v10 = (V_MapHeader_word_6D1160.SizeY >> 2) - vLatitude;
    }
    V_Dem_dword_63F540[1] = vTerrains[3] + 2 * v10 + 2 * vTerrains[1];
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x25) )
    {
      V_Dem_dword_63F540[1] *= 2;
    }
    V_Dem_dword_63F540[2] = 3 * (0x15 - vTerrains[0xA]) / 2 + vLatitude;
    if ( V_Cities_stru_64F340[aCity].Size < 4 )
    {
      V_Dem_dword_63F540[2] += V_Dem_dword_63F540[2] >> 1;
    }
    if ( V_Cities_stru_64F340[aCity].Size >= 0xC )
    {
      V_Dem_dword_63F540[2] /= 2;
    }
    if ( vTechs >= 0x30 )
    {
      V_Dem_dword_63F540[2] /= 2;
    }
    v42 = 8;
    for ( j = V_Cities_stru_64F340[aCity].Size; v42 && j > 0; j -= v24 )
    {
      v24 = j_Q_Clamp_sub_5ADFA0(j, 0, 5);
      V_Dem_dword_63F540[4] += v42 * v24;
      v42 /= 2;
    }
    V_Dem_dword_63F540[4] -= vTechs / 2;
    V_Dem_dword_63F540[5] = vTechs + vCitySizeFactor * (vLatitude + 0xA);
    if ( V_Cities_stru_64F340[aCity].Size < 5 )
    {
      V_Dem_dword_63F540[5] = 0;
    }
    if ( V_Cities_stru_64F340[aCity].Size < 8 )
    {
      V_Dem_dword_63F540[5] >>= 1;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x25) )
    {
      V_Dem_dword_63F540[5] *= 2;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x17) )
    {
      V_Dem_dword_63F540[5] *= 2;
    }
    if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0x13) )
    {
      V_Dem_dword_63F540[5] *= 2;
    }
    if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0x14)
      || j_Q_CityHasImprovement_sub_43D20A(aCity, 0x15)
      || j_Q_CityHasImprovement_sub_43D20A(aCity, 0x1D) )
    {
      V_Dem_dword_63F540[5] >>= 3;
    }
    V_Dem_dword_63F540[6] = vCitySizeFactor * (vRoads + vRivers + 1);
    if ( V_Dem_dword_63F540[6] <= V_Sup_dword_63F668[6] )
    {
      V_Dem_dword_63F540[6] >>= 1;
    }
    if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 5) )
    {
      V_Dem_dword_63F540[6] += V_Dem_dword_63F540[6] >> 1;
    }
    if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0xA) )
    {
      V_Dem_dword_63F540[6] += V_Dem_dword_63F540[6] >> 1;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x17) )
    {
      V_Dem_dword_63F540[6] += V_Dem_dword_63F540[6] >> 1;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x10) )
    {
      V_Dem_dword_63F540[6] /= 4;
    }
    if ( V_Cities_stru_64F340[aCity].Size < 5 )
    {
      V_Dem_dword_63F540[6] >>= 1;
    }
    V_Dem_dword_63F540[7] = vRoads + V_Sup_dword_63F668[3];
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0xA) )
    {
      V_Dem_dword_63F540[7] /= 2;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x30) )
    {
      V_Dem_dword_63F540[7] /= 2;
    }
    if ( V_Cities_stru_64F340[aCity].X - V_Cities_stru_64F340[aCity].Y <= 0 )
    {
      v9 = V_Cities_stru_64F340[aCity].Y - V_Cities_stru_64F340[aCity].X;
    }
    else
    {
      v9 = V_Cities_stru_64F340[aCity].X - V_Cities_stru_64F340[aCity].Y;
    }
    V_Dem_dword_63F540[8] = v9 + 4 * vCitySizeFactor + 4;
    V_Dem_dword_63F540[9] = vTerrains[1] / 2
                          + (V_MapHeader_word_6D1160.SizeX >> 1)
                          + 2 * ((V_MapHeader_word_6D1160.SizeY >> 1) - vLatitude)
                          - vLongitude
                          + 4 * vTerrains[9]
                          + 2 * vTerrains[8]
                          + 4 * vTerrains[0];
    v5 = j_Q_Clamp_sub_5ADFA0(vCitySizeFactor - 1, 0xFFFFFFFF, 1);
    V_Dem_dword_63F540[9] = j_Q_MultOnPowOf2_sub_5AE3EC(V_Dem_dword_63F540[9], v5);
    if ( vMassIndex == 1 && (aCity & 2) != 0 )
    {
      V_Dem_dword_63F540[9] += V_Dem_dword_63F540[9] >> 1;
    }
    if ( V_Cities_stru_64F340[aCity].Size < 7 )
    {
      V_Dem_dword_63F540[9] >>= 1;
    }
    V_Dem_dword_63F540[0xA] = 8 * V_Cities_stru_64F340[aCity].Size;
    V_Dem_dword_63F540[0xD] = 0;
    V_Dem_dword_63F540[0xC] = 0;
    v30 = 0xA;
    v8 = (V_Cities_stru_64F340[aCity].X + V_Cities_stru_64F340[aCity].Y) % 3;
    if ( v8 == 1 )
    {
      V_Dem_dword_63F540[0xC] = V_Dem_dword_63F540[0xA];
      v30 = 0xC;
    }
    else if ( v8 == 2 )
    {
      V_Dem_dword_63F540[0xD] = V_Dem_dword_63F540[0xA];
      v30 = 0xD;
    }
    if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0xB) || j_Q_CivHasWonder_sub_453E51(vOwner, 0xA) )
    {
      V_Dem_dword_63F540[v30] = (3 * V_Dem_dword_63F540[v30]) >> 1;
    }
    if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0xA) )
    {
      V_Dem_dword_63F540[v30] = (3 * V_Dem_dword_63F540[v30]) >> 1;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x16) )
    {
      V_Dem_dword_63F540[v30] >>= 1;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x10) )
    {
      V_Dem_dword_63F540[v30] >>= 1;
    }
    if ( V_Civs_stru_64C6A0[vOwner].Leader == 0x11 )
    {
      V_Dem_dword_63F540[v30] *= 2;
    }
    v6 = vTechs - 0xC;
    if ( vTechs - 0xC <= 0 )
    {
      v6 = 0;
    }
    V_Dem_dword_63F540[0xB] = stru_666130.Unknown_00[8 * vMassIndex] / 0xA - v6;
    if ( V_Cities_stru_64F340[aCity].Size < 4 )
    {
      V_Dem_dword_63F540[0xB] /= 2;
    }
    if ( stru_666130.Unknown_00[8 * vMassIndex] > 0x190 )
    {
      if ( V_Cities_stru_64F340[aCity].Size >= 8 )
      {
        V_Dem_dword_63F540[0xB] *= 2;
      }
      if ( (((unsigned __int8)-V_Cities_stru_64F340[aCity].Y - (unsigned __int8)V_Cities_stru_64F340[aCity].X) & 3) == 0 )
      {
        V_Dem_dword_63F540[0xB] = 0;
      }
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x46) )
    {
      V_Dem_dword_63F540[0xB] >>= 1;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x25) )
    {
      V_Dem_dword_63F540[0xE] = (vCitySizeFactor + 2) * (vTechs / 3);
      if ( V_Sup_dword_63F668[0xE] >= (vCitySizeFactor + 2) * (vTechs / 3) )
      {
        V_Dem_dword_63F540[0xE] >>= 1;
      }
      if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0xF) )
      {
        V_Dem_dword_63F540[0xE] = 3 * V_Dem_dword_63F540[0xE] / 2;
      }
      else
      {
        if ( V_Cities_stru_64F340[aCity].Size < 5 )
        {
          V_Dem_dword_63F540[0xE] >>= 1;
        }
        if ( V_Cities_stru_64F340[aCity].Size < 0xA )
        {
          V_Dem_dword_63F540[0xE] >>= 1;
        }
        if ( V_Cities_stru_64F340[aCity].Size < 0x14 )
        {
          V_Dem_dword_63F540[0xE] >>= 1;
        }
      }
      if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 5) )
      {
        V_Dem_dword_63F540[0xE] *= 3;
      }
      if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0x19) )
      {
        V_Dem_dword_63F540[0xE] *= 2;
      }
      if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0xD) )
      {
        V_Dem_dword_63F540[0xE] >>= 1;
      }
      if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0x12) )
      {
        V_Dem_dword_63F540[0xE] >>= 1;
      }
    }
    else
    {
      V_Dem_dword_63F540[0xE] = 0xFFFFFFFF;
    }
    if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x3A) )
    {
      V_Dem_dword_63F540[0xF] = vTechs * vTechs;
      v7 = j_Q_Clamp_sub_5ADFA0(vCitySizeFactor - 3, 0xFFFFFFFD, 0);
      V_Dem_dword_63F540[0xF] = j_Q_MultOnPowOf2_sub_5AE3EC(V_Dem_dword_63F540[0xF], v7);
      if ( j_Q_CityHasImprovement_sub_43D20A(aCity, 0x15) || j_Q_CityHasImprovement_sub_43D20A(aCity, 0x11) )
      {
        V_Dem_dword_63F540[0xF] *= 2;
      }
    }
    else
    {
      V_Dem_dword_63F540[0xF] = 0xFFFFFFFF;
    }
    for ( i = 0; i < 0x10; ++i )
    {
      if ( V_Dem_dword_63F540[i] > V_Sup_dword_63F668[i] )
      {
        if ( V_Sup_dword_63F668[i] > 0 )
        {
          V_Sup_dword_63F668[i] = 0;
        }
      }
      else if ( V_Dem_dword_63F540[i] > 0 )
      {
        V_Dem_dword_63F540[i] = 0;
      }
    }
    j_Q_SortPairs_sub_414F02(0x10, vSupArr, V_Sup_dword_63F668);
    j_Q_SortPairs_sub_414F02(0x10, vDemArr, V_Dem_dword_63F540);
    v17 = 0xF;
    for ( i = 0; i < 3; ++i )
    {
      do
      {
        v34 = vSupArr[v17--];
      }
      while ( V_Sup_dword_63F668[v17 + 1] < 0 );
      V_Cities_stru_64F340[aCity].SuppliedTradeItem[i] = v34;
    }
    v17 = 0xF;
    for ( i = 0; i < 3; ++i )
    {
      do
      {
        v34 = vDemArr[v17--];
      }
      while ( V_Dem_dword_63F540[v17 + 1] < 0 );
      V_Cities_stru_64F340[aCity].DemandedTradeItem[i] = v34;
    }
    if ( vTechs < 0x20 )
    {
      v39 = (3 * V_Cities_stru_64F340[aCity].X + 5 * V_Cities_stru_64F340[aCity].Y) % 0xE;
      v45 = (0xD * V_Cities_stru_64F340[aCity].X + 7 * V_Cities_stru_64F340[aCity].Y) % 0xE;
    }
    else
    {
      v39 = (3 * V_Cities_stru_64F340[aCity].X + 5 * V_Cities_stru_64F340[aCity].Y) % 9 + 5;
      v45 = (0xD * V_Cities_stru_64F340[aCity].X + 7 * V_Cities_stru_64F340[aCity].Y) % 9 + 5;
    }
    if ( v45 == v39 )
    {
      v45 = 0xFFFFFFFE;
    }
    v21 = 0;
    for ( i = 0; i < 3; ++i )
    {
      if ( V_Cities_stru_64F340[aCity].DemandedTradeItem[i] >= 0xE )
      {
        v21 |= 1u;
      }
      if ( V_Cities_stru_64F340[aCity].SuppliedTradeItem[i] >= 0xE )
      {
        v21 |= 2u;
      }
      if ( V_Cities_stru_64F340[aCity].SuppliedTradeItem[i] == v39
        || V_Cities_stru_64F340[aCity].DemandedTradeItem[i] == v39 )
      {
        v39 = 0xFFFFFFFE;
      }
      if ( V_Cities_stru_64F340[aCity].SuppliedTradeItem[i] == v45
        || V_Cities_stru_64F340[aCity].DemandedTradeItem[i] == v45 )
      {
        v45 = 0xFFFFFFFE;
      }
    }
    if ( v39 < 0 && (v21 & 1) == 0 )
    {
      if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x25) && (v39 & 1) != 0 )
      {
        v39 = 0xE;
      }
      else if ( j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x3A) )
      {
        if ( (v39 & 1) == 0 )
        {
          v39 = 0xF;
        }
      }
    }
    if ( v39 >= 0 )
    {
      V_Cities_stru_64F340[aCity].DemandedTradeItem[1] = v39;
    }
    if ( v45 < 0 && (v21 & 2) == 0 )
    {
      v45 = (v45 & 1) + 0xE;
      if ( v45 == 0xE && !j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x25) )
      {
        v45 = 0xFFFFFFFF;
      }
      if ( v45 == 0xF && !j_Q_CivHasTech_sub_4BD9F0(vOwner, 0x3A) )
      {
        v45 = 0xFFFFFFFF;
      }
    }
    if ( v45 >= 0 )
    {
      V_Cities_stru_64F340[aCity].SuppliedTradeItem[1] = v45;
    }
    for ( i = 0; V_Cities_stru_64F340[aCity].TradeRoutes > i; ++i )
    {
      v34 = V_Cities_stru_64F340[aCity].CommodityTraded[i];
      if ( v34 >= 0 )
      {
        for ( k = 0; k < 3; ++k )
        {
          if ( V_Cities_stru_64F340[aCity].SuppliedTradeItem[k] == v34 )
          {
            V_Cities_stru_64F340[aCity].SuppliedTradeItem[k] = -V_Cities_stru_64F340[aCity].SuppliedTradeItem[k];
          }
        }
        v44 = V_Cities_stru_64F340[aCity].TradePartner[i];
        v34 = 0xFFFFFFFF;
        for ( k = 0; V_Cities_stru_64F340[v44].TradeRoutes > k; ++k )
        {
          if ( V_Cities_stru_64F340[v44].TradePartner[k] == aCity )
          {
            v34 = V_Cities_stru_64F340[v44].CommodityTraded[k];
          }
        }
        if ( v34 >= 0 )
        {
          for ( k = 0; k < 3; ++k )
          {
            if ( V_Cities_stru_64F340[aCity].DemandedTradeItem[k] == v34 )
            {
              V_Cities_stru_64F340[aCity].DemandedTradeItem[k] = -V_Cities_stru_64F340[aCity].DemandedTradeItem[k];
            }
          }
        }
      }
    }
    for ( m = 0; V_GameParameters_stru_655AE8.TotalUnits > m; ++m )
    {
      if ( stru_6560F0[m].ID )
      {
        if ( stru_6560F0[m].HomeCity == aCity
          && V_UnitTypes_stru_64B1B8[stru_6560F0[m].UnitType].Role == 7
          && stru_6560F0[m].Counter >= 0 )
        {
          for ( i = 0; i < 3; ++i )
          {
            if ( V_Cities_stru_64F340[aCity].SuppliedTradeItem[i] == stru_6560F0[m].Counter )
            {
              V_Cities_stru_64F340[aCity].SuppliedTradeItem[i] = -V_Cities_stru_64F340[aCity].SuppliedTradeItem[i];
            }
          }
        }
      }
    }
  }
}
EDIT: Fixed in v1.19
https://forums.civfanatics.com/thre...dditions-civ2uia.623515/page-11#post-16289629
 
Last edited:
Don't know if this "bug" is present on vanilla version or if it is specific to UIA. Loaded a game earlier today and could not select any city (the city window would not appear)

Solution was to re-load another savegame, opening city window there and then after that the game worked normally on this savegame again. Attached is the saved game to see if you can reproduce that problem in your end. Glad I did not to remove the whole save for corruption.
 

Attachments

  • Civ2savegame.zip
    18.8 KB · Views: 194
Don't know if this "bug" is present on vanilla version or if it is specific to UIA. Loaded a game earlier today and could not select any city (the city window would not appear)

Solution was to re-load another savegame, opening city window there and then after that the game worked normally on this savegame again. Attached is the saved game to see if you can reproduce that problem in your end. Glad I did not to remove the whole save for corruption.
Tried your save, but no bug detected. One of ideas is that there is some modal window opened behind the map.
Otherwise need reproducible sequence of actions which lead to this bug.
 
I get the error message:
"Error: ReadProcessMemory: 5"
Please tell me waht further information you need from me to help with this. Thank you!
 
I get the error message:
"Error: ReadProcessMemory: 5"
Please tell me waht further information you need from me to help with this. Thank you!
Have you tried "run as administrator"?
 
Have you tried "run as administrator"?
Yes I have, thank you for that advise. I think it may have been due to having an older version of that patch already installed. Im running Windows 10 Home, and the game runs fine otherwise with the older version. I then did try to install the game again in a different directory using the original CD I still have, but the install does not even start. Im happy the game runs as it is, so Ill live with what I got. I just miss all those extra QOL's the newer patch affords!
 
Yes I have, thank you for that advise. I think it may have been due to having an older version of that patch already installed. Im running Windows 10 Home, and the game runs fine otherwise with the older version. I then did try to install the game again in a different directory using the original CD I still have, but the install does not even start. Im happy the game runs as it is, so Ill live with what I got. I just miss all those extra QOL's the newer patch affords!
Can't reproduce this behavior in my environment. You can try to play with folder/file permissions. Something like this:
https://answers.microsoft.com/en-us...ndows-10/8a4069ea-4b0e-4517-9d7a-62c44b4d6e7d
 
Can't reproduce this behavior in my environment. You can try to play with folder/file permissions. Something like this:
https://answers.microsoft.com/en-us...ndows-10/8a4069ea-4b0e-4517-9d7a-62c44b4d6e7d
Thank you anyway for your replys. Im trying to tell myself it aint the end of the world, at least the game plays..lol..

EDIT: Guess what? NOW WE WORK! Either before I was not running as Administartor, even though I thought I was, or was running the wrong executable. This time I thought "what the hell, try it again.." and off we go!
 
Last edited:
Hello all. I'm new to the forums. Been playing Civilization since the 90's. Just got a copy of Civ 2 MGE the other day. I did some of the updates to get it running correctly on my Win 7 system. The problem I'm having though, is trying to get Multiplayer to connect with my brothers laptop. He has Win 8. We tried LAN and Internet games but neither connect. We can see the game room either way (he sets it up or I do). Did I miss a patch that corrects it or is there another program I have download to both systems?
 
Hi @FoxAhead I have downloaded the tool to play with simultaneous turns in multiplayer. As far as you know, does this tool work with the UIA Launcher?
 
Hello all. I'm new to the forums. Been playing Civilization since the 90's. Just got a copy of Civ 2 MGE the other day. I did some of the updates to get it running correctly on my Win 7 system. The problem I'm having though, is trying to get Multiplayer to connect with my brothers laptop. He has Win 8. We tried LAN and Internet games but neither connect. We can see the game room either way (he sets it up or I do). Did I miss a patch that corrects it or is there another program I have download to both systems?
Hello!
CIV2UIA should fix network problem relevant to Win8 and Win10.

catalin72,
but I can start multiplayer Civ2 MGE directly (Internet game) between two different computers on different ISP (Internet service providers). There were notebook with Win7 behind WiFi-router and desktop PC with Win 7 VPN-connected directly to another ISP.
After fixing problems with multiplayer on Windows 10 now I am able to connect Windows 10 and Windows 7 through Internet without any Hamachi. Here is result on photo: Windows 10 is on virtual machine behind NAT. All I have to do is port-forward two ports: 4993 and 4994. And another machine is again notebook with Windows 7. Game on Windows 10 was launched with Civ2UIA. And on Windows 7 game launched directly without any patches.
Finally about socket buffers in multiplayer. All network part of the game resides in a separate library XDaemon.dll. That library uses Windows Sockets API (wsock32.dll) for organizing multiplayer game. Socket is endpoint for sending/receiving data. Socket has a lot of options and two of them are SO_RCVBUF and SO_SNDBUF. That is as MS online help states "The total per-socket buffer space reserved for receives/sends."
When opening socket with socket function all its options are initialized with defaults. It seems that for many years default values for SO_RCVBUF and SO_SNDBUF were no more than 0x2000 bytes. So programmers of XDaemon.dll didn't bothered about setting those options explicitly with setsockopt function hoping that it would be always the same. Also later in code they used getsockopt function to read SO_RCVBUF option and store it in 2-bytes variable for using later in data-receive loops.
But in Windows 8 and 10 the default value became 0x10000. And it doesn't fit in 2-bytes variable causing it to be zero and no data received at some point.
What I did is just added explicit call of setsockopt function for setting correct buffer sizes right after opening socket. I choose value of 0x2000 as it seems like game is somehow bound to this value.
 
Hi @FoxAhead I have downloaded the tool to play with simultaneous turns in multiplayer. As far as you know, does this tool work with the UIA Launcher?
What is this tool? UIA was developed without taking simultaneous turns into account. I mean it was not tested in that conditions. But you could try.
 
Here it is https://www.civfanatics.com/civ2/downloads/utility/
The problem is that the tool asks me to choose "CIV2.exe" only, however your launcher is "Civ2UIALauncher.exe". I will try editing it in "CIV2" and see if it works.
@Kaiser85
you can try this instead:

New version 1.14 (build 65).
New option for Simultaneous moves in multiplayer.
Same as writing 'Simultaneous=1' string to the CIV.INI file. With this option enabled, the multiplayer feature 'Humans Move Units at the Same Time' should be available when setting up a new multiplayer game.

Download

https://github.com/FoxAhead/Civ2-UI-Additions/releases/tag/v1.14
 
@FoxAhead

I got both computer systems up and connected on a network game. The problem I run into now is I can't actually get a game to start. He connects into my game and we can get our Civs set up, but then my system just locks up on the building world screen and his screen says waiting for other people to join. I set it up for 4 civilizations on a large map so it should be me, him, and 2 AI. Not sure what I'm missing but everything else is working great.
 
Top Bottom