- minor bit of cleanup of tags code.

This commit is contained in:
Christoph Oelckers 2015-04-19 08:48:20 +02:00
parent f983f778f2
commit f65a07c952
4 changed files with 11 additions and 9 deletions

View file

@ -830,6 +830,11 @@ bool sector_t::HasTag(int checktag) const
return tag == checktag; return tag == checktag;
} }
bool sector_t::HasTags() const
{
return tag != 0;
}
void sector_t::SetMainTag(int tagnum) void sector_t::SetMainTag(int tagnum)
{ {
tag = tagnum; tag = tagnum;
@ -864,11 +869,6 @@ void line_t::SetMainId(int newid)
id = newid; id = newid;
} }
int line_t::GetMainId() const
{
return id;
}
void line_t::ClearIds() void line_t::ClearIds()
{ {
id = -1; id = -1;

View file

@ -778,6 +778,7 @@ public:
bool strifetrans = false; bool strifetrans = false;
bool strifetrans2 = false; bool strifetrans2 = false;
FString arg0str, arg1str; FString arg0str, arg1str;
int lineid; // forZDoomTranslated namespace
memset(ld, 0, sizeof(*ld)); memset(ld, 0, sizeof(*ld));
ld->Alpha = FRACUNIT; ld->Alpha = FRACUNIT;
@ -814,7 +815,8 @@ public:
continue; continue;
case NAME_Id: case NAME_Id:
ld->SetMainId(CheckInt(key)); lineid = CheckInt(key);
ld->SetMainId(lineid);
continue; continue;
case NAME_Sidefront: case NAME_Sidefront:
@ -1067,7 +1069,7 @@ public:
maplinedef_t mld; maplinedef_t mld;
memset(&mld, 0, sizeof(mld)); memset(&mld, 0, sizeof(mld));
mld.special = ld->special; mld.special = ld->special;
mld.tag = ld->GetMainId(); mld.tag = lineid;
P_TranslateLineDef(ld, &mld, false); P_TranslateLineDef(ld, &mld, false);
ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY)); ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY));
} }

View file

@ -307,7 +307,7 @@ void P_TranslateTeleportThings ()
while ( (dest = iterator.Next()) ) while ( (dest = iterator.Next()) )
{ {
if (dest->Sector->GetMainTag() == 0) if (!dest->Sector->HasTags())
{ {
dest->tid = 1; dest->tid = 1;
dest->AddToHash (); dest->AddToHash ();

View file

@ -634,6 +634,7 @@ struct sector_t
} }
bool HasTag(int checktag) const; bool HasTag(int checktag) const;
bool HasTags() const;
void SetMainTag(int tagnum); void SetMainTag(int tagnum);
int GetMainTag() const; int GetMainTag() const;
void ClearTags(); void ClearTags();
@ -908,7 +909,6 @@ struct line_t
void SetMainId(int newid); void SetMainId(int newid);
int GetMainId() const;
void ClearIds(); void ClearIds();
bool HasId(int id) const; bool HasId(int id) const;
static void HashIds(); static void HashIds();