mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 23:19: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.offset) + " ";
|
||||||
set += std::to_string(trainset.velocity) + "\n";
|
set += std::to_string(trainset.velocity) + "\n";
|
||||||
for (const auto &veh : trainset.vehicles) {
|
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 += "node -1 0 " + veh.name + " dynamic ";
|
||||||
set += veh.vehicle->path.parent_path().generic_string() + " ";
|
set += veh.vehicle->path.parent_path().generic_string() + " ";
|
||||||
set += veh.skin->skin + " ";
|
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->texture_author = win1250_to_utf8(meta->texture_author);
|
||||||
meta->photo_author = win1250_to_utf8(meta->photo_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 != "?") {
|
if (!meta->rev_date.empty() && meta->rev_date != "?") {
|
||||||
std::istringstream stream(meta->rev_date);
|
std::istringstream stream(meta->rev_date);
|
||||||
std::string day, month;
|
std::string day, month;
|
||||||
|
|||||||
@@ -171,24 +171,25 @@ void ui::vehiclepicker_panel::render()
|
|||||||
auto skin = skinset_list[i];
|
auto skin = skinset_list[i];
|
||||||
|
|
||||||
//std::string label = skin->skins[0].stem().string();
|
//std::string label = skin->skins[0].stem().string();
|
||||||
std::string label = skin->meta->name;
|
std::string label = skin->skin;
|
||||||
if (label.empty() || label == "?")
|
if (skin->meta && !skin->meta->name.empty() && skin->meta->name != "?")
|
||||||
label = skin->skin;
|
label = skin->meta->name;
|
||||||
|
|
||||||
auto mini = skin->mini ? &skin->mini : &placeholder_mini;
|
auto mini = skin->mini ? &skin->mini : &placeholder_mini;
|
||||||
if (selectable_image(label.c_str(), skin == selected_skinset, mini, skin))
|
if (selectable_image(label.c_str(), skin == selected_skinset, mini, skin))
|
||||||
selected_skinset = skin;
|
selected_skinset = skin;
|
||||||
|
|
||||||
if (ImGui::IsItemHovered()) {
|
if (skin->meta && ImGui::IsItemHovered()) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::TextUnformatted(skin->skin.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"),
|
||||||
ImGui::TextUnformatted(skin->vehicle.lock()->path.string().c_str());
|
skin->skin.c_str(),
|
||||||
ImGui::TextUnformatted(skin->meta->short_id.c_str());
|
skin->vehicle.lock()->path.string().c_str(),
|
||||||
ImGui::TextUnformatted(skin->meta->location.c_str());
|
skin->meta->short_id.c_str(),
|
||||||
ImGui::TextUnformatted(skin->meta->rev_date.c_str());
|
skin->meta->location.c_str(),
|
||||||
ImGui::TextUnformatted(skin->meta->rev_company.c_str());
|
skin->meta->rev_date.c_str(),
|
||||||
ImGui::TextUnformatted(skin->meta->texture_author.c_str());
|
skin->meta->rev_company.c_str(),
|
||||||
ImGui::TextUnformatted(skin->meta->photo_author.c_str());
|
skin->meta->texture_author.c_str(),
|
||||||
|
skin->meta->photo_author.c_str());
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,8 +209,10 @@ bool ui::vehiclepicker_panel::selectable_image(const char *desc, bool selected,
|
|||||||
if (pickable)
|
if (pickable)
|
||||||
ImGui::SetItemAllowOverlap();
|
ImGui::SetItemAllowOverlap();
|
||||||
|
|
||||||
if (!image)
|
if (!image) {
|
||||||
|
ImGui::PopID();
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
GLuint tex = image->get();
|
GLuint tex = image->get();
|
||||||
if (tex != -1) {
|
if (tex != -1) {
|
||||||
@@ -235,6 +238,5 @@ bool ui::vehiclepicker_panel::selectable_image(const char *desc, bool selected,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user