About Store Forum Documentation Contact
Donations:
206$/mo



Post Reply 
Character went out from a car
Author Message
Esenthel Offline
Administrator

Post: #16
RE: Character went out from a car
__super can call base methods of the base class
01-21-2010 05:19 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #17
RE: Character went out from a car
So if I have Base object with virtual void abc(); and Xyz:Base object with virtual void abc(); and in for example Xyz::update() i write before __super abc() i'll use method from Xyz:Base and when i write abc; after __super i'll use method from Base? I hope that you understand what I mean grin
(This post was last modified: 01-21-2010 05:51 PM by Harry.)
01-21-2010 05:32 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #18
RE: Character went out from a car
I got confused in the middle wink
01-21-2010 05:41 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #19
RE: Character went out from a car
struct Base
{
virtual void abc(); // first
....
}
struct Xyz:Base
{
virtual void abc(); // second
virtual Bool update();
}
Bool Xyz::upadate()
{
abc(); // i use function from struct Base
__super()::update();
abc(); // i use function from struct Xyz::Base

return true;
}

And now smile ?
01-21-2010 05:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #20
RE: Character went out from a car
nope,

it works this way:

Code:
struct Base
{
   virtual void abc(); // first
  ....
}
struct Xyz : Base
{
  virtual void abc(); // second
  virtual Bool update();
}
Bool Xyz::upadate()
{
  __super()::abc(); // i use function from struct Base
  abc(); // i use function from struct Xyz::Base

  __super()::abc(); // i use function from struct Base
  abc(); // i use function from struct Xyz::Base

return true;
}
01-21-2010 05:56 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #21
RE: Character went out from a car
Ok now I understand it. Thanks.
01-21-2010 06:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #22
RE: Character went out from a car
I have this error:

error C2259: 'policeCar' : cannot instantiate abstract class

Code:
struct Car : Game::Obj
{
...
}
struct policeCar : Car
{
...
}

Game::ObjMemx<policeCar   > policeCars; // container for vehicle objects
.setObjType(policeCars,OBJ_VEHICLE  )
Reference<policeCar>refCar;

What is wrong here? Is it better to create car which base on Game::Obj or make it as struct without base (is it possible?). How can I set car in right place in World by using second method?
01-26-2010 10:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #23
RE: Character went out from a car
error C2259: 'policeCar' : cannot instantiate abstract class

you must define all methods which are declared in the header with "=NULL" at the end (check tutorial for extending base game object class)
01-26-2010 11:41 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #24
RE: Character went out from a car
Why when this lines:

wheel[0].angle(carAngle).accel(accel).brake(brake);
wheel[1].angle(carAngle).accel(accel).brake(brake);

are called in my code, fps value harshly fall? (from 50 to 17 for example). I have them in PoliceCars::update and all cars is based on Item objects.
03-17-2010 06:26 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply