File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -887,6 +887,21 @@ static int getMaxStockpileId()
887887 return max_id;
888888}
889889
890+ static int getMaxCivzoneId ()
891+ {
892+ auto &vec = world->buildings .other [buildings_other_id::ANY_ZONE ];
893+ int max_id = 0 ;
894+
895+ for (size_t i = 0 ; i < vec.size (); i++)
896+ {
897+ auto bld = strict_virtual_cast<df::building_civzonest>(vec[i]);
898+ if (bld)
899+ max_id = std::max (max_id, bld->zone_num );
900+ }
901+
902+ return max_id;
903+ }
904+
890905bool Buildings::constructAbstract (df::building *bld)
891906{
892907 CHECK_NULL_POINTER (bld);
@@ -903,6 +918,11 @@ bool Buildings::constructAbstract(df::building *bld)
903918 stock->stockpile_number = getMaxStockpileId () + 1 ;
904919 break ;
905920
921+ case building_type::Civzone:
922+ if (auto zone = strict_virtual_cast<df::building_civzonest>(bld))
923+ zone->zone_num = getMaxCivzoneId () + 1 ;
924+ break ;
925+
906926 default :
907927 break ;
908928 }
You can’t perform that action at this time.
0 commit comments