feat: customisable switch generated source groups (#5016)
Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "eeprominterface.h"
|
||||
#include "radiodata.h"
|
||||
#include "modeldata.h"
|
||||
#include "radiodataconversionstate.h"
|
||||
|
||||
#include <float.h>
|
||||
@@ -255,6 +256,9 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
|
||||
case SOURCE_TYPE_SPACEMOUSE:
|
||||
return tr("sm%1").arg(QChar('A' + (index - 1)));
|
||||
|
||||
case SOURCE_TYPE_FUNCTIONSWITCH_GROUP:
|
||||
return tr("GR%1").arg(index);
|
||||
|
||||
default:
|
||||
return QString(CPN_STR_UNKNOWN_ITEM);
|
||||
}
|
||||
@@ -284,9 +288,14 @@ bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings
|
||||
if (type == SOURCE_TYPE_CH && abs(index) > CPN_MAX_CHNOUT)
|
||||
return false;
|
||||
|
||||
if (type == SOURCE_TYPE_FUNCTIONSWITCH_GROUP && index >= b.getCapability(Board::FunctionSwitches))
|
||||
return false;
|
||||
|
||||
if (type == SOURCE_TYPE_CUSTOM_SWITCH && abs(index) > CPN_MAX_LOGICAL_SWITCHES)
|
||||
return false;
|
||||
|
||||
if (type == SOURCE_TYPE_FUNCTIONSWITCH_GROUP && model->getFuncGroupSwitchCount(abs(index), CPN_MAX_SWITCHES_FUNCTION) == 0)
|
||||
return false;
|
||||
|
||||
if (type == SOURCE_TYPE_LUA_OUTPUT && div(abs(index - 1), 16).quot >= CPN_MAX_SCRIPTS)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user