]> git.pond.sub.org Git - empserver/commitdiff
Simplify satmap() with snxtitem_use_condarg(), snxtsct_use_condarg()
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 8 Apr 2011 19:15:05 +0000 (21:15 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 14 Apr 2011 18:21:21 +0000 (20:21 +0200)
src/lib/subs/satmap.c

index 06f016af2f5367674a00ce63a5b5601df31caf58..34b937b49f49a877032f330905836594f86b383f 100644 (file)
@@ -66,7 +66,6 @@ satmap(int x, int y, int eff, int range, int flags, int type)
     int changed = 0;
     long crackle;
     signed char noise[100];
     int changed = 0;
     long crackle;
     signed char noise[100];
-    char selection[1024];
 
     if (!eff)
        return RET_OK;
 
     if (!eff)
        return RET_OK;
@@ -96,16 +95,11 @@ satmap(int x, int y, int eff, int range, int flags, int type)
            noise[100 * n / (100 - eff)] = 1;
     }
 
            noise[100 * n / (100 - eff)] = 1;
     }
 
-    /* Have to convert to player coords, since it gets converted
-       back from there */
-    sprintf(selection, "@%s:%d", xyas(x, y, player->cnum), range);
-
     if (type == EF_BAD || type == EF_SECTOR) {
     if (type == EF_BAD || type == EF_SECTOR) {
-       if (type == EF_SECTOR) { /* Use ?conditionals */
-           if (!snxtsct(&ns, selection))
-               return RET_SYN;
-       } else
-           snxtsct_dist(&ns, x, y, range);
+       snxtsct_dist(&ns, x, y, range);
+       if (type == EF_SECTOR && !snxtsct_use_condarg(&ns))
+           return RET_SYN;
+           
 
        blankfill(radbuf, &ns.range, 1);
        if (flags & P_S) {
 
        blankfill(radbuf, &ns.range, 1);
        if (flags & P_S) {
@@ -145,11 +139,9 @@ satmap(int x, int y, int eff, int range, int flags, int type)
 
     if ((type == EF_BAD || type == EF_SHIP) &&
        (flags & P_S || flags & P_I)) {
 
     if ((type == EF_BAD || type == EF_SHIP) &&
        (flags & P_S || flags & P_I)) {
-       if (type == EF_SHIP) {
-           if (!snxtitem(&ni, EF_SHIP, selection, NULL))
-               return RET_SYN;
-       } else
-           snxtitem_dist(&ni, EF_SHIP, x, y, range);
+       snxtitem_dist(&ni, EF_SHIP, x, y, range);
+       if (type == EF_SHIP && !snxtitem_use_condarg(&ni))
+           return RET_SYN;
 
        crackle = count = 0;
        if (flags & P_S) {
 
        crackle = count = 0;
        if (flags & P_S) {
@@ -191,11 +183,9 @@ satmap(int x, int y, int eff, int range, int flags, int type)
 
     if ((type == EF_BAD || type == EF_LAND) &&
        (flags & P_S || flags & P_I)) {
 
     if ((type == EF_BAD || type == EF_LAND) &&
        (flags & P_S || flags & P_I)) {
-       if (type == EF_LAND) {
-           if (!snxtitem(&ni, EF_LAND, selection, NULL))
-               return RET_SYN;
-       } else
-           snxtitem_dist(&ni, EF_LAND, x, y, range);
+       snxtitem_dist(&ni, EF_LAND, x, y, range);
+       if (type == EF_LAND && !snxtitem_use_condarg(&ni))
+           return RET_SYN;
 
        crackle = count = 0;
        if (flags & P_S) {
 
        crackle = count = 0;
        if (flags & P_S) {