/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* Known contributors to this file:
* Doug Hay, 1990
+ * Markus Armbruster, 2007
*/
/*
#include <config.h>
-#include <stdio.h>
-#include "misc.h"
-#include "player.h"
-#include "nat.h"
-#include "file.h"
-#include "empthread.h"
#include "commands.h"
#include "optlist.h"
#include "server.h"
struct natstr *natp;
char *p;
- int update;
int checking;
int wantupd;
int totpop;
int dowant;
char buf[1024];
- if (!opt_DEMANDUPDATE) {
+ if (update_demand != UPD_DEMAND_SCHED
+ && update_demand != UPD_DEMAND_ASYNC) {
pr("Demand updates are not enabled.\n");
return RET_FAIL;
}
if (player->aborted)
return RET_FAIL;
- if (!p) {
- /* Default response is checking only */
- checking = 1;
- } else {
- checking = 0;
- if (*p == 'n' || *p == 'N') {
- wantupd = 0;
- } else if (*p == 'y' || *p == 'Y') {
+ checking = 1;
+ wantupd = 0;
+ if (p) {
+ if (*p == 'y' || *p == 'Y') {
+ checking = 0;
wantupd = 1;
- } else {
- /* Default response is checking only */
- checking = 1;
+ } else if (*p == 'n' || *p == 'N') {
+ checking = 0;
+ wantupd = 0;
}
}
pr("Unable to request an update as the country is in flux\n");
return RET_FAIL;
}
- update = natp->nat_update | WUPD_WANT;
- natp->nat_missed = 0;
pr("You (%d) now want an update.\n", whichcnum);
} else {
- update = natp->nat_update & ~WUPD_WANT;
pr("You (%d) now DON'T want an update.\n", whichcnum);
}
- natp->nat_update = update;
+ natp->nat_update = wantupd;
putnat(natp);
}
pr("You want an update.\n");
} else
pr("You DON'T want an update, yet.\n");
- pr("You have missed the vote on a demand update %d times.\n",
- natp->nat_missed);
- pr("It takes %d misses to veto a demand update.\n",
- update_missed);
}
pr("%d of a total of %d lunatics want an update.\n", totwant, totpop);
if (!checking && wantupd && demandupdatecheck()) {
pr("Here goes...\n");
- empth_sem_signal(update_sem);
+ update_trigger();
}
return RET_OK;
}