Enable use of scope_dumper without scope info logging enabled

This commit is contained in:
Jonathan G Rennison 2018-07-25 08:13:15 +01:00
parent bb8c18b017
commit e2a4e51725
2 changed files with 10 additions and 9 deletions

View File

@ -40,6 +40,8 @@ int WriteScopeLog(char *buf, const char *last)
return b - buf;
}
#endif
// helper functions
const char *scope_dumper::CompanyInfo(int company_id)
{
@ -106,5 +108,3 @@ const char *scope_dumper::StationInfo(const BaseStation *st)
}
return this->buffer;
}
#endif

View File

@ -12,13 +12,14 @@
#ifndef SCOPE_INFO_H
#define SCOPE_INFO_H
#ifdef USE_SCOPE_INFO
#include <functional>
#include <vector>
struct Vehicle;
struct BaseStation;
#ifdef USE_SCOPE_INFO
extern std::vector<std::function<int(char *, const char *)>> _scope_stack;
struct scope_info_func_obj {
@ -52,6 +53,12 @@ int WriteScopeLog(char *buf, const char *last);
return SCOPE_INFO_PASTE(_sc_lm_, __LINE__) (buf, last); \
});
#else /* USE_SCOPE_INFO */
#define SCOPE_INFO_FMT(...) { }
#endif /* USE_SCOPE_INFO */
/**
* This is a set of helper functions to print useful info from within a SCOPE_INFO_FMT statement.
* The use of a struct is so that when used as an argument to SCOPE_INFO_FMT/seprintf/etc, the buffer lives
@ -68,10 +75,4 @@ private:
char buffer[256];
};
#else /* USE_SCOPE_INFO */
#define SCOPE_INFO_FMT(...) { }
#endif /* USE_SCOPE_INFO */
#endif /* SCOPE_INFO_H */