static bool Disabled( unlockable_t *unlockable ) { switch ( unlockable->type ) { case UNLT_WEAPON: return BG_WeaponDisabled( unlockable->num ); case UNLT_UPGRADE: return BG_UpgradeDisabled( unlockable->num ); case UNLT_BUILDABLE: return BG_BuildableDisabled( unlockable->num ); case UNLT_CLASS: return BG_ClassDisabled( unlockable->num ); } Com_Error( ERR_FATAL, "Disabled: Unlockable has unknown type" ); return false; }
static void CG_Rocket_DFCMArmouryBuyUpgrade( int handle, const char *data ) { upgrade_t upgrade = (upgrade_t) atoi( Info_ValueForKey( data, "1" ) ); const char *Class = ""; const char *Icon = ""; const char *action = ""; playerState_t *ps = &cg.snap->ps; int credits = ps->persistant[ PERS_CREDIT ]; if( BG_InventoryContainsUpgrade( upgrade, cg.predictedPlayerState.stats ) ){ Class = "active"; action = va( "onClick='Cmd.exec(\"sell %s\")'", BG_Upgrade( upgrade )->name ); //Check mark icon. UTF-8 encoding of \uf00c Icon = "<icon class=\"current\">\xEF\x80\x8C</icon>"; } else if ( !BG_UpgradeUnlocked( upgrade ) || BG_UpgradeDisabled( upgrade ) ) { Class = "locked"; //Padlock icon. UTF-8 encoding of \uf023 Icon = "<icon>\xEF\x80\xA3</icon>"; } else if ( !trap_Cvar_VariableIntegerValue( "x_freeUpgrades" ) && BG_Upgrade( upgrade )->price > credits ) { Class = "expensive"; //$1 bill icon. UTF-8 encoding of \uf0d6 Icon = "<icon>\xEF\x83\x96</icon>"; } else { Class = "available"; action = va( "onClick='Cmd.exec(\"buy +%s\")'", BG_Upgrade( upgrade )->name ); } Rocket_DataFormatterFormattedData( handle, va( "<button class='armourybuy %s' onMouseover='Events.pushevent(\"setDS armouryBuyList upgrades %s\", event)' %s>%s<img src='/%s'/></button>", Class, Info_ValueForKey( data, "2" ), action, Icon, CG_GetShaderNameFromHandle( cg_upgrades[ upgrade ].upgradeIcon)), false ); }