Skip to content

Commit

Permalink
Refactor|Line: Replaced the now singular "internal" map Line flag wit…
Browse files Browse the repository at this point in the history
…h a bool
  • Loading branch information
danij-deng committed Apr 29, 2013
1 parent ed4226f commit 668d819
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
15 changes: 8 additions & 7 deletions doomsday/client/include/map/line.h
Expand Up @@ -38,9 +38,6 @@ class HEdge;
class LineOwner;
class Sector;

// Internal flags:
#define LF_POLYOBJ 0x1 ///< Line is part of a polyobject.

/**
* World map line.
*
Expand Down Expand Up @@ -457,10 +454,7 @@ class Line : public de::MapElement
LineOwner *_vo1;
LineOwner *_vo2;

/// Internal LF_* flags.
byte _inFlags;

/// Sector of the map which for which this line acts as a "One-way window".
/// Sector of the map for which this line acts as a "One-way window".
/// @todo Now unnecessary, refactor away -ds
Sector *_bspWindowSector;

Expand Down Expand Up @@ -750,6 +744,13 @@ class Line : public de::MapElement
*/
bool isFromPolyobj() const;

/**
* Mark the line as being owned by/is part of some Polyobj.
*
* @param set @c true to set, @c false to clear.
*/
void markPolyobjOwned(bool set = true);

/**
* Returns @c true iff the line resulted in the creation of a BSP window
* effect when partitioning the map.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/edit_map.cpp
Expand Up @@ -1128,7 +1128,7 @@ int MPE_PolyobjCreate(int *lines, int lineCount, int tag, int sequenceType,
Line *line = editMap.lines[lines[i]];

// This line belongs to a polyobj.
line->_inFlags |= LF_POLYOBJ;
line->markPolyobjOwned();
static_cast<Polyobj::Lines *>(po->_lines)->append(line);
}

Expand Down
12 changes: 10 additions & 2 deletions doomsday/client/src/map/line.cpp
Expand Up @@ -472,6 +472,9 @@ DENG2_PIMPL(Line)
Side front;
Side back;

/// @c true= the line is owned by some Polyobj.
bool polyobjOwned;

/// Used by legacy algorithms to prevent repeated processing.
int validCount;

Expand All @@ -490,6 +493,7 @@ DENG2_PIMPL(Line)
length(direction.length()),
front(*i, frontSector),
back(*i, backSector),
polyobjOwned(false),
validCount(0)
{
std::memset(mapped, 0, sizeof(mapped));
Expand All @@ -505,7 +509,6 @@ Line::Line(Vertex &from, Vertex &to, int flags, Sector *frontSector, Sector *bac
: MapElement(DMU_LINE),
_vo1(0),
_vo2(0),
_inFlags(0),
_bspWindowSector(0),
d(new Instance(this, from, to, flags, frontSector, backSector))
{
Expand Down Expand Up @@ -540,7 +543,12 @@ bool Line::isBspWindow() const

bool Line::isFromPolyobj() const
{
return (_inFlags & LF_POLYOBJ) != 0;
return d->polyobjOwned;
}

void Line::markPolyobjOwned(bool set)
{
d->polyobjOwned = set;
}

Line::Side &Line::side(int back)
Expand Down

0 comments on commit 668d819

Please sign in to comment.