]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/orig.c
Use relations_with() for US==THEM || getrel(NP, THEM)
[empserver] / src / lib / commands / orig.c
index 4063893e66f82c41ada34f5a8d8c0601329c35df..9dfb8b92d928cc8d8e0b7d58a43c9e269547a67b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
  *  ---
  *
  *  orig.c: Move your origin
- * 
+ *
  *  Known contributors to this file:
  *     Shelley Louie, 1988
  *     Markus Armbruster, 2006
@@ -43,11 +43,11 @@ orig(void)
     char *p;
     coord x, y;
     char buf[1024];
-    natid cnum;
+    int cnum;
     struct natstr *np;
 
     p = getstarg(player->argp[1], "New origin (sector or country) : ", buf);
-    if (!p)
+    if (!p || !*p)
        return RET_SYN;
     if (!isalpha(*p) && strchr(p, ',')) {
        /* sector */
@@ -67,8 +67,7 @@ orig(void)
        cnum = natarg(p, NULL);
        if (!(np = getnatp(cnum)))
            return RET_SYN;
-       if (!player->god && player->cnum != cnum
-           && getrel(np, player->cnum) != ALLIED) {
+       if (!player->god && relations_with(cnum, player->cnum) != ALLIED) {
            pr("Country %s is not allied with you!\n", np->nat_cnam);
            return RET_FAIL;
        }