equal
deleted
inserted
replaced
545 |
545 |
546 MergePoint(&rect, st->airport_tile); |
546 MergePoint(&rect, st->airport_tile); |
547 MergePoint(&rect, st->airport_tile + TileDiffXY(afc->size_x - 1, afc->size_y - 1)); |
547 MergePoint(&rect, st->airport_tile + TileDiffXY(afc->size_x - 1, afc->size_y - 1)); |
548 } |
548 } |
549 |
549 |
550 if (st->dock_tile != 0) MergePoint(&rect, st->dock_tile); |
550 if (st->dock_tile != 0) { |
|
551 MergePoint(&rect, st->dock_tile); |
|
552 if (IsDockTile(st->dock_tile)) { |
|
553 MergePoint(&rect, st->dock_tile + TileOffsByDiagDir(GetDockDirection(st->dock_tile))); |
|
554 } // else OilRig |
|
555 } |
551 |
556 |
552 for (const RoadStop *rs = st->bus_stops; rs != NULL; rs = rs->next) { |
557 for (const RoadStop *rs = st->bus_stops; rs != NULL; rs = rs->next) { |
553 MergePoint(&rect, rs->xy); |
558 MergePoint(&rect, rs->xy); |
554 } |
559 } |
555 |
560 |
557 MergePoint(&rect, rs->xy); |
562 MergePoint(&rect, rs->xy); |
558 } |
563 } |
559 |
564 |
560 /* And retrieve the acceptance. */ |
565 /* And retrieve the acceptance. */ |
561 AcceptedCargo accepts; |
566 AcceptedCargo accepts; |
|
567 assert((rect.right >= rect.left) == !st->rect.IsEmpty()); |
562 if (rect.right >= rect.left) { |
568 if (rect.right >= rect.left) { |
|
569 assert(rect.left == st->rect.left); |
|
570 assert(rect.top == st->rect.bottom); |
|
571 assert(rect.right == st->rect.right); |
|
572 assert(rect.bottom == st->rect.top); |
563 GetAcceptanceAroundTiles( |
573 GetAcceptanceAroundTiles( |
564 accepts, |
574 accepts, |
565 TileXY(rect.left, rect.bottom), |
575 TileXY(rect.left, rect.bottom), |
566 rect.right - rect.left + 1, |
576 rect.right - rect.left + 1, |
567 rect.top - rect.bottom + 1, |
577 rect.top - rect.bottom + 1, |
2124 if (st != NULL) { |
2134 if (st != NULL) { |
2125 if (st->owner != _current_company) { |
2135 if (st->owner != _current_company) { |
2126 return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION); |
2136 return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION); |
2127 } |
2137 } |
2128 |
2138 |
2129 if (!st->rect.BeforeAddRect(tile, _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TEST)) return CMD_ERROR; |
2139 if (!st->rect.BeforeAddRect( |
|
2140 tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]), |
|
2141 _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TEST)) return CMD_ERROR; |
2130 |
2142 |
2131 if (st->dock_tile != 0) return_cmd_error(STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK); |
2143 if (st->dock_tile != 0) return_cmd_error(STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK); |
2132 } else { |
2144 } else { |
2133 /* allocate and initialize new station */ |
2145 /* allocate and initialize new station */ |
2134 /* allocate and initialize new station */ |
2146 /* allocate and initialize new station */ |
2148 |
2160 |
2149 if (flags & DC_EXEC) { |
2161 if (flags & DC_EXEC) { |
2150 st->dock_tile = tile; |
2162 st->dock_tile = tile; |
2151 st->AddFacility(FACIL_DOCK, tile); |
2163 st->AddFacility(FACIL_DOCK, tile); |
2152 |
2164 |
2153 st->rect.BeforeAddRect(tile, _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TRY); |
2165 st->rect.BeforeAddRect( |
|
2166 tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]), |
|
2167 _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TRY); |
2154 |
2168 |
2155 MakeDock(tile, st->owner, st->index, direction, wc); |
2169 MakeDock(tile, st->owner, st->index, direction, wc); |
2156 |
2170 |
2157 UpdateStationVirtCoordDirty(st); |
2171 UpdateStationVirtCoordDirty(st); |
2158 UpdateStationAcceptance(st, false); |
2172 UpdateStationAcceptance(st, false); |