Question : C++ compiler error C2039

1>..\scripts\northrend\icecrown_citadel\frozen_halls\halls_of_reflection\halls_of_reflection.cpp(748) : error C2039: 'SummonGameobject' : is not a member of 'Creature'
1>        c:\documents and settings\latest+kortoc\master\src\game\Creature.h(390) : see declaration of 'Creature'

Creature.h (line 390) = class MANGOS_DLL_SPEC Creature : public Unit

Could someone please explain how to make 'SummonGameobject' a member of creature? Forgive me, i'm quite the C++ newbie.

Answer : C++ compiler error C2039

Side: You other project has probably implemented SummonGameObject as a static method in the WorldObject class.

GameObject* WorldObject::SummonGameobject(uint32 id, float x, float y, float z, float angle, uint32 despwtime)

This line however gives the impression that it's non-static, but my rough guess is that it should be static because it seems to take GameObject's Id as first parameter GO_ICE_WALL stands for game object ice_wall. This method is the usual Global lookup method that locates register game objects and therefore makes sense to be static, unless ofcourse a worldobject is a composite game object composed of other game objects.

if(GameObject* pGate = m_creature->SummonGameObject(GO_ICE_WALL, 5540.39f, 2086.48f, 731.066f, 1.00057f, 0))

 Maybe you can check with the other project and see how they have done it. BTW, if SummonGameobject can return a GameObject that may not always be WorldGameObject then the return type should be a bit more stricter to avoid further unnessary typecasting and make subsequent code more typesafe. Otherwise it probably makes more sense to put it in GameObject rather than WorldGameObject.

It could be as simple as copying to Worldobject.h/cpp (if those are the names). Otherwise you should try to have your own design as you may see fit. Start by just defining it in Creature, if you need it elsewhere you can move it to the base class and refactor accordingle.

Would have been less of a guess game, had you have posted the source code ...

Random Solutions  
 
programming4us programming4us