|
|
1.1 ! root 1: #include "jerq.h" ! 2: #include "commands.h" ! 3: #include "io.h" ! 4: ! 5: #define MAXMENU 20 ! 6: Menu *menutab[MAXMENU]; ! 7: ! 8: static char **table; ! 9: ! 10: static char *tablegen(i) ! 11: { ! 12: return table[i]; ! 13: } ! 14: ! 15: int findMenu(m) Menu *m; ! 16: { int i, j; ! 17: char *s, *(*generator)(); ! 18: ! 19: for (i=0; i<MAXMENU && menutab[i]!=m & menutab[i]!=(Menu *)NULL; i++) ; ! 20: if (i==MAXMENU) i=nrand(MAXMENU); ! 21: if (menutab[i]!=m) { ! 22: menutab[i] = m; ! 23: sendCommand(CCMENU); ! 24: sendInt(i); ! 25: generator = (table=m->item) ? tablegen : m->generator; ! 26: for(j=0; s=(*generator)(j); ++j) ; ! 27: sendInt(j); ! 28: for(j=0; s=(*generator)(j); ++j) sendToChar(s); ! 29: } ! 30: return(i); ! 31: } ! 32: ! 33: ! 34: int menuhit(m, b) Menu *m; int b; ! 35: { int i; ! 36: i = findMenu(m); ! 37: sendCommand(CCMENUHIT); ! 38: sendInt(i); ! 39: sendInt(b); ! 40: flush(); ! 41: clearMouseQ(); ! 42: return recInt(); ! 43: } ! 44:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.