Make prewrite callbacks more robust
Treat zero owner just like efficiency below minimum. Before, cargo was taken off carriers only when efficiency fell below minimum, not when owner changed to zero. Run item_prewrite() unconditionally, for simplicity.
This commit is contained in:
parent
fc42f66b4a
commit
861a66625c
4 changed files with 18 additions and 20 deletions
|
@ -60,17 +60,17 @@ nuk_prewrite(int n, void *old, void *new)
|
|||
{
|
||||
struct nukstr *oldnp = old;
|
||||
struct nukstr *np = new;
|
||||
natid own = np->nuk_own;
|
||||
natid own = np->nuk_effic == 0 ? 0 : np->nuk_own;
|
||||
|
||||
if (np->nuk_effic == 0) {
|
||||
own = 0;
|
||||
if (!own) {
|
||||
np->nuk_effic = 0;
|
||||
np->nuk_plane = -1;
|
||||
}
|
||||
|
||||
if (oldnp->nuk_plane != np->nuk_plane)
|
||||
nuk_carrier_change(np, EF_PLANE, oldnp->nuk_plane, np->nuk_plane);
|
||||
|
||||
/* We've avoided assigning to np->nuk_own, in case oldsp == sp */
|
||||
/* We've avoided assigning to np->nuk_own, in case oldnp == np */
|
||||
if (oldnp->nuk_own != own)
|
||||
lost_and_found(EF_NUKE, oldnp->nuk_own, own,
|
||||
np->nuk_uid, np->nuk_x, np->nuk_y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue