#include "print.h"
#include "cmdline.h"
+extern Side* dside;
+
+#ifdef MAC
+int use_mac_charcodes = TRUE;
+#endif
+
+extern int autotest(void);
+
static void init_displays(void);
static void get_input(void);
static void interpret_command(Obj *cmd);
static void show_help(Side *side, HelpNode *node);
static void describe_commands(int arg, char *key, TextBuffer *buf);
-#ifdef THINK_C
-/* This is to get the command line reader in Think C on the Mac. */
-#include <console.h>
-#endif /* THINK_C */
-
/* This structure maintains state that is local to a side's display.
At the very least, it must track when the display is open and closed. */
{
extern long initrandstate, randstate;
long currandstate;
+ int option_autotest = FALSE;
-#ifdef THINK_C
- /* This is how Think C picks up a command line. */
- argc = ccommand(&argv);
-#endif
printf("Skeleton Xconq version %s\n", version_string());
printf("(C) %s\n", copyright_string());
init_library_path(NULL);
}
printf("\n");
currandstate = randstate;
+ if ((argc > 1) && strcmp ("--auto", argv[1]) == 0) {
+ option_autotest = TRUE;
+ ++argv;
+ --argc;
+ }
parse_command_line(argc, argv, general_options);
if (currandstate != randstate) {
printf("Random state is now %ld.\n", randstate);
assign_players_to_sides();
init_signal_handlers();
time(&skelturnstart);
+
+ if (option_autotest) {
+ exit(autotest());
+ }
+
run_game(0);
init_displays();
multicmd = lispnil;
}
}
+void
+run_ui_idler ()
+{}
+
Player *
add_default_player(void)
{
{
int u;
Side *side2;
+#if 0
Agreement *ag;
extern int num_agreements;
+#endif
printf("Sides: (%s)\n",
(g_use_side_priority() ? "sequential" : "simultaneous"));
}
/* (should say something about mplayer goals here) */
}
+#if 0
if (num_agreements > 0) {
printf("Agreements:\n");
for_all_agreements(ag) {
printf("%s\n", agreement_desig(ag));
}
}
+#endif
}
static void
for (i = 0; taskdefns[i].name != NULL; ++i) {
if (strcmp(taskname, taskdefns[i].name) == 0) {
if (thisunit != NULL && thisunit->plan != NULL) {
- task = create_task(i);
+ task = create_task((TaskType) i);
numargs = strlen(taskdefns[i].argtypes);
for (j = 0; j < numargs; ++j) {
if (taskparms != lispnil) {
}
}
+void
+cmd_error(Side *side, char *fmt, ...)
+{
+ char tmpnbuf[BUFSIZE];
+ va_list ap;
+
+ if (!empty_string(fmt)) {
+
+ va_start(ap, fmt);
+ vsnprintf(tmpnbuf, sizeof tmpnbuf, fmt, ap);
+ va_end(ap);
+
+ low_notify(dside, tmpnbuf);
+ }
+}
+
void
low_notify(Side *side, char *str)
{
{
}
+extern int suppress_update_cell_display;
+
/* (should count # of calls to inactive and non-displayed side...) */
void
update_cell_display(Side *side, int x, int y, int flags)
{
++numcellupdatesperturn;
- if (active_display(side)) {
+ if (active_display(side) && !suppress_update_cell_display) {
++numusefulcellupdatesperturn;
DGprintf("Update %s: view of %d,%d 0x%x\n",
side_desig(side), x, y, flags);
printf("Update %s: side %s%s\n",
side_desig(side), side2desc, (rightnow ? " (now)" : ""));
}
+}
+
+void
+update_research_display(Side *side)
+{
if (numatypes > 0
&& g_side_can_research()
- && side == side2
- && side->research_topic == NOADVANCE) {
+ && dside->research_topic == NOADVANCE) {
/* Should eventually pop up a side research dialog instead. */
- auto_pick_side_research(side);
+ auto_pick_side_research(dside);
}
}
fflush(stderr);
}
+static void
+report_warning(void)
+{
+ /* Ideally this would get passed back to the test framework which could
+ record it as FAIL or ERROR, but for now just make sure it doesn't
+ score as PASS. */
+ exit(EXIT_FAILURE);
+}
+
/* A warning just gets displayed, no other action is taken. */
void
printf("\n");
fprintf(stdout, "Warning: %s.\n", str);
fflush(stdout);
+
+ report_warning();
}
/* A run error is fatal. */
printf("\n");
fprintf(stdout, "Warning: %s.\n", str);
fflush(stdout);
+ report_warning();
}
void
/* Note that the fake declaration below will cause problems if imf.h
is included. */
+#if (0)
void make_generic_image_data(char *imf);
void
make_generic_image_data(char *imf)
-{
-}
+{}
+#else
+#include "imf.h"
+void make_generic_image_data(ImageFamily *imf);
+void
+make_generic_image_data(ImageFamily *imf)
+{}
+#endif
+
#ifdef MAC
int receivecursor;
int sendcursor;
-int
-serial_port_dialog()
-{
- return 0;
-}
-
#endif /* MAC */
void
{
printf("From %d: received chat \"%s\"\n", rid, str);
}
+
+/* Dummy function needed in run_turn_start. */
+
+void
+place_legends(Side *side)
+{
+}