Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Find_My_Vehicle
Find_My_Vehicle [message #456821] Tue, 04 October 2011 15:10 Go to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
How do i get the VehicleGameObj converted to a normal GameObject?


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Wed, 05 October 2011 03:53]

Report message to a moderator

Re: Find_My_Vehicle [message #456945 is a reply to message #456821] Wed, 05 October 2011 23:38 Go to previous messageGo to next message
snazy2000 is currently offline  snazy2000
Messages: 67
Registered: December 2007
Karma: 0
Recruit
what do you mean?
Re: Find_My_Vehicle [message #456960 is a reply to message #456821] Thu, 06 October 2011 07:10 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
VehicleGameObject pVehicleObj = Find_My_Vehicle();
GameObject* pObject = dynamic_cast<GameObject*>(pVehicleObj);



Or...

GameObject* pObject = dynamic_cast<GameObject*>(Find_My_Vehicle());



Or...

GameObject* pObject = (GameObject*)Find_My_Vehicle();




(PS: If you didn't already figure it out, VehicleGameObject *is* a GameObject, since it's a derived class)




(PPS: Yes, I know dynamic casting a subclass to its superclass is redundant since it's always going to succeed, just illustrating my point Razz )


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Thu, 06 October 2011 07:14]

Report message to a moderator

Re: Find_My_Vehicle [message #457022 is a reply to message #456821] Thu, 06 October 2011 17:28 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
ok that works although i dont understand how it works i gues i understand it somehow on some way XD im just a nooby in programmin

Owner of kambot TT server

kambot.freeforums.org
Re: Find_My_Vehicle [message #457045 is a reply to message #456821] Fri, 07 October 2011 00:27 Go to previous messageGo to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
VehicleGameObject is derived from GameObject.
This means VehicleGameObject is everything GameObject is +more.

The code for this would be
class VehicleGameObject : public GameObject{...};

*note: In the scripts.dll source, there might be an inheritance in between or multiple inheritance. I did not check this code so it may look a bit different in the real source. This does however reflect how VehicleGameObject is a GameObject

You can ofcourse have this stacked
class X{...};

//Y is X +more
class Y : public X{...};

//Z is Y +more
class Z : public Y{...};

As Z derives from Y, and Y from X, Z is also an X.

Or multiple
class A{...};
class B{...};

class C : public A, B{...};

C is both an A and B, BUT A is not a B and B is not an A in this case.

http://www.cprogramming.com/tutorial/lesson20.html

Then you also get things like access modifiers and the virtual keyword that all affect inheritance behavior, but you can search that up when you need it Wink


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Fri, 07 October 2011 00:37]

Report message to a moderator

Re: Find_My_Vehicle [message #457046 is a reply to message #456821] Fri, 07 October 2011 00:32 Go to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
look at VehicleGameObj.h for all the stuff you can do with vehicles game objects.

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Previous Topic: old tokenclass
Next Topic: Tool for renaming w3d-files?
Goto Forum:
  


Current Time: Sun Dec 01 19:35:43 MST 2024

Total time taken to generate the page: 0.00721 seconds