Skip to content

Commit

Permalink
Surface: Added methods (setFlags, isFlagged)
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jun 13, 2013
1 parent a6eb4fe commit fd35bce
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
19 changes: 17 additions & 2 deletions doomsday/client/include/world/surface.h
Expand Up @@ -82,7 +82,7 @@ class Surface : public de::MapElement
};
#endif // __CLIENT__

public:
public: /// @todo make private:
#ifdef __CLIENT__
struct DecorationData
{
Expand Down Expand Up @@ -137,10 +137,25 @@ class Surface : public de::MapElement
void setNormal(de::Vector3f const &newNormal);

/**
* Returns the @ref surfaceFlags of the surface.
* Returns a copy of the current @ref surfaceFlags of the surface.
*/
int flags() const;

/**
* Change the @ref surfaceFlags of the surface.
*
* @param flagsToChange Flags to change the value of.
* @param operation Logical operation to perform on the flags.
*/
void setFlags(int flagsToChange, de::FlagOp operation = de::SetFlags);

/**
* Returns @c true iff the surface is flagged @a flagsToTest.
*/
inline bool isFlagged(int flagsToTest) const {
return (flags() & flagsToTest) != 0;
}

/**
* Returns @c true iff a material is bound to the surface.
*/
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/render/rend_decor.cpp
Expand Up @@ -349,7 +349,7 @@ static void plotSourcesForSurface(Surface &suf)
if(useLightDecorations)
{
Surface::DecorSource const *sources = (Surface::DecorSource const *)suf._decorationData.sources;
for(uint i = 0; i < suf.decorationCount(); ++i)
for(int i = 0; i < suf.decorationCount(); ++i)
{
newSource(suf, sources[i]);
}
Expand Down
5 changes: 5 additions & 0 deletions doomsday/client/src/world/surface.cpp
Expand Up @@ -282,6 +282,11 @@ int Surface::flags() const
return d->flags;
}

void Surface::setFlags(int flagsToChange, FlagOp operation)
{
applyFlagOperation(d->flags, flagsToChange, operation);
}

bool Surface::setMaterial(Material *newMaterial, bool isMissingFix)
{
if(d->material != newMaterial)
Expand Down

0 comments on commit fd35bce

Please sign in to comment.