Witam,
Mam nastepujacy problem. Probuje dobrac sie do nastepujacej klasy (skrocona wersja):
class Entity : public Listener
{
public:
CLASS_PROTOTYPE( Entity );
// spawning variables
int entnum;
gentity_t *edict;
gclient_t *client;
int spawnflags;
// standard variables
str model;
// physics variables
float move_time; // how much time total_delta will take
Vector total_delta; // total unprocessed movement
Vector mins;
Vector maxs;
Vector absmin;
Vector absmax;
Vector centroid;
Vector velocity;
Vector avelocity;
Vector origin;
Vector angles;
Vector size;
int movetype;
int mass;
float gravity; // per entity gravity multiplier (1.0 is normal)
float orientation[3][3];
gentity_t *groundentity;
cplane_t groundplane;
int groundcontents;
// Model Binding variables
int numchildren;
int children[MAX_MODEL_CHILDREN];
// Surface variables
int numsurfaces;
// Light variables
float lightRadius;
// Team variables
str moveteam;
Entity *teamchain;
Entity *teammaster;
// Binding variables
Entity *bindmaster;
qboolean bind_use_my_angles;
Vector localorigin;
Vector localangles;
// targeting variables
str target;
str targetname;
str killtarget;
// Character state
float health;
float max_health;
int deadflag;
int flags;
// underwater variables
int watertype;
int waterlevel;
// Pain and damage variables
damage_t takedamage;
EntityPtr enemy;
float pain_finished;
float damage_debounce_time;
int damage_type;
// tutaj dosc duzo wycialem, nie jest to potrzebne
virtual void VelocityModified( void );
virtual void Archive( Archiver &arc );
};
Definicja CLASS_PROTOTYPE:
#define CLASS_PROTOTYPE( nameofclass ) \
public: \
static ClassDef ClassInfo; \
static void *_newInstance( void ); \
virtual ClassDef *classinfo( void ); \
static ResponseDef<nameofclass> Responses[]
Chodzi mi o to, zeby dobrac sie do wlasciwosci tej klasy majac do dyspozycji tylko wskaznik do niej. Sprawe komplikuje to, ze ten kod pochodzi z wczesniejszej wersji, a do kodu zrodlowego nowszej nie mam dostepu, wiec uklad wlasciwosci i metod mogl sie zmienic (ale jestem pewien, ze jest z grubsza ten sam), przez co nie moge po prostu wrzucic tej definicji do swojego kodu i uzyc go. Zeby bylo smieszniej, ta klasa Entity dziedziczy z 2 innych (Listener, ktory jest pochodna Class).
Czy mozna cos z tym zrobic? Chodzi mi tylko o dostanie sie do rzeczy typu entnum, spawnflags etc. Myslalem, zeby moze przesunac wskaznik o odpowiedna ilosc bajtow i czytac to jak strukture, mozna tak?
Z gory dziekuje,
Rookie One
<EDIT>Stad wiem, ze moge czytac klasy jak struktury, ale co z klasami dziedziczacymi?</EDIT>