DLL - Various Mod Components

I thought "BUGFIX_RESEARCH_OVERFLOW" option should be 'abandoned option' as this option exists since before official fix patch. But you made micro-mod which enables this option and I just wondered what this option does. Best way to solve my question is looking into code, of course, but I couldn't figure out on my own because I was away from home.

Now I see into your code and Yes, with this option the game uses correct way to calculate science overflow instead of Firaxis' clever solution; setting the limit of max overflow amount. It's very nice. :)

I'm sorry to annoy you.
And again thanks for your effort.
 
Unlikely! What I said was that the para-drop mod does something similar so you could use that as a starting point ... a search-and-replace of event names is very unlikely to work!

It works well! :goodjob:

Following is the Test Code:

Code:
local directions = {
	DirectionTypes.DIRECTION_NORTHEAST, DirectionTypes.DIRECTION_EAST,
	DirectionTypes.DIRECTION_SOUTHEAST, DirectionTypes.DIRECTION_SOUTHWEST, 
	DirectionTypes.DIRECTION_WEST,      DirectionTypes.DIRECTION_NORTHWEST
}

function OnCanAirliftFrom(iPlayer, iUnit, iPlotX, iPlotY)
	local pPlot = Map.GetPlot(iPlotX, iPlotY);
	local pCarrUnit = nil;
	local pUnit = Players[iPlayer]:GetUnitByID(iUnit);
	local bIsCanAirliftFrom = false;
	
	if pPlot and pPlot:GetNumUnits() > 1 then
		for i = 0, pPlot:GetNumUnits() - 1 do
			pCarrUnit = pPlot:GetUnit(i);
			if pCarrUnit:GetOwner() == iPlayer and pCarrUnit ~= pUnit and pCarrUnit:IsHoveringUnit() then
				bIsCanAirliftFrom = true;
				break;
			end
		end
	end
	if not bIsCanAirliftFrom then
		for _, direction in ipairs(directions) do
			pPlot = Map.PlotDirection(iPlotX, iPlotY, direction);
			if pPlot and pPlot:GetNumUnits() > 0 then
				for i = 0, pPlot:GetNumUnits() - 1 do
					pCarrUnit = pPlot:GetUnit(i)
					if pCarrUnit:GetOwner() == iPlayer and pCarrUnit:IsHoveringUnit() then
						bIsCanAirliftFrom = true;
						break;
					end
				end
				if bIsCanAirliftFrom then
					break;
				end
			end
		end
	end
	if pUnit and pUnit:HasMoved() then
		bIsCanAirliftFrom = false;
	end
	
	return bIsCanAirliftFrom;
end
GameEvents.CanAirliftFrom.Add(OnCanAirliftFrom)

function OnCanAirliftTo(iPlayer, iUnit, iPlotX, iPlotY)
	local pPlot = Map.GetPlot(iPlotX, iPlotY);
	local pCarrUnit = nil;
	local bIsCanAirliftTo = false;
	
	if pPlot:GetNumUnits() == 0 then
		for _, direction in ipairs(directions) do
			pPlot = Map.PlotDirection(iPlotX, iPlotY, direction);
			if     pPlot and pPlot:IsCity() then
				local pCity = pPlot:GetPlotCity();
				if (pCity:GetOwner() == iPlayer or Players[pCity:GetOwner()]:IsAllies(iPlayer))
				and(pCity:IsHasBuilding(GameInfo.Buildings["BUILDING_AIRPORT"].ID)
				or  pCity:IsHasBuilding(GameInfo.Buildings["BUILDING_MILITARY_BASE"].ID))
				then
					bIsCanAirliftTo = true;
					break;
				end
			elseif pPlot and pPlot:GetNumUnits() > 0 then
				for i = 0, pPlot:GetNumUnits() - 1 do
					pCarrUnit = pPlot:GetUnit(i)
					if pCarrUnit:GetOwner() == iPlayer and pCarrUnit:IsHoveringUnit() then
						bIsCanAirliftTo = true;
						break;
					end
				end
				if bIsCanAirliftTo then
					break;
				end
			end
		end
	end
	
	return bIsCanAirliftTo;
end
GameEvents.CanAirliftTo.Add(OnCanAirliftTo)

:lol:
 
Hey whoward,

I've integrated v74 into the CP, and I've encountered a bug in the 100s xp model. It seems that, when resolving combat between two civs, the MAX_INT value (of the cvunit::maxXPValue) is being multiplied by 100, thus resulting in an error value of -1 when setting XP. This doesn't happen for barbs (as they have a within-bounds XP value). So, I'm thinking that the iMax * 100 need an additional element, like this:

