1
0
Fork 0

FGButton: Make init()'s "module" parameter const

FGButton::init() passes the module parameter (a non-const string
reference) straight through to FGCommonInput::read_bindings() as a const
reference.

Change the FGButton::init() signature so that module is const there too,
so that callers can pass it const string references returned by
accessors without having to make copies.
This commit is contained in:
James Hogan 2021-11-03 22:18:36 +00:00
parent b9efba55e7
commit dc5404a3c2
No known key found for this signature in database
GPG key ID: 35CEE4862B1023F2
2 changed files with 4 additions and 2 deletions

View file

@ -46,7 +46,8 @@ FGButton::~FGButton ()
} }
void FGButton::init( const SGPropertyNode * node, const std::string & name, std::string & module ) void FGButton::init(const SGPropertyNode* node, const std::string& name,
const std::string& module)
{ {
if (node == 0) { if (node == 0) {
SG_LOG(SG_INPUT, SG_DEBUG, "No bindings for button " << name); SG_LOG(SG_INPUT, SG_DEBUG, "No bindings for button " << name);

View file

@ -32,7 +32,8 @@ class FGButton : public FGCommonInput {
public: public:
FGButton(); FGButton();
virtual ~FGButton(); virtual ~FGButton();
void init( const SGPropertyNode * node, const std::string & name, std::string & module ); void init(const SGPropertyNode* node, const std::string& name,
const std::string& module);
void update( int modifiers, bool pressed, int x = -1, int y = -1); void update( int modifiers, bool pressed, int x = -1, int y = -1);
bool is_repeatable; bool is_repeatable;
float interval_sec, delay_sec, release_delay_sec; float interval_sec, delay_sec, release_delay_sec;