Refactored; added state property to command struct to notate where in the lifecycle...
[open-adventure.git] / advent.h
index 27250b7dd0f198bd550cabcf2ab1148b571f2624..48cb54e16fccf86980025e3313359172236eeb4c 100644 (file)
--- a/advent.h
+++ b/advent.h
@@ -8,9 +8,9 @@
 
 /* LCG PRNG parameters tested against
  * Knuth vol. 2. by the original authors */
-#define LCG_A 1093
-#define LCG_C 221587
-#define LCG_M 1048576
+#define LCG_A 1093L
+#define LCG_C 221587L
+#define LCG_M 1048576L
 
 #define LINESIZE       1024
 #define TOKLEN         5          // № sigificant characters in a token */
@@ -107,6 +107,7 @@ enum phase_codes {
     GO_MOVE,
     GO_TOP,
     GO_CLEAROBJ,
+    GO_CHECKHINT,
     GO_WORD2,
     GO_UNKNOWN,
     GO_DWARFWAKE,
@@ -195,11 +196,14 @@ typedef struct {
     word_type_t type;
 } command_word_t;
 
+typedef enum {EMPTY, RAW, TOKENIZED, GIVEN, PREPROCESSED, PROCESSING, EXECUTED} command_state_t;
+
 typedef struct {
     enum speechpart part;
     command_word_t word[2];
     verb_t verb;
-    obj_t   obj;
+    obj_t obj;
+    command_state_t state;
 } command_t;
 
 extern struct game_t game;
@@ -208,7 +212,7 @@ extern struct settings_t settings;
 extern bool get_command_input(command_t *);
 extern void speak(const char*, ...);
 extern void sspeak(int msg, ...);
-extern void pspeak(vocab_t, enum speaktype, int, bool, ...);
+extern void pspeak(vocab_t, enum speaktype, bool, int, ...);
 extern void rspeak(vocab_t, ...);
 extern void echo_input(FILE*, const char*, const char*);
 extern bool silent_yes(void);
@@ -230,9 +234,9 @@ extern int suspend(void);
 extern int resume(void);
 extern int restore(FILE *);
 extern long initialise(void);
-extern int action(command_t command);
+extern int action(command_t);
 extern void state_change(obj_t, int);
-
+extern bool is_valid(struct game_t);
 
 void bug(enum bugtype, const char *) __attribute__((__noreturn__));