Topic: mGetShipBPV() does not work - here is the fix for it  (Read 3936 times)

0 Members and 1 Guest are viewing this topic.

Offline FPF-SCM_TraceyG_XC

  • Empress of the Empire
  • Commander
  • *
  • Posts: 2543
  • Gender: Female
mGetShipBPV() does not work - here is the fix for it
« on: December 22, 2004, 11:05:14 am »
ship->mGetShipBPV() always returns zero, however, the protected member fShipBPV is being initialised to the correct BPV.

Looking in shipinfo.cpp, we find that function does nothing and only has the one line that says "return 0". Since  fShipBPV is a protected member, we cannot access it outside of the class, nor do we have the source code to the API to make the correct change and recompile it.

However, we can write a new function and add it to shipinfo.h as part of the tShipInfo class by using an inline function

In order to access it, you must make the following changes to the OP API in ShipInfo.h, you will need to change the properties of the file first so it is not set to read only in order to save the chanes.

In  class tShipInfo   : public tActor find the section of code which looks like this:

   //
   //   BPV values
   //
   int32   mGetBPV( void );
   int32   mGetTotalBPV( void );


and change it to:

   //
   //   BPV values
   //
   int32   mGetBPV( void );

   inline int32 mGetRealBPV() // this function added by TraceyG
   {
      return fShipBPV;
   }

   int32   mGetTotalBPV( void );

This adds in a new inline function without the need to recompile ShipInfo.cpp

Once you have done this, you can then use the function ship->mGetRealBPV() just as you would have used mGetBPV(), only now it will return the correct value.
Captain FPF-TraceyG, Federation Protection Fleet


SFC2.net Admin member
SFC3.net Admin member
Voting member of the DGA
Member of XenoCorp, Squadron Commodore

Offline FA Frey XC

  • Site Owner
  • Administrator
  • Captain
  • *
  • Posts: 5694
  • Gender: Male
    • XenoCorp.Net
Re: mGetShipBPV() does not work - here is the fix for it
« Reply #1 on: December 22, 2004, 11:07:31 am »
Nice work Tracey!
Vice President of Technology,
Dynaverse Gaming Association
Owner, CEO XenoCorp Inc.


Offline FPF-SCM_TraceyG_XC

  • Empress of the Empire
  • Commander
  • *
  • Posts: 2543
  • Gender: Female
Re: mGetShipBPV() does not work - here is the fix for it
« Reply #2 on: September 09, 2006, 06:16:47 am »
Bump for Dave
Captain FPF-TraceyG, Federation Protection Fleet


SFC2.net Admin member
SFC3.net Admin member
Voting member of the DGA
Member of XenoCorp, Squadron Commodore