diff --git a/info/Commands/edit.t b/info/Commands/edit.t index b0a36870..a5bb163f 100644 --- a/info/Commands/edit.t +++ b/info/Commands/edit.t @@ -1,7 +1,17 @@ .TH Command EDIT .NA edit "Change stats of country, ship, land unit, or plane" .LV Expert -.SY "edit " -Once you specify what you want to edit, the server will tell you what -to do. Hit return to get out of the prompter. +.SY "edit [ ]..." +The \*Qedit\*U command allows deities to edit properties of a country, +sector (confusingly called here), land unit, ship, plane or +nuke. +.s1 +If you don't specify any pair, \*Qedit\*U enters +interactive mode. Editable properties are shown together with their +keys and values. Enter a key character and a value to change a +property. Hit return to finish the command. +.s1 +You can also specify one or more pairs as command +arguments. In this case, \*Qedit\*U just sets the properties, and +does not enter interactive mode. .SA "setsector, setresource, give, Deity" diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index 1994633d..fb6bb226 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -87,6 +87,7 @@ edit(void) int num; int arg; int err; + int arg_index = 3; coord x, y; float farg; natid nat; @@ -158,34 +159,44 @@ edit(void) pr_land(&land); break; } - } else if (player->argp[4] != 0) - (void)strcat(player->argp[3], player->argp[4]); + } ptr = &buf[0]; *ptr = 0; for (;;) { - if ((err = getin(&thing, &ptr, &arg, buf)) != RET_OK) { - if (err == END) { - switch (ewhat) { - case 'c': - prnat(nat); - break; - case 'l': - prsect(§); - break; - case 's': - pr_ship(&ship); - break; - case 'u': - pr_land(&land); - break; - case 'p': - pr_plane(&plane); - break; - } - break; + if (player->argp[arg_index] != 0) { + if (player->argp[arg_index+1] != 0) { + thing = player->argp[arg_index++]; + ptr = player->argp[arg_index++]; + arg = atoi(ptr); } else - return err; + return RET_SYN; } + else if (arg_index == 3) { + if ((err = getin(&thing, &ptr, &arg, buf)) != RET_OK) { + if (err == END) { + switch (ewhat) { + case 'c': + prnat(nat); + break; + case 'l': + prsect(§); + break; + case 's': + pr_ship(&ship); + break; + case 'u': + pr_land(&land); + break; + case 'p': + pr_plane(&plane); + break; + } + break; + } else + return err; + } + } else + break; switch (ewhat) { case 'c': farg = atof(ptr); @@ -206,7 +217,6 @@ edit(void) return RET_FAIL; break; case 'u': - farg = atof(ptr); if ((err = dounit(thing[0], arg, ptr, &land)) != RET_OK) return err; diff --git a/src/lib/player/empmod.c b/src/lib/player/empmod.c index 21874f3b..06ee64d2 100644 --- a/src/lib/player/empmod.c +++ b/src/lib/player/empmod.c @@ -287,7 +287,7 @@ struct cmndstr player_coms[] = { {"drop ", 1, drop, C_MOD, NORM + MONEY + CAP}, {"dump []", 0, dump, 0, NORM}, {"echo []", 0, echo, 0, NORM}, - {"edit ", 0, edit, C_MOD, GOD}, + {"edit [ ]...", 0, edit, C_MOD, GOD}, {"enable", 0, enab, C_MOD, GOD}, {"enlist ", 2, enli, C_MOD, NORM + MONEY + CAP}, {"execute ", 0, execute, 0, VIS},