SDK Error: Cannot convert from 'int *' to 'int'

stolenrays

Deity
Joined
Aug 2, 2009
Messages
2,063
So I am trying to convert some Total War Code. I keep getting a: SDK Error: Cannot convert from 'int *' to 'int'. Not sure what it means, but here is the function in CvGame.cpp & then below the CvGame.h initializations.

Code:
int CvGame::getProhibitedSpecialUnitCount(SpecialUnitTypes eIndex) const
{
	FAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");
	FAssertMsg(eIndex < GC.getNumSpecialUnitInfos(), "eIndex is expected to be within maximum bounds (invalid Index)");

	if (m_ppaaiAM[eIndex] == NULL)
	{
		return 0;
	}
	return m_ppaaiAM[eIndex];
}

1>CvGame.cpp(3774) : error C2440: 'return' : cannot convert from 'int *' to 'int'
1> This conversion requires a reinterpret_cast, a C-style cast or function-style cast

Code:
	int* m_ppaaiProhibitedSpecialUnitCount;
	int** m_ppaaiAM;
             int getProhibitedSpecialUnitCount(SpecialUnitTypes eIndex) const;
 
m_ppaaiAM = ProhibitedSpecialUnitCount
It is declared (in both name and code) as a 2d array but you index it as a 1d array (that is why you get the error message).
And then you have a similar 1d array declared as well (but with a name that claims being a 2d array).
 
Back
Top Bottom