1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Fix for amphibious landing out-of-sync

Discussion in 'Civ4 - Unofficial Patches' started by alexman, Feb 11, 2009.

  1. alexman

    alexman King

    Joined:
    Feb 28, 2002
    Messages:
    784
    Location:
    Maryland, USA
    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;
        }
    }
    
     
  2. Breunor

    Breunor Deity

    Joined:
    Jul 2, 2004
    Messages:
    2,388
    Location:
    Earth
    Good to see you are still looking after us, Alexman!

    Best wishes,

    Breunor
     
  3. CanuckSoldier

    CanuckSoldier Emperor

    Joined:
    Oct 29, 2001
    Messages:
    1,834
    Location:
    Canada
    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
     
  4. SirPartyMan

    SirPartyMan Chieftain

    Joined:
    Apr 14, 2003
    Messages:
    2
    Location:
    New Jersey Short
    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
     
  5. ori

    ori Repair Guy Super Moderator

    Joined:
    Dec 17, 2005
    Messages:
    16,561
    Location:
    Baden-Württemberg, Germany
    It will need to be compiled into a new CvGameCoreDLL.dll
    and:
    :eek: Welcome to the posting side :band: [party] ;)
     
  6. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    Thankyou alexman for the post.:goodjob:

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

    I could update the DLL but do you want any other bugs from 3.17 fixed at the same time?
     
  7. classical_hero

    classical_hero In whom I trust

    Joined:
    Jan 30, 2003
    Messages:
    33,262
    Location:
    Perth,Western Australia
    Where is this file located?
     
  8. nutella67

    nutella67 Chieftain

    Joined:
    Feb 14, 2009
    Messages:
    1
    Location:
    Bamberg, Germany
    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 :(
     
  9. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    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.
     

    Attached Files:

  10. MadmanAtW

    MadmanAtW Knight

    Joined:
    Apr 13, 2008
    Messages:
    579
    Location:
    San Leandro, CA
    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.
     
  11. arhancsm

    arhancsm Chieftain

    Joined:
    Jun 26, 2003
    Messages:
    7
    why dont you just send the request to their coroporate to fix it
     
  12. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    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.
     
  13. MadmanAtW

    MadmanAtW Knight

    Joined:
    Apr 13, 2008
    Messages:
    579
    Location:
    San Leandro, CA
    Thanks. No, I'm not expecting them to either, but I wouldn't mind being pleasantly surprised, so... :)
     
  14. CanuckSoldier

    CanuckSoldier Emperor

    Joined:
    Oct 29, 2001
    Messages:
    1,834
    Location:
    Canada
    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
     
  15. classical_hero

    classical_hero In whom I trust

    Joined:
    Jan 30, 2003
    Messages:
    33,262
    Location:
    Perth,Western Australia
    Does this overwrite the things in he other unofficial patch, that have been fixed by that patch?
     
  16. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    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.
     
  17. CanuckSoldier

    CanuckSoldier Emperor

    Joined:
    Oct 29, 2001
    Messages:
    1,834
    Location:
    Canada
    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
     
  18. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    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.
     
  19. CanuckSoldier

    CanuckSoldier Emperor

    Joined:
    Oct 29, 2001
    Messages:
    1,834
    Location:
    Canada
    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
     
  20. SirPartyMan

    SirPartyMan Chieftain

    Joined:
    Apr 14, 2003
    Messages:
    2
    Location:
    New Jersey Short
    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
     

Share This Page