From ee595c6fb0a2db2da5cfb2ab32b331931befcd5b Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 12 Sep 2008 05:06:21 +0000 Subject: [PATCH] menu cleanup fix git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2541 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/menus.cpp | 8 ++++---- source/src/protos.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/src/menus.cpp b/source/src/menus.cpp index b0fc8225..f0a7a9b8 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -474,7 +474,7 @@ void newmenu(char *name, char *hotkeys, char *forwardkeys) void menumanual(void *menu, int n, char *text, char *action, color *bgcolor) { gmenu &m = *(gmenu *)menu; - if(!n) m.items.setsize(0); + if(!n) m.items.deletecontentsp(); m.items.add(new mitemtext(&m, text, action, NULL, bgcolor)); } @@ -495,7 +495,7 @@ void menuitem(char *text, char *action, char *hoveraction) { if(!lastmenu) return; char *t = newstring(text); - lastmenu->items.add(new mitemtext(lastmenu, t, action[0] ? newstring(action) : t, hoveraction[0] ? newstring(hoveraction) : NULL, NULL)); + lastmenu->items.add(new mitemtext(lastmenu, t, newstring(action[0] ? action : text), hoveraction[0] ? newstring(hoveraction) : NULL, NULL)); } void menuitemtextinput(char *text, char *value, char *action, char *hoveraction) @@ -708,7 +708,7 @@ void gmenu::init() { if(dirlist) { - items.setsize(0); + items.deletecontentsp(); cvector files; listfiles(dirlist->dir, dirlist->ext, files); loopv(files) @@ -806,7 +806,7 @@ void refreshapplymenu(void *menu, bool init) { gmenu *m = (gmenu *) menu; if(!m || (!init && needsapply.length() != m->items.length()-3)) return; - m->items.setsize(0); + m->items.deletecontentsp(); loopv(needsapply) m->items.add(new mitemtext(m, newstring(needsapply[i]), NULL, NULL, NULL)); m->items.add(new mitemtext(m, newstring(""), NULL, NULL, NULL)); m->items.add(new mitemtext(m, newstring("Yes"), newstring("resetgl"), NULL, NULL)); diff --git a/source/src/protos.h b/source/src/protos.h index 01ee2ba5..5e73dd6a 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -142,7 +142,7 @@ struct gmenu int anim, rotspeed, scale; mdirlist *dirlist; - gmenu(){} + gmenu() : name(0), title(0), header(0), footer(0), initaction(0), mdl(0), dirlist(0) {} virtual ~gmenu() { DELETEA(name);