Remove GetCustomWorkshopType, custom workshop types are now saner.

develop
Petr Mrázek 2012-01-06 01:08:30 +01:00
parent e520a1d43b
commit a2cad00dbb
4 changed files with 5 additions and 21 deletions

@ -69,10 +69,9 @@ namespace DFHack
bool Read (const uint32_t index, t_building & building);
bool Finish();
// read a vector of names
// read mapping from custom_type value to building RAW name
// custom_type of -1 implies ordinary building
bool ReadCustomWorkshopTypes(std::map <uint32_t, std::string> & btypes);
// returns -1 on error, >= 0 for real value
int32_t GetCustomWorkshopType(t_building & building);
private:
struct Private;

@ -122,6 +122,7 @@ bool Buildings::Read (const uint32_t index, t_building & building)
building.material.index = bld_40d->mat_index;
building.material.type = bld_40d->mat_type;
building.type = type;
building.custom_type = bld_40d->getCustomType();
building.origin = (void *) &bld_40d;
return true;
}
@ -153,19 +154,3 @@ bool Buildings::ReadCustomWorkshopTypes(map <uint32_t, string> & btypes)
return true;
}
// FIXME: ugly hack
int32_t Buildings::GetCustomWorkshopType(t_building & building)
{
if(!d->Inited)
return false;
int32_t type = (int32_t)building.type;
int32_t ret = -1;
if(type != -1 && type == d->custom_workshop_id)
{
// read the custom workshop subtype
df::building_workshopst * workshop = (df::building_workshopst *) building.origin;
ret = workshop->custom_type;
}
return ret;
}

@ -1 +1 @@
Subproject commit 355674a508d72349983455f04791b4481b6c1515
Subproject commit 3277c6b29ddbb5d800ccb65eba27fed200236f3d

@ -1 +1 @@
Subproject commit 39a27d73e75b7ee22d93d31a9040322b0ceaa512
Subproject commit 545b2730ed137935643778f1b8ba115ae11c50a2