From 27328f254639a0db8a4d8c26afcfc8b605adf353 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 Sep 2011 21:21:42 +0200 Subject: CGE: Little cleanup of vmenu --- engines/cge/vmenu.cpp | 45 +++++++++++++++++++++------------------------ engines/cge/vmenu.h | 7 +++++-- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'engines') diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index c8a21160bf..1497d5823c 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -59,29 +59,6 @@ MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) { _flags._bDel = true; } -static char *g_vmgt; - -char *VMGather(Choice *list) { - Choice *cp; - int len = 0, h = 0; - - for (cp = list; cp->_text; cp++) { - len += strlen(cp->_text); - h++; - } - g_vmgt = new char[len + h]; - if (g_vmgt) { - *g_vmgt = '\0'; - for (cp = list; cp->_text; cp++) { - if (*g_vmgt) - strcat(g_vmgt, "|"); - strcat(g_vmgt, cp->_text); - h++; - } - } - return g_vmgt; -} - Vmenu *Vmenu::_addr = NULL; int Vmenu::_recent = -1; @@ -90,7 +67,7 @@ Vmenu::Vmenu(CGEEngine *vm, Choice *list, int x, int y) Choice *cp; _addr = this; - delete[] g_vmgt; + delete[] _vmgt; _items = 0; for (cp = list; cp->_text; cp++) _items++; @@ -142,4 +119,24 @@ void Vmenu::touch(uint16 mask, int x, int y) { } } +char *Vmenu::VMGather(Choice *list) { + Choice *cp; + int len = 0, h = 0; + + for (cp = list; cp->_text; cp++) { + len += strlen(cp->_text); + h++; + } + _vmgt = new char[len + h]; + if (_vmgt) { + *_vmgt = '\0'; + for (cp = list; cp->_text; cp++) { + if (*_vmgt) + strcat(_vmgt, "|"); + strcat(_vmgt, cp->_text); + h++; + } + } + return _vmgt; +} } // End of namespace CGE diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h index 30fcb53f4b..b8740a9e93 100644 --- a/engines/cge/vmenu.h +++ b/engines/cge/vmenu.h @@ -53,8 +53,6 @@ private: class Vmenu : public Talk { - uint16 _items; - Choice *_menu; public: static Vmenu *_addr; static int _recent; @@ -63,7 +61,12 @@ public: ~Vmenu(); virtual void touch(uint16 mask, int x, int y); private: + char *_vmgt; CGEEngine *_vm; + uint16 _items; + Choice *_menu; + + char *VMGather(Choice *list); }; } // End of namespace CGE -- cgit v1.2.3