00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <config.h>
00036
00037 #include "commands.h"
00038 #include "land.h"
00039 #include "map.h"
00040 #include "optlist.h"
00041 #include "ship.h"
00042
00043 int
00044 map(void)
00045 {
00046 int unit_type = EF_BAD;
00047 int bmap = 0;
00048 char *str;
00049 char buf[1024];
00050 char prompt[128];
00051
00052 if (**player->argp != 'm') {
00053 if (**player->argp == 'b')
00054 bmap = 'b';
00055 else if (**player->argp == 'n') {
00056 unit_type = EF_NUKE;
00057 if (player->argp[0][1] == 'b')
00058 bmap = 'b';
00059 else
00060 bmap = 'n';
00061 } else {
00062 if (**player->argp == 'l')
00063 unit_type = EF_LAND;
00064 else if (**player->argp == 'p')
00065 unit_type = EF_PLANE;
00066 else if (**player->argp == 's')
00067 unit_type = EF_SHIP;
00068 else {
00069 logerror("map: bad player->argp[0]");
00070 return RET_SYN;
00071 }
00072 if (player->argp[0][1] == 'b')
00073 bmap = 'b';
00074 }
00075 }
00076
00077 if (player->argp[1] == NULL) {
00078 if (unit_type == EF_BAD) {
00079 str = getstring("(sects)? ", buf);
00080 } else {
00081 sprintf(prompt, "(sects, %s)? ", ef_nameof(unit_type));
00082 str = getstring(prompt, buf);
00083 }
00084
00085 if (!str || !*str)
00086 return RET_SYN;
00087 } else
00088 str = player->argp[1];
00089
00090 if (unit_type == EF_BAD)
00091 unit_type = EF_SHIP;
00092
00093 return do_map(bmap, unit_type, str, player->argp[2]);
00094 }