From 24286cb0fcc5c35451fdb9ec6aa58d764c36c32b Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 16 Jul 2024 23:30:23 +0800 Subject: [PATCH] [saco] Implement/match `CMenu::AddMenuItem(...)` --- saco/game/menu.cpp | 10 ++++++++++ saco/game/menu.h | 1 + 2 files changed, 11 insertions(+) diff --git a/saco/game/menu.cpp b/saco/game/menu.cpp index 39656a5..c866425 100644 --- a/saco/game/menu.cpp +++ b/saco/game/menu.cpp @@ -34,6 +34,16 @@ void CMenu::SetTitle(PCHAR pTitle) strcpy(m_charTitle, pTitle); } +void CMenu::AddMenuItem(BYTE byteColumn, BYTE byteRow, PCHAR pText) +{ + if(strlen(pText) > MAX_MENU_LINE) return; + if(byteColumn >= MAX_COLUMNS) return; + if(byteRow >= MAX_MENU_ITEMS) return; + + memset(m_charItems[byteRow][byteColumn], 0, sizeof(m_charItems[byteRow][byteColumn])); + strcpy(m_charItems[byteRow][byteColumn], pText); +} + void CMenu::Show() { ScriptCommand(&create_panel, m_charTitle[0] ? "SAMPHED" : "DUMMY", m_fXPos, m_fYPos, (m_fCol1Width + m_fCol2Width) / m_byteColumns, m_byteColumns, m_MenuInteraction.bMenu, 1, 1, &m_dwPanel); diff --git a/saco/game/menu.h b/saco/game/menu.h index 87fb62c..907015d 100644 --- a/saco/game/menu.h +++ b/saco/game/menu.h @@ -41,6 +41,7 @@ public: CMenu(float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction); void SetTitle(PCHAR pTitle); + void AddMenuItem(BYTE byteColumn, BYTE byteRow, PCHAR pText); void Show(); void Hide(); PCHAR GetMenuItem(BYTE byteColumn, BYTE byteRow);