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

DLL - Various Mod Components

Discussion in 'Civ5 - Mod Components' started by whoward69, Nov 4, 2012.

  1. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    DLL containing various "mod components" to enhance/extend my Pick'N'Mix mods. Download here, install notes here.

    EDIT: List last updated for V16 of the DLL - for full details of each feature see posts #2 and #3

    • Global - Enable Magellan: Adds a notification when someone circumnavigates the globe (does not itself enable the circumnavigate option)
    • Global - Local Generals: Great Generals and Admirals gained from combat experience spawn in the war-zone and not in a distant city
    • Global - Passable Forts: Ships may enter coastal forts/citadels
    • Global - Passable Forts Any: Ships may enter any forts/citadels
    • Global - City Forest Bonus: Give initial production boost for cities founded on forests, as if the forest had been chopped down by a worker
    • Global - CS Gift Ships: City States will gift ships
    • Global - CS Upgrades: Units in allied militaristic City States can upgrade
    • Global - CS Raze Rarely: City States will only raze captured cities if they are very unhappy
    • Global - No Conquered Spaceships: Removes assembled spaceship parts from conquered capitals
    • Global - Allies Block Blockades: Adjacent allied ships block blockades by enemy ships 2 or more tiles away
    • Global - Short Embarked Blockades: Embarked combat units only blockade adjacent tiles
    • Global - Grateful Settlers: Other player's settlers captured from Barbarians will sometimes remain as settlers
    • Global - Subs Under Ice Immunity: Subs under ice are immune to all attacks except from other subs
    • Global - Promotion Classes: Permits units to have promotion trees different from their assigned CombatClass
    • Global - Alpine Passes: Mountain plots return their terrain as TERRAIN_MOUNTAIN and any land unit may enter a mountain that has a road/rail route
    • Global - City State Gifts: City States give different gifts depending on their type (cultural, religious, maritime, etc)
    • Global - Quick Routes: Route To will only build roads, or upgrade road to rail, for human players
    • Global - Paratroops Movement: Paratroops can move/attack after the drop, if the drop is not at max range
    • Global - Paratroops AA Damage: Paratroops take AA damage from hostile units
    • Global - Nukes Melt Ice: Nukes will melt ice
    • Buildings - Pro-Rata Purchase: Purchase of buildings in cities allows for any current production
    • Traits - Crosses Ice: Permits land units to cross ice
    • Promotions - Variable Recon: Permits variable recon ranges by creating extra recon range promotions (like extra sight range)
    • Promotions - Cross Mountains: Permits land units to cross mountains (like the Carthage trait)
    • Promotions - Cross Oceans: Permits coastal units to cross oceans
    • Promotions - Cross Ice: Permits land units to cross ice
    • Promotions - Half Move: Adds a HalfMove feature to the UnitPromotions_Terrains and UnitPromotions_Features tables
    • Promotions - Deep Water Embarkation: Permits Deep Water (Ocean) embarkation for hovering units
    • UI - City Production: Permit the focus (gold, science, etc) of puppet cities to be set (but not what is being built or how specialists are allocated)
    • UI - City Expansion: Permit human players to choose they own city tiles due to cultural expansion
    • Units - Local Workers: Restricts worker suggestions to local tiles
    • Units - Hovering Land Only Heal: Hovering unit can only heal over land
    • Units - Hovering Coastal Attacks: Permits hovering units to attack coastal shipping
    • Religion - No Preferences: Removes religion preference
    • Religion - Randomise: Randomises religion choice (if preferred religion unavailable) - use with Religion - No Preferences for totally random religions
    • Religion - Conversion Modifiers: Adds ConversionModifier and GlobalConversionModifier (in the same vein as espionage modifiers) to buildings
    • Events - New Era: Sent when the team/player enters a new era - GameEvents.TeamSetEra.Add(function(eTeam, eEra) end)
    • Events - Diplo Events: Sent during Game.DoFromUIDiploEvent - GameEvents.UiDiploEvent.Add(function(eEvent, eAIPlayer, iArg1, iArg2) end)
    • Events - Goody Tech: Sent if a Goody Hut is giving a tech - GameEvents.GoodyHutCanResearch.Add(function(ePlayer, eTech) return true end) and GameEvents.GoodyHutTechResearched.Add(function(ePlayer, eTech) end)
    • Events - Natural WOnder Discovery: Event sent when the team discovers a new Natural Wonder - GameEvents.NaturalWonderDiscovered.Add(function(iTeam, iFeature, iX, iY, bFirst) end)
    • Events - Minors: Events sent on status change with City States - GameEvents.MinorFriendsChanged.Add(function(iMinor, iMajor, bIsFriend, iOldFriendship, iNewFriendship) end) and GameEvents.MinorAlliesChanged.Add(function(iMinor, iMajor, bIsAlly, iOldFriendship, iNewFriendship) end)
    • Events - Found Religion: Events sent when a player is about to found a religion - 6 events (see below)
    • Events - Acquire Beliefs: Events sent when choosing beliefs - GameEvents.PlayerCanHaveBelief.Add(function(iPlayer, iBelief) return true end) and GameEvents.ReligionCanHaveBelief.Add(function(iReligion, iBelief) return true end)
    • Events - Paradrops: Events sent to ascertain if a unit can start a paradrop from this tile - 3 events (see below)
    • Events - Can Move Into: Event sent to ascertain if a unit can move into a given plot - GameEvents.CanMoveInto.Add(function(iPlayer, iUnit, iPlotX, iPlotY, bAttack, bDeclareWar) return true end)
    • Events - Nuclear Detonation: Event sent when a nuke is fired - GameEvents.NuclearDetonation.Add(function(iPlayer, iX, iY, bWar, bBystanders) end)
    • Events - War And Peace: Events sent about war and peace - 4 events (see below)
    • Events - City: Events sent after a city produces/buys something - 5 events (see below)
    • Events - Unit Upgrades: Events sent as units are promoted/upgraded - 5 events (see below)
    • Events - Rebase: Events sent to ascertain if a unit can rebase to a specific plot (either a city or a carrier) - 4 events (see below)
    • Events - RED: Events generated by the RED (by Gedemon) dll mod code - 7 events (see below)
    • API - Espionage API: Adds various Lua methods to the Player object for controlling spies
    • API - Religion: Enables the Religion API
    • API - Plot Based Damage: Enabes the Plot Based Damage API (replaces fixed damage from mountains)
    • API - Extensions: Enables the Extensions API
    • API - Lua Extensions: Enables the LUA Extensions API
    • Config - AI In XML: Push various hard-coded values controlling the AI out into XML
    • BugFix - Free Food Building: Fixes the NumCitiesFreeFoodBuilding (policy finisher) bug where the civilization has a UB for the Aquaduct
    • BugFix - Naval Free Units: Fixes the bug where the naval Civilization_FreeUnits start on land
    • BugFix - Naval Nearest Water: Fixes the bug where the naval units jump to the nearest city and not the nearest available water plot
    • BugFix - Barb Camp Terrains: Fixes the bug where Barb Camps ignore the ValidTerrains and ValidFeatures tables
    • BugFix - Remove Ghost Routes: Fixes the bug where you can't remove roads in no-mans-land originally built by a now dead player
    • BugFix - Units Awake In Danger: Fixes healing units ignoring enemy units and sleeping units under direct fire remaining asleep - thanks to hulkster for highlighting the latter issue
    • BugFix - Workers Visible Danger: Fixes workers stopping what they are doing at any hint of danger to only when they can see an enemy unit
    • BugFix - Interceptor Strength: Fixes the bug in calculating AA interception strength which takes terrain into account
    • BugFix - Unit Power Calculation: Fixes the very dodgy maths in the calculation of a unit's power
    • BugFix - Unit Power Bonus Vs Domain Only: Fixes the Anti-Air non-domain bonuses issue, requires BUGFIX_UNIT_POWER_CALC to be enabled
    • BugFix - Unit Power Naval Consistency: Fixes the naval imbalance in a unit's power calculation, requires BUGFIX_UNIT_POWER_CALC to be enabled
    • BugFix - Hovering Pathfinder: Fixes a bug in the pathfinder code for hovering units at the coast
    • BugFix - Embarking Pathfinder: Fixes a bug in the pathfinder code for embarking
    • BugFix - Range 3 Targetting: Fixes the Range-3 targetting bug - code by DaveMcW

    NOTE: Most of these options must be enabled by another mod that also provides the UI for them and/or additional Lua coding. The following Pick'N'Mix mods use features of the DLL

    • Global - City State Airbases
    • Global - City States Gifts
    • Global - Enable Magellan
    • Global - Espionage Mapping
    • Global - Espionage Race
    • Goody Huts - Tech Refund
    • Improvement - Airbases
    • Improvement - Tunnel
    • Religion - Natural Wonder Epiphany
    • Promotions - Heli AirRecon
    • Promotions - Jet Long Range Recon
    • Promotions - Terrain Crossing
    • Units - Paratroop Enhancements
    • Unique Unit - Longboat
    • Unique Building - Cistern
    • Unique Building - Turkish Baths
    • UI - City Expansion
    • UI - City Production
    • UI - Diary



    In keeping with my "buffet table" approach to modding, each component can be enabled/disabled (via an XML based database table in CustomModOptions.xml) or the associated code excluded from the build (via #defines in CustomMods.h)

    Full source code changes included - suggest you start at CustomMods.h (source code also available from GitHub)
    If you use this code as the basis for your own changes, please ensure you read the modder notes in CvDllContext.cpp and change the GUID in CustomMods.h
     

    Attached Files:

    BlueCulture likes this.
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    All options are documented in CustomModOptions.xml

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
      <CustomModOptions>
        <!-- "See also: Mod Name" refers to mods on www.picknmixmods.com -->
        <!-- Any option with a "See also" and a default value of 0 should not be enabled directly in this file but only via a mod -->
        
        <!-- Class - Data=0, BugFix=1, API=2, Events=3, Minor=4, Common=5, Major=6 -->
        <!--   0=Data   - Data used by other components -->
        <!--   1=BugFix - Bug fixes, usually wanted -->
        <!--   2=API    - API, no effect and very minor overhead unless used by another mod -->
        <!--   3=Events - Events, overhead even if not used by another mod -->
        <!--   4=Minor  - Minor enhancements, limited game play changes -->
        <!--   5=Common - Common enhancements, obvious game play changes -->
        <!--   6=Major  - Major enhancements, massive game play changes -->
        <!-- Most useful for SQL ... "UPDATE CustomModOptions SET Value=0 WHERE Class>=3;" -->
    
        <!-- Adds a notification when someone circumnavigates the globe -->
        <!-- Requires a mod to actually enable the feature in-game -->
        <!-- See also: "Global - Enable Magellan" -->
        <Row Class="4" Name="GLOBAL_ENABLE_MAGELLAN" Value="1"/>
    
        <!-- Great Generals and Admirals gained from combat experience spawn in the war-zone and not in a distant city -->
        <Row Class="5" Name="GLOBAL_LOCAL_GENERALS" Value="1"/>
    
    	<!-- Permits units to have promotion trees different from their assigned CombatClass -->
        <Row Class="4" Name="GLOBAL_PROMOTION_CLASSES" Value="0"/>
    
        <!-- Ships may enter coastal forts/citadels -->
        <!-- GLOBAL_PASSABLE_FORTS=0 ships may only enter player cities or pass through allied CS cities -->
        <!-- GLOBAL_PASSABLE_FORTS=1 ships may additionally enter coastal forts in player, allied CS or no-mans land -->
        <!-- GLOBAL_PASSABLE_FORTS_ANY=1 ships may additionally enter inland forts in player, allied CS or no-mans land -->
        <Row Class="6" Name="GLOBAL_PASSABLE_FORTS" Value="1"/>
        <!-- Ships may enter ANY forts/citadels (requires GLOBAL_PASSABLE_FORTS=1) -->
        <Row Class="6" Name="GLOBAL_PASSABLE_FORTS_ANY" Value="0"/> <!-- Default is OFF -->
    
        <!-- Give initial production boost for cities founded on forests, as if the forest had been chopped down by a worker -->
        <Row Class="6" Name="GLOBAL_CITY_FOREST_BONUS" Value="1"/>
    
        <!-- Mountain plots return their terrain as TERRAIN_MOUNTAIN and any land unit may enter a mountain that has a road/rail route -->
        <!-- See also: "Improvement - Tunnel" -->
        <Row Class="5" Name="GLOBAL_ALPINE_PASSES" Value="0"/>
    
        <!-- City States will (occasionally) gift ships -->
        <Row Class="5" Name="GLOBAL_CS_GIFT_SHIPS" Value="1"/>
    
        <!-- Units in allied militaristic City States can upgrade - requires a (cosmetic) patch to UnitPanel.lua to fix the incorrect message about being in friendly territory-->
        <Row Class="5" Name="GLOBAL_CS_UPGRADES" Value="1"/>
    
        <!-- City States will only raze captured cities if they are very unhappy (and not just unhappy) -->
        <Row Class="5" Name="GLOBAL_CS_RAZE_RARELY" Value="1"/>
    
        <!-- City States give different gifts depending on their type (cultural, religious, maritime, etc) -->
        <!-- See also: "Global - City States Gifts" -->
        <Row Class="6" Name="GLOBAL_CS_GIFTS" Value="0"/>
    
        <!-- Remove assembled spaceship parts from conquered capitals -->
        <Row Class="5" Name="GLOBAL_NO_CONQUERED_SPACESHIPS" Value="1"/>
    
        <!-- Adjacent allied ships block blockades by enemy ships 2 or more tiles away -->
        <Row Class="6" Name="GLOBAL_ALLIES_BLOCK_BLOCKADES" Value="1"/>
        <!-- Embarked combat units only blockade adjacent tiles -->
        <Row Class="6" Name="GLOBAL_SHORT_EMBARKED_BLOCKADES" Value="1"/>
    
        <!-- Other player's settlers captured from Barbarians will sometimes remain as settlers -->
        <Row Class="6" Name="GLOBAL_GRATEFUL_SETTLERS" Value="1"/>
        <Row Class="0" Name="GLOBAL_GRATEFUL_SETTLERS_PERCENT" Value="20"/>
    
        <!-- Route To will only build roads, or upgrade road to rail, for human players -->
        <Row Class="4" Name="GLOBAL_QUICK_ROUTES" Value="1"/>
    
        <!-- Subs under ice are immune to all attacks except from other subs -->
        <Row Class="6" Name="GLOBAL_SUBS_UNDER_ICE_IMMUNITY" Value="1"/>
    
        <!-- Paratroops can move/attack after the drop, if the drop is not at max range -->
        <!-- See also: "Units - Paratroop Enhancements" -->
        <Row Class="5" Name="GLOBAL_PARATROOPS_MOVEMENT" Value="0"/>
        <!-- Paratroops take AA damage from hostile units -->
        <!-- See also: "Units - Paratroop Enhancements" -->
        <Row Class="5" Name="GLOBAL_PARATROOPS_AA_DAMAGE" Value="0"/>
    
        <!-- Nukes will melt ice, however as neither the 3D nor the SV map update as the ice is removed it's fairly pointless! -->
        <Row Class="4" Name="GLOBAL_NUKES_MELT_ICE" Value="0"/>
    
        <!-- Permits land units to cross ice, this is the trait version (ie applies to all units of the civ) of PROMOTIONS_CROSS_ICE -->
        <Row Class="2" Name="TRAITS_CROSSES_ICE" Value="1"/>
    
        <!-- Permits variable recon ranges by creating extra recon range promotions (like extra sight range) -->
        <!-- See also: "Promotions - Heli AirRecon" -->
        <!-- See also: "Promotions - Jet Long Range Recon" -->
        <Row Class="2" Name="PROMOTIONS_VARIABLE_RECON" Value="1"/>
    
        <!-- Permits land units to cross mountains (like the Carthage trait) -->
        <!-- See also: "Promotions - Terrain Crossing" -->
        <Row Class="2" Name="PROMOTIONS_CROSS_MOUNTAINS" Value="1"/>
        <!-- Permits coastal units to cross oceans -->
        <!-- See also: "Promotions - Terrain Crossing" -->
        <!-- See also: "Unique Unit - Longboat" -->
        <Row Class="2" Name="PROMOTIONS_CROSS_OCEANS" Value="1"/>
        <!-- Permits land units to cross ice -->
        <!-- See also: "Promotions - Terrain Crossing" -->
        <Row Class="2" Name="PROMOTIONS_CROSS_ICE" Value="1"/>
        <!-- Adds a HalfMove feature to the UnitPromotions_Terrains and UnitPromotions_Features tables -->
        <!-- See also: "Promotions - Terrain Crossing" -->
        <Row Class="2" Name="PROMOTIONS_HALF_MOVE" Value="1"/>
        <!-- Permits Deep Water (Ocean) embarkation for hovering units -->
        <!-- See also: "Promotions - Terrain Crossing" -->
        <Row Class="2" Name="PROMOTIONS_DEEP_WATER_EMBARKATION" Value="0"/>
    
        <!-- Permit the focus (gold, science, etc) of puppet cities to be set (but not what is being built or how specialists are allocated) -->
        <!-- Requires a mod to provide the actual UI -->
        <!-- See also: "UI - City Production" -->
        <Row Class="5" Name="UI_CITY_PRODUCTION" Value="1"/>
        <!-- Permit human players to choose they own city tiles due to cultural expansion -->
        <!-- Requires a mod to provide the actual UI -->
        <!-- See also: "UI - City Expansion" -->
        <Row Class="6" Name="UI_CITY_EXPANSION" Value="0"/>
        <Row Class="0" Name="UI_CITY_EXPANSION_BUTTONPOPUP_MODDER_OFFSET" Value="0"/>
    
        <!-- Purchase of buildings in cities allows for any current production, (current production is depreciated) -->
        <Row Class="5" Name="BUILDINGS_PRO_RATA_PURCHASE" Value="1"/>
        <Row Class="0" Name="BUILDINGS_PRO_RATA_PURCHASE_DEPRECIATION" Value="80"/>
    
        <!-- Restricts worker suggestions to local tiles (at the limits specified - limits are distances between the unit and the plot as the crow flies, NOT path lengths) -->
        <Row Class="5" Name="UNITS_LOCAL_WORKERS" Value="1"/>
        <Row Class="0" Name="UNITS_LOCAL_WORKERS_LANDLIMIT" Value="6"/>
        <Row Class="0" Name="UNITS_LOCAL_WORKERS_WATERLIMIT" Value="10"/>
    
        <!-- Hovering unit can only heal over land -->
        <Row Class="6" Name="UNITS_HOVERING_LAND_ONLY_HEAL" Value="1"/>
        <!-- Permits hovering units to attack coastal shipping -->
        <Row Class="6" Name="UNITS_HOVERING_COASTAL_ATTACKS" Value="1"/>
        <Row Class="0" Name="UNITS_HOVERING_COASTAL_ATTACKS_RANGE" Value="1"/>
        <Row Class="0" Name="UNITS_HOVERING_COASTAL_ATTACKS_MULTIPLIER" Value="1"/>
        <Row Class="0" Name="UNITS_HOVERING_COASTAL_ATTACKS_DIVISOR" Value="2"/>
    
        <!-- Removes religion preference -->
        <Row Class="5" Name="RELIGION_NO_PREFERRENCES" Value="1"/>
        <!-- Randomises religion choice (if preferred religion unavailable) -->
        <Row Class="4" Name="RELIGION_RANDOMISE" Value="1"/>
        <!-- Adds ConversionModifier and GlobalConversionModifier (in the same vein as espionage modifiers) to buildings -->
        <Row Class="5" Name="RELIGION_CONVERSION_MODIFIERS" Value="0"/>
    
    (continued below ...)
     
  3. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    (... continued from above)

    Code:
        <!-- Event sent when the player enters a new era, see also NewEraPopup.lua and BUTTONPOPUP_NEW_ERA -->
        <!--   GameEvents.TeamSetEra.Add(function(eTeam, eEra, bFirst) end) -->
        <!-- See also: "Global - Espionage Race" -->
        <Row Class="3" Name="EVENTS_NEW_ERA" Value="1"/>
    
    	<!-- Event sent when the team discovers a new Natural Wonder -->
    	<!--   GameEvents.NaturalWonderDiscovered.Add(function(iTeam, iFeature, iX, iY, bFirst) end) -->
        <!-- See also: "Religion - Natural Wonder Epiphany" -->
        <Row Class="3" Name="EVENTS_NW_DISCOVERY" Value="0"/>
    
        <!-- Event sent during Game.DoFromUIDiploEvent, see also DiscussionDialog.lua -->
        <!--   GameEvents.UiDiploEvent.Add(function(eEvent, eAIPlayer, iArg1, iArg2) end) -->
        <!-- See also: "UI - Diary" -->
        <Row Class="3" Name="EVENTS_DIPLO_EVENTS" Value="1"/>
    
        <!-- Events sent on status change with City States -->
        <!--   GameEvents.MinorFriendsChanged.Add(function(iMinor, iMajor, bIsFriend, iOldFriendship, iNewFriendship) end) -->
        <!--   GameEvents.MinorAlliesChanged.Add(function(iMinor, iMajor, bIsAlly, iOldFriendship, iNewFriendship) end) -->
        <!-- See also: "Global - City State Airbases" -->
        <Row Class="3" Name="EVENTS_MINORS" Value="0"/>
    
        <!-- Events sent if a Goody Hut is giving a tech -->
        <!--   GameEvents.GoodyHutCanResearch.Add(function(iPlayer, eTech) return true end) -->
        <!--   GameEvents.GoodyHutTechResearched.Add(function(iPlayer, eTech) end) -->
        <!-- See also: "Goody Huts - Tech Refund" -->
        <Row Class="3" Name="EVENTS_GOODY_TECH" Value="0"/>
    
        <!-- Events sent when a player is about to found a religion -->
        <!--   GameEvents.PlayerCanFoundPantheon(function(iPlayer) return true end) -->
        <!--   GameEvents.PlayerCanFoundReligion(function(iPlayer, iCity) return true end) -->
        <!--   GameEvents.GetReligionToFound.Add(function(iPlayer, iPreferredReligion, bIsAlreadyFounded) return iPreferredReligion end) -->
        <!--   GameEvents.PantheonFounded.add(function(iPlayer, iReligion, iBelief1) end) -->
        <!--   GameEvents.ReligionFounded.add(function(iPlayer, iHolyCity, iReligion, iBelief1, iBelief2, iBelief3, iBelief4, iBelief5, sCustomName) end) -->
        <!--   GameEvents.ReligionEnhanced.add(function(iPlayer, iReligion, iBelief1, iBelief2) end) -->
        <Row Class="3" Name="EVENTS_FOUND_RELIGION" Value="0"/>
        <!-- Events sent when choosing beliefs -->
        <!--   GameEvents.PlayerCanHaveBelief.Add(function(iPlayer, iBelief) return true end) -->
        <!--   GameEvents.ReligionCanHaveBelief.Add(function(iReligion, iBelief) return true end) -->
        <Row Class="3" Name="EVENTS_ACQUIRE_BELIEFS" Value="0"/>
    
        <!-- Events sent after a city produces/buys something -->
        <!--   GameEvents.CityTrained.Add(function(iPlayer, iCity, iUnit, bGold, bFaith) end) -->
        <!--   GameEvents.CityConstructed.Add(function(iPlayer, iCity, iBuilding, bGold, bFaith) end) -->
        <!--   GameEvents.CityCreated.Add(function(iPlayer, iCity, iProject, bGold, bFaith) end) -->
        <!--   GameEvents.CityBoughtPlot.Add(function(iPlayer, iCity, iPlotX, iPlotY, bGold, bCulture) end) -->
        <Row Class="3" Name="EVENTS_CITY" Value="0"/>
    
        <!-- Event sent to ascertain if a unit can rebase to a specific plot (either a city or a carrier) -->
        <!-- This is a "TestAny" event so is currently fairly unique!!! -->
        <!--   GameEvents.CanLoadAt(function(iPlayer, iUnit, iPlotX, iPlotY) return false end) -->
        <!-- This is a "TestAny" event so is currently fairly unique!!! -->
        <!--   GameEvents.CanRebaseInCity.Add(function(iPlayer, iUnit, iPlotX, iPlotY) return false end) -->
        <!-- This is a "TestAny" event so is currently fairly unique!!! -->
        <!--   GameEvents.CanRebaseTo.Add(function(iPlayer, iUnit, iPlotX, iPlotY) return true end) -->
        <!-- This is a standard "Hook" event -->
        <!--   GameEvents.RebaseTo.Add(function(iPlayer, iUnit, iPlotX, iPlotY) end) -->
        <!-- See also: "Improvement - Airbases" -->
        <!-- See also: "Global - City State Airbases" -->
        <Row Class="3" Name="EVENTS_REBASE" Value="0"/>
    
        <!-- Events sent before and after a paradrop -->
        <!-- This is a "TestAny" event so is currently fairly unique!!! -->
        <!--   GameEvents.CanParadropFrom.Add(function(iPlayer, iUnit, iPlotX, iPlotY) return false end) -->
        <!-- This is a standard "TestAll" event
        <!--   GameEvents.CannotParadropFrom.Add(function(iPlayer, iUnit, iPlotX, iPlotY) return false end) -->
        <!-- This is a standard "Hook" event -->
        <!--   GameEvents.ParadropAt.Add(function(iPlayer, iUnit, iFromX, iFromY, iToX, iToY) end) -->
        <!-- See also: "Units - Paratroop Enhancements" -->
        <Row Class="3" Name="EVENTS_PARADROPS" Value="0"/>
    
    	<!-- Events sent as units are promoted/upgraded -->
        <!--   GameEvents.CanHavePromotion.Add(function(iPlayer, iUnit, iPromotionType) return true end) -->
        <!--   GameEvents.UnitPromoted.Add(function(iPlayer, iUnit, iPromotionType) end) -->
        <!--   GameEvents.CanHaveAnyUpgrade.Add(function(iPlayer, iUnit) return true end) -->
        <!--   GameEvents.CanHaveUpgrade.Add(function(iPlayer, iUnit, iUnitClassType, iUnitType) return true end) -->
        <!--   GameEvents.UnitUpgraded.Add(function(iPlayer, iOldUnit, iNewUnit, bGoodyHut) end) -->
        <Row Class="3" Name="EVENTS_UNIT_UPGRADES" Value="0"/>
    
        <!-- Events sent about war and peace -->
        <!--   GameEvents.IsAbleToDeclareWar.Add(function(iPlayer, iAgainstTeam) return true end) -->
        <!--   GameEvents.DeclareWar.Add(function(iPlayer, iAgainstTeam) end) -->
        <!--   GameEvents.IsAbleToMakePeace.Add(function(iPlayer, iAgainstTeam) return true end) -->
        <!--   GameEvents.MakePeace.Add(function(iPlayer, iAgainstTeam) end) -->
        <Row Class="3" Name="EVENTS_WAR_AND_PEACE" Value="0"/>
    
    	<!-- Event sent when a nuke is fired -->
    	<!--   GameEvents.NuclearDetonation.Add(function(iPlayer, iX, iY, bWar, bBystanders) end) -->
        <Row Class="3" Name="EVENTS_NUCLEAR_DETONATION" Value="0"/>
    
        <!-- Events generated by the RED (by Gedemon) dll mod code -->
        <!--   Turn   ==> PlayerEndTurnInitiated, PlayerEndTurnCompleted, TurnComplete -->
        <!--   Combat ==> PushingMissionTo, MustAbortAttack, CombatResult, CombatEnded -->
        <Row Class="3" Name="EVENTS_RED_TURN" Value="0"/>
        <Row Class="3" Name="EVENTS_RED_COMBAT" Value="0"/>
        <Row Class="3" Name="EVENTS_RED_COMBAT_MISSION" Value="0"/>
        <Row Class="3" Name="EVENTS_RED_COMBAT_ABORT" Value="0"/>
        <Row Class="3" Name="EVENTS_RED_COMBAT_RESULT" Value="0"/>
        <Row Class="3" Name="EVENTS_RED_COMBAT_ENDED" Value="0"/>
    
        <!-- Event sent to ascertain if a unit can move into a given plot -->
        <!--   GameEvents.CanMoveInto.Add(function(iPlayer, iUnit, iPlotX, iPlotY, bAttack, bDeclareWar) return true end) -->
        <!-- VERY, VERY CPU INTENSIVE - should only really be used for investigation, not actual game play!!! -->
        <Row Class="3" Name="EVENTS_CAN_MOVE_INTO" Value="0"/>
    
        <!-- Most API enhancements cannot be turned on or off, those entries (*) are just here to get their entries into the CustomMod.log file -->
        <!-- Enabes the Plot Based Damage API (replaces fixed damage from mountains) -->
        <!-- Take care when enabling this and adding terrain based damage for ice as you will probably want to give submarines the IgnoreTerrainDamage promotion -->
        <!-- See also: "Promotions - Terrain Crossing" -->
        <Row Class="2" Name="API_PLOT_BASED_DAMAGE" Value="0"/>
    
        <!-- * Enables the Espionage API -->
        <!-- See also: "Global - Espionage Race" -->
        <!-- See also: "Global - Espionage Mapping" -->
        <Row Class="2" Name="API_ESPIONAGE" Value="1"/>
    
        <!-- * Enables the Religion API -->
        <!-- See also: "Religion - Natural Wonder Epiphany" -->
        <Row Class="2" Name="API_RELIGION" Value="1"/>
    
        <!-- * Enables the LUA Extensions API - see http://forums.civfanatics.com/showthread.php?t=492305 -->
        <Row Class="2" Name="API_LUA_EXTENSIONS" Value="1"/>
        <!-- * Enables the Extensions API -->
        <!-- pCity->IsAddsFreshWater() -->
        <!-- See also: "Unique Building - Cistern" -->
        <Row Class="2" Name="API_EXTENSIONS" Value="1"/>
        <!-- * Push various hard-coded values controlling the AI out into XML - see CustomModDbUpdates.sql for specific values-->
        <Row Class="2" Name="CONFIG_AI_IN_XML" Value="1"/>
            
        <!-- Some bug fixes cannot be turned on or off, those entries (*) are just here to get their entries into the CustomMod.log file -->
        <!-- Fixes the NumCitiesFreeFoodBuilding (policy finisher) bug where the civilization has a UB for the Aquaduct -->
        <!-- See also: "Unique Building - Turkish Baths" -->
        <Row Class="1" Name="BUGFIX_FREE_FOOD_BUILDING" Value="1"/>
        <!-- * Fixes the bug where the naval Civilization_FreeUnits start on land -->
        <Row Class="1" Name="BUGFIX_NAVAL_FREE_UNITS" Value="1"/>
        <!-- Fixes the bug where the naval units jump to the nearest city and not the nearest available water plot -->
        <Row Class="1" Name="BUGFIX_NAVAL_NEAREST_WATER" Value="1"/>
        <!-- Fixes the bug where Barb Camps ignore the ValidTerrains and ValidFeatures tables -->
        <Row Class="1" Name="BUGFIX_BARB_CAMP_TERRAINS" Value="1"/>
        <!-- Fixes the bug where you can't remove roads in no-mans-land originally built by a now dead player -->
        <Row Class="1" Name="BUGFIX_REMOVE_GHOST_ROUTES" Value="1"/>
        <!-- Fixes healing units ignoring enemy units and sleeping units under direct fire remaining asleep -->
        <Row Class="1" Name="BUGFIX_UNITS_AWAKE_IN_DANGER" Value="1"/>
        <!-- Fixes workers stopping what they are doing at any hint of danger to only when they can see an enemy unit -->
        <Row Class="1" Name="BUGFIX_WORKERS_VISIBLE_DANGER" Value="1"/>
        <!-- Fixes the bug in calculating AA interception strength which takes terrain into account -->
        <Row Class="1" Name="BUGFIX_INTERCEPTOR_STRENGTH" Value="1"/>
        <!-- Fixes the very dodgy maths in the calculation of a unit's power -->
        <Row Class="1" Name="BUGFIX_UNIT_POWER_CALC" Value="1"/>
        <!-- Fixes the Anti-Air non-domain bonuses issue, requires BUGFIX_UNIT_POWER_CALC to be enabled -->
        <Row Class="1" Name="BUGFIX_UNIT_POWER_BONUS_VS_DOMAIN_ONLY" Value="1"/>
        <!-- Fixes the naval imbalance in a unit's power calculation, requires BUGFIX_UNIT_POWER_CALC to be enabled -->
        <Row Class="1" Name="BUGFIX_UNIT_POWER_NAVAL_CONSISTENCY" Value="1"/>
        <!-- * Fixes a bug in the pathfinder code for hovering units at the seaside! -->  
        <Row Class="1" Name="BUGFIX_HOVERING_PATHFINDER" Value="1"/>
        <!-- Fixes the Range-3 targetting bug - code by DaveMcW (http://forums.civfanatics.com/showthread.php?t=479509) -->
        <Row Class="1" Name="BUGFIX_RANGE_3_TARGETTING" Value="1"/>
      </CustomModOptions>
    </GameData>
    
    I shall be adding more components to this DLL mod as I get around to them
     
  4. trystero49

    trystero49 Chieftain

    Joined:
    Apr 30, 2012
    Messages:
    515
    Canals?!?!? Awesome.

    Should Great Admirals be changed to allow them to build canals instead of their somewhat situational Repair Fleet ability?
     
  5. ww2commander

    ww2commander Chieftain

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Its kind of funny how it took you a matter of days to implement something a lot of people have been asking (personally not me!) Firaxis to enable since day 0 of its release!

    Makes you wonder how wish-list items are managed on their priority list or even if they have a wish-list???

    Anyhow, good work whoward. Now I just need to get my head around how to use all these DLL modifications that are beginning to flood the forum. I feel a DLL 'standards' or 'etiquette' may be required sooner rather than later!
     
  6. daviiadams

    daviiadams Chieftain

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    After the way things have developed since release, I'm all too disappointed in Firaxis in general.

    Canals have been asked for since forever, so you'll be making a fair few people happy whoward!

    As for the persistent downloading of mods; I've assumed that's likely to mean the cache is being deleted automatically, every time the game is exited :confused:
     
  7. ww2commander

    ww2commander Chieftain

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Your probably right as I noticed every time I start up the game or Worldbuilder, it asks me to re-select my mods as if I had just cleared my cache or am using them for the first time.
     
  8. trystero49

    trystero49 Chieftain

    Joined:
    Apr 30, 2012
    Messages:
    515
    Your source code includes a bunch of .h and .cpp files which I assume contain your changes. But what are the .rc and .vcproj files for? I assume the .vcproj are there to open your changes in VC studio. What's the .rc for?
     
  9. Terradive

    Terradive Chieftain

    Joined:
    Jun 4, 2009
    Messages:
    186
    You know looking through the changes in the dll it is really disappointing that they pawned this off as a new game, and had soooo many problems to boot.
     
  10. Pouakai

    Pouakai It belongs in a museum. Moderator

    Joined:
    Jun 16, 2010
    Messages:
    7,151
    Location:
    Aotearoa
    These are great mods, well done! Are they installed like standard mods, or is there anything special that needs doing?
     
  11. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
  12. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    They are all in one mod (as you can only have one DLL mod loaded at a time). It's a standard mod, install it, enable it, play with it.

    After you have installed it, if you don't want "Feature X" edit the file CustomModOptions.xml and change the corresponding value to 0, eg to stop generals and admirals spawing in the war-zone (ie to restore the original behaviour)

    Code:
    <!-- Great Generals and Admirals gained from combat experience spawn in the war-zone and not in a distant city -->
    <Row Name="GLOBAL_LOCAL_GENERALS" Value="0"/>
    
    If you include my code into your own DLL mod and don't want that feature, don't bother removing the code, just open CustomMods.h and comment out the corresponding #define

    Code:
    // Great Generals and Admirals gained from combat experience spawn in the war-zone and not in a distant city
    // #define MOD_GLOBAL_LOCAL_GENERALS     (gCustomMods.getOption("GLOBAL_LOCAL_GENERALS") == 1)
    
    Disabling the code that way will make it easier for you to reapply the changes if/when I fix bugs or add new components - in theory it also makes it easier to create compound DLLs using code from many developers as it makes it very easy to find and identify changes
     
  13. trystero49

    trystero49 Chieftain

    Joined:
    Apr 30, 2012
    Messages:
    515
    I really appreciate the way that you went about adding in your changes because I know I will be using more than one mod with a custom .dll. So far there are two custom .dlls released that I know of and like and it is definitely a lot easier to find the changes that people have made (and implement them) when you use the #preprocessor commands to make your changes.

    For example, both these mod components and Range 3 bugfix make changes to CvPlot.cpp. Merging the two .cpp files into one was relatively straightforward this time but it could get a lot more complicated in the future.

    I would recommend that people write a quick /*blurb*/ at the top of every source file that they modify and explain how they modified it. It's very helpful for the 20K+ line .cpp files that you have to look through. Or I guess you can just add quick //author:me comments above whatever code you added. Either way, I think some easy to find documentation is in order, especially because mods that add a custom .dll are exclusive with mods that add another custom .dll.

    Offtopic: If you have a line of code in c++ that looks like this:

    #preprocessor CODE //comment

    does the preprocessor understand the "//comment" as a comment or part of the #preprocessor command?
     
  14. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    IMHO code should be self-commenting, as I'm a great believer in the school-of-thought that says "if the code and the comments disagree, believe neither" ;)

    What is much more useful is the ability to be able to compare two files and merge them quickly (eg with BeyondCompare or WinDiff) and for that you need to be able to identify what changed and which fix/feature those changes apply to - and the #directives do that very effectively
     
  15. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    It really doesn't matter, as it's only the compiler that ever sees the results.
     
  16. trystero49

    trystero49 Chieftain

    Joined:
    Apr 30, 2012
    Messages:
    515
    Well, in your case, it was easy to figure out what the code was and where it was. Just follow the MOD_GLOBAL_s or the MOD_UI_s, and it was pretty obvious what was happening. But since the community is comprised of a variety of people with varying coding experience and styles, going through 20K lines of code in some files, self-commenting code might end up too high an ideal to aspire to.

    Also, thanks for letting me know about those programs. I tried using OOO to compare files but it was kind of unwieldy. I'll check these out.
     
  17. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    It's not just coding ... people will still post walls of text using txtspk and no capitals or punctuation wiv por speling even gramma and stuff and still xpect replies

    Literacy in computer languages is no different to that in spoken/written langauges ;)
     
  18. daviiadams

    daviiadams Chieftain

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Should mods in this area look to be more of a collaborative effort, given the one DLL situation? Not that I can see me being brave enough to touch it at the moment :-S
     
  19. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,342
    Location:
    Near Portsmouth, UK
    Comes back to the "one man's meat is another man's poison" argument (or "one man's bug-fix is another man's broken exploit")

    If
    a) any mod with a DLL includes the source
    b) the mod author permits the use of that source in other mods
    c) the changes to the source are clearly identified
    then no, they don't need to be a collaborative effort, as you can always merge the required changes for your own mod(s)
     
  20. daviiadams

    daviiadams Chieftain

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Ah ok, just wondered if the perceptions of how people go about it might change as a result :)
     

Share This Page