diff --git a/info/edit.t b/info/edit.t index 85365fda..f2f83eed 100644 --- a/info/edit.t +++ b/info/edit.t @@ -1,13 +1,15 @@ .TH Command EDIT -.NA edit "Edit sectors, ships, planes, land units or countries" +.NA edit "Edit sectors, ships, planes, land units, nukes or countries" .LV Expert .SY "edit land [ ]..." .SY "edit ship [ ]..." .SY "edit plane [ ]..." .SY "edit unit [ ]..." +.SY "edit nuke [ ]..." .SY "edit country [ ]..." -The \*Qedit\*U command allows deities to edit properties of a sector -(confusingly called here), ship, plane, land unit, or country. +The \*Qedit\*U command allows deities to edit properties of sectors +(confusingly called here), ships, planes, land units, nukes, or +countries. .s1 If you don't specify any pair, \*Qedit\*U enters interactive mode. Editable properties are shown together with their diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index 09760530..c85398b6 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -54,11 +54,13 @@ static void print_nat(struct natstr *); static void print_plane(struct plnstr *); static void print_land(struct lndstr *); static void print_ship(struct shpstr *); +static void print_nuke(struct nukstr *); static char *getin(char *, char **); static int edit_nat(struct natstr *, char *, char *); static int edit_ship(struct shpstr *, char *, char *); static int edit_land(struct lndstr *, char *, char *); static int edit_plane(struct plnstr *, char *, char *); +static int edit_nuke(struct nukstr *, char *, char *); int edit(void) @@ -90,8 +92,8 @@ edit(void) type = EF_LAND; break; case 'n': - pr("Not implemented yet.\n"); - return RET_FAIL; + type = EF_NUKE; + break; case 'c': type = EF_NATION; break; @@ -117,6 +119,9 @@ edit(void) case EF_LAND: print_land(&item.land); break; + case EF_NUKE: + print_nuke(&item.nuke); + break; case EF_NATION: print_nat(&item.nat); break; @@ -171,6 +176,9 @@ edit(void) case EF_PLANE: ret = edit_plane(&item.plane, key, ptr); break; + case EF_NUKE: + ret = edit_nuke(&item.nuke, key, ptr); + break; default: CANT_REACH(); } @@ -336,6 +344,19 @@ print_ship(struct shpstr *ship) pr("\n"); } +static void +print_nuke(struct nukstr *nuke) +{ + pr("%s %s\n", prnatid(nuke->nuk_own), prnuke(nuke)); + pr("UID : %d\t\t\t", nuke->nuk_uid); + pr("Type : %d\n", nuke->nuk_type); + pr("Owner : %d\t\t\t", nuke->nuk_own); + pr("Location : %s\n", xyas(nuke->nuk_x, nuke->nuk_y, player->cnum)); + pr("Tech : %d\t\t\t", nuke->nuk_tech); + pr("Stockpile : %.1s\n", &nuke->nuk_stockpile); + pr("Plane

