diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-06-29 00:52:09 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-06-29 16:40:28 +0200 |
commit | 0918eb3bcdefd0d6ee4bd573b761454c99f032f6 (patch) | |
tree | dd1bd0bfe5348ad3b4860f11b7d3dcbb6db9ca3c /src/ui/ui_main.c | |
parent | 93d2e4414ee25e417ee0d2ca0248448002ea4d5b (diff) |
Initial implementation of new grenades.
Diffstat (limited to 'src/ui/ui_main.c')
-rw-r--r-- | src/ui/ui_main.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 6487fae..dc5bc26 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -2353,6 +2353,17 @@ static void UI_ParseCarriageList( void ) uiInfo.upgrades |= ( 1 << i ); } + else if( iterator[ 0 ] == 'G' ) + { + iterator++; + + while( iterator[ 0 ] != ' ' ) + *bufPointer++ = *iterator++; + + *bufPointer++ = '\n'; + + uiInfo.grenades = atoi( buffer ); + } iterator++; } @@ -2444,7 +2455,7 @@ static void UI_LoadHumanArmourySells( void ) { if( uiInfo.weapons & ( 1 << i ) ) { - uiInfo.humanArmourySellList[ j ].text = BG_Weapon( i )->humanName; + uiInfo.humanArmourySellList[ j ].text =BG_Weapon( i )->humanName; uiInfo.humanArmourySellList[ j ].cmd = String_Alloc( va( "cmd sell %s\n", BG_Weapon( i )->name ) ); uiInfo.humanArmourySellList[ j ].type = INFOTYPE_WEAPON; @@ -2458,9 +2469,18 @@ static void UI_LoadHumanArmourySells( void ) for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( uiInfo.upgrades & ( 1 << i ) ) + if( ( uiInfo.upgrades & ( 1 << i ) ) || + ( i == UP_GRENADE && uiInfo.grenades ) ) { - uiInfo.humanArmourySellList[ j ].text = BG_Upgrade( i )->humanName; + if( i == UP_GRENADE ) + { + uiInfo.humanArmourySellList[ j ].text = + String_Alloc( va( "%s (%d)", BG_Upgrade( i )->humanName, uiInfo.grenades ) ); + } + else + { + uiInfo.humanArmourySellList[ j ].text = BG_Upgrade( i )->humanName; + } uiInfo.humanArmourySellList[ j ].cmd = String_Alloc( va( "cmd sell %s\n", BG_Upgrade( i )->name ) ); uiInfo.humanArmourySellList[ j ].type = INFOTYPE_UPGRADE; @@ -2482,10 +2502,13 @@ static void UI_ArmouryRefreshCb( void *data ) { int oldWeapons = uiInfo.weapons; int oldUpgrades = uiInfo.upgrades; + int oldGrenades = uiInfo.grenades; UI_ParseCarriageList( ); - if( uiInfo.weapons != oldWeapons || uiInfo.upgrades != oldUpgrades ) + if( uiInfo.weapons != oldWeapons || + uiInfo.upgrades != oldUpgrades || + uiInfo.grenades != oldGrenades ) { UI_LoadHumanArmouryBuys( ); UI_LoadHumanArmourySells( ); |