-
Weird Inheritence Error
The error message I get is this.
Code:
C:\Programming\4x\ClientCode\SplashManager.cpp(81) : error C2039: 'LoadMenuA' : is not a member of 'sGameMode'
c:\programming\4x\clientcode\mode.h(36) : see declaration of 'sGameMode'
My code is gigantic, Ill just cut out the relavant parts to make this easy to read.
Code:
struct sShared {
public:
sGameMode* mode;
};
struct sGameMode {
public:
sGameMode() {
mode = GAMEMODE_LOAD_SPLASH;
}
~sGameMode() {
}
//batch
void LoadSplash() {
mode = GAMEMODE_LOAD_SPLASH;
}
void LoadMenu() {
mode = GAMEMODE_LOAD_MENU;
}
void Quit() {
mode = GAMEMODE_QUIT;
}
void Exit() {
mode = GAMEMODE_EXIT;
}
//Only return a load mode one time, increment to the actual mode after
short GetMode() {
short m = mode;
switch(mode) {
case GAMEMODE_LOAD_SPLASH:
case GAMEMODE_LOAD_MENU:
mode++;
break;
}
return m;
}
private:
short mode;
};
class cSplashManager : public sShared {
public:
cSplashManager();
~cSplashManager();
void Process(float* rate);
private:
//data structures
sSplash* current;
//fade functionality
bool fadein;
float accum;
};
void cSplashManager::Process(float* rate) {
//increment the accum value based on in our out
if(fadein)
accum += *rate;
else
accum -= *rate;
//check to see if we need to change direction
if(accum > 1.5f)
fadein = false;
//check to see if we are done
else if(accum < -0.25f)
mode->LoadMenu(); //COMPILER ERROR HERE
//set the current color based on this value
current->color->SetA(accum);
}
-
Try changing the name of LoadMenu to something completely unique (like GameModeLoadMenu123). Make sure to update that name everywhere you use it.
The error reference to LoadMenuA makes me think that a Windows typedef or #define is conflicting with your method names.
If that doesn't work, then try to make a small, compilable example that demonstrates the problem.
-
Thats what it was, damn annoying I tell you. Thanks.