mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 14:49:19 +02:00
Final fix for missing getCommands function inside abstractscreenrenderer
This commit is contained in:
40
PyInt.cpp
40
PyInt.cpp
@@ -111,27 +111,33 @@ void render_task::run() {
|
|||||||
|
|
||||||
// get commands from renderer
|
// get commands from renderer
|
||||||
auto *commandsPO = PyObject_CallMethod(m_renderer, "getCommands", nullptr);
|
auto *commandsPO = PyObject_CallMethod(m_renderer, "getCommands", nullptr);
|
||||||
std::vector<std::string> commands = python_external_utils::PyObjectToStringArray(commandsPO);
|
if (commandsPO != nullptr)
|
||||||
Py_DECREF(commandsPO);
|
{
|
||||||
|
std::vector<std::string> commands = python_external_utils::PyObjectToStringArray(commandsPO);
|
||||||
|
|
||||||
// we perform any actions ONLY when there are any commands in buffer
|
Py_DECREF(commandsPO);
|
||||||
if (!commands.empty())
|
// we perform any actions ONLY when there are any commands in buffer
|
||||||
{
|
if (!commands.empty())
|
||||||
for (const auto &command : commands)
|
|
||||||
{
|
{
|
||||||
auto it = simulation::commandMap.find(command);
|
for (const auto &command : commands)
|
||||||
if (it != simulation::commandMap.end())
|
|
||||||
{
|
{
|
||||||
// command found
|
auto it = simulation::commandMap.find(command);
|
||||||
command_data cd;
|
if (it != simulation::commandMap.end())
|
||||||
cd.command = it->second;
|
{
|
||||||
cd.action = GLFW_PRESS;
|
// command found
|
||||||
simulation::Commands.push(cd, static_cast<std::size_t>(command_target::vehicle) | 1); // player train is always 1
|
command_data cd;
|
||||||
|
cd.command = it->second;
|
||||||
|
cd.action = GLFW_PRESS;
|
||||||
|
simulation::Commands.push(cd, static_cast<std::size_t>(command_target::vehicle) | 1); // player train is always 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ErrorLog("Python: Command [" + command + "] not found!");
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
ErrorLog("Python: Command [" + command + "] not found!");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user