(SDK) What is GET_PLAYER actually returning?

isau

Deity
Joined
Jan 15, 2007
Messages
3,071
I'm not a C++ guy, so some help is appreciated. :)

The more I look at it, the more GET_PLAYER confuses me. It seems to return an instance of CvPlayerAI, but most of the public methods available to CvPlayerAI can't be used with GET_PLAYER. For example:

Code:
GET_PLAYER( GC.getGame().getActivePlayer() ).getCanDoCivics(eCivic)

..throws an error similar to "getCanDoCivics is not a member of CvPlayerAI." I know I must be missing something super obvious, but after a few hours of looking at this I'm not any closer to an answer. Can someone help me out?

-isau
 
@isau
The function should be canDoCivics(eCivic)

GET_PLAYER is a macro. A macro in C++ is like an alias. If you look in the file CvPlayerAI.h line #425 you will see this:

#define GET_PLAYER CvPlayerAI::getPlayer

This means that every time GET_PLAYER is found it is replaced with CvPlayerAI::getPlayer. You don't need to know more details unless you actually want to learn C++.
 
Lol ok I got you.

This is embaressing but the problem is that I was typing getCanDoCivics instead of canDoCivics. 10 hours of programming baked me I guess. I was thinking maybe C++ differed radically from C# in how it does inheritance... lol anyway it works now. Thank you both so much for replying.

--isau
 
Top Bottom