Bug fixes

This commit is contained in:
Grinch_ 2022-09-24 00:51:37 +06:00
parent 95c573d194
commit 3cdaf619ed
3 changed files with 12 additions and 6 deletions

View File

@ -625,6 +625,7 @@ TrafficType = "Traffic type"
TuneTab = "Tune" TuneTab = "Tune"
TurnMass = "Turn mass" TurnMass = "Turn mass"
Type = "Type" Type = "Type"
Unsupported = "This vehicle isn't compatible"
UpperLimit = "Upper limit" UpperLimit = "Upper limit"
Watertight = "Watertight car" Watertight = "Watertight car"
WatertightTip = """ WatertightTip = """

View File

@ -88,6 +88,13 @@ void VehCustmzrMgr::ApplyCustomizations(std::string& cat, std::string& key, std:
int model = pVeh->m_nModelIndex; int model = pVeh->m_nModelIndex;
std::string name = Util::GetCarName(model); std::string name = Util::GetCarName(model);
std::string index = std::format("{}.{}.", name, key); std::string index = std::format("{}.{}.", name, key);
int reqModel = m_CustomizeData.m_pData->Get((index + "Model").c_str(), -1);
if (model != reqModel)
{
Util::SetMessage(TEXT("Vehicle.Unsupported"));
return;
}
// colors // colors
toml::array *temp = m_CustomizeData.m_pData->GetArray((index + "ColorMat").c_str()); toml::array *temp = m_CustomizeData.m_pData->GetArray((index + "ColorMat").c_str());
@ -144,6 +151,7 @@ void VehCustmzrMgr::SaveCustomizations()
int model = pVeh->m_nModelIndex; int model = pVeh->m_nModelIndex;
std::string name = Util::GetCarName(model); std::string name = Util::GetCarName(model);
std::string index = std::format("{}.{} - {}.", name, name, m_nLabel); std::string index = std::format("{}.{} - {}.", name, name, m_nLabel);
m_CustomizeData.m_pData->Set((index + "Model").c_str(), model);
// Save colors // Save colors
auto paintData = Paint.Get().GetData(pVeh); auto paintData = Paint.Get().GetData(pVeh);

View File

@ -304,19 +304,16 @@ void DrawClippedImages(ResourceStore& data, ImVec2 imgSz, size_t imagesInRow, bo
int imageCount = 1; int imageCount = 1;
size_t totalSz = data.m_nSearchList.size(); size_t totalSz = data.m_nSearchList.size();
ImGuiListClipper clipper((totalSz > 3 ? totalSz/3 : totalSz), imgSz.y); ImGuiListClipper clipper((totalSz > imagesInRow ? totalSz/imagesInRow : totalSz), imgSz.y);
while (clipper.Step()) while (clipper.Step())
{ {
// hack to get clipper working with rowed items // hack to get clipper working with rowed items
size_t start = clipper.DisplayStart * imagesInRow; size_t start = clipper.DisplayStart * imagesInRow;
size_t end = clipper.DisplayEnd * imagesInRow + imagesInRow; size_t end = clipper.DisplayEnd * imagesInRow + imagesInRow;
end = (end > totalSz) ? totalSz : end;
for (size_t i = start; i < end; ++i) for (size_t i = start; i < end; ++i)
{ {
if (data.m_nSearchList.size() == i)
{
break;
}
std::string &text = std::get<ImageLookup>(data.m_nSearchList[i]).m_FileName; std::string &text = std::get<ImageLookup>(data.m_nSearchList[i]).m_FileName;
std::string &modelName = std::get<ImageLookup>(data.m_nSearchList[i]).m_ModelName; std::string &modelName = std::get<ImageLookup>(data.m_nSearchList[i]).m_ModelName;
bool custom = std::get<ImageLookup>(data.m_nSearchList[i]).m_bCustom; bool custom = std::get<ImageLookup>(data.m_nSearchList[i]).m_bCustom;