Skip to content
Permalink
Browse files

Add BG_CostToEvolve

  • Loading branch information
Gireen authored and Ubuntu committed Nov 11, 2019
1 parent a45b145 commit cce906da669e08487473689ac2ae6cc2eba05854
Showing with 25 additions and 12 deletions.
  1. +1 −1 src/cgame/cg_rocket_datasource.cpp
  2. +23 −11 src/shared/bg_misc.cpp
  3. +1 −0 src/shared/bg_public.h
@@ -1652,7 +1652,7 @@ void CG_Rocket_BuildAlienEvolveList( const char *table )
Info_SetValueForKey( buf, "num", va( "%d", i ), false );
Info_SetValueForKey( buf, "name", BG_ClassModelConfig( i )->humanName, false );
Info_SetValueForKey( buf, "description", BG_Class( i )->info, false );
Info_SetValueForKey( buf, "price", va( "%d", BG_ClassCanEvolveFromTo( cg.predictedPlayerState.stats[ STAT_CLASS ], i, cg.predictedPlayerState.persistant[ PERS_CREDIT ] ) / CREDITS_PER_EVO ), false );
Info_SetValueForKey( buf, "price", va( "%d", BG_CostToEvolve( cg.predictedPlayerState.stats[ STAT_CLASS ], i ) / CREDITS_PER_EVO ), false );

Rocket_DSAddRow( "alienEvolveList", "default", buf );

@@ -412,21 +412,16 @@ bool BG_ClassHasAbility( int pClass, int ability )

/*
==============
BG_ClassCanEvolveFromTo
BG_CostToEvolve
==============
*/
int BG_ClassCanEvolveFromTo( int from, int to, int credits )
int BG_CostToEvolve( int from, int to )
{
int fromCost, toCost, evolveCost;
int fromCost, toCost;

if ( from == to ||
from <= PCL_NONE || from >= PCL_NUM_CLASSES ||
to <= PCL_NONE || to >= PCL_NUM_CLASSES )
{
return -1;
}

if ( !BG_ClassUnlocked( to ) || BG_ClassDisabled( to ) )
from <= PCL_NONE || from >= PCL_NUM_CLASSES ||
to <= PCL_NONE || to >= PCL_NUM_CLASSES )
{
return -1;
}
@@ -453,7 +448,24 @@ int BG_ClassCanEvolveFromTo( int from, int to, int credits )
return -1;
}

evolveCost = toCost - fromCost;
return toCost - fromCost;
}

/*
==============
BG_ClassCanEvolveFromTo
==============
*/
int BG_ClassCanEvolveFromTo( int from, int to, int credits )
{
int evolveCost;

if ( !BG_ClassUnlocked( to ) || BG_ClassDisabled( to ) )
{
return -1;
}

evolveCost = BG_CostToEvolve( from, to );

if ( credits < evolveCost )
{
@@ -1394,6 +1394,7 @@ void BG_ClassBoundingBox( int pClass, vec3_t mins, vec3_t
team_t BG_ClassTeam( int pClass );
bool BG_ClassHasAbility( int pClass, int ability );

int BG_CostToEvolve(int from, int to);
int BG_ClassCanEvolveFromTo(int from, int to, int credits);
bool BG_AlienCanEvolve(int from, int credits);

0 comments on commit cce906d

Please sign in to comment.
You can’t perform that action at this time.