From 872bba6278f8641b5e91af6e5adff635a1fe8ace Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sat, 29 Dec 2007 22:21:13 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1521 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/console.cpp | 22 ++++++++++------------ source/src/cube.h | 3 +++ source/src/menus.cpp | 5 +++-- source/src/protos.h | 14 +++++++------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/source/src/console.cpp b/source/src/console.cpp index b886ec50..a2922470 100644 --- a/source/src/console.cpp +++ b/source/src/console.cpp @@ -93,17 +93,15 @@ void keymap(char *code, char *key, char *action) km.action = newstring(action); } - - COMMAND(keymap, ARG_3STR); -keym *findbind(char *key) +keym *findbind(const char *key) { loopv(keyms) if(!strcasecmp(keyms[i].name, key)) return &keyms[i]; return NULL; } -keym *findbinda(char *action) +keym *findbinda(const char *action) { loopv(keyms) if(!strcasecmp(keyms[i].action, action)) return &keyms[i]; return NULL; @@ -118,7 +116,7 @@ keym *findbindc(int code) keym *keypressed = NULL; char *keyaction = NULL; -bool bindkey(keym *km, char *action) +bool bindkey(keym *km, const char *action) { if(!km) return false; if(!keypressed || keyaction!=km->action) delete[] km->action; @@ -126,14 +124,14 @@ bool bindkey(keym *km, char *action) return true; } -void bindk(char *key, char *action) +void bindk(const char *key, const char *action) { keym *km = findbind(key); if(!km) { conoutf("unknown key \"%s\"", key); return; } bindkey(km, action); } -bool bindc(int code, char *action) +bool bindc(int code, const char *action) { keym *km = findbindc(code); if(km) return bindkey(km, action); @@ -197,7 +195,7 @@ void pasteconsole(char *dst) #elif defined(__APPLE__) extern void mac_pasteconsole(char *commandbuf); - mac_pasteconsole(commandbuf); + mac_pasteconsole(dst); #else SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version); @@ -206,17 +204,17 @@ void pasteconsole(char *dst) int cbsize; char *cb = XFetchBytes(wminfo.info.x11.display, &cbsize); if(!cb || !cbsize) return; - int commandlen = strlen(commandbuf); + int commandlen = strlen(dst); for(char *cbline = cb, *cbend; commandlen + 1 < _MAXDEFSTR && cbline < &cb[cbsize]; cbline = cbend + 1) { cbend = (char *)memchr(cbline, '\0', &cb[cbsize] - cbline); if(!cbend) cbend = &cb[cbsize]; if(commandlen + cbend - cbline + 1 > _MAXDEFSTR) cbend = cbline + _MAXDEFSTR - commandlen - 1; - memcpy(&commandbuf[commandlen], cbline, cbend - cbline); + memcpy(&dst[commandlen], cbline, cbend - cbline); commandlen += cbend - cbline; - commandbuf[commandlen] = '\n'; + dst[commandlen] = '\n'; if(commandlen + 1 < _MAXDEFSTR && cbend < &cb[cbsize]) ++commandlen; - commandbuf[commandlen] = '\0'; + dst[commandlen] = '\0'; } XFree(cb); #endif diff --git a/source/src/cube.h b/source/src/cube.h index d622bc0b..2c3a075c 100644 --- a/source/src/cube.h +++ b/source/src/cube.h @@ -11,7 +11,10 @@ #include "entity.h" #include "command.h" #include "vote.h" + +#ifndef STANDALONE #include "console.h" +#endif typedef vector cvector; typedef vector ivector; diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 612d7a2e..d66e72d6 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -283,7 +283,7 @@ struct mitemslider : mitem int min_, max_, step, value; char *text, *valueexp, *display, *action; - mitemslider(gmenu *parent, char *text, int min_, int max_, int step, char *value, char *display, char *action, color *bgcolor) : mitem(parent, bgcolor), min_(min_), max_(max_), step(step), text(text), valueexp(value), value(min_), display(display), action(action) + mitemslider(gmenu *parent, char *text, int min_, int max_, int step, char *value, char *display, char *action, color *bgcolor) : mitem(parent, bgcolor), min_(min_), max_(max_), step(step), value(min_), text(text), valueexp(value), display(display), action(action) { } @@ -595,4 +595,5 @@ void rendermenumdl() rendermodel(isplayermodel ? (char *)"playermodels" : m.mdl, m.anim, tex, 0, pos, yaw, 0, 0, 0, NULL, isplayermodel ? (char*)"weapons/subgun/world" : NULL, m.scale ? m.scale/25.0f : 1.0f); glPopMatrix(); -} \ No newline at end of file +} + diff --git a/source/src/protos.h b/source/src/protos.h index da13d6f8..f6c574e0 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -57,9 +57,9 @@ struct keym ~keym() { DELETEA(name); DELETEA(action); } }; -extern bool bindkey(keym *km, char *action); -extern keym *findbinda(char *action); -extern bool bindc(int code, char *action); +extern bool bindkey(keym *km, const char *action); +extern keym *findbinda(const char *action); +extern bool bindc(int code, const char *action); // menus extern void rendermenu(); @@ -75,18 +75,18 @@ extern void showmenu(char *name); struct mitem { - color *bgcolor; struct gmenu *parent; + color *bgcolor; - mitem(gmenu *parent, color *bgcolor) : parent(parent), bgcolor(bgcolor) {}; + mitem(gmenu *parent, color *bgcolor) : parent(parent), bgcolor(bgcolor) {} virtual ~mitem() { delete bgcolor; } virtual void render(int x, int y, int w); virtual int width() = 0; - virtual void select(){} + virtual void select() {} virtual void focus(bool on) {} virtual void key(int code, bool isdown, int unicode) {} - virtual void init(){} + virtual void init() {} bool isselection(); void renderbg(int x, int y, int w); };