本文整理汇总了C++中ListIter::removeItem方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIter::removeItem方法的具体用法?C++ ListIter::removeItem怎么用?C++ ListIter::removeItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListIter
的用法示例。
在下文中一共展示了ListIter::removeItem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
Scene::Collect()
{
ListIter<Graphic> iter = graphics;
while (++iter) {
Graphic* g = iter.value();
if (g->Life() == 0) {
delete iter.removeItem();
}
}
iter.attach(sprites);
while (++iter) {
Graphic* g = iter.value();
if (g->Life() == 0) {
delete iter.removeItem();
}
}
ListIter<Light> iter1 = lights;
while (++iter1) {
Light* l = iter1.value();
if (l->Life() == 0) {
delete iter1.removeItem();
}
}
}
示例2:
void
ModConfig::DisableMod(const char* name)
{
if (!name || !*name)
return;
Text* mod_name;
ListIter<Text> iter = enabled;
while (++iter) {
Text* t = iter.value();
if (*t == name) {
mod_name = t;
iter.removeItem();
break;
}
}
if (mod_name) {
disabled.append(mod_name);
ListIter<ModInfo> iter = mods;
while (++iter) {
ModInfo* mod_info = iter.value();
if (mod_info->Name() == *mod_name) {
delete iter.removeItem();
break;
}
}
}
}
示例3: if
void
NetGameClient::ExecFrame()
{
if (local_player) {
if (local_player->GetObjID() == 0) {
SendJoinRequest();
}
else if (active) {
// check health of server:
NetPeer* server_peer = link->FindPeer(server_id);
if (server_peer && (NetLayer::GetUTC() - server_peer->LastReceiveTime() > 15)) {
NetMsg net_disco(0, NET_DISCONNECT, 0, 0, 0);
DoDisconnect(&net_disco);
}
// if server is still there,
else if (server_peer) {
// check if any old join announcements still need to be processed:
ListIter<NetJoinAnnounce> iter = join_backlog;
while (++iter) {
NetJoinAnnounce* join_ann = iter.value();
if (DoJoinBacklog(join_ann)) {
iter.removeItem();
delete join_ann;
}
}
}
}
}
NetGame::ExecFrame();
}
示例4: new
void
ModConfig::EnableMod(const char* name)
{
if (!name || !*name)
return;
Text* mod_name;
ListIter<Text> iter = disabled;
while (++iter) {
Text* t = iter.value();
if (*t == name) {
mod_name = t;
iter.removeItem();
break;
}
}
if (mod_name) {
enabled.append(mod_name);
if (!IsDeployed(*mod_name)) {
ModInfo* mod_info = new(__FILE__,__LINE__) ModInfo;
if (mod_info->Load(*mod_name) && mod_info->Enable()) {
mods.append(mod_info);
}
}
}
}
示例5: RemoveSelectedItems
void ListBox::RemoveSelectedItems()
{
if (selcount) {
ListIter<ListBoxItem> item = items;
while (++item) {
if (item->selected) {
delete item.removeItem();
}
}
line_count = items.size();
selcount = 0;
}
}
示例6: while
void
DetailSet::Destroy()
{
for (int i = 0; i < levels; i++) {
ListIter<Graphic> iter = rep[i];
while (++iter) {
Graphic* g = iter.removeItem();
g->Destroy(); // this will delete the object (g)
}
off[i].destroy();
}
rate.destroy();
spin.destroy();
}
示例7: if
void
DisplayView::ExecFrame()
{
double seconds = Game::GUITime();
ListIter<DisplayElement> iter = elements;
while (++iter) {
DisplayElement* elem = iter.value();
if (elem->fade_in > 0)
elem->fade_in -= seconds;
else if (elem->hold > 0)
elem->hold -= seconds;
else if (elem->fade_out > 0)
elem->fade_out -= seconds;
else
delete iter.removeItem();
}
}
示例8: deployed
void
ModConfig::Deploy()
{
Save();
if (enabled.size() < 1)
return;
Print("\nDEPLOYING MODS\n--------------\n");
int i = 1;
ListIter<Text> iter = enabled;
while (++iter) {
Text* name = iter.value();
if (IsDeployed(name->data())) {
Print(" %d. %s is already deployed (skipping)\n", i++, name->data());
continue;
}
Print(" %d. %s\n", i++, name->data());
ModInfo* mod_info = new(__FILE__,__LINE__) ModInfo;
if (mod_info->Load(name->data()) && mod_info->Enable()) {
mods.append(mod_info);
}
else {
Print(" Could not deploy '%s' - disabling\n", name->data());
delete mod_info;
iter.removeItem();
disabled.append(name);
}
}
Print("\n");
Game::UseLocale(0);
}
示例9: if
void
MusicDirector::ScanTracks()
{
DataLoader* loader = DataLoader::GetLoader();
bool old_file_system = loader->IsFileSystemEnabled();
loader->UseFileSystem(true);
loader->SetDataPath("Music/");
List<Text> files;
loader->ListFiles("*.ogg", files, true);
if (files.size() == 0) {
loader->UseFileSystem(old_file_system);
no_music = true;
return;
}
no_music = false;
ListIter<Text> iter = files;
while (++iter) {
Text* name = iter.value();
Text* file = new(__FILE__,__LINE__) Text("Music/");
name->setSensitive(false);
file->append(*name);
if (name->indexOf("Menu") == 0) {
menu_tracks.append(file);
}
else if (name->indexOf("Intro") == 0) {
intro_tracks.append(file);
}
else if (name->indexOf("Brief") == 0) {
brief_tracks.append(file);
}
else if (name->indexOf("Debrief") == 0) {
debrief_tracks.append(file);
}
else if (name->indexOf("Promot") == 0) {
promote_tracks.append(file);
}
else if (name->indexOf("Flight") == 0) {
flight_tracks.append(file);
}
else if (name->indexOf("Combat") == 0) {
combat_tracks.append(file);
}
else if (name->indexOf("Launch") == 0) {
launch_tracks.append(file);
}
else if (name->indexOf("Recovery") == 0) {
recovery_tracks.append(file);
}
else if (name->indexOf("Victory") == 0) {
victory_tracks.append(file);
}
else if (name->indexOf("Defeat") == 0) {
defeat_tracks.append(file);
}
else if (name->indexOf("Credit") == 0) {
credit_tracks.append(file);
}
else {
menu_tracks.append(file);
}
delete iter.removeItem();
}
loader->UseFileSystem(old_file_system);
menu_tracks.sort();
intro_tracks.sort();
brief_tracks.sort();
debrief_tracks.sort();
promote_tracks.sort();
flight_tracks.sort();
combat_tracks.sort();
launch_tracks.sort();
recovery_tracks.sort();
victory_tracks.sort();
defeat_tracks.sort();
credit_tracks.sort();
}