* Tries to remove first instance of given tile and dir * @param tile tile * @param dir and dir to remove * @return element was found and removed */
| 119 | * @return element was found and removed |
| 120 | */ |
| 121 | bool Remove(TileIndex tile, Tdir dir) |
| 122 | { |
| 123 | for (uint i = 0; i < this->n; i++) { |
| 124 | if (this->data[i].tile == tile && this->data[i].dir == dir) { |
| 125 | this->data[i] = this->data[--this->n]; |
| 126 | return true; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | return false; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Tries to find given tile and dir in the set |