mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 01:39:19 +02:00
reformat: use auto on certain types
This commit is contained in:
@@ -203,7 +203,7 @@ void eu07_application::DiscordRPCService()
|
||||
{
|
||||
// initialize discord-rpc
|
||||
WriteLog("Initializing Discord Rich Presence...");
|
||||
static const char *discord_app_id = "1343662664504840222";
|
||||
static auto discord_app_id = "1343662664504840222";
|
||||
DiscordEventHandlers handlers;
|
||||
memset(&handlers, 0, sizeof(handlers));
|
||||
Discord_Initialize(discord_app_id, &handlers, 1, nullptr);
|
||||
|
||||
@@ -575,7 +575,7 @@ void driver_mode::update_camera(double const Deltatime)
|
||||
}
|
||||
else
|
||||
{
|
||||
TDynamicObject *d = std::get<TDynamicObject *>(simulation::Region->find_vehicle(Camera.Pos, 300, false, false));
|
||||
auto d = std::get<TDynamicObject *>(simulation::Region->find_vehicle(Camera.Pos, 300, false, false));
|
||||
if (!d)
|
||||
d = std::get<TDynamicObject *>(simulation::Region->find_vehicle(Camera.Pos, 1000, false, false)); // dalej szukanie, jesli bliżej nie ma
|
||||
|
||||
@@ -963,7 +963,7 @@ void driver_mode::OnKeyDown(int cKey)
|
||||
// only available in free fly mode
|
||||
break;
|
||||
|
||||
TDynamicObject *dynamic = std::get<TDynamicObject *>(simulation::Region->find_vehicle(Global.pCamera.Pos, 50, false, false));
|
||||
auto dynamic = std::get<TDynamicObject *>(simulation::Region->find_vehicle(Global.pCamera.Pos, 50, false, false));
|
||||
if (dynamic)
|
||||
{
|
||||
m_relay.post(user_command::entervehicle, Global.ctrlState ? GLFW_MOD_CONTROL : 0, simulation::Train ? simulation::Train->id() : 0, GLFW_PRESS, 0, dynamic->GetPosition(),
|
||||
|
||||
@@ -612,7 +612,7 @@ debug_panel::render() {
|
||||
#ifdef WITH_UART
|
||||
if(true == render_section( "UART", m_uartlines)) {
|
||||
int ports_num = UartStatus.available_ports.size();
|
||||
char **avlports = new char*[ports_num];
|
||||
auto avlports = new char*[ports_num];
|
||||
for (int i=0; i < ports_num; i++) {
|
||||
avlports[i] = (char *) UartStatus.available_ports[i].c_str();
|
||||
}
|
||||
|
||||
@@ -1090,7 +1090,7 @@ void editor_mode::handle_terrain_sculpt(double Deltatime)
|
||||
|
||||
void editor_mode::capture_terrain()
|
||||
{
|
||||
TAnimModel *model = dynamic_cast<TAnimModel *>(m_node);
|
||||
auto model = dynamic_cast<TAnimModel *>(m_node);
|
||||
if (model == nullptr || model->pModel == nullptr)
|
||||
{
|
||||
WriteLog("Editor: select a model instance to capture as terrain", logtype::generic);
|
||||
@@ -1231,9 +1231,9 @@ void editor_mode::render_gizmo()
|
||||
glm::mat4 const projection = glm::perspective(fovy, aspect, 0.1f, 10000.0f);
|
||||
|
||||
// rotation/scale are only meaningful for instanced models; other node types translate only
|
||||
TAnimModel *model = dynamic_cast<TAnimModel *>(m_node);
|
||||
auto model = dynamic_cast<TAnimModel *>(m_node);
|
||||
|
||||
glm::vec3 const relativepos = glm::vec3(m_node->location() - camerapos);
|
||||
auto const relativepos = glm::vec3(m_node->location() - camerapos);
|
||||
glm::vec3 const angles = model ? model->Angles() : glm::vec3(0.0f);
|
||||
glm::vec3 const scalevec = model ? model->Scale() : glm::vec3(1.0f);
|
||||
|
||||
@@ -1246,7 +1246,7 @@ void editor_mode::render_gizmo()
|
||||
|
||||
// map the editor's transform mode onto ImGuizmo; fall back to translate for non-models
|
||||
ImGuizmo::OPERATION operation = ImGuizmo::TRANSLATE;
|
||||
EditorSnapshot::Action action = EditorSnapshot::Action::Move;
|
||||
auto action = EditorSnapshot::Action::Move;
|
||||
if (model && m_gizmo_op == gizmo_operation::rotate)
|
||||
{
|
||||
operation = ImGuizmo::ROTATE;
|
||||
@@ -1473,7 +1473,7 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in
|
||||
case GLFW_KEY_DELETE:
|
||||
if (is_press(Action))
|
||||
{
|
||||
TAnimModel *model = dynamic_cast<TAnimModel *>(m_node);
|
||||
auto model = dynamic_cast<TAnimModel *>(m_node);
|
||||
if (model)
|
||||
{
|
||||
// record deletion for undo (serialize full node)
|
||||
|
||||
@@ -67,7 +67,7 @@ scenarioloader_ui::scenarioloader_ui()
|
||||
std::vector<std::string> scenarioloader_ui::get_random_trivia()
|
||||
{
|
||||
WriteLog("Loading random trivia...");
|
||||
std::vector<std::string> trivia = std::vector<std::string>();
|
||||
auto trivia = std::vector<std::string>();
|
||||
|
||||
if (!FileExists("lang/trivia_" + Global.asLang + ".json")
|
||||
&& !FileExists("lang/trivia_en.json"))
|
||||
@@ -203,7 +203,7 @@ void scenarioloader_ui::render_()
|
||||
// Gradient at the lower half of the screen
|
||||
if (!Global.NvRenderer)
|
||||
{
|
||||
const ImTextureID tex = (ImTextureID)(intptr_t)m_gradient_overlay_tex; // See https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples#example-for-opengl-users
|
||||
const auto tex = (ImTextureID)(intptr_t)m_gradient_overlay_tex; // See https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples#example-for-opengl-users
|
||||
draw_list->AddImage(tex, ImVec2(0, Global.window_size.y / 2), ImVec2(Global.window_size.x, Global.window_size.y), ImVec2(0, 0), ImVec2(1, 1));
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void scenarioloader_ui::render_()
|
||||
if (!sceneryName.empty())
|
||||
{
|
||||
ImVec2 text_size = ImGui::CalcTextSize(sceneryName.c_str());
|
||||
ImVec2 text_pos = ImVec2(screen_size.x - 16 * scale - text_size.x, 16 * scale);
|
||||
auto text_pos = ImVec2(screen_size.x - 16 * scale - text_size.x, 16 * scale);
|
||||
draw_list->AddText(text_pos, IM_COL32_WHITE, sceneryName.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user