| 629 | } |
| 630 | |
| 631 | static void update_stockpile_links(EngineInfo *engine) |
| 632 | { |
| 633 | engine->links.take_from_pile.clear(); |
| 634 | |
| 635 | for (auto it = engine->stockpiles.begin(); it != engine->stockpiles.end(); ) |
| 636 | { |
| 637 | int id = *it; ++it; |
| 638 | auto pile = df::building::find(id); |
| 639 | |
| 640 | if (!pile || pile->getType() != building_type::Stockpile) |
| 641 | forgetStockpileLink(engine, id); |
| 642 | else |
| 643 | // The vector is sorted, but we are iterating through a sorted set |
| 644 | engine->links.take_from_pile.push_back(pile); |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | static int getStockpileLinks(lua_State *L) |
| 649 | { |