diff --git a/src/gui/C4MainMenu.cpp b/src/gui/C4MainMenu.cpp index 2e9c09b71..6b863a3e0 100644 --- a/src/gui/C4MainMenu.cpp +++ b/src/gui/C4MainMenu.cpp @@ -47,16 +47,16 @@ void C4MainMenu::Default() Player=NO_OWNER; } -bool C4MainMenu::Init(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra, int32_t iExtraData, int32_t iId, int32_t iStyle) +bool C4MainMenu::Init(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iId, int32_t iStyle) { - if (!DoInit(fctSymbol, szEmpty, iExtra, iExtraData, iId, iStyle)) return false; + if (!DoInit(fctSymbol, szEmpty, iId, iStyle)) return false; Player=iPlayer; return true; } -bool C4MainMenu::InitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra, int32_t iExtraData, int32_t iId, int32_t iStyle) +bool C4MainMenu::InitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iId, int32_t iStyle) { - if (!DoInitRefSym(fctSymbol, szEmpty, iExtra, iExtraData, iId, iStyle)) return false; + if (!DoInitRefSym(fctSymbol, szEmpty, iId, iStyle)) return false; Player=iPlayer; return true; } @@ -151,7 +151,7 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled) sprintf(szInfoCaption,LoadResStr("IDS_MENU_ATTACKINFO"),pPlr->GetName(),szFriendly,szNot); if (iIndex==pPlayer->Number) SCopy(LoadResStr("IDS_MENU_ATTACKSELF"),szInfoCaption); // Add item - Add(sMsg.getData(),fctSymbol,szCommand,C4MN_Item_NoCount,NULL,szInfoCaption); + Add(sMsg.getData(),fctSymbol,szCommand,szInfoCaption); fctSymbol.Default(); } break; @@ -209,7 +209,7 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled) sTeamName.Ref(LoadResStr("IDS_PRC_NEWTEAM")); const char *szOperation = (Identification == C4MN_TeamSwitch) ? "TeamSwitch" : "TeamSel"; Add(sTeamName.getData(), fctSymbol,FormatString("%s:%d", szOperation, pTeam ? pTeam->GetID() : TEAMID_New).getData(), - C4MN_Item_NoCount,NULL,FormatString(LoadResStr("IDS_MSG_JOINTEAM"), sTeamName.getData()).getData(), C4ID(pTeam ? pTeam->GetID() : 0)); + FormatString(LoadResStr("IDS_MSG_JOINTEAM"), sTeamName.getData()).getData()); fctSymbol.Default(); } break; @@ -224,7 +224,7 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled) if (!pVP) return false; int32_t iInitialSelection = 0; // Add free view - AddRefSym(LoadResStr("IDS_MSG_FREEVIEW"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Star), "Observe:Free", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MSG_FREELYSCROLLAROUNDTHEMAP")); + AddRefSym(LoadResStr("IDS_MSG_FREEVIEW"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Star), "Observe:Free", LoadResStr("IDS_MSG_FREELYSCROLLAROUNDTHEMAP")); // Add players C4Player *pPlr; int32_t iIndex; for (iIndex=0; (pPlr = ::Players.GetByIndex(iIndex)); iIndex++) @@ -246,7 +246,7 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled) StdStrBuf sInfo; sInfo.Format(LoadResStr("IDS_TEXT_FOLLOWVIEWOFPLAYER"), pPlr->GetName()); // Add item - Add(sMsg.getData(),fctSymbol,sCommand.getData(),C4MN_Item_NoCount,NULL,sInfo.getData()); + Add(sMsg.getData(),fctSymbol,sCommand.getData(),sInfo.getData()); fctSymbol.Default(); // check if this is the currently selected player if (pVP->GetPlayer() == pPlr->Number) iInitialSelection = GetItemCount()-1; @@ -339,7 +339,7 @@ bool C4MainMenu::ActivateGoals(int32_t iPlayer, bool fDoActivate) ::GraphicsResource.fctCaptain.Draw(fctGF); } StdStrBuf Command; Command.Format("Player:Goal:%s", idGoal.ToString()); - Add(pDef->GetName(),fctSymbol,Command.getData(),C4MN_Item_NoCount,NULL,""); + Add(pDef->GetName(),fctSymbol,Command.getData(),""); } // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); @@ -363,7 +363,7 @@ bool C4MainMenu::ActivateRules(int32_t iPlayer) { fctSymbol.Create(C4SymbolSize,C4SymbolSize); pDef->Draw(fctSymbol); sprintf(Command, "Player:Rule:%s", idGoal.ToString()); - Add(pDef->GetName(),fctSymbol,Command,C4MN_Item_NoCount,NULL,""); + Add(pDef->GetName(),fctSymbol,Command,""); } // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); @@ -458,7 +458,7 @@ bool C4MainMenu::ActivateSavegame(int32_t iPlayer) // Item caption strCaption = LoadResStr("IDS_MENU_CPSAVEGAME"); // add menu item - AddRefSym(strCaption.getData(), GfxR->fctMenu.GetPhase(i - 1, fFree ? 2 : 1), strCommand.getData(), C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CPSAVEGAMEINFO")); + AddRefSym(strCaption.getData(), GfxR->fctMenu.GetPhase(i - 1, fFree ? 2 : 1), strCommand.getData(), LoadResStr("IDS_MENU_CPSAVEGAMEINFO")); } // Go back to options menu on close @@ -470,7 +470,7 @@ bool C4MainMenu::ActivateSavegame(int32_t iPlayer) bool C4MainMenu::ActivateHost(int32_t iPlayer) { // Menu symbol/init - InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), LoadResStr("IDS_MENU_DISCONNECTCLIENT"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); + InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), LoadResStr("IDS_MENU_DISCONNECTCLIENT"), iPlayer, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); // Clients @@ -492,7 +492,7 @@ bool C4MainMenu::ActivateClient(int32_t iPlayer) { // Menu symbol/init C4FacetSurface fctSymbol; - InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), LoadResStr("IDS_MENU_DISCONNECTFROMSERVER"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); + InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), LoadResStr("IDS_MENU_DISCONNECTFROMSERVER"), iPlayer, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,3,0); Add(LoadResStr("IDS_BTN_YES"), fctSymbol, "Part"); @@ -505,7 +505,7 @@ bool C4MainMenu::ActivateClient(int32_t iPlayer) bool C4MainMenu::ActivateSurrender(int32_t iPlayer) { C4FacetSurface fctSymbol; - InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Surrender), LoadResStr("IDS_MENU_SURRENDER"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); + InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Surrender), LoadResStr("IDS_MENU_SURRENDER"), iPlayer, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,3,0); Add(LoadResStr("IDS_BTN_YES"), fctSymbol, "Surrender"); @@ -518,13 +518,13 @@ bool C4MainMenu::ActivateSurrender(int32_t iPlayer) bool C4MainMenu::ActivateOptions(int32_t iPlayer, int32_t selection) { // Menu symbol/init - InitRefSym(GfxR->fctOptions.GetPhase(0), LoadResStr("IDS_MNU_OPTIONS"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); + InitRefSym(GfxR->fctOptions.GetPhase(0), LoadResStr("IDS_MNU_OPTIONS"), iPlayer, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); // Sound - AddRefSym(LoadResStr("IDS_DLG_SOUND"), GfxR->fctOptions.GetPhase(17 + Config.Sound.RXSound),"Options:Sound",C4MN_Item_NoCount); + AddRefSym(LoadResStr("IDS_DLG_SOUND"), GfxR->fctOptions.GetPhase(17 + Config.Sound.RXSound),"Options:Sound"); // Music - AddRefSym(LoadResStr("IDS_MNU_MUSIC"), GfxR->fctOptions.GetPhase(1 + Config.Sound.RXMusic),"Options:Music",C4MN_Item_NoCount); + AddRefSym(LoadResStr("IDS_MNU_MUSIC"), GfxR->fctOptions.GetPhase(1 + Config.Sound.RXMusic),"Options:Music"); // Music AddRefSym(LoadResStr("IDS_MENU_DISPLAY"), GfxR->fctMenu.GetPhase(8), "ActivateMenu:Display"); // Restore selection @@ -538,24 +538,24 @@ bool C4MainMenu::ActivateOptions(int32_t iPlayer, int32_t selection) bool C4MainMenu::ActivateDisplay(int32_t iPlayer, int32_t selection) { // Menu symbol/init - InitRefSym(GfxR->fctMenu.GetPhase(8), LoadResStr("IDS_MENU_DISPLAY"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); + InitRefSym(GfxR->fctMenu.GetPhase(8), LoadResStr("IDS_MENU_DISPLAY"), iPlayer, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); // Crew player names - AddRefSym(LoadResStr("IDS_MNU_PLAYERNAMES"), GfxR->fctOptions.GetPhase(7 + Config.Graphics.ShowCrewNames), "Display:PlayerNames", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_PLAYERNAMES_DESC")); + AddRefSym(LoadResStr("IDS_MNU_PLAYERNAMES"), GfxR->fctOptions.GetPhase(7 + Config.Graphics.ShowCrewNames), "Display:PlayerNames", LoadResStr("IDS_MENU_PLAYERNAMES_DESC")); // Crew clonk names - AddRefSym(LoadResStr("IDS_MNU_CLONKNAMES"), GfxR->fctOptions.GetPhase(9 + Config.Graphics.ShowCrewCNames), "Display:ClonkNames", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CLONKNAMES_DESC")); + AddRefSym(LoadResStr("IDS_MNU_CLONKNAMES"), GfxR->fctOptions.GetPhase(9 + Config.Graphics.ShowCrewCNames), "Display:ClonkNames", LoadResStr("IDS_MENU_CLONKNAMES_DESC")); // Upper Board if (!Application.isEditor) { - AddRefSym(LoadResStr("IDS_MNU_UPPERBOARD"),GfxR->fctOptions.GetPhase(3 + Config.Graphics.UpperBoard),"Display:UpperBoard",C4MN_Item_NoCount); + AddRefSym(LoadResStr("IDS_MNU_UPPERBOARD"),GfxR->fctOptions.GetPhase(3 + Config.Graphics.UpperBoard),"Display:UpperBoard"); } // FPS if (!Application.isEditor) - AddRefSym(LoadResStr("IDS_MNU_FPS"), GfxR->fctOptions.GetPhase(5 + Config.General.FPS), "Display:FPS", C4MN_Item_NoCount); + AddRefSym(LoadResStr("IDS_MNU_FPS"), GfxR->fctOptions.GetPhase(5 + Config.General.FPS), "Display:FPS"); // Clock if (!Application.isEditor) - AddRefSym(LoadResStr("IDS_MNU_CLOCK"), GfxR->fctOptions.GetPhase(15 + Config.Graphics.ShowClock), "Display:Clock", C4MN_Item_NoCount); + AddRefSym(LoadResStr("IDS_MNU_CLOCK"), GfxR->fctOptions.GetPhase(15 + Config.Graphics.ShowClock), "Display:Clock"); // Restore selection SetSelection(selection, false, true); // Go back to options menu on close @@ -572,7 +572,7 @@ bool C4MainMenu::ActivateMain(int32_t iPlayer) C4FacetSurface fctSymbol; fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol, true, 1, 1); - Init(fctSymbol, LoadResStr(pPlr ? "IDS_MENU_CPMAIN" : "IDS_MENU_OBSERVER"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); + Init(fctSymbol, LoadResStr(pPlr ? "IDS_MENU_CPMAIN" : "IDS_MENU_OBSERVER"), iPlayer, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); // Goals+Rules (player menu only) // Goal menu can't be shown because of script callbacks @@ -581,55 +581,55 @@ bool C4MainMenu::ActivateMain(int32_t iPlayer) if (pPlr) { // Goals - AddRefSym(LoadResStr("IDS_MENU_CPGOALS"),GfxR->fctMenu.GetPhase(4),"ActivateMenu:Goals",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MENU_CPGOALSINFO")); + AddRefSym(LoadResStr("IDS_MENU_CPGOALS"),GfxR->fctMenu.GetPhase(4),"ActivateMenu:Goals",LoadResStr("IDS_MENU_CPGOALSINFO")); // Rules - AddRefSym(LoadResStr("IDS_MENU_CPRULES"),GfxR->fctMenu.GetPhase(5),"ActivateMenu:Rules",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MENU_CPRULESINFO")); + AddRefSym(LoadResStr("IDS_MENU_CPRULES"),GfxR->fctMenu.GetPhase(5),"ActivateMenu:Rules",LoadResStr("IDS_MENU_CPRULESINFO")); } // Observer menu in free viewport if (!pPlr) { - AddRefSym(LoadResStr("IDS_TEXT_VIEW"),C4GUI::Icon::GetIconFacet(C4GUI::Ico_View),"ActivateMenu:Observer",C4MN_Item_NoCount,NULL,LoadResStr("IDS_TEXT_DETERMINEPLAYERVIEWTOFOLL")); + AddRefSym(LoadResStr("IDS_TEXT_VIEW"),C4GUI::Icon::GetIconFacet(C4GUI::Ico_View),"ActivateMenu:Observer",LoadResStr("IDS_TEXT_DETERMINEPLAYERVIEWTOFOLL")); } // Hostility (player menu only) if (pPlr && (::Players.GetCount() > 1)) { GfxR->fctFlagClr.Surface->SetClr(0xff0000); - AddRefSym(LoadResStr("IDS_MENU_CPATTACK"),GfxR->fctMenu.GetPhase(7),"ActivateMenu:Hostility",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MENU_CPATTACKINFO")); + AddRefSym(LoadResStr("IDS_MENU_CPATTACK"),GfxR->fctMenu.GetPhase(7),"ActivateMenu:Hostility",LoadResStr("IDS_MENU_CPATTACKINFO")); } // Team change if (pPlr && Game.Teams.IsTeamSwitchAllowed()) { C4Facet fctTeams; fctTeams = C4GUI::Icon::GetIconFacet(C4GUI::Ico_Team); - AddRefSym(LoadResStr("IDS_MSG_SELTEAM"),fctTeams,"ActivateMenu:TeamSel",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MSG_ALLOWSYOUTOJOINADIFFERENT")); + AddRefSym(LoadResStr("IDS_MSG_SELTEAM"),fctTeams,"ActivateMenu:TeamSel",LoadResStr("IDS_MSG_ALLOWSYOUTOJOINADIFFERENT")); } // Player join if ((::Players.GetCount() < Game.Parameters.MaxPlayers) && !Game.Parameters.isLeague()) { - AddRefSym(LoadResStr("IDS_MENU_CPNEWPLAYER"),GfxR->fctPlayerClr.GetPhase(),"ActivateMenu:NewPlayer",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MENU_CPNEWPLAYERINFO")); + AddRefSym(LoadResStr("IDS_MENU_CPNEWPLAYER"),GfxR->fctPlayerClr.GetPhase(),"ActivateMenu:NewPlayer",LoadResStr("IDS_MENU_CPNEWPLAYERINFO")); } // Save game (player menu only - should we allow saving games with no players in it?) if (pPlr && (!::Network.isEnabled() || ::Network.isHost())) { - AddRefSym(LoadResStr("IDS_MENU_CPSAVEGAME"),GfxR->fctMenu.GetPhase(0),"ActivateMenu:Save:Game",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MENU_CPSAVEGAMEINFO")); + AddRefSym(LoadResStr("IDS_MENU_CPSAVEGAME"),GfxR->fctMenu.GetPhase(0),"ActivateMenu:Save:Game",LoadResStr("IDS_MENU_CPSAVEGAMEINFO")); } // Options - AddRefSym(LoadResStr("IDS_MNU_OPTIONS"), GfxR->fctOptions.GetPhase(0), "ActivateMenu:Options",C4MN_Item_NoCount, NULL, LoadResStr("IDS_MNU_OPTIONSINFO")); + AddRefSym(LoadResStr("IDS_MNU_OPTIONS"), GfxR->fctOptions.GetPhase(0), "ActivateMenu:Options", LoadResStr("IDS_MNU_OPTIONSINFO")); // Disconnect if (::Network.isEnabled()) { // Host if (::Network.isHost() && Game.Clients.getClient(NULL)) - AddRefSym(LoadResStr("IDS_MENU_DISCONNECT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), "ActivateMenu:Host", C4MN_Item_NoCount, NULL, LoadResStr("IDS_TEXT_KICKCERTAINCLIENTSFROMTHE")); + AddRefSym(LoadResStr("IDS_MENU_DISCONNECT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), "ActivateMenu:Host", LoadResStr("IDS_TEXT_KICKCERTAINCLIENTSFROMTHE")); // Client if (!::Network.isHost()) - AddRefSym(LoadResStr("IDS_MENU_DISCONNECT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), "ActivateMenu:Client", C4MN_Item_NoCount, NULL, LoadResStr("IDS_TEXT_DISCONNECTTHEGAMEFROMTHES")); + AddRefSym(LoadResStr("IDS_MENU_DISCONNECT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), "ActivateMenu:Client", LoadResStr("IDS_TEXT_DISCONNECTTHEGAMEFROMTHES")); } // Surrender (player menu only) if (pPlr) - AddRefSym(LoadResStr("IDS_MENU_CPSURRENDER"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Surrender), "ActivateMenu:Surrender", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CPSURRENDERINFO")); + AddRefSym(LoadResStr("IDS_MENU_CPSURRENDER"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Surrender), "ActivateMenu:Surrender", LoadResStr("IDS_MENU_CPSURRENDERINFO")); // Abort if (!Application.isEditor) - AddRefSym(LoadResStr("IDS_MENU_ABORT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Exit), "Abort", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_ABORT_DESC")); + AddRefSym(LoadResStr("IDS_MENU_ABORT"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Exit), "Abort", LoadResStr("IDS_MENU_ABORT_DESC")); // No empty menus if (GetItemCount()==0) Close(false); // Done @@ -642,7 +642,7 @@ bool C4MainMenu::ActivateHostility(int32_t iPlayer) C4FacetSurface fctSymbol; fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctMenu.GetPhase(7).Draw(fctSymbol); - Init(fctSymbol, LoadResStr("IDS_MENU_CPATTACK"), iPlayer, C4MN_Extra_None, 0, C4MN_Hostility); + Init(fctSymbol, LoadResStr("IDS_MENU_CPATTACK"), iPlayer, C4MN_Hostility); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); Refill(); @@ -875,7 +875,7 @@ bool C4MainMenu::ActivateObserver() // Safety: Viewport lost? if (!::Viewports.GetViewport(NO_OWNER)) return false; // Menu symbol/init - InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_View), LoadResStr("IDS_TEXT_VIEW"), NO_OWNER, C4MN_Extra_None, 0, C4MN_Observer, C4MN_Style_Context); + InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_View), LoadResStr("IDS_TEXT_VIEW"), NO_OWNER, C4MN_Observer, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); // Players added in Refill Refill(); diff --git a/src/gui/C4MainMenu.h b/src/gui/C4MainMenu.h index 7fb58cf11..44f2ea357 100644 --- a/src/gui/C4MainMenu.h +++ b/src/gui/C4MainMenu.h @@ -41,8 +41,8 @@ protected: int32_t Player; public: - bool Init(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); - bool InitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); + bool Init(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); + bool InitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); bool ActivateMain(int32_t iPlayer); bool ActivateNewPlayer(int32_t iPlayer); diff --git a/src/gui/C4Menu.cpp b/src/gui/C4Menu.cpp index 4019f0d61..3e6f9c82b 100644 --- a/src/gui/C4Menu.cpp +++ b/src/gui/C4Menu.cpp @@ -35,9 +35,7 @@ const int32_t C4MN_InfoCaption_Delay = 90; // ----------------------------------------------------------- // C4MenuItem -C4MenuItem::C4MenuItem(C4Menu *pMenu, int32_t iIndex, const char *szCaption, - const char *szCommand, int32_t iCount, C4Object *pObject, const char *szInfoCaption, - C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, int32_t iStyle, bool fIsSelectable) +C4MenuItem::C4MenuItem(C4Menu *pMenu, int32_t iIndex, const char *szCaption, const char *szCommand, const char *szInfoCaption, int32_t iStyle) : C4GUI::Element(), pSymbolGraphics(NULL), dwSymbolClr(0u), fSelected(false), iStyle(iStyle), pMenu(pMenu), iIndex(iIndex) { @@ -182,21 +180,21 @@ bool C4Menu::TryClose(bool fOK, bool fControl) return true; } -bool C4Menu::DoInit(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iExtra, int32_t iExtraData, int32_t iId, int32_t iStyle) +bool C4Menu::DoInit(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iId, int32_t iStyle) { Clear(); Default(); Symbol.GrabFrom(fctSymbol); - return InitMenu(szEmpty, iExtra, iExtraData, iId, iStyle); + return InitMenu(szEmpty, iId, iStyle); } -bool C4Menu::DoInitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iExtra, int32_t iExtraData, int32_t iId, int32_t iStyle) +bool C4Menu::DoInitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iId, int32_t iStyle) { Clear(); Default(); Symbol.Set(fctSymbol); - return InitMenu(szEmpty, iExtra, iExtraData, iId, iStyle); + return InitMenu(szEmpty, iId, iStyle); } -bool C4Menu::InitMenu(const char *szEmpty, int32_t iExtra, int32_t iExtraData, int32_t iId, int32_t iStyle) +bool C4Menu::InitMenu(const char *szEmpty, int32_t iId, int32_t iStyle) { SCopy(szEmpty,Caption,C4MaxTitle); Identification=iId; @@ -213,35 +211,29 @@ bool C4Menu::InitMenu(const char *szEmpty, int32_t iExtra, int32_t iExtraData, i return true; } -bool C4Menu::AddRefSym(const char *szCaption, const C4Facet &fctSymbol, const char *szCommand, - int32_t iCount, C4Object *pObject, const char *szInfoCaption, - C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, bool fIsSelectable) +bool C4Menu::AddRefSym(const char *szCaption, const C4Facet &fctSymbol, const char *szCommand, const char *szInfoCaption) { if (!IsActive()) return false; // Create new menu item - C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,iCount,pObject,szInfoCaption,idID,szCommand2,fOwnValue,iValue,Style,fIsSelectable); + C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,szInfoCaption,Style); // Ref Symbol pNew->RefSymbol(fctSymbol); // Add - return AddItem(pNew, szCaption, szCommand, iCount, pObject, szInfoCaption, idID, szCommand2, fOwnValue, iValue, fIsSelectable); + return AddItem(pNew, szCaption, szCommand, szInfoCaption); } -bool C4Menu::Add(const char *szCaption, C4FacetSurface &fctSymbol, const char *szCommand, - int32_t iCount, C4Object *pObject, const char *szInfoCaption, - C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, bool fIsSelectable) +bool C4Menu::Add(const char *szCaption, C4FacetSurface &fctSymbol, const char *szCommand, const char *szInfoCaption) { if (!IsActive()) return false; // Create new menu item - C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,iCount,pObject,szInfoCaption,idID,szCommand2,fOwnValue,iValue,Style,fIsSelectable); + C4MenuItem *pNew = new C4MenuItem(this, ItemCount, szCaption,szCommand,szInfoCaption,Style); // Set Symbol pNew->GrabSymbol(fctSymbol); // Add - return AddItem(pNew, szCaption, szCommand, iCount, pObject, szInfoCaption, idID, szCommand2, fOwnValue, iValue, fIsSelectable); + return AddItem(pNew, szCaption, szCommand, szInfoCaption); } -bool C4Menu::AddItem(C4MenuItem *pNew, const char *szCaption, const char *szCommand, - int32_t iCount, C4Object *pObject, const char *szInfoCaption, - C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, bool fIsSelectable) +bool C4Menu::AddItem(C4MenuItem *pNew, const char *szCaption, const char *szCommand, const char *szInfoCaption) { // Add it to the list pClientWindow->AddElement(pNew); diff --git a/src/gui/C4Menu.h b/src/gui/C4Menu.h index 06dbff8ef..20459ad13 100644 --- a/src/gui/C4Menu.h +++ b/src/gui/C4Menu.h @@ -36,20 +36,12 @@ enum C4MN_Style_Context = 1, }; enum -{ - C4MN_Extra_None = 0, -}; -enum { C4MN_Align_Left = 1, C4MN_Align_Right = 2, C4MN_Align_Top = 4, C4MN_Align_Bottom = 8, }; -enum -{ - C4MN_Item_NoCount = 12345678 -}; class C4MenuItem : public C4GUI::Element { @@ -75,9 +67,7 @@ protected: virtual void DrawElement(C4TargetFacet &cgo); // draw menu item // ctor - C4MenuItem(C4Menu *pMenu, int32_t iIndex, const char *szCaption, const char *szCommand, - int32_t iCount, C4Object *pObject, const char *szInfoCaption, - C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, int32_t iStyle, bool fIsSelectable); + C4MenuItem(C4Menu *pMenu, int32_t iIndex, const char *szCaption, const char *szCommand, const char *szInfoCaption, int32_t iStyle); void GrabSymbol(C4FacetSurface &fctSymbol) { Symbol.GrabFrom(fctSymbol); if (Symbol.Surface) dwSymbolClr=Symbol.Surface->GetClr(); } void SetGraphics(C4DefGraphics* pGfx) { pSymbolGraphics = pGfx; } void RefSymbol(const C4Facet &fctSymbol) { Symbol.Set(fctSymbol); if (Symbol.Surface) dwSymbolClr=Symbol.Surface->GetClr(); } @@ -140,14 +130,8 @@ public: bool IsActive(); bool Control(BYTE byCom, int32_t iData); bool KeyControl(BYTE byCom); // direct keyboard callback - bool AddRefSym(const char *szCaption, const C4Facet &fctSymbol, const char *szCommand, - int32_t iCount=C4MN_Item_NoCount, C4Object *pObject=NULL, - const char *szInfoCaption=NULL, - C4ID idID=C4ID::None, const char *szCommand2=NULL, bool fOwnValue=false, int32_t iValue=0, bool fIsSelectable=true); - bool Add(const char *szCaption, C4FacetSurface &fctSymbol, const char *szCommand, - int32_t iCount=C4MN_Item_NoCount, C4Object *pObject=NULL, - const char *szInfoCaption=NULL, - C4ID idID=C4ID::None, const char *szCommand2=NULL, bool fOwnValue=false, int32_t iValue=0, bool fIsSelectable=true); + bool AddRefSym(const char *szCaption, const C4Facet &fctSymbol, const char *szCommand, const char *szInfoCaption=NULL); + bool Add(const char *szCaption, C4FacetSurface &fctSymbol, const char *szCommand, const char *szInfoCaption=NULL); void ClearItems(); void ResetLocation() { LocationSet = false; } bool SetLocation(int32_t iX, int32_t iY); // set location relative to user viewport @@ -159,13 +143,11 @@ public: #endif private: - bool AddItem(C4MenuItem *pNew, const char *szCaption, const char *szCommand, - int32_t iCount, C4Object *pObject, const char *szInfoCaption, - C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, bool fIsSelectable); - bool InitMenu(const char *szEmpty, int32_t iExtra, int32_t iExtraData, int32_t iId, int32_t iStyle); + bool AddItem(C4MenuItem *pNew, const char *szCaption, const char *szCommand, const char *szInfoCaption); + bool InitMenu(const char *szEmpty, int32_t iId, int32_t iStyle); protected: - bool DoInitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); - bool DoInit(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); + bool DoInitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); + bool DoInit(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal); void DrawBuffer(C4Facet &cgo); void AdjustSelection(); void AdjustPosition(); diff --git a/src/player/C4Player.cpp b/src/player/C4Player.cpp index 6bb5047af..3e7fae838 100644 --- a/src/player/C4Player.cpp +++ b/src/player/C4Player.cpp @@ -1214,7 +1214,7 @@ bool C4Player::ActivateMenuTeamSelection(bool fFromMain) { // Menu symbol/init bool fSwitch = !(Status==PS_TeamSelection); - Menu.InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Team),LoadResStr("IDS_MSG_SELTEAM"),Number, C4MN_Extra_None, 0, fSwitch ? C4MN_TeamSwitch : C4MN_TeamSelection); + Menu.InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Team),LoadResStr("IDS_MSG_SELTEAM"),Number, fSwitch ? C4MN_TeamSwitch : C4MN_TeamSelection); Menu.SetAlignment(fSwitch ? C4MN_Align_Left | C4MN_Align_Bottom : 0); Menu.Refill(); // Go back to options menu on close