General Tso
Panzer General
I'm trying to something that should be very simple, but I can't get it to work. I'm guessing that my problem is caused by some aspect of C++ that I don't understand. I'm trying to add a new variable to the CvGame.cpp file then access it in the usual fashion, but I keep getting the following error when I try to compile the SDK.
Here is what I have done to make the error appear.
I added this to CvGame.h
I added these to CvGame.cpp
and
When I call setSelectedUnitPlot from CvGame.ccp or CvGameInterface.cpp I get the error mentioned above. (I haven't tried calling from anywhere else.)
I created m_iSelectedUnitPlot as a protected variable and it is initialized in CvGame::CvGame.
setSelectedUnitPlot and getSelectedUnitPlot are created as public functions.
Anybody have any ideas?
Code:
1>CvGameInterface.cpp(906) : error C2662: 'CvGame::setSelectedUnitPlot' : cannot convert 'this' pointer from 'const CvGame' to 'CvGame &'
1> Conversion loses qualifiers
Here is what I have done to make the error appear.
I added this to CvGame.h
Code:
int m_iSelectedUnitPlot;
I added these to CvGame.cpp
Code:
int m_iSelectedUnitPlot = -1;
and
Code:
void CvGame::setSelectedUnitPlot(CvUnit* pUnit)
{
if (pUnit != NULL)
{
m_iSelectedUnitPlot = GC.getMapINLINE().plotNum(pUnit->getX(), pUnit->getY());
}
}
CvPlot* CvGame::getSelectedUnitPlot() const
{
return GC.getMapINLINE().plotByIndex(m_iSelectedUnitPlot);
}
When I call setSelectedUnitPlot from CvGame.ccp or CvGameInterface.cpp I get the error mentioned above. (I haven't tried calling from anywhere else.)
I created m_iSelectedUnitPlot as a protected variable and it is initialized in CvGame::CvGame.
setSelectedUnitPlot and getSelectedUnitPlot are created as public functions.
Anybody have any ideas?