Loading

Paste #pqaazgxp7

  1. Index: src/object_cmd.cpp
  2. ===================================================================
  3. --- src/object_cmd.cpp  (revision 27655)
  4. +++ src/object_cmd.cpp  (working copy)
  5. @@ -770,6 +770,8 @@
  6.  {
  7.     if (!IsTileOwner(tile, old_owner)) return;
  8.  
  9. +   bool do_clear = false;
  10. +
  11.     if (IsObjectType(tile, OBJECT_OWNED_LAND) && new_owner != INVALID_OWNER) {
  12.         SetTileOwner(tile, new_owner);
  13.     } else if (IsObjectType(tile, OBJECT_STATUE)) {
  14. @@ -780,12 +782,18 @@
  15.             SetBit(t->statues, new_owner);
  16.             SetTileOwner(tile, new_owner);
  17.         } else {
  18. -           ReallyClearObjectTile(Object::GetByTile(tile));
  19. +           do_clear = true;
  20.         }
  21.  
  22.         SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
  23.     } else {
  24. +       do_clear = true;
  25. +   }
  26. +
  27. +   if (do_clear) {
  28.         ReallyClearObjectTile(Object::GetByTile(tile));
  29. +       /* When clearing objects, they may turn into canal, which may require transfering ownership. */
  30. +       ChangeTileOwner(tile, old_owner, new_owner);
  31.     }
  32.  }
  33.  
  34.  

Comments