edit: Make unit owner change away from POGO work

Units owned by POGO are not in use.  Giving a unit to POGO destroys
it.  The opposite doesn't work, however: the unit prewrite hooks give
it right back to POGO, because efficiency is below the minimum.  Make
it work by also increasing efficiency to minimum.

Note that you can't use this to create a unit that doesn't already
exist in the respective file.  That's because edit's second argument
selects from existing objects only.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-12-29 10:37:11 +01:00
parent 3404b9ce7f
commit 2936e07f41
4 changed files with 33 additions and 2 deletions

View file

@ -759,6 +759,11 @@ edit_unit(struct empobj *unit, char *key, char *p,
report_god_takes("", unit_nameof(unit), unit->own); report_god_takes("", unit_nameof(unit), unit->own);
report_god_gives("", unit_nameof(unit), arg); report_god_gives("", unit_nameof(unit), arg);
} }
if (arg && unit->effic < mineff) {
divine_unit_change_quiet(unit, "Efficiency", 1,
"from %d to %d", unit->effic, mineff);
unit->effic = mineff;
}
unit->own = arg; unit->own = arg;
break; break;
case 'L': case 'L':

View file

@ -366,11 +366,11 @@ actor action victim times duration time
0 44 3 1 0 0 0 44 3 1 0 0
0 44 1 32 0 0 0 44 1 32 0 0
0 43 2 5 0 0 0 43 2 5 0 0
0 44 3 19 0 0 0 44 3 22 0 0
0 43 1 73 0 0 0 43 1 73 0 0
0 42 1 4 0 0 0 42 1 4 0 0
1 45 0 1 0 0 1 45 0 1 0 0
0 43 3 30 0 0 0 43 3 33 0 0
0 44 2 6 0 0 0 44 2 6 0 0
0 42 3 4 0 0 0 42 3 4 0 0
0 43 4 2 0 0 0 43 4 2 0 0
@ -505,6 +505,7 @@ timestamp owner type id x y
0 3 3 0 1 -1 0 3 3 0 1 -1
0 3 3 1 1 -1 0 3 3 1 1 -1
0 3 3 2 1 -1 0 3 3 2 1 -1
0 0 3 4 1 -1
/config /config
config realm config realm
cnum realm xl xh yl yh cnum realm xl xh yl yh

View file

