projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mostly confine assumptions about what token_t is to misc.c
[open-adventure.git]
/
misc.c
diff --git
a/misc.c
b/misc.c
index 26bb3325fce1b5a3402beaca1566da5cf47563e0..ba834fdffd44b84cef98268a2e2cbadc8dea63b2 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-50,6
+50,23
@@
void packed_to_token(long packed, char token[6])
}
}
}
}
+/* Hide the fact that wods are corrently packed longs */
+
+bool wordeq(token_t a, token_t b)
+{
+ return a == b;
+}
+
+bool wordempty(token_t a)
+{
+ return a == 0;
+}
+
+void wordclear(token_t *v)
+{
+ *v = 0;
+}
+
/* I/O routines (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */
void speak(const char* msg)
/* I/O routines (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */
void speak(const char* msg)
@@
-250,7
+267,7
@@
char* get_input()
return (input);
}
return (input);
}
-bool YES(
vocab_t question, vocab_t yes_response, vocab_t
no_response)
+bool YES(
const char* question, const char* yes_response, const char*
no_response)
/* Print message X, wait for yes/no answer. If yes, print Y and return true;
* if no, print Z and return false. */
{
/* Print message X, wait for yes/no answer. If yes, print Y and return true;
* if no, print Z and return false. */
{
@@
-258,7
+275,7
@@
bool YES(vocab_t question, vocab_t yes_response, vocab_t no_response)
bool outcome;
for (;;) {
bool outcome;
for (;;) {
-
RSPEAK
(question);
+
speak
(question);
reply = get_input();
reply = get_input();
@@
-276,11
+293,11
@@
bool YES(vocab_t question, vocab_t yes_response, vocab_t no_response)
free(firstword);
if (yes == 0 || y == 0) {
free(firstword);
if (yes == 0 || y == 0) {
-
RSPEAK
(yes_response);
+
speak
(yes_response);
outcome = true;
break;
} else if (no == 0 || n == 0) {
outcome = true;
break;
} else if (no == 0 || n == 0) {
-
RSPEAK
(no_response);
+
speak
(no_response);
outcome = false;
break;
} else
outcome = false;
break;
} else
@@
-417,7
+434,7
@@
void MOVE(long object, long where)
from = game.fixed[object - NOBJECTS];
else
from = game.place[object];
from = game.fixed[object - NOBJECTS];
else
from = game.place[object];
- if (from != NOWHERE && from != CARRIED && !SPECIAL(from))
+ if (from !=
LOC_
NOWHERE && from != CARRIED && !SPECIAL(from))
CARRY(object, from);
DROP(object, where);
}
CARRY(object, from);
DROP(object, where);
}
@@
-658,4
+675,10
@@
void DATIME(long* d, long* t)
*t = (long) tv.tv_usec;
}
*t = (long) tv.tv_usec;
}
+void bug(enum bugtype num, const char *error_string)
+{
+ fprintf(stderr, "Fatal error %d, %s.\n", num, error_string);
+ exit(EXIT_FAILURE);
+}
+
/* end */
/* end */