mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
reformat: remove redundant parentheses
This commit is contained in:
@@ -120,7 +120,7 @@ void render_task::run()
|
||||
const int screenWidth = static_cast<int>(PyLong_AsLong(outputWidth));
|
||||
const int screenHeight = static_cast<int>(PyLong_AsLong(outputHeight));
|
||||
|
||||
const bool useRgb = (false && !Global.gfx_usegles);
|
||||
const bool useRgb = false && !Global.gfx_usegles;
|
||||
|
||||
const int glFormat = useRgb ? GL_SRGB8 : GL_SRGB8_ALPHA8;
|
||||
const int glComponents = useRgb ? GL_RGB : GL_RGBA;
|
||||
@@ -130,7 +130,7 @@ void render_task::run()
|
||||
Py_ssize_t pythonBufferBytes = 0;
|
||||
char *pythonBufferPtr = nullptr;
|
||||
|
||||
const bool bufferExtracted = (PyBytes_AsStringAndSize(output, &pythonBufferPtr, &pythonBufferBytes) == 0) && (pythonBufferPtr != nullptr);
|
||||
const bool bufferExtracted = PyBytes_AsStringAndSize(output, &pythonBufferPtr, &pythonBufferBytes) == 0 && pythonBufferPtr != nullptr;
|
||||
|
||||
if (!bufferExtracted)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ auto python_taskqueue::init() -> bool
|
||||
crashreport_add_info("python.threadedupload", Global.python_threadedupload ? "yes" : "no");
|
||||
crashreport_add_info("python.uploadmain", Global.python_uploadmain ? "yes" : "no");
|
||||
#ifdef _WIN32
|
||||
const wchar_t *pythonhome = (sizeof(void *) == 8) ? L"python64" : L"python";
|
||||
const wchar_t *pythonhome = sizeof(void *) == 8 ? L"python64" : L"python";
|
||||
#elif __linux__
|
||||
const wchar_t *pythonhome = (sizeof(void *) == 8) ? L"linuxpython64" : L"linuxpython";
|
||||
#elif __APPLE__
|
||||
@@ -291,8 +291,8 @@ auto python_taskqueue::init() -> bool
|
||||
}
|
||||
|
||||
stringiomodule = PyImport_ImportModule("io");
|
||||
stringioclassname = (stringiomodule != nullptr ? PyObject_GetAttrString(stringiomodule, "StringIO") : nullptr);
|
||||
stringioobject = (stringioclassname != nullptr ? PyObject_CallObject(stringioclassname, nullptr) : nullptr);
|
||||
stringioclassname = stringiomodule != nullptr ? PyObject_GetAttrString(stringiomodule, "StringIO") : nullptr;
|
||||
stringioobject = stringioclassname != nullptr ? PyObject_CallObject(stringioclassname, nullptr) : nullptr;
|
||||
m_stderr = {(stringioobject == nullptr ? nullptr : PySys_SetObject(const_cast<char *>("stderr"), stringioobject) != 0 ? nullptr : stringioobject)};
|
||||
|
||||
if (false == run_file("abstractscreenrenderer"))
|
||||
@@ -377,7 +377,7 @@ void python_taskqueue::exit()
|
||||
auto python_taskqueue::insert(task_request const &Task) -> bool
|
||||
{
|
||||
|
||||
if (!m_initialized || (false == Global.python_enabled) || (Task.renderer.empty()) || (Task.input == nullptr) || (Task.target == 0))
|
||||
if (!m_initialized || false == Global.python_enabled || Task.renderer.empty() || Task.input == nullptr || Task.target == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ basic_element::output() const -> int {
|
||||
return std::get<variable>(data).value;
|
||||
}
|
||||
case basic_element::type_e::timer: {
|
||||
return ( std::get<timer>(data).time_elapsed >= std::get<timer>(data).time_preset ? std::get<timer>(data).value : 0 );
|
||||
return std::get<timer>(data).time_elapsed >= std::get<timer>(data).time_preset ? std::get<timer>(data).value : 0;
|
||||
}
|
||||
case basic_element::type_e::counter: {
|
||||
return ( std::get<counter>(data).count_value >= std::get<counter>(data).count_limit ? 1 : 0 );
|
||||
return std::get<counter>(data).count_value >= std::get<counter>(data).count_limit ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,10 +140,7 @@ basic_controller::deserialize_operation( cParser &Input ) -> bool {
|
||||
>> operationparameter;
|
||||
|
||||
auto const lookup { m_operationcodemap.find( operationname ) };
|
||||
operation.code = (
|
||||
lookup != m_operationcodemap.end() ?
|
||||
lookup->second :
|
||||
opcode_e::op_nop );
|
||||
operation.code = lookup != m_operationcodemap.end() ? lookup->second : opcode_e::op_nop;
|
||||
if( lookup == m_operationcodemap.end() ) {
|
||||
log_error( "contains unknown command \"" + operationname + "\"", Input.Line() - 1 );
|
||||
}
|
||||
@@ -292,7 +289,7 @@ basic_controller::run() -> int {
|
||||
case basic_element::type_e::counter: {
|
||||
std::get<basic_element::counter>(target.data).count_limit = operation.parameter1;
|
||||
// increase counter value on input activation
|
||||
if( ( initialstate == 0 ) && ( target.input() != 0 ) ) {
|
||||
if( initialstate == 0 && target.input() != 0 ) {
|
||||
/*
|
||||
// TBD: use overflow-prone version instead of safe one?
|
||||
target.data.counter.count_value += 1;
|
||||
@@ -387,10 +384,10 @@ basic_controller::guess_element_type_from_name( std::string const &Name ) const
|
||||
|
||||
auto const name { split_string_and_number( Name ) };
|
||||
|
||||
if( ( name.first == "t" ) || ( name.first == "ton" ) || ( name.first.find( "timer." ) == 0 ) ) {
|
||||
if( name.first == "t" || name.first == "ton" || name.first.find("timer.") == 0 ) {
|
||||
return basic_element::type_e::timer;
|
||||
}
|
||||
if( ( name.first == "c" ) || ( name.first.find( "counter." ) == 0 ) ) {
|
||||
if( name.first == "c" || name.first.find("counter.") == 0 ) {
|
||||
return basic_element::type_e::counter;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
auto guess_element_type_from_name( std::string const &Name ) const->basic_element::type_e;
|
||||
inline
|
||||
auto inverse( int const Value ) const -> int {
|
||||
return ( Value == 0 ? 1 : 0 ); }
|
||||
return Value == 0 ? 1 : 0; }
|
||||
// element access
|
||||
inline
|
||||
auto element( element_handle const Element ) const -> basic_element const {
|
||||
|
||||
Reference in New Issue
Block a user