cpluspluscom/ChessPlusPlus

Changing AppStates

Thumperrr opened this issue · 4 comments

Application implements a function called changeState, who's function speaks for itself.
When creating AppStateGame, Application passes a pointer to itself, presumably so that AppStateGame should be able to call changeState when necessary.
However, the Application pointer in AppStateGame isn't a complete type, so you can't access any members of it.
I can't think of an elegant way to resolve this. Ideas?

Refer to the repo as of this commit: 5f27e5a

EDIT:
Would it be intuitive to make Application a singleton class?

LB-- commented

When creating AppStateGame, Application passes a pointer to itself

I can't find this, on what file and what line?

However, the Application pointer in AppStateGame isn't a complete type

It can be a complete type in the cpp file, can't it?

I can't find this, on what file and what line?

Application.hpp:21

It can be a complete type in the cpp file, can't it?

I just tried to access a member from a non-inline function (defined in cpp). The compiler still says it's an incomplete type.

LB-- commented

Application.hpp:21

Oh, that's a design flaw - I'll go fix it.

I just tried to access a member from a non-inline function (defined in cpp). The compiler still says it's an incomplete type.

Did you #include "Application.hpp"?

LB-- commented

@Thumperrr see if you like this better.