Sea Bridge Mod

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
I'm attempting to reconstruct the Bridge mod so I can post a working version for everyone to use. I have successfully compiled my SDK changes into a new DLL. I have made the required changes in the following XML files:

CIV4ArtDefines_Improvement.xml
CIV4ImprovementInfos.xml
CIV4TerrainSchema.xml
Sea_Bridge_CIV4GameText.xml

My problem is I get the following error, when I start the mod:

Code:
LoadXML call failed for Terrain/CIV4ImprovementInfos.xml

There are more siblings than memory allocated for them in CvXMLLoadUtility::SetVariableListTagPair
Current XML file is: XXXXX.xml (it runs through a whole list of repeating files).

I'll be glad to post anything you may wish to look at.

What can I do to resolve this error?
 
I solved the problem, which was incredibly easy. It was a one line naming problem for the Civ4ImprovementInfos.xml file. :hammer2: I also made a small SDK change. The latest files, that now work, are posted for everyone to download.

Get it here: http://forums.civfanatics.com/downloads.php?do=file&id=18822
 
this looks great. I would like to use this in my rivermod. Just one question: does the AI understands this and uses it?
 
this looks great. I would like to use this in my rivermod. Just one question: does the AI understands this and uses it?

Without further testing, I would assume at this stage that the AI does not know how to use the workboat to build the SeaBridge. It's likely that AI units would use any existing SeaBridge, which has been built. I could be wrong. At this time I just don't know for sure. The purpose of the mod was to get the stand alone SeaBridge mod working, so that it can be merged into other mods. The AI stuff can come latter.
 
Are you sure this needs SDK?
You could also use 'use as city' in the XML for the improvements, and then make it only buildable on coastal tiles. Wouldn't it work already after doing that?
The only 'problem' you would have is that you get bonuses from city promotions when attacking units on a bridge. Oh, and I don't know if this is the case now too, but it'd also be a problem that you can build it at any coastal tile, which would look really stupid - this problem I actually do consider a problem but should be moddable in python, but that's what I hope not what I know!
But would that be the only problem? Well, I'm not an expert at modding at all, that's why I'm just suggesting this, I leave it to you to tell me if it's a good idea ;)
 
Are you sure this needs SDK?
You could also use 'use as city' in the XML for the improvements, and then make it only buildable on coastal tiles. Wouldn't it work already after doing that?
The only 'problem' you would have is that you get bonuses from city promotions when attacking units on a bridge. Oh, and I don't know if this is the case now too, but it'd also be a problem that you can build it at any coastal tile, which would look really stupid - this problem I actually do consider a problem but should be moddable in python, but that's what I hope not what I know!
But would that be the only problem? Well, I'm not an expert at modding at all, that's why I'm just suggesting this, I leave it to you to tell me if it's a good idea ;)

As you said, getting bonuses from city promotions when attacking units on a bridge, would be a problem. Yes, a problem that is completely avoided, by using SDK. Mine Warfare has been improved dramatically by migrating it to the SDK and you will get a chance to play them both when the next version of OGI is released. :)
 
I, I have this problem, my medieval units can't walk on the bridge.... I am the only one ?
Taken from vanilla CvUnit::canMoveInto
PHP:
    case DOMAIN_LAND:
       if (pPlot->isWater() && !canMoveAllTerrain())
       {
           if (!pPlot->isCity() || 0 == GC.getDefineINT("LAND_UNITS_CAN_ATTACK_WATER_CITIES"))
           {
               if (bIgnoreLoad || !isHuman() || plot()->isWater() || !canLoad(pPlot))
               {
                   return false;
It is used when unit is DOMAIN_LAND and pPlot->isWater(). Notice how it at this point will not check if there is a route on the plot and just report that it can't move onto the plot. This mean it requires DLL changes to make bridges working.
 
This is the code I have in OGI:

Code:
case DOMAIN_LAND:
  if (pPlot->isWater() && !canMoveAllTerrain())
  {
/************************************************************************************************/
/* Orion Veteran - Sea Bridge - Start         19 March 2012                                     */
/************************************************************************************************/
   ImprovementTypes eImprovement = pPlot->getImprovementType();
   bool plotHasSeaBridge = false;
   
   if (eImprovement != NO_IMPROVEMENT)
   {
    plotHasSeaBridge = GC.getImprovementInfo(eImprovement).isSeaBridge();
   }
   
   if (!plotHasSeaBridge || !pPlot->isAdjacentToLand())
            {
    if (!pPlot->isCity() || 0 == GC.getDefineINT("LAND_UNITS_CAN_ATTACK_WATER_CITIES"))
    {
     if (bIgnoreLoad || !isHuman() || plot()->isWater() || !canLoad(pPlot))
     {
      return false;
     }
    }
/************************************************************************************************/
/* Orion Veteran - Sea Bridge - End           19 March 2012                                     */
/************************************************************************************************/
   }
  }
  break;

[CODE/]
 
plotHasSeaBridge = GC.getImprovementInfo(eImprovement).isSeaBridge();
This obviously has to add isSeaBridge, which could be as simple as adding a bool to xml.

if (!pPlot->isCity() || 0 == GC.getDefineINT("LAND_UNITS_CAN_ATTACK_WATER_CITIES"))
I wouldn't use getDefineINT in a frequently called function like this. It's way too slow for that. Cache the value and rely on a cached int/bool.
 
Hi!
I found a bug.
If AI finishes a move on the bridge, it freezes.
How to fix it?
 

Attachments

  • Civ4ScreenShot0003.jpg
    Civ4ScreenShot0003.jpg
    262.4 KB · Views: 87
Top Bottom