Fix for amphibious landing out-of-sync

alexman

Ancient Geek
Joined
Feb 28, 2002
Messages
792
Location
Mohawk
In 3.17 we introduced a bug that results in players getting out-of-sync when performing an amphibious landing by moving transports directly onto an enemy-occupied tile. Here's how to fix it:

In CvSelectionGroup::groupAmphibMove, replace the following code:

Code:
std::vector<CvUnit*> aCargoUnits;
pLoopUnit1->getCargoUnits(aCargoUnits);
std::set<CvSelectionGroup*> aCargoGroups;
for (uint i = 0; i < aCargoUnits.size(); ++i)
{
    aCargoGroups.insert(aCargoUnits[i]->getGroup());
}

std::set<CvSelectionGroup*>::iterator it;
for (it = aCargoGroups.begin(); it != aCargoGroups.end(); ++it)
{
    CvSelectionGroup* pGroup = *it;
    if (pGroup->canAllMove())
    {
        FAssert(!pGroup->at(pPlot->getX_INLINE(), pPlot->getY_INLINE()));
        pGroup->pushMission(MISSION_MOVE_TO, pPlot->getX_INLINE(), pPlot->getY_INLINE(), (MOVE_IGNORE_DANGER | iFlags));
        bLanding = true;
    }
}

by the following code segment:

Code:
std::vector<CvUnit*> aCargoUnits;
pLoopUnit1->getCargoUnits(aCargoUnits);
std::vector<CvSelectionGroup*> aCargoGroups;
for (uint i = 0; i < aCargoUnits.size(); ++i)
{
    CvSelectionGroup* pGroup = aCargoUnits[i]->getGroup();
    if (std::find(aCargoGroups.begin(), aCargoGroups.end(), pGroup) == aCargoGroups.end())						
    {
        aCargoGroups.push_back(aCargoUnits[i]->getGroup());
    }
}

for (uint i = 0; i < aCargoGroups.size(); ++i)
{
    CvSelectionGroup* pGroup = aCargoGroups[i];
    if (pGroup->canAllMove())
    {
        FAssert(!pGroup->at(pPlot->getX_INLINE(), pPlot->getY_INLINE()));
        pGroup->pushMission(MISSION_MOVE_TO, pPlot->getX_INLINE(), pPlot->getY_INLINE(), (MOVE_IGNORE_DANGER | iFlags));
        bLanding = true;
    }
}
 
Thanks again Alex, and if any of the fine modders here can produce an updated file please feel free to do so, I'm not much of a programmer myself, but this is a huge fix for the MP community.

CS
 
Alexman, or anyone else qualified to answer:

This is fantastic news as this bug has really effected MP games involving naval warfare.

My question is does this code need to be compiled to produce something like CvGameCoreDLL.dll or can we just update some text file like CvEventManager.py or if it's neither of those, what is the best process to generate an effective patch?

Thanks,
SirPartyMan
Admin, CIVPLAYERS LADDER LEAGUE
www.civplayers.com
 
Thankyou alexman for the post.:goodjob:

As CanuckSoldier said, this problem has reared its ugly head in multiplayer very frequently (isolated island games anyone?).

Thanks again Alex, and if any of the fine modders here can produce an updated file please feel free to do so, I'm not much of a programmer myself, but this is a huge fix for the MP community.

CS

I could update the DLL but do you want any other bugs from 3.17 fixed at the same time?
 
Is there a possibility tocreate some kind of file in order to help players to easily get this running. I have no idea where and how to fix it :(
 
Here is the fixed file. For BtS 3.17 only. (it is not for the unofficial patch.)

Don't forget, it's still best to play without Random Events as they can still cause OOS I think.


Instructions:
Backup the current CvGameCoreDLL file. It will be found in \Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Assets. To back it up you could either copy it to another location or you can rename it to something else like CvGameCoreDLL.dll.backup.

Paste this file in its place, and make sure all other players are using the same DLL and you will be right.
 

Attachments

  • CvGameCoreDLL amphib-OOS fixed BtS3.17.zip
    1.6 MB · Views: 490
Three questions just to be sure:
(1) If firaxis releases another BtS patch, would we need to revert DLLs before patching?
(2) Backwards save compatible?
(3) Compatible with mods that don't muck with DLLs?

Thanks so much for making that.
 
Three questions just to be sure:
(1) If firaxis releases another BtS patch, would we need to revert DLLs before patching?
(2) Backwards save compatible?
(3) Compatible with mods that don't muck with DLLs?

Thanks so much for making that.

1) I don't think so. But it's highly unlikely Firaxis are going to release a patch, and I don't think anyone is realistically expecting them to anymore.

2) It should be backwards save compatible. If it's not, you kept a backup of the original DLL in case. ;)

3) Yes. It should be compatible with other mods that don't muck with DLLs. In fact that would be the best way to use this DLL, because it won't involve replacing the original DLL - you can just put this one in the Assets folder in your mod. By the way, this DLL will definitely not work from the CustomAssets folder.
 
Thanks, Primax has also produced any updated dll and as requested by myself he is going to make an installer soon so that the less technically inclined players can't screw up replacing of the files. We are also testing this mod at Civplayers before I release it too the general MP community just to make sure there are no other hidden issues, but it looks good so far. One point to note that it will NOT cause a *MOD* label in a staging room, but it will always cause an OOS on turn 1 in a MP game if you play with people that do not have this installed, however I am hoping that the once released that the critical mass of players will adopt this and that will encourage the entire MP community to move to the unofficial patch.

CS
 
If you are referring to the DLL in my post above, it is only for BtS 3.17.

EDIT
It will need to be added to the unofficial patch still.

The DLL is just a fix directly on BtS 3.17 unmodded. Probably only useful to those who play MP without any need for an unofficial patch.
 
Yes in the MP community we have not used the other unofficial patch due to the need for everyone to have the same files. This patch fixes something that is very key to late era M games which makes it worth wild to adopt it even though there will likely be a short stage were not everyone will have the patch.

CS
 
CanuckSoldier,

Would you like to create a thread in the BtS forum or MP forum for this minor patch, and try to get it stickied? Having this DLL in a place that is more accessible than the lone post above would be better I think.

You are welcome to do whatever you like with the DLL - I'm not concerned with ownership of it or whatever.
 
Yes that was a plan of mine, Primax emailed me an installer version, I'm just waiting for some internal testing so I don't push any bugs on the masses :p If I don't get any bug reports by the weekend I'll start an information campaign across the MP areas on the various fan sites.

CS
 
Just to update everyone, we rolled out the "patch" over this past weekend, and we've had over 1000 downloads. If you look at the game titles in the CIV4 Lobby you'll see many references to patched games, not just by our Ladder community but by open players, Earth Games, and other leagues as well. It appears to be a solid success. Thanks to all who assisted.


SirPartyMan
Admin
www.civplayers.com
 
Top Bottom