Skip to content
Snippets Groups Projects
Commit e96ffca9 authored by rswindell's avatar rswindell
Browse files

Fix Deuce's previous "fix": Apparently macros are *not* how you should work

around C++ scoping issues (return from a macro?). :-)
parent ec348349
Branches
Tags
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
...@@ -41,16 +41,18 @@ ...@@ -41,16 +41,18 @@
#define nosound() #define nosound()
#define KBINCOM(ch, timeout) \ int kbincom(sbbs_t* sbbs, unsigned long timeout)
{ \ {
if(keybuftop!=keybufbot) { \ int ch;
ch=keybuf[keybufbot++]; \
if(keybufbot==KEY_BUFSIZE) \ if(sbbs->keybuftop!=sbbs->keybufbot) {
keybufbot=0; \ ch=sbbs->keybuf[sbbs->keybufbot++];
} else \ if(sbbs->keybufbot==KEY_BUFSIZE)
ch=incom(timeout); \ sbbs->keybufbot=0;
\ } else
return ch; \ ch=sbbs->incom(timeout);
return ch;
} }
/****************************************************************************/ /****************************************************************************/
...@@ -61,7 +63,7 @@ char sbbs_t::inkey(long mode, unsigned long timeout) ...@@ -61,7 +63,7 @@ char sbbs_t::inkey(long mode, unsigned long timeout)
{ {
uchar ch=0; uchar ch=0;
KBINCOM(ch, timeout); ch=kbincom(this,timeout);
if(ch==0) { if(ch==0) {
// moved here from getkey() on AUG-29-2001 // moved here from getkey() on AUG-29-2001
...@@ -261,7 +263,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode) ...@@ -261,7 +263,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode)
hotkey_inside--; hotkey_inside--;
return(0); return(0);
case ESC: case ESC:
KBINCOM(i,mode&K_GETSTR ? 3000:1000); i=kbincom(this, (mode&K_GETSTR) ? 3000:1000);
if(i==NOINP) // timed-out waiting for '[' if(i==NOINP) // timed-out waiting for '['
return(ESC); return(ESC);
ch=i; ch=i;
...@@ -277,7 +279,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode) ...@@ -277,7 +279,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode)
putuserrec(&cfg,useron.number,U_MISC,8,ultoa(useron.misc,str,16)); putuserrec(&cfg,useron.number,U_MISC,8,ultoa(useron.misc,str,16));
} }
while(i<10 && j<30) { /* up to 3 seconds */ while(i<10 && j<30) { /* up to 3 seconds */
KBINCOM(ch, 100); ch=kbincom(this, 100);
if(ch==(NOINP&0xff)) { if(ch==(NOINP&0xff)) {
j++; j++;
continue; continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment