mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
launcher tweaks
This commit is contained in:
@@ -145,6 +145,11 @@ void ui::scenerylist_panel::add_replace_entry(const trainset_desc &trainset)
|
||||
set += std::to_string(trainset.offset) + " ";
|
||||
set += std::to_string(trainset.velocity) + "\n";
|
||||
for (const auto &veh : trainset.vehicles) {
|
||||
if (!veh.skin) {
|
||||
ErrorLog("trainset contains invalid vehicle " + veh.name);
|
||||
continue;
|
||||
}
|
||||
|
||||
set += "node -1 0 " + veh.name + " dynamic ";
|
||||
set += veh.vehicle->path.parent_path().generic_string() + " ";
|
||||
set += veh.skin->skin + " ";
|
||||
|
||||
@@ -167,6 +167,11 @@ std::shared_ptr<ui::skin_meta> ui::vehicles_bank::parse_meta(const std::string &
|
||||
meta->texture_author = win1250_to_utf8(meta->texture_author);
|
||||
meta->photo_author = win1250_to_utf8(meta->photo_author);
|
||||
|
||||
std::replace(std::begin(meta->location), std::end(meta->location), '_', ' ');
|
||||
std::replace(std::begin(meta->rev_company), std::end(meta->rev_company), '_', ' ');
|
||||
std::replace(std::begin(meta->texture_author), std::end(meta->texture_author), '_', ' ');
|
||||
std::replace(std::begin(meta->photo_author), std::end(meta->photo_author), '_', ' ');
|
||||
|
||||
if (!meta->rev_date.empty() && meta->rev_date != "?") {
|
||||
std::istringstream stream(meta->rev_date);
|
||||
std::string day, month;
|
||||
|
||||
@@ -171,24 +171,25 @@ void ui::vehiclepicker_panel::render()
|
||||
auto skin = skinset_list[i];
|
||||
|
||||
//std::string label = skin->skins[0].stem().string();
|
||||
std::string label = skin->meta->name;
|
||||
if (label.empty() || label == "?")
|
||||
label = skin->skin;
|
||||
std::string label = skin->skin;
|
||||
if (skin->meta && !skin->meta->name.empty() && skin->meta->name != "?")
|
||||
label = skin->meta->name;
|
||||
|
||||
auto mini = skin->mini ? &skin->mini : &placeholder_mini;
|
||||
if (selectable_image(label.c_str(), skin == selected_skinset, mini, skin))
|
||||
selected_skinset = skin;
|
||||
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (skin->meta && ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted(skin->skin.c_str());
|
||||
ImGui::TextUnformatted(skin->vehicle.lock()->path.string().c_str());
|
||||
ImGui::TextUnformatted(skin->meta->short_id.c_str());
|
||||
ImGui::TextUnformatted(skin->meta->location.c_str());
|
||||
ImGui::TextUnformatted(skin->meta->rev_date.c_str());
|
||||
ImGui::TextUnformatted(skin->meta->rev_company.c_str());
|
||||
ImGui::TextUnformatted(skin->meta->texture_author.c_str());
|
||||
ImGui::TextUnformatted(skin->meta->photo_author.c_str());
|
||||
ImGui::Text(STR_C("Skin: %s\nType: %s\nCarrier code: %s\nDepot: %s\nMaintenance: %s, by %s\nSkin author: %s\nPhoto author: %s"),
|
||||
skin->skin.c_str(),
|
||||
skin->vehicle.lock()->path.string().c_str(),
|
||||
skin->meta->short_id.c_str(),
|
||||
skin->meta->location.c_str(),
|
||||
skin->meta->rev_date.c_str(),
|
||||
skin->meta->rev_company.c_str(),
|
||||
skin->meta->texture_author.c_str(),
|
||||
skin->meta->photo_author.c_str());
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
@@ -208,8 +209,10 @@ bool ui::vehiclepicker_panel::selectable_image(const char *desc, bool selected,
|
||||
if (pickable)
|
||||
ImGui::SetItemAllowOverlap();
|
||||
|
||||
if (!image)
|
||||
if (!image) {
|
||||
ImGui::PopID();
|
||||
return ret;
|
||||
}
|
||||
|
||||
GLuint tex = image->get();
|
||||
if (tex != -1) {
|
||||
@@ -235,6 +238,5 @@ bool ui::vehiclepicker_panel::selectable_image(const char *desc, bool selected,
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user