mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
launcher link start fix, assume scn files in win1250
This commit is contained in:
@@ -61,7 +61,7 @@ void ui::scenerylist_panel::render_contents()
|
|||||||
if (ImGui::Button(link.second.c_str(), ImVec2(-1, 0))) {
|
if (ImGui::Button(link.second.c_str(), ImVec2(-1, 0))) {
|
||||||
std::string file = ToLower(link.first);
|
std::string file = ToLower(link.first);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
system(("start \"" + file + "\"").c_str());
|
system(("start \"eu07_link\" \"" + file + "\"").c_str());
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
system(("xdg-open \"" + file + "\"").c_str());
|
system(("xdg-open \"" + file + "\"").c_str());
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
@@ -150,7 +150,6 @@ void ui::scenerylist_panel::render_contents()
|
|||||||
set += "enddynamic\n";
|
set += "enddynamic\n";
|
||||||
}
|
}
|
||||||
set += "endtrainset\n";
|
set += "endtrainset\n";
|
||||||
WriteLog(set);
|
|
||||||
|
|
||||||
Global.trainset_overrides.emplace(selected_trainset->file_bounds.first, set);
|
Global.trainset_overrides.emplace(selected_trainset->file_bounds.first, set);
|
||||||
|
|
||||||
@@ -227,7 +226,10 @@ void ui::scenerylist_panel::draw_trainset(trainset_desc &trainset)
|
|||||||
}
|
}
|
||||||
ImGui::SameLine(afterX);
|
ImGui::SameLine(afterX);
|
||||||
|
|
||||||
if (ImGui::IsItemClicked(1)) {
|
if (ImGui::IsItemDeactivated() && ImGui::IsItemHovered()) {
|
||||||
|
selected_trainset = &trainset;
|
||||||
|
}
|
||||||
|
else if (ImGui::IsItemClicked(1)) {
|
||||||
register_popup(std::make_unique<ui::dynamic_edit_popup>(*this, dyn_desc));
|
register_popup(std::make_unique<ui::dynamic_edit_popup>(*this, dyn_desc));
|
||||||
}
|
}
|
||||||
else if (ImGui::IsItemHovered()) {
|
else if (ImGui::IsItemHovered()) {
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ void scenery_scanner::scan_scn(std::filesystem::path path)
|
|||||||
if (line[3] == 'i')
|
if (line[3] == 'i')
|
||||||
desc.image_path = "scenery/images/" + line.substr(5);
|
desc.image_path = "scenery/images/" + line.substr(5);
|
||||||
else if (line[3] == 'n')
|
else if (line[3] == 'n')
|
||||||
desc.name = line.substr(5);
|
desc.name = win1250_to_utf8(line.substr(5));
|
||||||
else if (line[3] == 'd')
|
else if (line[3] == 'd')
|
||||||
desc.description += line.substr(5) + '\n';
|
desc.description += win1250_to_utf8(line.substr(5)) + '\n';
|
||||||
else if (line[3] == 'f') {
|
else if (line[3] == 'f') {
|
||||||
std::string lang;
|
std::string lang;
|
||||||
std::string file;
|
std::string file;
|
||||||
@@ -66,7 +66,7 @@ void scenery_scanner::scan_scn(std::filesystem::path path)
|
|||||||
stream >> lang >> file;
|
stream >> lang >> file;
|
||||||
std::getline(stream, label);
|
std::getline(stream, label);
|
||||||
|
|
||||||
desc.links.push_back(std::make_pair(file, label));
|
desc.links.push_back(std::make_pair(file, win1250_to_utf8(label)));
|
||||||
}
|
}
|
||||||
else if (line[3] == 'o') {
|
else if (line[3] == 'o') {
|
||||||
for (auto &trainset : desc.trainsets) {
|
for (auto &trainset : desc.trainsets) {
|
||||||
@@ -74,7 +74,7 @@ void scenery_scanner::scan_scn(std::filesystem::path path)
|
|||||||
|| line_counter > trainset.file_bounds.second)
|
|| line_counter > trainset.file_bounds.second)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
trainset.description = line.substr(5);
|
trainset.description = win1250_to_utf8(line.substr(5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,6 +330,22 @@ win1250_to_ascii( std::string &Input ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string win1250_to_utf8(const std::string &Input) {
|
||||||
|
std::unordered_map<char, std::string> const charmap {
|
||||||
|
{ 165, u8"Ą" }, { 198, u8"Ć" }, { 202, u8"Ę" }, { 163, u8"Ł" }, { 209, u8"Ń" }, { 211, u8"Ó" }, { 140, u8"Ś" }, { 143, u8"Ź" }, { 175, u8"Ż" },
|
||||||
|
{ 185, u8"ą" }, { 230, u8"ć" }, { 234, u8"ę" }, { 179, u8"ł" }, { 241, u8"ń" }, { 243, u8"ó" }, { 156, u8"ś" }, { 159, u8"ź" }, { 191, u8"ż" }
|
||||||
|
};
|
||||||
|
std::string output;
|
||||||
|
std::unordered_map<char, std::string>::const_iterator lookup;
|
||||||
|
for( auto &input : Input ) {
|
||||||
|
if( ( lookup = charmap.find( input ) ) != charmap.end() )
|
||||||
|
output += lookup->second;
|
||||||
|
else
|
||||||
|
output += input;
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
// Ra: tymczasowe rozwiązanie kwestii zagranicznych (czeskich) napisów
|
// Ra: tymczasowe rozwiązanie kwestii zagranicznych (czeskich) napisów
|
||||||
char charsetconversiontable[] =
|
char charsetconversiontable[] =
|
||||||
"E?,?\"_++?%S<STZZ?`'\"\".--??s>stzz"
|
"E?,?\"_++?%S<STZZ?`'\"\".--??s>stzz"
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ void win1250_to_ascii( std::string &Input );
|
|||||||
// TODO: unify with win1250_to_ascii()
|
// TODO: unify with win1250_to_ascii()
|
||||||
std::string Bezogonkow( std::string Input, bool const Underscorestospaces = false );
|
std::string Bezogonkow( std::string Input, bool const Underscorestospaces = false );
|
||||||
|
|
||||||
|
std::string win1250_to_utf8(const std::string &input);
|
||||||
|
|
||||||
inline
|
inline
|
||||||
std::string
|
std::string
|
||||||
extract_value( std::string const &Key, std::string const &Input ) {
|
extract_value( std::string const &Key, std::string const &Input ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user