@ -238,6 +238,7 @@ for my $ef ('ship', 'plane', 'land') {
edit($ef, 1, 'O', $MAXNOC - 1); edit($ef, 1, 'O', $MAXNOC - 1);
edit($ef, 1, 'O', $MAXNOC); edit($ef, 1, 'O', $MAXNOC);
edit($ef, 2, 'O', 2); edit($ef, 2, 'O', 2);
edit($ef, 4, 'O', 0, 'O', '3');
# uid (copy) # uid (copy)
edit($ef, 3, 'U', 5, 'U', 3); edit($ef, 3, 'U', 5, 'U', 3);
edit($ef, 0, 'U', 0, 'U', -1); edit($ef, 0, 'U', 0, 'U', -1);

View file

@ -860,6 +860,12 @@
Play#0 command edit Play#0 command edit
Play#0 output Play#0 1 Owner of cs cargo ship (#2) changed from 3 (#3) to 2 (#2) Play#0 output Play#0 1 Owner of cs cargo ship (#2) changed from 3 (#3) to 2 (#2)
Play#0 output Play#0 6 0 640 Play#0 output Play#0 6 0 640
Play#0 input edit s 4 O 0 O 3
Play#0 command edit
Play#0 output Play#0 1 Owner of cs cargo ship (#4) changed from 3 (#3) to POGO (#0)
Play#0 output Play#0 1 Owner of cs cargo ship (#4) changed from POGO (#0) to 3 (#3)
Play#0 output Play#0 1 Efficiency of cs cargo ship (#4) changed from 0 to 20
Play#0 output Play#0 6 0 640
Play#0 input edit s 3 U 5 U 3 Play#0 input edit s 3 U 5 U 3
Play#0 command edit Play#0 command edit
Play#0 output Play#0 1 cs cargo ship (#3) duplicated to (#5) Play#0 output Play#0 1 cs cargo ship (#3) duplicated to (#5)
@ -904,6 +910,12 @@
Play#0 command edit Play#0 command edit
Play#0 output Play#0 1 Owner of f1 Sopwith Camel #2 changed from 3 (#3) to 2 (#2) Play#0 output Play#0 1 Owner of f1 Sopwith Camel #2 changed from 3 (#3) to 2 (#2)
Play#0 output Play#0 6 0 640 Play#0 output Play#0 6 0 640
Play#0 input edit p 4 O 0 O 3
Play#0 command edit
Play#0 output Play#0 1 Owner of f1 Sopwith Camel #4 changed from 3 (#3) to POGO (#0)
Play#0 output Play#0 1 Owner of f1 Sopwith Camel #4 changed from POGO (#0) to 3 (#3)
Play#0 output Play#0 1 Efficiency of f1 Sopwith Camel #4 changed from 0 to 10
Play#0 output Play#0 6 0 640
Play#0 input edit p 3 U 5 U 3 Play#0 input edit p 3 U 5 U 3
Play#0 command edit Play#0 command edit
Play#0 output Play#0 1 f1 Sopwith Camel #3 duplicated to (#5) Play#0 output Play#0 1 f1 Sopwith Camel #3 duplicated to (#5)
@ -948,6 +960,12 @@
Play#0 command edit Play#0 command edit
Play#0 output Play#0 1 Owner of sup supply #2 changed from 3 (#3) to 2 (#2) Play#0 output Play#0 1 Owner of sup supply #2 changed from 3 (#3) to 2 (#2)
Play#0 output Play#0 6 0 640 Play#0 output Play#0 6 0 640
Play#0 input edit u 4 O 0 O 3
Play#0 command edit
Play#0 output Play#0 1 Owner of sup supply #4 changed from 3 (#3) to POGO (#0)
Play#0 output Play#0 1 Owner of sup supply #4 changed from POGO (#0) to 3 (#3)
Play#0 output Play#0 1 Efficiency of sup supply #4 changed from 0 to 10
Play#0 output Play#0 6 0 640
Play#0 input edit u 3 U 5 U 3 Play#0 input edit u 3 U 5 U 3
Play#0 command edit Play#0 command edit
Play#0 output Play#0 1 sup supply #3 duplicated to (#5) Play#0 output Play#0 1 sup supply #3 duplicated to (#5)
@ -1767,6 +1785,8 @@
Play#0 output Play#0 1 cs cargo ship (#0) taken from you by an act of POGO! Play#0 output Play#0 1 cs cargo ship (#0) taken from you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#1) taken from you by an act of POGO! Play#0 output Play#0 1 cs cargo ship (#1) taken from you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#2) taken from you by an act of POGO! Play#0 output Play#0 1 cs cargo ship (#2) taken from you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#4) taken from you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#4) given to you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#5) given to you by an act of POGO! Play#0 output Play#0 1 cs cargo ship (#5) given to you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#3) taken from you by an act of POGO! Play#0 output Play#0 1 cs cargo ship (#3) taken from you by an act of POGO!
Play#0 output Play#0 1 cs cargo ship (#3) given to you by an act of POGO! Play#0 output Play#0 1 cs cargo ship (#3) given to you by an act of POGO!
@ -1774,6 +1794,8 @@
Play#0 output Play#0 1 f1 Sopwith Camel #0 taken from you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #0 taken from you by an act of POGO!
Play#0 output Play#0 1 f1 Sopwith Camel #1 taken from you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #1 taken from you by an act of POGO!
Play#0 output Play#0 1 f1 Sopwith Camel #2 taken from you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #2 taken from you by an act of POGO!
Play#0 output Play#0 1 f1 Sopwith Camel #4 taken from you by an act of POGO!
Play#0 output Play#0 1 f1 Sopwith Camel #4 given to you by an act of POGO!
Play#0 output Play#0 1 f1 Sopwith Camel #5 given to you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #5 given to you by an act of POGO!
Play#0 output Play#0 1 f1 Sopwith Camel #3 taken from you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #3 taken from you by an act of POGO!
Play#0 output Play#0 1 f1 Sopwith Camel #3 given to you by an act of POGO! Play#0 output Play#0 1 f1 Sopwith Camel #3 given to you by an act of POGO!
@ -1781,6 +1803,8 @@
Play#0 output Play#0 1 sup supply #0 taken from you by an act of POGO! Play#0 output Play#0 1 sup supply #0 taken from you by an act of POGO!
Play#0 output Play#0 1 sup supply #1 taken from you by an act of POGO! Play#0 output Play#0 1 sup supply #1 taken from you by an act of POGO!
Play#0 output Play#0 1 sup supply #2 taken from you by an act of POGO! Play#0 output Play#0 1 sup supply #2 taken from you by an act of POGO!
Play#0 output Play#0 1 sup supply #4 taken from you by an act of POGO!
Play#0 output Play#0 1 sup supply #4 given to you by an act of POGO!
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 #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 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 sup supply #3 given to you by an act of POGO!