[SDK] Using global define causes crash - what's the problem??

Maniac

Apolyton Sage
Joined
Nov 27, 2004
Messages
5,603
Location
Gent, Belgium
I've added a little piece of code to CvUnit::canMoveInto :

When I add a global define, and use it, the game crashes after a couple turns:

Code:
if (isBarbarian() && !(isHasPromotion((PromotionTypes)GC.getDefineINT("PROMOTION_NATIVES_CAN_MOVE_IN_CULTURE"))))
{
	if (pPlot->isOwned())
	{
		return false;
	}
}

However when I hardcode the promotion which the global define points to into the SDK, the game works fine:

Code:
if (isBarbarian() && !(isHasPromotion((PromotionTypes)GC.getInfoTypeForString("PROMOTION_NATIVES_CAN_MOVE_IN_CULTURE"))))
{
	if (pPlot->isOwned())
	{
		return false;
	}
}

Hardcoding stuff in the SDK is of course not desirable, so I'm wondering... what's the problem with using a global define? How can I use this global define in this piece of code?
 
Without seeing you new GlobalDefine stuff, I would say it should be..
Code:
GC.getInfoTypeForString(GC.getDefineSTRING("PROMOTION_NATIVES_CAN_MOVE_IN_CULTURE"))
 
Back
Top Bottom