: %d\n", nuke->nuk_plane); +} + static char * getin(char *buf, char **valp) { @@ -810,6 +831,7 @@ edit_unit(struct empobj *unit, char *key, char *p, case 'F': case 'W': case 'A': + case 'S': if (p[0] == '~') newgroup = 0; else if (isalpha(p[0])) @@ -1140,3 +1162,55 @@ edit_plane(struct plnstr *plane, char *key, char *p) } return RET_OK; } + +static int +edit_nuke(struct nukstr *nuke, char *key, char *p) +{ + struct nchrstr *ncp = &nchr[nuke->nuk_type]; + int arg = atoi(p); + + switch (*key) { + case 'U': + case 'O': + case 'L': + case 'S': + return edit_unit((struct empobj *)nuke, key, p, + 100, "stockpile", nuke->nuk_plane >= 0); + case 't': + arg = ef_elt_byname(EF_NUKE_CHR, p); + if (arg < 0) { + pr("%s: invalid nuke type\n", p); + return RET_FAIL; + } + divine_unit_change((struct empobj *)nuke, "Type", + arg != nuke->nuk_type, 0, + "to %s", nchr[arg].n_name); + nuke->nuk_type = arg; + if (nuke->nuk_tech >= nchr[arg].n_tech) + break; + arg = nchr[arg].n_tech; + /* fall through */ + case 'T': + arg = LIMIT_TO(arg, ncp->n_tech, SHRT_MAX); + divine_unit_change((struct empobj *)nuke, "Tech level", + arg != nuke->nuk_tech, arg - nuke->nuk_tech, + "from %d to %d", nuke->nuk_tech, arg); + nuke->nuk_tech = arg; + break; + case 'p': + if (arg < -1 || arg >= ef_nelem(EF_PLANE)) + return RET_SYN; + if (arg == nuke->nuk_plane) { + pr("Plane of %s unchanged\n", prnuke(nuke)); + break; + } + divine_unload((struct empobj *)nuke, EF_PLANE, nuke->nuk_plane); + divine_load((struct empobj *)nuke, EF_PLANE, arg); + nuke->nuk_plane = arg; + break; + default: + pr("huh? (%s)\n", key); + return RET_FAIL; + } + return RET_OK; +} diff --git a/src/lib/player/empmod.c b/src/lib/player/empmod.c index 7120819d..771628d2 100644 --- a/src/lib/player/empmod.c +++ b/src/lib/player/empmod.c @@ -32,7 +32,7 @@ * Thomas Ruschak, 1992 * Ken Stevens, 1995 * Steve McClure, 1996-2000 - * Markus Armbruster, 2004-2012 + * Markus Armbruster, 2004-2013 */ /* @@ -99,7 +99,7 @@ struct cmndstr player_coms[] = { 1, drop, C_MOD, NORM + MONEY + CAP}, {"dump []", 0, dump, 0, NORM}, {"echo []", 0, echo, 0, 0}, - {"edit [ ]...", + {"edit [ ]...", 0, edit, C_MOD, GOD}, {"enable", 0, enab, C_MOD, GOD}, {"enlist ", 2, enli, C_MOD, NORM + MONEY + CAP}, diff --git a/tests/actofgod/actofgod.xdump b/tests/actofgod/actofgod.xdump index a446e563..6029033c 100644 --- a/tests/actofgod/actofgod.xdump +++ b/tests/actofgod/actofgod.xdump @@ -354,6 +354,56 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h /config config nuke uid owner xloc yloc type effic mobil off tech opx opy mission radius stockpile plane +0 0 1 -1 0 0 0 0 400 0 0 none 0 "a" -1 +1 98 1 -1 0 100 0 0 400 0 0 none 0 "" -1 +2 2 3 -1 0 100 0 0 280 0 0 none 0 "" -1 +3 3 1 -1 0 100 0 0 280 0 0 none 0 "" 3 +4 3 1 -1 0 100 0 0 32767 0 0 none 0 "" -1 +5 3 1 -1 0 100 0 0 32767 0 0 none 0 "" -1 +6 1 0 0 1 100 0 0 300 0 0 none 0 "" -1 +7 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +8 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +9 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +10 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +11 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +12 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +13 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +14 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +15 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +16 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +17 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +18 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +19 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +20 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +21 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +22 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +23 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +24 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +25 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +26 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +27 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +28 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +29 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +30 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +31 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +32 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +33 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +34 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +35 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +36 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +37 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +38 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +39 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +40 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +41 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +42 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +43 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +44 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +45 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +46 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +47 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +48 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 +49 0 0 0 0 0 0 0 0 0 0 none 0 "" -1 /config config news actor action victim times duration time @@ -365,13 +415,13 @@ actor action victim times duration time 0 42 1 39 0 0 0 44 3 1 0 0 0 44 1 32 0 0 -0 43 2 5 0 0 -0 44 3 22 0 0 -0 43 1 79 0 0 +0 43 2 6 0 0 +0 44 3 28 0 0 +0 43 1 81 0 0 0 42 1 6 0 0 1 45 0 3 0 0 -0 43 3 33 0 0 -0 44 2 6 0 0 +0 43 3 38 0 0 +0 44 2 7 0 0 0 42 3 4 0 0 0 43 4 2 0 0 0 44 1 1 0 0 @@ -386,7 +436,7 @@ uid owner type unitid price maxbidder markettime xloc yloc /config config nat cnum stat flags cname passwd ip hostname userid xcap ycap xorg yorg update tgms ann timeused btu access milreserve money login logout newstim annotim tech research education happiness relations(0) relations(1) relations(2) relations(3) relations(4) relations(5) relations(6) relations(7) relations(8) relations(9) relations(10) relations(11) relations(12) relations(13) relations(14) relations(15) relations(16) relations(17) relations(18) relations(19) relations(20) relations(21) relations(22) relations(23) relations(24) relations(25) relations(26) relations(27) relations(28) relations(29) relations(30) relations(31) relations(32) relations(33) relations(34) relations(35) relations(36) relations(37) relations(38) relations(39) relations(40) relations(41) relations(42) relations(43) relations(44) relations(45) relations(46) relations(47) relations(48) relations(49) relations(50) relations(51) relations(52) relations(53) relations(54) relations(55) relations(56) relations(57) relations(58) relations(59) relations(60) relations(61) relations(62) relations(63) relations(64) relations(65) relations(66) relations(67) relations(68) relations(69) relations(70) relations(71) relations(72) relations(73) relations(74) relations(75) relations(76) relations(77) relations(78) relations(79) relations(80) relations(81) relations(82) relations(83) relations(84) relations(85) relations(86) relations(87) relations(88) relations(89) relations(90) relations(91) relations(92) relations(93) relations(94) relations(95) relations(96) relations(97) relations(98) contacts(0) contacts(1) contacts(2) contacts(3) contacts(4) contacts(5) contacts(6) contacts(7) contacts(8) contacts(9) contacts(10) contacts(11) contacts(12) contacts(13) contacts(14) contacts(15) contacts(16) contacts(17) contacts(18) contacts(19) contacts(20) contacts(21) contacts(22) contacts(23) contacts(24) contacts(25) contacts(26) contacts(27) contacts(28) contacts(29) contacts(30) contacts(31) contacts(32) contacts(33) contacts(34) contacts(35) contacts(36) contacts(37) contacts(38) contacts(39) contacts(40) contacts(41) contacts(42) contacts(43) contacts(44) contacts(45) contacts(46) contacts(47) contacts(48) contacts(49) contacts(50) contacts(51) contacts(52) contacts(53) contacts(54) contacts(55) contacts(56) contacts(57) contacts(58) contacts(59) contacts(60) contacts(61) contacts(62) contacts(63) contacts(64) contacts(65) contacts(66) contacts(67) contacts(68) contacts(69) contacts(70) contacts(71) contacts(72) contacts(73) contacts(74) contacts(75) contacts(76) contacts(77) contacts(78) contacts(79) contacts(80) contacts(81) contacts(82) contacts(83) contacts(84) contacts(85) contacts(86) contacts(87) contacts(88) contacts(89) contacts(90) contacts(91) contacts(92) contacts(93) contacts(94) contacts(95) contacts(96) contacts(97) contacts(98) rejects(0) rejects(1) rejects(2) rejects(3) rejects(4) rejects(5) rejects(6) rejects(7) rejects(8) rejects(9) rejects(10) rejects(11) rejects(12) rejects(13) rejects(14) rejects(15) rejects(16) rejects(17) rejects(18) rejects(19) rejects(20) rejects(21) rejects(22) rejects(23) rejects(24) rejects(25) rejects(26) rejects(27) rejects(28) rejects(29) rejects(30) rejects(31) rejects(32) rejects(33) rejects(34) rejects(35) rejects(36) rejects(37) rejects(38) rejects(39) rejects(40) rejects(41) rejects(42) rejects(43) rejects(44) rejects(45) rejects(46) rejects(47) rejects(48) rejects(49) rejects(50) rejects(51) rejects(52) rejects(53) rejects(54) rejects(55) rejects(56) rejects(57) rejects(58) rejects(59) rejects(60) rejects(61) rejects(62) rejects(63) rejects(64) rejects(65) rejects(66) rejects(67) rejects(68) rejects(69) rejects(70) rejects(71) rejects(72) rejects(73) rejects(74) rejects(75) rejects(76) rejects(77) rejects(78) rejects(79) rejects(80) rejects(81) rejects(82) rejects(83) rejects(84) rejects(85) rejects(86) rejects(87) rejects(88) rejects(89) rejects(90) rejects(91) rejects(92) rejects(93) rejects(94) rejects(95) rejects(96) rejects(97) rejects(98) -0 deity (flash beep coastwatch sonar techlists) "POGO" "peter" "127.0.0.1" "" "tester" 0 0 0 0 0 0 0 255 640 0 0 123455839 0 0 0 0 400.000 0.00000 0.00000 0.00000 neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () +0 deity (flash beep coastwatch sonar techlists) "POGO" "peter" "127.0.0.1" "" "tester" 0 0 0 0 0 0 0 255 640 0 0 123405839 0 0 0 0 400.000 0.00000 0.00000 0.00000 neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () 1 active (flash beep coastwatch sonar techlists) "1" "1" "" "" "" 0 0 0 0 0 1 0 255 0 0 0 -2147483648 0 0 0 0 3.14000 3.14000 3.14000 3.14000 neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () 2 active (flash beep coastwatch sonar techlists) "2" "0123456789012345678" "" "" "" 2 0 2 0 0 1 0 255 0 0 0 0 0 0 0 0 100.000 100.000 100.000 100.000 neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () 3 active (flash beep coastwatch sonar techlists) "drei" "3" "" "" "" 0 0 0 0 0 1 0 255 640 0 0 0 0 0 0 0 0.00000 0.00000 0.00000 0.00000 neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral neutral 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () @@ -505,7 +555,10 @@ timestamp owner type id x y 0 3 3 0 1 -1 0 3 3 1 1 -1 0 3 3 2 1 -1 -0 0 3 4 1 -1 +0 3 4 0 1 -1 +0 3 4 1 1 -1 +0 3 4 2 1 -1 +0 0 4 4 1 -1 /config config realm cnum realm xl xh yl yh diff --git a/tests/actofgod/geninput.pl b/tests/actofgod/geninput.pl index a003c504..4742eb46 100755 --- a/tests/actofgod/geninput.pl +++ b/tests/actofgod/geninput.pl @@ -9,7 +9,7 @@ # x<-1,y<0 own 0 # all wilderness, rest sea # owned sectors have 1m 1c -# units 5 cs #0..4, 5 f1 #0..4, 5 sup #0..4, all in 1,-1 owned by 3 +# units cs #0..4, f1 #0..4, sup #0..4, 10kt #0..4, all in 1,-1 owned by 3 use warnings; use strict; @@ -227,9 +227,9 @@ give('8,6', 'c', -1); # swapsector swaps('-2,2', '2,-2'); -## Ship, plane, land unit +## Ship, plane, land unit, nuke -for my $ef ('ship', 'plane', 'land') { +for my $ef ('ship', 'plane', 'land', 'nuke') { # invalid key edit($ef, 0, '@', 0); # own @@ -286,6 +286,14 @@ edit_int('land', 2, ( ['m', 0, 25], )); +# nuke: type +edit('nuke', 6, 't', '15kt', 'O', 1, 't', '15kt', 't', '50kt', 't', '15kt'); + +# nuke: tech +edit_int('nuke', 2, ( + ['T', 280, 32767], +)); + # fleet, wing, army sub unit_group { my ($ef, $key) = @_; @@ -311,13 +319,14 @@ edit('plane', 2, 'f', 4); # carrier sub unit_carrier { - my ($ef, $skey, $pkey) = @_; - edit($ef, 2, $skey, -1, $skey, 9999); - edit($ef, 3, $skey, 3); - edit($ef, 4, $skey, 4, $pkey, 4); + my ($ef, $key1, $key2) = @_; + edit($ef, 2, $key1, -1, $key1, 9999); + edit($ef, 3, $key1, 3); + edit($ef, 4, $key1, 4, $key2, 4) if defined $key2; } unit_carrier('plane', 's', 'y'); unit_carrier('land', 'S', 'Y'); +unit_carrier('nuke', 'p'); # special case: move carrier's cargo away edit('plane', 4, 'l', '5,1'); @@ -330,6 +339,7 @@ iedit('ship', 0, 'M 2', 'm 1', 'f 1'); iedit('ship', 0, 'R n', 'R ""'); iedit('plane', 0, 'm 2', 'y -1'); iedit('land', 0, 'M 2', 'Y -1'); +iedit('nuke', 0, 'S a', 'p -1'); ## Nation diff --git a/tests/actofgod/init_script b/tests/actofgod/init_script index 8b4ed96a..e15e1498 100644 --- a/tests/actofgod/init_script +++ b/tests/actofgod/init_script @@ -28,5 +28,7 @@ des 1,-1 * buil p 1,-1 f1 5 100 des 1,-1 ! buil l 1,-1 sup 5 100 +des 1,-1 n +buil n 1,-1 10kt 5 edit l 3,-1 L 1,-1 edit c 1/2/3/4/5 t 0 s 4 diff --git a/tests/actofgod/journal.log b/tests/actofgod/journal.log index 7bf93c67..1e0a4e1f 100644 --- a/tests/actofgod/journal.log +++ b/tests/actofgod/journal.log @@ -20,7 +20,7 @@ Play#0 input edit l 0,0 @ 0 Play#0 command edit Play#0 output Play#0 1 huh? (@) - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input setres @ 0,0 0 Play#0 command setresource @@ -43,7 +43,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 1,7 o -1 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 3,7 o 98 Play#0 command edit @@ -51,7 +51,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 3,7 o 99 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 1,7 O 0 Play#0 command edit @@ -59,7 +59,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 1,7 O -1 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 3,7 O 98 Play#0 command edit @@ -67,7 +67,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 3,7 O 99 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 1,7 X 0 Play#0 command edit @@ -75,7 +75,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 1,7 X -1 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 3,7 X 98 Play#0 command edit @@ -83,7 +83,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 3,7 X 99 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 5,7 o 2 Play#0 command edit @@ -132,7 +132,7 @@ Play#0 input edit l 3,-7 L 3,-7 L 1,0 Play#0 command edit Play#0 output Play#0 1 Sector 3,-7 unchanged - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 1,1 e 0 Play#0 command edit @@ -726,7 +726,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 8,4 s , Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 6:8,4 S + Play#0 command edit @@ -739,7 +739,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit l 8,4 S , Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit l 1,5 m 1 a 1 Play#0 command edit @@ -846,7 +846,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit s 0 O -1 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit s 1 O 98 Play#0 command edit @@ -854,7 +854,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit s 1 O 99 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit s 2 O 2 Play#0 command edit @@ -875,7 +875,7 @@ Play#0 input edit s 0 U 0 U -1 Play#0 command edit Play#0 output Play#0 1 cs cargo ship (#0) unchanged - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit s 2 L 3,-1 Play#0 command edit @@ -896,7 +896,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit p 0 O -1 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit p 1 O 98 Play#0 command edit @@ -904,7 +904,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit p 1 O 99 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit p 2 O 2 Play#0 command edit @@ -925,7 +925,7 @@ Play#0 input edit p 0 U 0 U -1 Play#0 command edit Play#0 output Play#0 1 f1 Sopwith Camel #0 unchanged - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit p 2 l 3,-1 Play#0 command edit @@ -946,7 +946,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit u 0 O -1 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit u 1 O 98 Play#0 command edit @@ -954,7 +954,7 @@ Play#0 output Play#0 6 0 640 Play#0 input edit u 1 O 99 Play#0 command edit - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit u 2 O 2 Play#0 command edit @@ -975,7 +975,7 @@ Play#0 input edit u 0 U 0 U -1 Play#0 command edit Play#0 output Play#0 1 sup supply #0 unchanged - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit u 2 L 3,-1 Play#0 command edit @@ -985,6 +985,56 @@ Play#0 command edit Play#0 output Play#0 1 Location of sup supply #3 changed from 1,-1 to 1,-1 Play#0 output Play#0 6 0 640 + Play#0 input edit n 0 @ 0 + Play#0 command edit + Play#0 output Play#0 1 huh? (@) + Play#0 output Play#0 1 command failed + Play#0 output Play#0 6 0 640 + Play#0 input edit n 0 O 0 + Play#0 command edit + Play#0 output Play#0 1 Owner of 10kt fission warhead #0 changed from 3 (#3) to POGO (#0) + Play#0 output Play#0 6 0 640 + Play#0 input edit n 0 O -1 + Play#0 command edit + Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 6 0 640 + Play#0 input edit n 1 O 98 + Play#0 command edit + Play#0 output Play#0 1 Owner of 10kt fission warhead #1 changed from 3 (#3) to 98 (#98) + Play#0 output Play#0 6 0 640 + Play#0 input edit n 1 O 99 + Play#0 command edit + Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 6 0 640 + Play#0 input edit n 2 O 2 + Play#0 command edit + Play#0 output Play#0 1 Owner of 10kt fission warhead #2 changed from 3 (#3) to 2 (#2) + Play#0 output Play#0 6 0 640 + Play#0 input edit n 4 O 0 O 3 + Play#0 command edit + Play#0 output Play#0 1 Owner of 10kt fission warhead #4 changed from 3 (#3) to POGO (#0) + Play#0 output Play#0 1 Owner of 10kt fission warhead #4 changed from POGO (#0) to 3 (#3) + Play#0 output Play#0 1 Efficiency of 10kt fission warhead #4 changed from 0 to 100 + Play#0 output Play#0 6 0 640 + Play#0 input edit n 3 U 5 U 3 + Play#0 command edit + Play#0 output Play#0 1 10kt fission warhead #3 duplicated to (#5) + Play#0 output Play#0 1 10kt fission warhead #5 duplicated to (#3) + Play#0 output Play#0 1 Replacing 10kt fission warhead #3 of 3 (#3) + Play#0 output Play#0 6 0 640 + Play#0 input edit n 0 U 0 U -1 + Play#0 command edit + Play#0 output Play#0 1 10kt fission warhead #0 unchanged + Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 6 0 640 + Play#0 input edit n 2 L 3,-1 + Play#0 command edit + Play#0 output Play#0 1 Location of 10kt fission warhead #2 changed from 1,-1 to 3,-1 + Play#0 output Play#0 6 0 640 + Play#0 input edit n 3 L 1,-1 + Play#0 command edit + Play#0 output Play#0 1 Location of 10kt fission warhead #3 changed from 1,-1 to 1,-1 + Play#0 output Play#0 6 0 640 Play#0 input edit s 6 t lc O 1 t lc t hc g 8 t lc Play#0 command edit Play#0 output Play#0 1 Type of fb fishing boat (#6) changed to lc light cruiser @@ -1278,6 +1328,33 @@ Play#0 command edit Play#0 output Play#0 1 military of sup supply #5 changed from 0 to 25 Play#0 output Play#0 6 0 640 + Play#0 input edit n 6 t 15kt O 1 t 15kt t 50kt t 15kt + Play#0 command edit + Play#0 output Play#0 1 Type of 10kt fission warhead #6 changed to 15kt fission + Play#0 output Play#0 1 Tech level of 15kt fission warhead #6 changed from 0 to 290 + Play#0 output Play#0 1 Owner of 15kt fission warhead #6 changed from POGO (#0) to 1 (#1) + Play#0 output Play#0 1 Efficiency of 15kt fission warhead #6 changed from 0 to 100 + Play#0 output Play#0 1 Type of 15kt fission warhead #6 unchanged + Play#0 output Play#0 1 Type of 15kt fission warhead #6 changed to 50kt fission + Play#0 output Play#0 1 Tech level of 50kt fission warhead #6 changed from 290 to 300 + Play#0 output Play#0 1 Type of 50kt fission warhead #6 changed to 15kt fission + Play#0 output Play#0 6 0 640 + Play#0 input edit n 2 T 280 + Play#0 command edit + Play#0 output Play#0 1 Tech level of 10kt fission warhead #2 changed from 400 to 280 + Play#0 output Play#0 6 0 640 + Play#0 input edit n 3 T 279 + Play#0 command edit + Play#0 output Play#0 1 Tech level of 10kt fission warhead #3 changed from 400 to 280 + Play#0 output Play#0 6 0 640 + Play#0 input edit n 4 T 32767 + Play#0 command edit + Play#0 output Play#0 1 Tech level of 10kt fission warhead #4 changed from 400 to 32767 + Play#0 output Play#0 6 0 640 + Play#0 input edit n 5 T 32768 + Play#0 command edit + Play#0 output Play#0 1 Tech level of 10kt fission warhead #5 changed from 400 to 32767 + Play#0 output Play#0 6 0 640 Play#0 input edit s 2 F ~ Play#0 command edit Play#0 output Play#0 1 Assignment of cs cargo ship (#2) unchanged @@ -1347,7 +1424,7 @@ Play#0 input edit p 2 s -1 s 9999 Play#0 command edit Play#0 output Play#0 1 Ship of f1 Sopwith Camel #2 unchanged - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit p 3 s 3 Play#0 command edit @@ -1362,7 +1439,7 @@ Play#0 input edit u 2 S -1 S 9999 Play#0 command edit Play#0 output Play#0 1 Ship of sup supply #2 unchanged - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit u 3 S 3 Play#0 command edit @@ -1374,6 +1451,15 @@ Play#0 output Play#0 1 sup supply #4 unloaded from ship #4 Play#0 output Play#0 1 sup supply #4 loaded onto land #4 Play#0 output Play#0 6 0 640 + Play#0 input edit n 2 p -1 p 9999 + Play#0 command edit + Play#0 output Play#0 1 Plane of 10kt fission warhead #2 unchanged + Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 6 0 640 + Play#0 input edit n 3 p 3 + Play#0 command edit + Play#0 output Play#0 1 10kt fission warhead #3 loaded onto plane #3 + Play#0 output Play#0 6 0 640 Play#0 input edit p 4 l 5,1 Play#0 command edit Play#0 output Play#0 1 Can't move f1 Sopwith Camel #4 while it's loaded @@ -1471,6 +1557,22 @@ Play#0 output Play#0 4 %c xxxxx -- thing value : Play#0 input Play#0 output Play#0 6 0 640 + Play#0 input edit n 0 + Play#0 command edit + Play#0 output Play#0 1 POGO (#0) 10kt fission warhead #0 + Play#0 output Play#0 1 UID : 0 Type : 0 + Play#0 output Play#0 1 Owner : 0 Location : 1,-1 + Play#0 output Play#0 1 Tech : 400 Stockpile : + Play#0 output Play#0 1 Plane

