* Adds tile & dir into the set, checks for full set * Sets the 'overflowed' flag if the set was full * @param tile tile * @param dir and dir to add * @return true iff the item could be added (set wasn't full) */
| 153 | * @return true iff the item could be added (set wasn't full) |
| 154 | */ |
| 155 | bool Add(TileIndex tile, Tdir dir) |
| 156 | { |
| 157 | if (this->IsFull()) { |
| 158 | overflowed = true; |
| 159 | Debug(misc, 0, "SignalSegment too complex. Set {} is full (maximum {})", name, items); |
| 160 | return false; // set is full |
| 161 | } |
| 162 | |
| 163 | this->data[this->n].tile = tile; |
| 164 | this->data[this->n].dir = dir; |
| 165 | this->n++; |
| 166 | |
| 167 | return true; |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * Reads the last added element into the set |
no test coverage detected