]> git.pond.sub.org Git - empserver/commitdiff
edit: Make unit owner change away from POGO work
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 29 Dec 2013 09:37:11 +0000 (10:37 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 2 Jan 2014 13:07:22 +0000 (14:07 +0100)
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>
src/lib/commands/edit.c
tests/actofgod/actofgod.xdump
tests/actofgod/geninput.pl
tests/actofgod/journal.log

index 894cd2c966ed79c56b56b80070582350dbd09541..e13cf1c8c5b5c161af20d1aa06df4ee537c3c9a9 100644 (file)
@@ -759,6 +759,11 @@ edit_unit(struct empobj *unit, char *key, char *p,
            report_god_takes("", unit_nameof(unit), unit->own);
            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;
        break;
     case 'L':
index 24d8d48dbcafce6a7cf190cf0c163457aca3f74b..b808384cfbf04b52f76a40d59bd8d2775a6cf035 100644 (file)
@@ -366,11 +366,11 @@ actor action victim times duration time
 0 44 3 1 0 0
 0 44 1 32 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 42 1 4 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 42 3 4 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 1 1 -1
 0 3 3 2 1 -1
+0 0 3 4 1 -1
 /config
 config realm
 cnum realm xl xh yl yh
index 2620c0fbd421b327d4b4bbd0afc5673e282b8054..56bb4bd332923f4c60fd9bc65aeaa4d16908fa9f 100755 (executable)
@@ -238,6 +238,7 @@ for my $ef ('ship', 'plane', 'land') {
     edit($ef, 1, 'O', $MAXNOC - 1);
     edit($ef, 1, 'O', $MAXNOC);
     edit($ef, 2, 'O', 2);
+    edit($ef, 4, 'O', 0, 'O', '3');
     # uid (copy)
     edit($ef, 3, 'U', 5, 'U', 3);
     edit($ef, 0, 'U', 0, 'U', -1);
index 43a6a93a4ac71ea2f14887c66d642a636e24e92c..a36565ee175923d0b2b5606e3f84b444b09d8fe4 100644 (file)
     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 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 command edit
     Play#0 output Play#0 1 cs   cargo ship (#3) duplicated to (#5)
     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 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 command edit
     Play#0 output Play#0 1 f1   Sopwith Camel #3 duplicated to (#5)
     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 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 command edit
     Play#0 output Play#0 1 sup  supply #3 duplicated to (#5)
     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 (#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 (#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 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 #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 #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 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 #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 #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!