: -1 + Play#0 output Play#0 4 %c xxxxx -- thing value : + Play#0 input S a + Play#0 output Play#0 1 Assignment of 10kt fission warhead #0 changed from stockpile ~ to a + Play#0 output Play#0 4 %c xxxxx -- thing value : + Play#0 input p -1 + Play#0 output Play#0 1 Plane of 10kt fission warhead #0 unchanged + Play#0 output Play#0 4 %c xxxxx -- thing value : + Play#0 input + Play#0 output Play#0 6 0 640 Play#0 input edit c 0 @ 0 Play#0 command edit Play#0 output Play#0 1 huh? (@) @@ -1586,7 +1688,7 @@ Play#0 input edit c 1 n POGO Play#0 command edit Play#0 output Play#0 1 Country #0 is already called `POGO' - Play#0 output Play#0 1 Usage: edit [ ]... + Play#0 output Play#0 1 Usage: edit [ ]... Play#0 output Play#0 6 0 640 Play#0 input edit c 2 n 2 Play#0 command edit @@ -1791,6 +1893,10 @@ Play#0 output Play#0 1 POGO gave you 12 guns in hat hvy artillery #6 Play#0 output Play#0 1 Type of hat hvy artillery #6 changed to art artillery by an act of POGO Play#0 output Play#0 1 POGO stole 2 guns from art artillery #6 + Play#0 output Play#0 1 15kt fission warhead #6 given to you by an act of POGO! + Play#0 output Play#0 1 Type of 15kt fission warhead #6 changed to 50kt fission by an act of POGO + Play#0 output Play#0 1 Tech level of 50kt fission warhead #6 changed from 290 to 300 by an act of POGO + Play#0 output Play#0 1 Type of 50kt fission warhead #6 changed to 15kt fission by an act of POGO Play#0 output Play#0 1 Money changed from 0 to -2147483648 by an act of POGO! Play#0 output Play#0 1 Technology changed from 0.00 to 3.14 by an act of POGO! Play#0 output Play#0 1 Research changed from 0.00 to 3.14 by an act of POGO! @@ -1810,6 +1916,8 @@ Play#0 output Play#0 1 Location of f1 Sopwith Camel #2 changed from 1,-1 to 3,-1 by an act of POGO! Play#0 output Play#0 1 sup supply #2 given to you by an act of POGO! Play#0 output Play#0 1 Location of sup supply #2 changed from 1,-1 to 3,-1 by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #2 given to you by an act of POGO! + Play#0 output Play#0 1 Location of 10kt fission warhead #2 changed from 1,-1 to 3,-1 by an act of POGO! Play#0 output Play#0 1 Mobility of cs cargo ship (#2) changed from 0 to -127 by an act of POGO Play#0 output Play#0 1 Tech level of cs cargo ship (#2) changed from 100 to 20 by an act of POGO Play#0 output Play#0 1 Mobility of f1 Sopwith Camel #2 changed from 0 to -127 by an act of POGO @@ -1818,6 +1926,7 @@ Play#0 output Play#0 1 Mobility of sup supply #2 changed from 0 to -127 by an act of POGO Play#0 output Play#0 1 Tech level of sup supply #2 changed from 100 to 50 by an act of POGO Play#0 output Play#0 1 Retreat percentage of sup supply #2 changed from 42 to 0 by an act of POGO + Play#0 output Play#0 1 Tech level of 10kt fission warhead #2 changed from 400 to 280 by an act of POGO Play#0 output Play#0 1 Retreat conditions of cs cargo ship (#2) changed by an act of POGO: group set Play#0 output Play#0 1 Retreat condition of sup supply #2 changed by an act of POGO: group set Play#0 output Play#0 1 Flags of f1 Sopwith Camel #2 changed by an act of POGO: airburst set @@ -1860,6 +1969,14 @@ Play#0 output Play#0 1 sup supply #5 given to you by an act of POGO! Play#0 output Play#0 1 sup supply #3 taken from you by an act of POGO! Play#0 output Play#0 1 sup supply #3 given to you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #0 taken from you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #1 taken from you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #2 taken from you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #4 taken from you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #4 given to you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #5 given to you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #3 taken from you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #3 given to you by an act of POGO! Play#0 output Play#0 1 Efficiency of cs cargo ship (#4) changed from 20 to 100 by an act of POGO Play#0 output Play#0 1 Efficiency of cs cargo ship (#5) changed from 20 to 100 by an act of POGO Play#0 output Play#0 1 Mobility of cs cargo ship (#3) changed from 0 to -127 by an act of POGO @@ -1894,6 +2011,9 @@ Play#0 output Play#0 1 Retreat percentage of sup supply #5 changed from 42 to 100 by an act of POGO Play#0 output Play#0 1 POGO gave you 25 military in sup supply #4 Play#0 output Play#0 1 POGO gave you 25 military in sup supply #5 + Play#0 output Play#0 1 Tech level of 10kt fission warhead #3 changed from 400 to 280 by an act of POGO + Play#0 output Play#0 1 Tech level of 10kt fission warhead #4 changed from 400 to 32767 by an act of POGO + Play#0 output Play#0 1 Tech level of 10kt fission warhead #5 changed from 400 to 32767 by an act of POGO Play#0 output Play#0 1 Assignment of cs cargo ship (#3) changed from fleet ~ to a by an act of POGO Play#0 output Play#0 1 Assignment of f1 Sopwith Camel #3 changed from wing ~ to a by an act of POGO Play#0 output Play#0 1 Assignment of sup supply #3 changed from army ~ to a by an act of POGO @@ -1913,6 +2033,7 @@ Play#0 output Play#0 1 sup supply #4 loaded onto ship #4 by an act of POGO! Play#0 output Play#0 1 sup supply #4 unloaded from ship #4 by an act of POGO! Play#0 output Play#0 1 sup supply #4 loaded onto land #4 by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #3 loaded onto plane #3 by an act of POGO! Play#0 output Play#0 1 sup supply #4 unloaded from land #4 by an act of POGO! Play#0 output Play#0 1 sup supply #4 loaded onto ship #2 by an act of POGO! Play#0 output Play#0 1 BTUs changed from 0 to 640 by an act of POGO! @@ -1947,6 +2068,7 @@ Play#0 output Play#0 1 cs cargo ship (#1) given to you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #1 given to you by an act of POGO! Play#0 output Play#0 1 sup supply #1 given to you by an act of POGO! + Play#0 output Play#0 1 10kt fission warhead #1 given to you by an act of POGO! Play#0 output Play#0 6 0 640 Play#0 input ctld Play#0 output Play#0 1 Bye-bye