summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2015-06-29 00:52:09 +0200
committerPaweł Redman <pawel.redman@gmail.com>2015-06-29 16:40:28 +0200
commit0918eb3bcdefd0d6ee4bd573b761454c99f032f6 (patch)
treedd1bd0bfe5348ad3b4860f11b7d3dcbb6db9ca3c /src/ui
parent93d2e4414ee25e417ee0d2ca0248448002ea4d5b (diff)
Initial implementation of new grenades.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/ui_local.h1
-rw-r--r--src/ui/ui_main.c31
2 files changed, 28 insertions, 4 deletions
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h
index 2c78e26..1d4303a 100644
--- a/src/ui/ui_local.h
+++ b/src/ui/ui_local.h
@@ -270,6 +270,7 @@ typedef struct
int weapons;
int upgrades;
+ int grenades;
serverStatus_t serverStatus;
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( );