本文整理汇总了C++中ListIter::value方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIter::value方法的具体用法?C++ ListIter::value怎么用?C++ ListIter::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListIter
的用法示例。
在下文中一共展示了ListIter::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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;
}
}
}
}
示例2: 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();
}
}
}
示例3: if
void
Element::HandleRadioMessage(RadioMessage* msg)
{
if (!msg) return;
static RadioHandler rh;
// if this is a message from within the element,
// then all ships should report in. Otherwise,
// just the leader will acknowledge the message.
int full_report = ships.contains(msg->Sender());
int reported = false;
ListIter<Ship> s = ships;
while (++s) {
if (rh.ProcessMessage(msg, s.value())) {
if (full_report) {
if (s.value() != msg->Sender())
rh.AcknowledgeMessage(msg, s.value());
}
else if (!reported) {
rh.AcknowledgeMessage(msg, s.value());
reported = true;
}
}
}
}
示例4: while
void
CameraDirector::SetViewObjectGroup(ListIter<Ship> group, bool quick)
{
if (!ship) return;
Starshatter* stars = Starshatter::GetInstance();
if (!stars->InCutscene()) {
// only view solid contacts:
while (++group) {
Ship* s = group.value();
if (s->GetIFF() != ship->GetIFF()) {
Contact* c = ship->FindContact(s);
if (!c || !c->ActLock())
return;
}
if (s->Life() == 0 || s->IsDying() || s->IsDead())
return;
}
}
group.reset();
if (external_group.size() > 1 &&
external_group.size() == group.size()) {
bool same = true;
for (int i = 0; same && i < external_group.size(); i++) {
if (external_group[i] != group.container()[i])
same = false;
}
if (same) {
SetMode(MODE_ZOOM);
return;
}
}
ClearGroup();
if (quick) {
mode = MODE_ORBIT;
transition = 0;
}
else {
SetMode(MODE_TRANSLATE);
}
external_group.append(group.container());
ListIter<Ship> iter = external_group;
while (++iter) {
Ship* s = iter.value();
region = s->GetRegion();
Observe(s);
}
}
示例5: while
void
UVMapView::SelectInverse()
{
ListIter<Poly> iter = polys;
while (++iter) {
Poly* p = iter.value();
if (p->material != material)
continue;
for (int i = 0; i < p->nverts; i++) {
WORD p_index = iter.index();
DWORD value = (p_index << 16) | i;
bool contains = false;
auto svi = selverts.begin();
for (; svi != selverts.end(); ++svi) {
if (*svi == value) {
contains = true;
break;
}
}
if (contains)
selverts.erase(svi);
else
selverts.push_back(value);
}
}
}
示例6:
bool
Screen::Resize(int w, int h)
{
// scale all root-level windows to new screen size:
ListIter<Window> iter = window_list;
while (++iter) {
Window* win = iter.value();
double w_x = win->GetRect().x / (double) width;
double w_y = win->GetRect().y / (double) height;
double w_w = win->GetRect().w / (double) width;
double w_h = win->GetRect().h / (double) height;
Rect r;
r.x = (int) (w_x * w);
r.y = (int) (w_y * h);
r.w = (int) (w_w * w);
r.h = (int) (w_h * h);
win->MoveTo(r);
}
width = w;
height = h;
return true;
}
示例7: 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);
}
}
}
}
示例8: while
void
CampaignPlanStrategic::ScoreDefend(Combatant* c, CombatGroup* g)
{
if (!g || g->IsReserve())
return;
if (g->IsDefensible()) {
g->SetPlanValue(g->Value());
c->GetDefendList().append(g);
CombatZone* zone = campaign->GetZone(g->GetRegion());
ZoneForce* force = 0;
if (zone)
force = zone->FindForce(c->GetIFF());
if (force)
force->GetDefendList().append(g);
}
ListIter<CombatGroup> iter = g->GetComponents();
while (++iter) {
ScoreDefend(c, iter.value());
}
}
示例9: type
System::System(const System& s)
: type(s.type), id(s.id), ship(0), subtype(s.subtype), status(s.status),
availability(s.availability), safety(s.safety), stability(s.stability),
crit_level(s.crit_level), net_avail(-1.0f),
mount_rel(s.mount_rel), radius(s.radius), safety_overload(0.0f),
hull_factor(s.hull_factor), energy(s.energy), capacity(s.capacity),
sink_rate(s.sink_rate), power_level(s.power_level), power_flags(s.power_flags),
source_index(s.source_index), power_on(s.power_on), max_value(s.max_value),
explosion_type(s.explosion_type), name(s.name), abrv(s.abrv), design(s.design),
emcon(s.emcon)
{
if (design) {
// cast-away const
ListIter<Component> c = (List<Component>&) s.components;
while (++c) {
Component* comp = new(__FILE__,__LINE__) Component(*(c.value()));
comp->SetSystem(this);
components.append(comp);
}
}
emcon_power[0] = s.emcon_power[0];
emcon_power[1] = s.emcon_power[1];
emcon_power[2] = s.emcon_power[2];
}
示例10:
void
NetClientConfig::Save()
{
FILE* f;
fopen_s(&f, "client.cfg", "w");
if (f) {
fprintf(f, "CLIENT_CONFIG\n\n");
ListIter<NetServerInfo> iter = servers;
while (++iter) {
NetServerInfo* server = iter.value();
if (server->save) {
int port = (int) server->port;
fprintf(f, "server: {\n");
fprintf(f, " name: \"%s\",\n", (const char*) server->name);
fprintf(f, " addr: \"%s\",\n", (const char*) server->hostname);
fprintf(f, " port: %d,\n", port);
if (server->password.length())
fprintf(f, " pass: \"%s\",\n", (const char*) server->password);
fprintf(f, "}\n\n");
}
}
fclose(f);
}
}
示例11: SelectTarget
void
GroundAI::ExecFrame(double secs)
{
const int exec_period = 1000;
if ((int) Game::GameTime() - exec_time > exec_period) {
exec_time = (int) Game::GameTime();
SelectTarget();
}
if (ship) {
Shield* shield = ship->GetShield();
if (shield)
shield->SetPowerLevel(100);
ListIter<WeaponGroup> iter = ship->Weapons();
while (++iter) {
WeaponGroup* group = (WeaponGroup*) iter.value();
if (group->NumWeapons() > 1 && group->CanTarget(Ship::DROPSHIPS))
group->SetFiringOrders(Weapon::POINT_DEFENSE);
else
group->SetFiringOrders(Weapon::AUTO);
group->SetTarget((Ship*) target, 0);
}
if (carrier_ai)
carrier_ai->ExecFrame(secs);
}
}
示例12: RandomIndex
void
CampaignPlanStrategic::PlaceGroup(CombatGroup* g)
{
if (!g)
return;
Text rgn = g->GetRegion();
CombatZone* zone = campaign->GetZone(rgn);
// if we couldn't find anything suitable,
// just pick a zone at random:
if (!zone && g->IsMovable()) {
int nzones = campaign->GetZones().size();
int n = RandomIndex() % nzones;
zone = campaign->GetZones().at(n);
Text assigned_rgn;
if (!campaign->GetZone(rgn)) {
assigned_rgn = *zone->GetRegions().at(0);
g->AssignRegion(assigned_rgn);
}
}
if (zone && !zone->HasGroup(g))
zone->AddGroup(g);
ListIter<CombatGroup> iter = g->GetComponents();
while (++iter)
PlaceGroup(iter.value());
}
示例13: 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();
}
示例14: while
void
NetClientDlg::ShowServers()
{
if (!config || !lst_servers) return;
lst_servers->ClearItems();
lst_servers->SetSelectedStyle(ListBox::LIST_ITEM_STYLE_FILLED_BOX);
lst_servers->SetLeading(2);
int i = 0;
ListIter<NetServerInfo> iter = config->GetServerList();
while (++iter) {
NetServerInfo* info = iter.value();
lst_servers->AddItemWithData(info->name, (DWORD) i);
lst_servers->SetItemText(i, 1, info->type);
lst_servers->SetItemText(i, 2, info->password);
lst_servers->SetItemText(i, 3, Game::GetText("NetClientDlg.offline"));
lst_servers->SetItemText(i, 4, "0");
lst_servers->SetItemText(i, 5, Game::GetText("NetClientDlg.not-avail"));
i++;
}
ping_index = 0;
server_index = -1;
if (btn_host) btn_host->SetEnabled(false);
if (btn_join) btn_join->SetEnabled(false);
if (btn_del) btn_del->SetEnabled(false);
}
示例15: Name
void
SimObject::Notify()
{
if (!notifying) {
notifying = true;
int nobservers = observers.size();
int nupdate = 0;
if (nobservers > 0) {
ListIter<SimObserver> iter = observers;
while (++iter) {
SimObserver* observer = iter.value();
observer->Update(this);
nupdate++;
}
observers.clear();
}
if (nobservers != nupdate) {
::Print("WARNING: incomplete notify sim object '%s' - %d of %d notified\n",
Name(), nupdate, nobservers);
}
notifying = false;
}
else {
::Print("WARNING: double notify on sim object '%s'\n", Name());
}
}