Code:
//	--------------------------------------------------------------------------------
#if defined(MOD_API_XP_TIMES_100)
void CvUnit::setExperienceTimes100(int iNewValueTimes100, int iMax)
#else
void CvUnit::setExperience(int iNewValue, int iMax)
#endif
{
	VALIDATE_OBJECT
#if defined(MOD_API_XP_TIMES_100)
		if ((getExperienceTimes100() != iNewValueTimes100) && (getExperienceTimes100() < ([COLOR="red"](iMax == INT_MAX || iMax == -1)[/COLOR] ? INT_MAX: (iMax * 100))))
#else
		if ((getExperience() != iNewValue) && (getExperience() < ((iMax == -1) ? INT_MAX : iMax)))
#endif
	{
#if defined(MOD_API_XP_TIMES_100)
		int iExperienceChangeTimes100 = iNewValueTimes100 - getExperienceTimes100();
#else
		int iExperienceChange = iNewValue - getExperience();
#endif

#if defined(MOD_API_XP_TIMES_100)
		m_iExperienceTimes100 = std::min(([COLOR="Red"](iMax == INT_MAX || iMax == -1)[/COLOR] ? INT_MAX : (iMax * 100)), iNewValueTimes100);
		CvAssert(getExperienceTimes100() >= 0);
#else
		m_iExperience = std::min(((iMax == -1) ? INT_MAX : iMax), iNewValue);
		CvAssert(getExperience() >= 0);
#endif

Make sense?

Anyways, keep up the good work, just thought I should stop by and share this.

Cheers,
Gazebo
 
I tries getting the latest DLL component mod for Super Power conversion and every link says 404 not found.

Anything?
 
I did a major internal update of the website last night and appear to have broken the download links on the mod pages.

However, the ones to the left of the mod name in the categories list (left hand nav tree thingy) work, so until I can fix the pages (tonight) you can download the .civ5mod files via those
 
I did a major internal update of the website last night and appear to have broken the download links on the mod pages.

However, the ones to the left of the mod name in the categories list (left hand nav tree thingy) work, so until I can fix the pages (tonight) you can download the .civ5mod files via those

Awesome, thanks for the info!
 
All download links should be working again. Please let me know of any further issues.
 
V75 on web site and GitHub - fixes XP times 100 issue
 
In this post you say your modifications to the DLL "solves all [...] issues" related to terrain crossing.

One of these issues is listed as:
  • The problem with <CanMoveAllTerrain> is that units will treat land/water as the same - and move freely anywhere on the map (it's what the Steam Punk Airships get)

Is there any way - while using VMC - to achieve this effect now? I want to give my Flying units the ability to go to water tiles without embarking as well as going over Mountains.
 
See my "Units - Steampunk Airships" or "Civilization - Morindim" mods. The former changes helicopters so they can fly over coast and embark at the coast/ocean boundary, the latter does something similar for the Great Air Spirit
 
V75 on web site and GitHub - fixes XP times 100 issue

was it a DLL fix only? So can I just replace in the v74 folder the DLL with the new dll ? Or were there other changes too?
(Just want to know if I have to compile a new modpack, or if it is enough to simply replace the DLL file ;) )
 
Yes, but, what I'm asking is about the possibility to achieve the original effect of CanMoveAllTerrain, i.e., an unit that can cross ocean without embarking and mountains while still using VMC (some of us are addicted to the DLL, we even got a group for it).

Isn't it the promotion DEEPWATER_EMBARKATION that defines if the specific (hovering) unit embarks when entering ocean tiles or not?
So that without this promotion it's able to hover over ocean tiles as well?

Or did I get that wrong?
 
CanMoveAllTerrain still works - check out the "Units - Steampunk Airships" mod. The big airship is like the original, it can fly anywhere (IIRC - just don't park over Krakatoa!) while the little one (and helicopters) can only fly over coast and have to embark at the ocean boundary.

@Lynnes - yes, it's the DEEPWATER_EMBARKATION promotion; no, you didn't get it wrong
 
Speaking of the DEEPWATER_EMBARKATION promotion, have you changed something about this lately?
When I was using VMC v72 all helicopter units got this promotion, but now with v75 it isn't there anymore.
When I check the PromotionsTerrainCrossing.xml I can't find an entry where this promotion is assigned to the gunships (no <Unit_FreePromotions>)
There is only

Code:
	<UnitPromotions_UnitCombats>
		<Row>
			<UnitCombatType>UNITCOMBAT_HELICOPTER</UnitCombatType>
			<PromotionType>PROMOTION_DEEPWATER_EMBARKATION</PromotionType>
		</Row>

		<Row>
			<UnitCombatType>UNITCOMBAT_HELICOPTER</UnitCombatType>
			<PromotionType>PROMOTION_DEFENSIVE_DEEPWATER_EMBARKATION</PromotionType>
		</Row>
	</UnitPromotions_UnitCombats>

plus

Code:
			<CannotBeChosen>true</CannotBeChosen>

So from my understanding there is no way how any unit could receive this promotion (without editing the mod).
Is this done via DLL?

edit: The promotion itself (when being added with Unit_FreePromotions) still works fine though.
 
Back
Top Bottom