本文整理汇总了C++中TArray::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Clear方法的具体用法?C++ TArray::Clear怎么用?C++ TArray::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Spread
void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor)
{
FTexture *tex;
vertex_t *v1;
double rorg, ldx, ldy;
GetWallStuff (wall, v1, ldx, ldy);
rorg = Length (x - v1->fX(), y - v1->fY());
if ((tex = TexMan[PicNum]) == NULL)
{
return;
}
int dwidth = tex->GetWidth ();
DecalWidth = dwidth * ScaleX;
DecalLeft = tex->LeftOffset * ScaleX;
DecalRight = DecalWidth - DecalLeft;
SpreadSource = this;
SpreadTemplate = tpl;
SpreadZ = z;
// Try spreading left first
SpreadLeft (rorg - DecalLeft, v1, wall, ffloor);
SpreadStack.Clear ();
// Then try spreading right
SpreadRight (rorg + DecalRight, wall,
Length (wall->linedef->Delta().X, wall->linedef->Delta().Y), ffloor);
SpreadStack.Clear ();
}
示例2: Spread
void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t x, fixed_t y, fixed_t z, F3DFloor * ffloor)
{
FTexture *tex;
vertex_t *v1;
fixed_t rorg, ldx, ldy;
GetWallStuff (wall, v1, ldx, ldy);
rorg = Length (x - v1->x, y - v1->y);
tex = TexMan[PicNum];
int dwidth = tex->GetWidth ();
DecalWidth = dwidth * ScaleX;
DecalLeft = tex->LeftOffset * ScaleX;
DecalRight = DecalWidth - DecalLeft;
SpreadSource = this;
SpreadTemplate = tpl;
SpreadZ = z;
// Try spreading left first
SpreadLeft (rorg - DecalLeft, v1, wall, ffloor);
SpreadStack.Clear ();
// Then try spreading right
SpreadRight (rorg + DecalRight, wall,
Length (wall->linedef->dx, wall->linedef->dy), ffloor);
SpreadStack.Clear ();
}
示例3: gl_InitializeActorLights
void gl_InitializeActorLights()
{
for(unsigned int i=0;i<LightAssociations.Size();i++)
{
const PClass * ti = PClass::FindClass(LightAssociations[i].ActorName());
if (ti)
{
ti = GetRealType(ti);
AActor * defaults = GetDefaultByType(ti);
if (defaults)
{
FInternalLightAssociation * iasso = new FInternalLightAssociation(&LightAssociations[i]);
if (!defaults->lightassociations)
{
TDeletingArray<FInternalLightAssociation*> *p =new TDeletingArray<FInternalLightAssociation*>;
defaults->lightassociations = p;
AssoDeleter.Push(p);
}
TDeletingArray<FInternalLightAssociation *> * lights = gl_GetActorLights(defaults);
if (iasso->Light()==NULL)
{
// The definition was not valid.
delete iasso;
}
else
{
lights->Push(iasso);
}
}
}
}
// we don't need the parser data for the light associations anymore
LightAssociations.Clear();
LightAssociations.ShrinkToFit();
StateLights.Resize(ParsedStateLights.Size()+1);
for(unsigned i=0; i<ParsedStateLights.Size();i++)
{
if (ParsedStateLights[i] != NAME_None)
{
StateLights[i] = (FLightDefaults*)-1; // something invalid that's not NULL.
for(unsigned int j=0;j<LightDefaults.Size();j++)
{
if (LightDefaults[j]->GetName() == ParsedStateLights[i])
{
StateLights[i] = LightDefaults[j];
break;
}
}
}
else StateLights[i] = NULL;
}
StateLights[StateLights.Size()-1] = NULL; // terminator
ParsedStateLights.Clear();
ParsedStateLights.ShrinkToFit();
}
示例4: ShutdownMapInfo
void ShutdownMapInfo()
{
guard(ShutdownMapInfo);
DefaultMap.Name.Clean();
MapInfo.Clear();
MapSongList.Clear();
ClusterDefs.Clear();
EpisodeDefs.Clear();
SkillDefs.Clear();
unguard;
}
示例5: R_DeinitColormaps
void R_DeinitColormaps ()
{
SpecialColormaps.Clear();
fakecmaps.Clear();
if (realcolormaps != NULL)
{
delete[] realcolormaps;
realcolormaps = NULL;
}
FreeSpecialLights();
}
示例6: gl_CreateSections
void gl_CreateSections()
{
SectionLines.Clear();
SectionLoops.Clear();
Sections.Clear();
SectionForSubsector.Resize(numsubsectors);
memset(&SectionForSubsector[0], -1, numsubsectors * sizeof(SectionForSubsector[0]));
FSectionCreator creat;
creat.CreateSections();
if (dumpsections) DumpSections();
}
示例7: gl_ReleaseLights
void gl_ReleaseLights()
{
unsigned int i;
for (i = 0; i < LightDefaults.Size(); i++)
{
delete LightDefaults[i];
}
LightAssociations.Clear();
LightDefaults.Clear();
}
示例8: ParseMapInfo
static void ParseMapInfo(VScriptParser* sc)
{
guard(ParseMapInfo);
bool HexenMode = false;
// Set up default map info.
mapInfo_t Default;
SetMapDefaults(Default);
while (!sc->AtEnd())
{
if (sc->Check("map"))
{
ParseMap(sc, HexenMode, Default);
}
else if (sc->Check("defaultmap"))
{
SetMapDefaults(Default);
ParseMapCommon(sc, &Default, HexenMode);
}
else if (sc->Check("adddefaultmap"))
{
ParseMapCommon(sc, &Default, HexenMode);
}
else if (sc->Check("clusterdef"))
{
ParseClusterDef(sc);
}
else if (sc->Check("episode"))
{
ParseEpisodeDef(sc);
}
else if (sc->Check("clearepisodes"))
{
EpisodeDefs.Clear();
}
else if (sc->Check("skill"))
{
ParseSkillDef(sc);
}
else if (sc->Check("clearskills"))
{
SkillDefs.Clear();
}
else
{
sc->Error(va("Invalid command %s", *sc->String));
}
}
delete sc;
sc = NULL;
unguard;
}
示例9: ParseTeamInfo
void FTeam::ParseTeamInfo ()
{
int iLump, iLastLump = 0;
Teams.Clear();
while ((iLump = Wads.FindLump ("TEAMINFO", &iLastLump)) != -1)
{
FScanner Scan (iLump);
while (Scan.GetString ())
{
if (Scan.Compare ("ClearTeams"))
ClearTeams ();
else if (Scan.Compare ("Team"))
ParseTeamDefinition (Scan);
else
Scan.ScriptError ("ParseTeamInfo: Unknown team command '%s'.\n", Scan.String);
}
}
if (Teams.Size () < 2)
I_FatalError ("ParseTeamInfo: At least two teams must be defined in TEAMINFO.");
else if (Teams.Size () > (unsigned)TEAM_MAXIMUM)
I_FatalError ("ParseTeamInfo: Too many teams defined. (Maximum: %d)", TEAM_MAXIMUM);
}
示例10: CompareSprites
//==========================================================================
//
//
//
//==========================================================================
SortNode * HWDrawList::SortSpriteList(SortNode * head)
{
SortNode * n;
int count;
unsigned i;
static TArray<SortNode*> sortspritelist;
SortNode * parent=head->parent;
sortspritelist.Clear();
for(count=0,n=head;n;n=n->next) sortspritelist.Push(n);
std::stable_sort(sortspritelist.begin(), sortspritelist.end(), [=](SortNode *a, SortNode *b)
{
return CompareSprites(a, b) < 0;
});
for(i=0;i<sortspritelist.Size();i++)
{
sortspritelist[i]->next=NULL;
if (parent) parent->equal=sortspritelist[i];
parent=sortspritelist[i];
}
return sortspritelist[0];
}
示例11: P_SetupWeapons_ntohton
void P_SetupWeapons_ntohton()
{
unsigned int i;
PClassWeapon *cls;
Weapons_ntoh.Clear();
Weapons_hton.Clear();
cls = NULL;
Weapons_ntoh.Push(cls); // Index 0 is always NULL.
for (i = 0; i < PClassActor::AllActorClasses.Size(); ++i)
{
PClassActor *cls = PClassActor::AllActorClasses[i];
if (cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
Weapons_ntoh.Push(static_cast<PClassWeapon *>(cls));
}
}
qsort(&Weapons_ntoh[1], Weapons_ntoh.Size() - 1, sizeof(Weapons_ntoh[0]), ntoh_cmp);
for (i = 0; i < Weapons_ntoh.Size(); ++i)
{
Weapons_hton[Weapons_ntoh[i]] = i;
}
}
示例12: ParseStatistics
static void ParseStatistics(const char *fn, TArray<FStatistics> &statlist)
{
statlist.Clear();
try
{
FScanner sc;
sc.OpenFile(fn);
while (sc.GetString())
{
FStatistics &ep_entry = statlist[statlist.Reserve(1)];
ep_entry.epi_header = sc.String;
sc.MustGetString();
ep_entry.epi_name = sc.String;
sc.MustGetStringName("{");
while (!sc.CheckString("}"))
{
FSessionStatistics &session = ep_entry.stats[ep_entry.stats.Reserve(1)];
sc.MustGetString();
sc.MustGetString();
strncpy(session.name, sc.String, 12);
sc.MustGetString();
strncpy(session.info, sc.String, 30);
int h,m,s;
sc.MustGetString();
sscanf(sc.String, "%d:%d:%d", &h, &m, &s);
session.timeneeded= ((((h*60)+m)*60)+s)*TICRATE;
sc.MustGetNumber();
session.skill=sc.Number;
if (sc.CheckString("{"))
{
while (!sc.CheckString("}"))
{
FLevelStatistics &lstats = session.levelstats[session.levelstats.Reserve(1)];
sc.MustGetString();
strncpy(lstats.name, sc.String, 12);
sc.MustGetString();
strncpy(lstats.info, sc.String, 30);
int h,m,s;
sc.MustGetString();
sscanf(sc.String, "%d:%d:%d", &h, &m, &s);
lstats.timeneeded= ((((h*60)+m)*60)+s)*TICRATE;
lstats.skill = 0;
}
}
}
}
}
catch(CRecoverableError &)
{
}
}
示例13: I_FlushBufferedConsoleStuff
void I_FlushBufferedConsoleStuff()
{
for (unsigned i = 0; i < bufferedConsoleStuff.Size(); i++)
{
DoPrintStr(bufferedConsoleStuff[i], ConWindow, NULL);
}
bufferedConsoleStuff.Clear();
}
示例14: FL_Shutdown
void FL_Shutdown()
{
guard(FL_Shutdown);
for (int i = 0; i < SearchPaths.Num(); i++)
{
delete SearchPaths[i];
SearchPaths[i] = NULL;
}
SearchPaths.Clear();
fl_basedir.Clean();
fl_savedir.Clean();
fl_gamedir.Clean();
fl_mainwad.Clean();
wadfiles.Clear();
IWadDirs.Clear();
unguard;
}
示例15: AddHiresTextures
void FTextureManager::AddHiresTextures (int wadnum)
{
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
char name[9];
TArray<FTextureID> tlist;
if (firsttx == -1 || lasttx == -1)
{
return;
}
name[8] = 0;
for (;firsttx <= lasttx; ++firsttx)
{
if (Wads.GetLumpNamespace(firsttx) == ns_hires)
{
Wads.GetLumpName (name, firsttx);
if (Wads.CheckNumForName (name, ns_hires) == firsttx)
{
tlist.Clear();
int amount = ListTextures(name, tlist);
if (amount == 0)
{
// A texture with this name does not yet exist
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
if (newtex != NULL)
{
newtex->UseType=FTexture::TEX_Override;
AddTexture(newtex);
}
}
else
{
for(unsigned int i = 0; i < tlist.Size(); i++)
{
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
if (newtex != NULL)
{
FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture;
// Replace the entire texture and adjust the scaling and offset factors.
newtex->bWorldPanning = true;
newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight());
newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale);
newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale);
ReplaceTexture(tlist[i], newtex, true);
}
}
}
//StartScreen->Progress();
}
}
}
}