remove size on statc CString arrays so that XToString can catch size differences

This commit is contained in:
Chris Danford
2005-05-05 19:55:04 +00:00
parent 11f9384528
commit 3db3500226
22 changed files with 100 additions and 98 deletions
+6 -5
View File
@@ -12,7 +12,7 @@
#include "PrefsManager.h"
#include "PlayerState.h"
const CString g_sCodeNames[CodeDetector::NUM_CODES] = {
const CString CodeNames[] = {
"Easier1",
"Easier2",
"Harder1",
@@ -55,8 +55,9 @@ const CString g_sCodeNames[CodeDetector::NUM_CODES] = {
"CancelAllPlayerOptions",
"BackInEventMode",
};
XToString( Code, NUM_CODES );
CodeItem g_CodeItems[CodeDetector::NUM_CODES];
static CodeItem g_CodeItems[NUM_CODES];
bool CodeItem::EnteredCode( GameController controller ) const
@@ -172,10 +173,10 @@ void CodeDetector::RefreshCacheItems( CString sClass )
{
if( sClass == "" )
sClass = "CodeDetector";
for( int i=0; i<NUM_CODES; i++ )
FOREACH_Code( c )
{
CodeItem& item = g_CodeItems[i];
const CString sCodeName = g_sCodeNames[i];
CodeItem& item = g_CodeItems[c];
const CString sCodeName = CodeToString(c);
const CString sButtonsNames = THEME->GetMetric(sClass,sCodeName);
item.Load( sButtonsNames );
+46 -45
View File
@@ -5,6 +5,52 @@
#include "GameInput.h"
enum Code {
CODE_EASIER1,
CODE_EASIER2,
CODE_HARDER1,
CODE_HARDER2,
CODE_NEXT_SORT1,
CODE_NEXT_SORT2,
CODE_NEXT_SORT3,
CODE_NEXT_SORT4,
CODE_MODE_MENU1,
CODE_MODE_MENU2,
CODE_MIRROR,
CODE_LEFT,
CODE_RIGHT,
CODE_SHUFFLE,
CODE_SUPER_SHUFFLE,
CODE_NEXT_TRANSFORM,
CODE_NEXT_SCROLL_SPEED,
CODE_PREVIOUS_SCROLL_SPEED,
CODE_NEXT_ACCEL,
CODE_NEXT_EFFECT,
CODE_NEXT_APPEARANCE,
CODE_NEXT_TURN,
CODE_REVERSE,
CODE_HOLDS,
CODE_MINES,
CODE_DARK,
CODE_HIDDEN,
CODE_RANDOMVANISH,
CODE_CANCEL_ALL,
CODE_NEXT_THEME,
CODE_NEXT_THEME2,
CODE_NEXT_ANNOUNCER,
CODE_NEXT_ANNOUNCER2,
CODE_NEXT_GAME,
CODE_NEXT_GAME2,
CODE_BW_NEXT_GROUP,
CODE_BW_NEXT_GROUP2,
CODE_SAVE_SCREENSHOT1,
CODE_SAVE_SCREENSHOT2,
CODE_CANCEL_ALL_PLAYER_OPTIONS,
CODE_BACK_IN_EVENT_MODE,
NUM_CODES // leave this at the end
};
#define FOREACH_Code( c ) FOREACH_ENUM( Code, NUM_CODES, c )
struct CodeItem
{
public:
@@ -26,51 +72,6 @@ private:
class CodeDetector
{
public:
enum Code {
CODE_EASIER1,
CODE_EASIER2,
CODE_HARDER1,
CODE_HARDER2,
CODE_NEXT_SORT1,
CODE_NEXT_SORT2,
CODE_NEXT_SORT3,
CODE_NEXT_SORT4,
CODE_MODE_MENU1,
CODE_MODE_MENU2,
CODE_MIRROR,
CODE_LEFT,
CODE_RIGHT,
CODE_SHUFFLE,
CODE_SUPER_SHUFFLE,
CODE_NEXT_TRANSFORM,
CODE_NEXT_SCROLL_SPEED,
CODE_PREVIOUS_SCROLL_SPEED,
CODE_NEXT_ACCEL,
CODE_NEXT_EFFECT,
CODE_NEXT_APPEARANCE,
CODE_NEXT_TURN,
CODE_REVERSE,
CODE_HOLDS,
CODE_MINES,
CODE_DARK,
CODE_HIDDEN,
CODE_RANDOMVANISH,
CODE_CANCEL_ALL,
CODE_NEXT_THEME,
CODE_NEXT_THEME2,
CODE_NEXT_ANNOUNCER,
CODE_NEXT_ANNOUNCER2,
CODE_NEXT_GAME,
CODE_NEXT_GAME2,
CODE_BW_NEXT_GROUP,
CODE_BW_NEXT_GROUP2,
CODE_SAVE_SCREENSHOT1,
CODE_SAVE_SCREENSHOT2,
CODE_CANCEL_ALL_PLAYER_OPTIONS,
CODE_BACK_IN_EVENT_MODE,
NUM_CODES // leave this at the end
};
static void RefreshCacheItems( CString sClass="" ); // call this before checking codes, but call infrequently
static bool EnteredEasierDifficulty( GameController controller );
static bool EnteredHarderDifficulty( GameController controller );
+2 -2
View File
@@ -5,7 +5,7 @@
#include "LuaManager.h"
static const CString DifficultyNames[NUM_DIFFICULTIES] = {
static const CString DifficultyNames[] = {
"Beginner",
"Easy",
"Medium",
@@ -59,7 +59,7 @@ REGISTER_WITH_LUA_FUNCTION( LuaDifficulty );
static const CString CourseDifficultyNames[NUM_DIFFICULTIES] =
static const CString CourseDifficultyNames[] =
{
"Beginner",
"Easy",
+2 -2
View File
@@ -15,7 +15,7 @@
#include "SongUtil.h"
static const CString EditMenuRowNames[NUM_EDIT_MENU_ROWS] = {
static const CString EditMenuRowNames[] = {
"Group",
"Song",
"StepsType",
@@ -27,7 +27,7 @@ static const CString EditMenuRowNames[NUM_EDIT_MENU_ROWS] = {
XToString( EditMenuRow, NUM_EDIT_MENU_ROWS );
XToThemedString( EditMenuRow, NUM_EDIT_MENU_ROWS );
static const CString EditMenuActionNames[NUM_EDIT_MENU_ACTIONS] = {
static const CString EditMenuActionNames[] = {
"Edit",
"Delete",
"Create",
+14 -14
View File
@@ -11,7 +11,7 @@
#include <float.h>
static const CString RadarCategoryNames[NUM_RADAR_CATEGORIES] = {
static const CString RadarCategoryNames[] = {
"Stream",
"Voltage",
"Air",
@@ -41,7 +41,7 @@ static void LuaStepsType(lua_State* L)
REGISTER_WITH_LUA_FUNCTION( LuaStepsType );
static const CString PlayModeNames[NUM_PLAY_MODES] = {
static const CString PlayModeNames[] = {
"Regular",
"Nonstop",
"Oni",
@@ -74,7 +74,7 @@ RankingCategory AverageMeterToRankingCategory( int iAverageMeter )
}
static const CString RankingCategoryNames[NUM_RANKING_CATEGORIES] = {
static const CString RankingCategoryNames[] = {
"a",
"b",
"c",
@@ -84,7 +84,7 @@ XToString( RankingCategory, NUM_RANKING_CATEGORIES );
StringToX( RankingCategory );
static const CString CoinModeNames[NUM_COIN_MODES] = {
static const CString CoinModeNames[] = {
"home",
"pay",
"free",
@@ -92,7 +92,7 @@ static const CString CoinModeNames[NUM_COIN_MODES] = {
XToString( CoinMode, NUM_COIN_MODES );
static const CString PremiumNames[NUM_PREMIUMS] = {
static const CString PremiumNames[] = {
"none",
"doubles",
"joint",
@@ -100,7 +100,7 @@ static const CString PremiumNames[NUM_PREMIUMS] = {
XToString( Premium, NUM_PREMIUMS );
static const CString SortOrderNames[NUM_SORT_ORDERS] = {
static const CString SortOrderNames[] = {
"Preferred",
"Group",
"Title",
@@ -146,7 +146,7 @@ static void LuaSortOrder(lua_State* L)
REGISTER_WITH_LUA_FUNCTION( LuaSortOrder );
static const CString TapNoteScoreNames[NUM_TAP_NOTE_SCORES] = {
static const CString TapNoteScoreNames[] = {
"None",
"HitMine",
"AvoidMine",
@@ -162,7 +162,7 @@ StringToX( TapNoteScore );
XToThemedString( TapNoteScore, NUM_TAP_NOTE_SCORES );
static const CString HoldNoteScoreNames[NUM_HOLD_NOTE_SCORES] = {
static const CString HoldNoteScoreNames[] = {
"None",
"NG",
"OK",
@@ -172,7 +172,7 @@ StringToX( HoldNoteScore );
XToThemedString( HoldNoteScore, NUM_HOLD_NOTE_SCORES );
static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = {
static const CString MemoryCardStateNames[] = {
"ready",
"checking",
"late",
@@ -183,7 +183,7 @@ static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = {
XToString( MemoryCardState, NUM_MEMORY_CARD_STATES );
static const CString PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = {
static const CString PerDifficultyAwardNames[] = {
"FullComboGreats",
"SingleDigitGreats",
"OneGreat",
@@ -204,7 +204,7 @@ StringToX( PerDifficultyAward );
// strings can be used as XML entity names.
// Numbers are intentially not at the back so that "1000" and "10000" don't
// conflict when searching for theme elements.
static const CString PeakComboAwardNames[NUM_PEAK_COMBO_AWARDS] = {
static const CString PeakComboAwardNames[] = {
"Peak1000Combo",
"Peak2000Combo",
"Peak3000Combo",
@@ -281,7 +281,7 @@ bool DisplayBpms::IsSecret() const
return false;
}
static const CString StyleTypeNames[NUM_STYLE_TYPES] = {
static const CString StyleTypeNames[] = {
"OnePlayerOneSide",
"TwoPlayersTwoSides",
"OnePlayerTwoSides",
@@ -290,7 +290,7 @@ XToString( StyleType, NUM_STYLE_TYPES );
StringToX( StyleType );
static const CString MenuDirNames[NUM_MENU_DIRS] = {
static const CString MenuDirNames[] = {
"Up",
"Down",
"Left",
@@ -300,7 +300,7 @@ static const CString MenuDirNames[NUM_MENU_DIRS] = {
XToString( MenuDir, NUM_MENU_DIRS );
static const CString GoalTypeNames[NUM_GOAL_TYPES] = {
static const CString GoalTypeNames[] = {
"Calories",
"Time",
"None",
+1 -1
View File
@@ -5,7 +5,7 @@
#include "Game.h"
static const CString GameControllerNames[MAX_GAME_CONTROLLERS] = {
static const CString GameControllerNames[] = {
"Controller1",
"Controller2",
};
+1 -1
View File
@@ -2783,7 +2783,7 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
}
}
static const char *szSecondaryNames[NUM_MENU_BUTTONS] =
static const char *szSecondaryNames[] =
{
"MenuLeft",
"MenuRight",
+1 -1
View File
@@ -765,7 +765,7 @@ int GameState::GetCourseSongIndex() const
CString GameState::GetPlayerDisplayName( PlayerNumber pn ) const
{
ASSERT( IsPlayerEnabled(pn) );
const CString defaultnames[NUM_PLAYERS] = { "Player 1", "Player 2" };
const CString defaultnames[] = { "Player 1", "Player 2" };
if( IsHumanPlayer(pn) )
{
if( !PROFILEMAN->GetPlayerName(pn).empty() )
+2 -2
View File
@@ -17,7 +17,7 @@ Preference<float> g_fLightsFalloffSeconds( Options, "LightsFalloffSeconds", 0.1f
Preference<float> g_fLightsAheadSeconds( Options, "LightsAheadSeconds", 0.05f );
static const CString CabinetLightNames[NUM_CABINET_LIGHTS] = {
static const CString CabinetLightNames[] = {
"MarqueeUpLeft",
"MarqueeUpRight",
"MarqueeLrLeft",
@@ -30,7 +30,7 @@ static const CString CabinetLightNames[NUM_CABINET_LIGHTS] = {
XToString( CabinetLight, NUM_CABINET_LIGHTS );
StringToX( CabinetLight );
static const CString LightsModeNames[NUM_LIGHTS_MODES] = {
static const CString LightsModeNames[] = {
"Attract",
"Joining",
"Menu",
+1 -1
View File
@@ -8,7 +8,7 @@
MessageManager* MESSAGEMAN = NULL; // global and accessable from anywhere in our program
static const CString MessageNames[NUM_MESSAGES] = {
static const CString MessageNames[] = {
"CurrentSongChanged",
"CurrentStepsP1Changed",
"CurrentStepsP2Changed",
+3 -3
View File
@@ -29,7 +29,7 @@ enum Part
const CString& PartToString( Part p );
#define FOREACH_Part( p ) FOREACH_ENUM( Part, NUM_PARTS, p )
static const CString PartNames[NUM_PARTS] = {
static const CString PartNames[] = {
"TapNote",
"TapAddition",
"TapMine",
@@ -273,13 +273,13 @@ Sprite* NoteColorSprite::Get( NoteType nt )
}
static const CString HoldTypeNames[NUM_HOLD_TYPES] = {
static const CString HoldTypeNames[] = {
"hold",
"roll",
};
XToString( HoldType, NUM_HOLD_TYPES );
static const CString ActiveTypeNames[NUM_ACTIVE_TYPES] = {
static const CString ActiveTypeNames[] = {
"active",
"inactive",
};
+1 -1
View File
@@ -12,7 +12,7 @@ TapNote TAP_ORIGINAL_AUTO_KEYSOUND ( TapNote::autoKeysound,TapNote::SubType_inva
TapNote TAP_ADDITION_TAP ( TapNote::tap, TapNote::SubType_invalid, TapNote::addition, "", 0, false, 0 );
TapNote TAP_ADDITION_MINE ( TapNote::mine, TapNote::SubType_invalid, TapNote::addition, "", 0, false, 0 );
static const CString NoteTypeNames[NUM_NOTE_TYPES] = {
static const CString NoteTypeNames[] = {
"4th",
"8th",
"12th",
+2 -2
View File
@@ -13,7 +13,7 @@
#include "Course.h"
#include "Style.h"
static const CString SelectTypeNames[NUM_SELECT_TYPES] = {
static const CString SelectTypeNames[] = {
"SelectOne",
"SelectMultiple",
"SelectNone",
@@ -21,7 +21,7 @@ static const CString SelectTypeNames[NUM_SELECT_TYPES] = {
XToString( SelectType, NUM_SELECT_TYPES );
StringToX( SelectType );
static const CString LayoutTypeNames[NUM_LAYOUT_TYPES] = {
static const CString LayoutTypeNames[] = {
"ShowAllInRow",
"ShowOneInRow",
};
+1 -1
View File
@@ -6,7 +6,7 @@
#include "LuaFunctions.h"
#include "LuaManager.h"
static const CString PrefsGroupNames[NUM_PREFS_GROUPS] = {
static const CString PrefsGroupNames[] = {
"Debug",
"Editor",
"Options",
+4 -4
View File
@@ -112,7 +112,7 @@ RageKeySym StringToRageKeySym( const CString& s )
}
static const CString InputDeviceNames[NUM_INPUT_DEVICES] = {
static const CString InputDeviceNames[] = {
"Key",
"Joy1",
"Joy2",
@@ -138,7 +138,7 @@ XToString( InputDevice, NUM_INPUT_DEVICES );
StringToX( InputDevice );
static const CString JoystickButtonNames[NUM_JOYSTICK_BUTTONS] = {
static const CString JoystickButtonNames[] = {
"Left",
"Right",
"Up",
@@ -200,7 +200,7 @@ XToString( JoystickButton, NUM_JOYSTICK_BUTTONS );
StringToX( JoystickButton );
static const CString PumpPadButtonNames[NUM_PUMP_PAD_BUTTONS] = {
static const CString PumpPadButtonNames[] = {
"UL",
"UR",
"MID",
@@ -217,7 +217,7 @@ XToString( PumpPadButton, NUM_PUMP_PAD_BUTTONS );
StringToX( PumpPadButton );
static const CString ParaPadButtonNames[NUM_PARA_PAD_BUTTONS] = {
static const CString ParaPadButtonNames[] = {
"L",
"UL",
"U",
+2 -2
View File
@@ -1309,8 +1309,8 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
HighScore &hs = m_HighScore[pn];
if( CodeDetector::EnteredCode(GameI.controller, CodeDetector::CODE_SAVE_SCREENSHOT1) ||
CodeDetector::EnteredCode(GameI.controller, CodeDetector::CODE_SAVE_SCREENSHOT2) )
if( CodeDetector::EnteredCode(GameI.controller, CODE_SAVE_SCREENSHOT1) ||
CodeDetector::EnteredCode(GameI.controller, CODE_SAVE_SCREENSHOT2) )
{
if( !m_bSavedScreenshot[pn] && // only allow one screenshot
PROFILEMAN->IsUsingProfile(pn) )
+1 -1
View File
@@ -135,7 +135,7 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
}
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( GameI.controller );
if( GAMESTATE->IsHumanPlayer(pn) && CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_CANCEL_ALL_PLAYER_OPTIONS) )
if( GAMESTATE->IsHumanPlayer(pn) && CodeDetector::EnteredCode(GameI.controller,CODE_CANCEL_ALL_PLAYER_OPTIONS) )
{
if( m_CancelAll.IsLoaded() )
m_CancelAll.Play();
+1 -1
View File
@@ -10,7 +10,7 @@
#include "EnumHelper.h"
#include "arch/ArchHooks/ArchHooks.h"
static const CString SetTimeSelectionNames[NUM_SET_TIME_SELECTIONS] = {
static const CString SetTimeSelectionNames[] = {
"Year",
"Month",
"Day",
+6 -6
View File
@@ -128,8 +128,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
//
// detect codes
//
if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_THEME) ||
CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_THEME2) )
if( CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_THEME) ||
CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_THEME2) )
{
THEME->NextTheme();
ApplyGraphicOptions(); // update window title and icon
@@ -137,8 +137,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
SCREENMAN->SetNewScreen( m_sName );
TEXTUREMAN->DoDelayedDelete();
}
if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_ANNOUNCER) ||
CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_ANNOUNCER2) )
if( CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_ANNOUNCER) ||
CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_ANNOUNCER2) )
{
ANNOUNCER->NextAnnouncer();
CString sName = ANNOUNCER->GetCurAnnouncerName();
@@ -146,8 +146,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
SCREENMAN->SystemMessage( "Announcer: "+sName );
SCREENMAN->SetNewScreen( m_sName );
}
if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME) ||
CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME2) )
if( CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_GAME) ||
CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_GAME2) )
{
vector<const Game*> vGames;
GAMEMAN->GetEnabledGames( vGames );
+1 -1
View File
@@ -1460,7 +1460,7 @@ static void HandleInputEvents(float fDeltaTime)
// check back in event mode
if( GAMESTATE->IsEventMode() &&
CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_BACK_IN_EVENT_MODE) )
CodeDetector::EnteredCode(GameI.controller,CODE_BACK_IN_EVENT_MODE) )
{
MenuI.player = PLAYER_1;
MenuI.button = MENU_BUTTON_BACK;
+1 -1
View File
@@ -24,7 +24,7 @@
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
static const CString ElementCategoryNames[NUM_ELEMENT_CATEGORIES] = {
static const CString ElementCategoryNames[] = {
"BGAnimations",
"Fonts",
"Graphics",
+1 -1
View File
@@ -18,7 +18,7 @@ UnlockManager* UNLOCKMAN = NULL; // global and accessable from anywhere in our p
#define UNLOCK_NAMES THEME->GetMetric ("Unlocks","UnlockNames")
#define UNLOCK(sLineName) THEME->GetMetric ("Unlocks",ssprintf("Unlock%s",sLineName.c_str()))
static CString UnlockTypeNames[NUM_UNLOCK_TYPES] =
static CString UnlockTypeNames[] =
{
"ArcadePoints",
"DancePoints",