Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 06:21:11 am

Login with username, password and session length
Be sure to check out the Dynaverse.Net Repository, the most comprehensive SFC library around !! ftp.dynaverse.net
692190 Posts in 49566 Topics by 2957 Members
Latest Member: Jasoneagle
* Home Help Search Calendar Login Register
Dynaverse.net  |  Taldrenites  |  Starfleet Command Mission Scripting  |  Topic: mGetClassType() returns the wrong values - here is the fix for it 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: mGetClassType() returns the wrong values - here is the fix for it  (Read 745 times)
FPF-SCM_TraceyG_XC
Empress of the Empire
Global Moderator
Commander
*
Offline Offline

Gender: Female
Posts: 2543



mGetClassType() returns the wrong values - here is the fix for it
« on: December 21, 2004, 09:08:42 am »

In the OP API, the class tShipInfo contains a method called mGetClassType(). It is supposed to return an enumerated value of eClassTypes.

eg. eClassTypes fHullClass = Ship->mGetClassType();

The returned value, however, is incorrect in the OP API (although I believe it works normally in EAW).

Fortunately there is a fix for it. I have used the following function to 'restores' the value returned from above to its correct value.

eClassTypes mDebugGetClassType(eClassTypes hullclass)
{
   switch(hullclass)
   {
   case kClassShuttle :
      return kClassShuttle;
      break;
   case kClassPseudoFighter :
      return kClassPseudoFighter;
      break;
   case kClassFreighter :
      return kClassFreighter;
      break;
   case kClassFrigate :
      return kClassCarrier;
      break;
   case kClassDestroyer :
      return kClassFrigate;
      break;
   case kClassWarDestroyer :
      return kClassDestroyer;
      break;
   case kClassLightCruiser :
      return kClassWarDestroyer;
      break;
   case kClassHeavyCruiser :
      return kClassLightCruiser;
      break;
   case kClassNewHeavyCruiser :
      return kClassNewHeavyCruiser;
      break;
   case kClassHeavyBattlecruiser :
      return kClassHeavyCruiser;
      break;
   case kClassCarrier :
      return kClassHeavyBattlecruiser;
      break;
   case kClassDreadnought :
      return kClassDreadnought;
      break;
   case kClassBattleship :
      return kClassBattleship;
      break;
   case kClassListeningPost :
      return kClassListeningPost;
      break;
   case kClassBaseStation :
      return kClassBaseStation;
      break;
   case kClassBattleStation :
      return kClassBattleStation;
      break;
   case kClassStarBase :
      return kClassStarBase;
      break;
   case kClassMonster :
      return kClassMonster;
      break;
   case kClassPlanets :
      return kClassPlanets;
      break;
   case kClassSpecial :
      return kClassSpecial;
      break;
   default :
      return kClassShuttle;
      break;
   }
}

I have declared this as a global function simply by placing it into my CommonDefs.cpp file (with appropriate prototype in Commondefs.h) but it can be placed anywhere.

In the above example, the code would now look like this:

eClassTypes fHullClass = Ship->mGetClassType();
fHullClass = mDebugGetClassType(fHullClass);

The above function must be called whenever mGetClassType() is used (until we can correct the source code).
Feel free to use the above code.
Logged

Captain FPF-TraceyG, Federation Protection Fleet


SFC2.net Admin member
SFC3.net Admin member
Voting member of the DGA
Member of XenoCorp, Squadron Commodore
Centauri Vaughn
Ensign
*
Offline Offline

Gender: Male
Posts: 45



Re: mGetClassType() returns the wrong values - here is the fix for it
« Reply #1 on: December 23, 2004, 11:23:45 am »


Hey TraceyG,

MagnumMan's ShipList library will save you from going through all this trouble.

Feel free to contact me if you intend to use it.
Logged
FPF-SCM_TraceyG_XC
Empress of the Empire
Global Moderator
Commander
*
Offline Offline

Gender: Female
Posts: 2543



Re: mGetClassType() returns the wrong values - here is the fix for it
« Reply #2 on: December 23, 2004, 12:19:52 pm »

Thanks for that CV. Unfortunately Magnum Man's shiplist library was not designed for custom shiplists and will not work properly if the shiplist is heavily modded. For this reason I have avoided using it until we can rewrite it so it will work with any shiplist.
Logged

Captain FPF-TraceyG, Federation Protection Fleet


SFC2.net Admin member
SFC3.net Admin member
Voting member of the DGA
Member of XenoCorp, Squadron Commodore
Centauri Vaughn
Ensign
*
Offline Offline

Gender: Male
Posts: 45



Re: mGetClassType() returns the wrong values - here is the fix for it
« Reply #3 on: December 24, 2004, 07:18:35 am »

Quote
Unfortunately Magnum Man's shiplist library was not designed for custom shiplists and will not work properly if the shiplist is heavily modded. For this reason I have avoided using it until we can rewrite it so it will work with any shiplist.

I have used MagnumMan's library for heavily modded shiplist. FleetPick, for example, could have not been created w/o it. The only draw back is the load time but there are a few lines of code you can add to take care of that.
Logged
FPF-SCM_TraceyG_XC
Empress of the Empire
Global Moderator
Commander
*
Offline Offline

Gender: Female
Posts: 2543



Re: mGetClassType() returns the wrong values - here is the fix for it
« Reply #4 on: December 24, 2004, 08:55:05 pm »

I heard that if you do not have the Federation listed first in the shiplist, then it doesn't work properly. Also, Firesoul is working on a new shiplist API that should remedy that (along with a few other additions). Magnum Man's shiplist scripting tool is certainly very useful though and opens up new possibilities. I also heard that the load time is increased for a mission, as you say. Coop ace also uses the it, (I think) and the mission runs fine on GSA, although Dave Wessels said he tried using it for D2 missions and it caused an increased incidence of player drops. I will certainly look you up if I have any questions  Smiley
Logged

Captain FPF-TraceyG, Federation Protection Fleet


SFC2.net Admin member
SFC3.net Admin member
Voting member of the DGA
Member of XenoCorp, Squadron Commodore
Pages: [1] Print 
Dynaverse.net  |  Taldrenites  |  Starfleet Command Mission Scripting  |  Topic: mGetClassType() returns the wrong values - here is the fix for it « previous next »
Jump to:  

Powered by MySQL Powered by PHP Dynaverse.net | Powered by SMF 1.0.15.
© 2001-2008, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!
Page created in 0.204 seconds with 20 queries.