@@ -51,13 +51,21 @@ using namespace df::enums;
5151using df::global::world;
5252using df::global::plotinfo;
5353
54- df::burrow *Burrows::findByName (std::string name)
54+ df::burrow *Burrows::findByName (std::string name, bool ignore_final_plus )
5555{
5656 auto &vec = df::burrow::get_vector ();
5757
58- for (size_t i = 0 ; i < vec.size (); i++)
59- if (vec[i]->name == name)
58+ if (ignore_final_plus && name.ends_with (' +' ))
59+ name = name.substr (0 , name.length () - 1 );
60+
61+ for (size_t i = 0 ; i < vec.size (); i++) {
62+ std::string bname = vec[i]->name ;
63+ if (ignore_final_plus && bname.ends_with (' +' ))
64+ bname = bname.substr (0 , bname.length () - 1 );
65+
66+ if (bname == name)
6067 return vec[i];
68+ }
6169
6270 return NULL ;
6371}
@@ -75,18 +83,6 @@ void Burrows::clearUnits(df::burrow *burrow)
7583 }
7684
7785 burrow->units .clear ();
78-
79- /* TODO: understand how this changes for v50
80- // Sync plotinfo if active
81- if (plotinfo && plotinfo->main.mode == ui_sidebar_mode::Burrows &&
82- plotinfo->burrows.in_add_units_mode && plotinfo->burrows.sel_id == burrow->id)
83- {
84- auto &sel = plotinfo->burrows.sel_units;
85-
86- for (size_t i = 0; i < sel.size(); i++)
87- sel[i] = false;
88- }
89- */
9086}
9187
9288bool Burrows::isAssignedUnit (df::burrow *burrow, df::unit *unit)
@@ -114,17 +110,6 @@ void Burrows::setAssignedUnit(df::burrow *burrow, df::unit *unit, bool enable)
114110 erase_from_vector (unit->burrows , burrow->id );
115111 erase_from_vector (burrow->units , unit->id );
116112 }
117-
118- /* TODO: understand how this changes for v50
119- // Sync plotinfo if active
120- if (plotinfo && plotinfo->main.mode == ui_sidebar_mode::Burrows &&
121- plotinfo->burrows.in_add_units_mode && plotinfo->burrows.sel_id == burrow->id)
122- {
123- int idx = linear_index(plotinfo->burrows.list_units, unit);
124- if (idx >= 0)
125- plotinfo->burrows.sel_units[idx] = enable;
126- }
127- */
128113}
129114
130115void Burrows::listBlocks (std::vector<df::map_block*> *pvec, df::burrow *burrow)
0 commit comments