Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2017-07-09 13:04:26 +0200
committerStijn Buys <ingar@osirion.org>2017-07-09 13:04:26 +0200
commit9ec090567986b5d273c90cceaceae42922b84afe (patch)
treed75f95564ff58e2cf148ae6018f7377f63f1791c /src
parente5d987a988cf66aaeb6d11579bd278df9daf8118 (diff)
Fixed a gcc 7 warning.
Diffstat (limited to 'src')
-rw-r--r--src/core/commandbuffer.cc8
-rw-r--r--src/core/cvar.h6
-rw-r--r--src/core/entity.h2
3 files changed, 11 insertions, 5 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc
index 4234f0e..a9b8117 100644
--- a/src/core/commandbuffer.cc
+++ b/src/core/commandbuffer.cc
@@ -229,7 +229,7 @@ void func_set(std::string const &args)
value += c;
Cvar *cvar = Cvar::set(varname.c_str(), value.c_str());
- if (cvar->flags() && Cvar::Info) {
+ if (cvar->has_flag(Cvar::Info)) {
localplayer()->set_dirty();
}
@@ -264,7 +264,7 @@ void func_toggle(std::string const &args)
(*cvar) = valueone;
}
- if (cvar->flags() && Cvar::Info) {
+ if (cvar->has_flag(Cvar::Info)) {
localplayer()->set_dirty();
}
@@ -438,14 +438,14 @@ void CommandBuffer::exec(std::string const &cmdline)
if (cvar) {
// cvar exists
std::string value;
- if (((cvar->flags() & Cvar::ReadOnly) == 0) && (cmdstream >> value)) {
+ if ((!cvar->has_flag(Cvar::ReadOnly)) && (cmdstream >> value)) {
// we're setting a new value
char c;
while (cmdstream.get(c))
value += c;
(*cvar) = value;
- if (cvar->flags() && Cvar::Info) {
+ if (cvar->has_flag(Cvar::Info)) {
localplayer()->set_dirty();
}
}
diff --git a/src/core/cvar.h b/src/core/cvar.h
index 864d751..4db09dc 100644
--- a/src/core/cvar.h
+++ b/src/core/cvar.h
@@ -59,6 +59,12 @@ public:
inline const std::string& str() const {
return cvar_str;
}
+
+ /// returns true if a cvar flag is set
+ inline const bool has_flag(const Flags flag) const
+ {
+ return ((cvar_flags & (unsigned int)flag) == (unsigned int)flag);
+ }
/*----- mutators -------------------------------------------------- */
diff --git a/src/core/entity.h b/src/core/entity.h
index 27d888c..3e0cea8 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -142,7 +142,7 @@ public:
return entity_flags;
}
- /// returns true of a flag is set
+ /// returns true if an entity flag is set
inline const bool has_flag(const Flags flag) const
{
return ((entity_flags & (unsigned int)flag) == (unsigned int)flag);