Define and use NATID_BAD instead of literal 255
This commit is contained in:
parent
00bb086d2a
commit
8d4b959a0c
4 changed files with 7 additions and 4 deletions
|
@ -39,6 +39,8 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#define NATID_BAD 255
|
||||||
|
|
||||||
#define MAXNOR 50 /* max # realms */
|
#define MAXNOR 50 /* max # realms */
|
||||||
|
|
||||||
/* Nation status */
|
/* Nation status */
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "empthread.h"
|
#include "empthread.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "nat.h"
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
@ -84,7 +85,7 @@ player_new(int s)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
emp_insque(&lp->queue, &Players);
|
emp_insque(&lp->queue, &Players);
|
||||||
lp->cnum = 255;
|
lp->cnum = NATID_BAD;
|
||||||
lp->curid = -1;
|
lp->curid = -1;
|
||||||
time(&lp->curup);
|
time(&lp->curup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ pass_cmd(void)
|
||||||
{
|
{
|
||||||
if (!player->argp[1])
|
if (!player->argp[1])
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (player->cnum == 255) {
|
if (player->cnum == NATID_BAD) {
|
||||||
pr_id(player, C_CMDERR, "need country first\n");
|
pr_id(player, C_CMDERR, "need country first\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ may_play(void)
|
||||||
{
|
{
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
if (player->cnum == 255 || !player->authenticated) {
|
if (player->cnum == NATID_BAD || !player->authenticated) {
|
||||||
pr_id(player, C_CMDERR, "need country and password\n");
|
pr_id(player, C_CMDERR, "need country and password\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ natbyname(char *name, natid *result)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*result = 255;
|
*result = NATID_BAD;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue