本文整理匯總了C++中END_OF_LIST函數的典型用法代碼示例。如果您正苦於以下問題:C++ END_OF_LIST函數的具體用法?C++ END_OF_LIST怎麽用?C++ END_OF_LIST使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了END_OF_LIST函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: multi_respawn_build_points
// build a list of respawn points for the mission
void multi_respawn_build_points()
{
ship_obj *moveup;
respawn_point *r;
// respawn points
Multi_respawn_point_count = 0;
Multi_next_respawn_point = 0;
moveup = GET_FIRST(&Ship_obj_list);
while(moveup != END_OF_LIST(&Ship_obj_list)){
// player ships
if(Objects[moveup->objnum].flags & (OF_PLAYER_SHIP | OF_COULD_BE_PLAYER)){
r = &Multi_respawn_points[Multi_respawn_point_count++];
r->pos = Objects[moveup->objnum].pos;
r->team = Ships[Objects[moveup->objnum].instance].team;
}
moveup = GET_NEXT(moveup);
}
// priority respawn points
Multi_respawn_priority_count = 0;
moveup = GET_FIRST(&Ship_obj_list);
while(moveup != END_OF_LIST(&Ship_obj_list)){
// stuff info
if((Ships[Objects[moveup->objnum].instance].respawn_priority > 0) && (Multi_respawn_priority_count < MAX_PRIORITY_POINTS)){
r = &Multi_respawn_priority_ships[Multi_respawn_priority_count++];
strcpy(r->ship_name, Ships[Objects[moveup->objnum].instance].ship_name);
r->team = Ships[Objects[moveup->objnum].instance].team;
}
moveup = GET_NEXT(moveup);
}
}
示例2: AddIdentToHash
//--------------------------------------------------------------------------
// Name AddIdentToHash
//
// Adds an identifier to the list, keeping the list sorted by scope nesting
// level. Higher nesting levels are at start of list, smaller at the end.
//
// Note: for debugging purposes we make sure that there is no already inserted
// ident with the same scope nesting.
//--------------------------------------------------------------------------
static void AddIdentToHash (
TListRoot * pList,
TLocalIdent * pIdent
)
{
int identLevel; // nesting level of the ident being added
TLocalIdent * pCur;
identLevel = pIdent->parentScope->level;
// Skip all idents with greater scope nesting
//
for ( pCur = (TLocalIdent *)pList->Flink;
!END_OF_LIST( pList, pCur ) && pCur->parentScope->level > identLevel;
pCur = (TLocalIdent *)pCur->nameLink.Flink )
{};
ASSERT( END_OF_LIST( pList, pCur ) || pCur->parentScope->level < identLevel ); // they can't be equal
// Insert before _pCur_
//
INSERT_TAIL_LIST( &pCur->nameLink, &pIdent->nameLink );
};
示例3: _FindScopeIdent
//--------------------------------------------------------------------------
// Name FindScopeIdent
//
// Finds an ident with this name and specified scope.
//--------------------------------------------------------------------------
TLocalIdent * _FindScopeIdent (
TListRoot * pTab,
TScope * pScope
)
{
TLocalIdent * pCur;
int scopeLevel;
scopeLevel = pScope->level;
// Iterate through all symbols. The scopes are ordered decreasingly.
// So, as soon as we reach a smaller scope, we can abort the search.
//
for ( pCur = (TLocalIdent *)pTab->Flink;
!END_OF_LIST( pTab, pCur );
pCur = (TLocalIdent *)pCur->nameLink.Flink
)
{
int lev;
ASSERT( pCur->parentScope );
lev = pCur->parentScope->level;
if (lev == scopeLevel)
{
ASSERT( pCur->parentScope == pScope );
return pCur;
}
else
if (lev < scopeLevel)
break;
}
return NULL;
};
示例4: hud_wingman_status_update
// Update the status of the wingman status
void hud_wingman_status_update()
{
if ( timestamp_elapsed(HUD_wingman_update_timer) ) {
int wing_index,wing_pos;
ship_obj *so;
object *ship_objp;
ship *shipp;
HUD_wingman_update_timer=timestamp(HUD_WINGMAN_UPDATE_STATUS_INTERVAL);
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
ship_objp = &Objects[so->objnum];
shipp = &Ships[ship_objp->instance];
wing_index = shipp->wing_status_wing_index;
wing_pos = shipp->wing_status_wing_pos;
if ( (wing_index >= 0) && (wing_pos >= 0) && !(ship_objp->flags & OF_SHOULD_BE_DEAD) ) {
HUD_wingman_status[wing_index].used = 1;
if (!(shipp->flags & SF_DEPARTING) ) {
HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_ALIVE;
}
HUD_wingman_status[wing_index].hull[wing_pos] = get_hull_pct(ship_objp);
if ( HUD_wingman_status[wing_index].hull[wing_pos] <= 0 ) {
HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_DEAD;
}
}
}
}
}
示例5: object_h
void camera::set_object_host(object *objp, int n_object_host_submodel)
{
if(objp == NULL)
object_host = object_h();
object_host = object_h(objp);
object_host_submodel = n_object_host_submodel;
set_custom_position_function(NULL);
set_custom_orientation_function(NULL);
if(n_object_host_submodel > 0)
{
if(objp->type == OBJ_SHIP)
{
ship_subsys* ssp = GET_FIRST(&Ships[objp->instance].subsys_list);
while ( ssp != END_OF_LIST( &Ships[objp->instance].subsys_list ) )
{
if(ssp->system_info->subobj_num == n_object_host_submodel)
{
if(ssp->system_info->type == SUBSYSTEM_TURRET)
{
set_custom_position_function(get_turret_cam_pos);
set_custom_orientation_function(get_turret_cam_orient);
}
}
ssp = GET_NEXT( ssp );
}
}
}
}
示例6: red_alert_bash_subsys_status
void red_alert_bash_subsys_status(red_alert_ship_status *ras, ship *shipp)
{
ship_subsys *ss;
int i, count = 0;
int list_size;
// restore from ship_exited
if ( (ras->ship_class == RED_ALERT_DESTROYED_SHIP_CLASS) || (ras->ship_class == RED_ALERT_PLAYER_DEL_SHIP_CLASS) ) {
return;
}
ss = GET_FIRST(&shipp->subsys_list);
while ( ss != END_OF_LIST( &shipp->subsys_list ) ) {
// using at() here for the bounds check, although out-of-bounds should
// probably never happen here
try {
ss->current_hits = ras->subsys_current_hits.at(count);
} catch (std::out_of_range range) {
break;
}
if (ss->current_hits <= 0) {
ss->submodel_info_1.blown_off = 1;
}
ss = GET_NEXT( ss );
count++;
}
list_size = (int)ras->subsys_aggregate_current_hits.size();
CLAMP(list_size, 0, SUBSYSTEM_MAX);
for (i = 0; i < list_size; i++) {
shipp->subsys_info[i].aggregate_current_hits = ras->subsys_aggregate_current_hits[i];
}
}
示例7: GET_FIRST
void WeaponEditorDlg::update_pilot()
{
int i;
object *ptr;
ship_weapon *weapon;
if (m_multi_edit) {
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list)) {
if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags[Object::Object_Flags::Marked])) {
weapon = &Ships[ptr->instance].weapons;
if (pilot.ai_class >= 0)
weapon->ai_class = pilot.ai_class;
for (i=0; i<MAX_SHIP_PRIMARY_BANKS; i++)
if (pilot.primary_bank_weapons[i] != -2)
weapon->primary_bank_weapons[i] = pilot.primary_bank_weapons[i];
for (i=0; i<MAX_SHIP_SECONDARY_BANKS; i++) {
if (pilot.secondary_bank_weapons[i] != -2)
weapon->secondary_bank_weapons[i] = pilot.secondary_bank_weapons[i];
if (pilot.secondary_bank_ammo[i] >= 0)
weapon->secondary_bank_ammo[i] = pilot.secondary_bank_ammo[i];
}
}
ptr = GET_NEXT(ptr);
}
}
}
示例8: multi_lag_recvfrom
// recvfrom for multilag
int multi_lag_recvfrom(uint s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen)
{
lag_buf *moveup = NULL;
lag_buf *item = NULL;
// now determine if we have any pending packets - find the first one
moveup=GET_FIRST(&Lag_used_list);
while ( moveup!=END_OF_LIST(&Lag_used_list) ) {
// if the timestamp has elapsed
if((s == (SOCKET)moveup->socket) && ((moveup->stamp <= 0) || timestamp_elapsed(moveup->stamp))){
item = moveup;
break;
}
moveup = GET_NEXT(moveup);
}
// if this happens, it means that the multi_lag_select() returned an improper value
Assert(item);
// stuff the data
Assert(item->data_len <= len);
memcpy(buf, item->data, item->data_len);
Assertion(Tcp_active, "multi_lag_recvfrom(): TCP/IP is not active!");
memcpy(from, &item->ip_addr, sizeof(SOCKADDR_IN));
// stick the item back on the free list
multi_lag_put_free(item);
// return the size in bytes
return item->data_len;
}
示例9: unmark_all
void ship_select::OnOK()
{
int i;
object *ptr;
unmark_all();
update_status();
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list))
{
if (ptr->flags & OF_TEMP_MARKED)
mark_object(OBJ_INDEX(ptr));
ptr = GET_NEXT(ptr);
}
if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) {
Assert(Briefing_dialog);
Briefing_dialog->icon_select(Objects[cur_object_index].instance);
} else {
if (Briefing_dialog)
Briefing_dialog->icon_select(-1);
}
filter_ships = m_filter_ships;
filter_starts = m_filter_starts;
filter_waypoints = m_filter_waypoints;
for (i = 0; i < MAX_IFFS; i++)
filter_iff[i] = m_filter_iff[i];
CDialog::OnOK();
}
示例10: unmark_all
void ship_select::OnOK()
{
object *ptr;
unmark_all();
update_status();
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list))
{
if (ptr->flags & OF_TEMP_MARKED)
mark_object(OBJ_INDEX(ptr));
ptr = GET_NEXT(ptr);
}
if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) {
Assert(Briefing_dialog);
Briefing_dialog->icon_select(Objects[cur_object_index].instance);
} else {
if (Briefing_dialog)
Briefing_dialog->icon_select(-1);
}
filter_ships = m_filter_ships;
filter_starts = m_filter_starts;
filter_waypoints = m_filter_waypoints;
filter_friendly = m_filter_friendly;
filter_hostile = m_filter_hostile;
filter_neutral = m_filter_neutral;
filter_unknown = m_filter_unknown;
CDialog::OnOK();
}
示例11: GET_FIRST
BOOL ShipSpecialDamage::OnInitDialog()
{
// TODO: Add extra initialization here
// get ship num
object *objp;
m_ship_num = -1;
objp = GET_FIRST(&obj_used_list);
while (objp != END_OF_LIST(&obj_used_list)) {
if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
if (objp->flags & OF_MARKED) {
m_ship_num = objp->instance;
break;
}
}
objp = GET_NEXT(objp);
}
if (Ships[m_ship_num].special_exp_index == -1) {
// get default_table_values
ship_info *sip;
sip = &Ship_info[Ships[m_ship_num].ship_info_index];
m_inner_rad = (int)sip->inner_rad;
m_outer_rad = (int)sip->outer_rad;
m_damage = (int) sip->damage;
m_blast = (int) sip->blast;
m_shock_enabled = (int) sip->explosion_propagates;
m_shock_speed = (int) sip->shockwave_speed;
m_special_exp_enabled = FALSE;
if (m_inner_rad < 10) m_inner_rad = 10;
if (m_outer_rad < 11) m_outer_rad = 11;
if (m_shock_speed < 10) m_shock_speed = 10;
} else {
int index = Ships[m_ship_num].special_exp_index;
Assert( (index > 0) && (index < MAX_SEXP_VARIABLES-5) );
m_inner_rad = atoi(Sexp_variables[index++].text);
m_outer_rad = atoi(Sexp_variables[index++].text);
m_damage = atoi(Sexp_variables[index++].text);
m_blast = atoi(Sexp_variables[index++].text);
m_shock_enabled = atoi(Sexp_variables[index++].text);
m_shock_speed = atoi(Sexp_variables[index++].text);
m_special_exp_enabled = TRUE;
}
CDialog::OnInitDialog();
// maybe gray out lots of stuff
DoGray();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例12: GET_FIRST
BOOL ship_select::OnInitDialog()
{
int i;
object *ptr;
CDialog::OnInitDialog();
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list))
{
ptr->flags.set(Object::Object_Flags::Temp_marked, ptr->flags[Object::Object_Flags::Marked]);
ptr = GET_NEXT(ptr);
}
list_size = 0;
create_list();
// init dialog stuff
for (i = 0; i < MAX_IFFS; i++)
{
if (i < Num_iffs)
{
GetDlgItem(IDC_FILTER_SHIPS_IFF[i])->SetWindowText(Iff_info[i].iff_name);
}
GetDlgItem(IDC_FILTER_SHIPS_IFF[i])->ShowWindow(i < Num_iffs);
}
for (i = 0; i < Num_iffs; i++)
GetDlgItem(IDC_FILTER_SHIPS_IFF[i])->EnableWindow(m_filter_ships);
wlist_size = wplist_size = 0;
wing_index.clear();
wing_sel_last.clear();
// Elements 0 - wlist_size are wings, and elements wlist_size - wplist_size are waypoint paths
m_wing_list.ResetContent();
wlist_size = 0;
for (i=0; i<MAX_WINGS; i++) {
if (Wings[i].wave_count) {
m_wing_list.AddString(Wings[i].name);
wing_sel_last.push_back(0);
wing_index.push_back(i);
wlist_size++;
}
}
wplist_size = wlist_size;
SCP_list<waypoint_list>::iterator ii;
for (i = 0, ii = Waypoint_lists.begin(); ii != Waypoint_lists.end(); ++i, ++ii) {
m_wing_list.AddString(ii->get_name());
wing_sel_last.push_back(0);
wing_index.push_back(i);
wplist_size++;
}
return TRUE;
}
示例13: hud_lock_get_new_lock_pos
// Try and find a new locking point
void hud_lock_get_new_lock_pos(object *target_objp, vector *lock_world_pos)
{
ship *target_shipp=NULL;
int lock_in_range=0;
float best_lock_dot=-1.0f, lock_dot=-1.0f;
ship_subsys *ss;
vector subsys_world_pos, vec_to_lock;
if ( target_objp->type == OBJ_SHIP ) {
target_shipp = &Ships[target_objp->instance];
}
// if a large ship, lock to pos closest to center and within range
if ( (target_shipp) && (Ship_info[target_shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) ) {
// check all the subsystems and the center of the ship
// assume best lock pos is the center of the ship
*lock_world_pos=target_objp->pos;
Player->locking_on_center=1;
Player->locking_subsys=NULL;
Player->locking_subsys_parent=-1;
lock_in_range = hud_lock_world_pos_in_range(lock_world_pos, &vec_to_lock);
vm_vec_normalize(&vec_to_lock);
if ( lock_in_range ) {
best_lock_dot=vm_vec_dot(&Player_obj->orient.vec.fvec, &vec_to_lock);
}
// take center if reasonable dot
if ( best_lock_dot > 0.95 ) {
return;
}
// iterate through subsystems to see if we can get a better choice
ss = GET_FIRST(&target_shipp->subsys_list);
while ( ss != END_OF_LIST( &target_shipp->subsys_list ) ) {
// get world pos of subsystem
get_subsystem_world_pos(target_objp, ss, &subsys_world_pos);
if ( hud_lock_world_pos_in_range(&subsys_world_pos, &vec_to_lock) ) {
vm_vec_normalize(&vec_to_lock);
lock_dot=vm_vec_dot(&Player_obj->orient.vec.fvec, &vec_to_lock);
if ( lock_dot > best_lock_dot ) {
best_lock_dot=lock_dot;
Player->locking_on_center=0;
Player->locking_subsys=ss;
Player->locking_subsys_parent=Player_ai->target_objnum;
*lock_world_pos=subsys_world_pos;
}
}
ss = GET_NEXT( ss );
}
} else {
// if small ship (or weapon), just go for the center
*lock_world_pos = target_objp->pos;
Player->locking_on_center=1;
Player->locking_subsys=NULL;
Player->locking_subsys_parent=-1;
}
}
示例14: hud_goto_pos
void hud_goto_pos(int delta)
{
int pos=0, font_height = gr_get_font_height();
if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
int count = 0, y = 0;
line_node *ptr;
if (EMPTY(&Msg_scrollback_used_list) || !HUD_msg_inited)
return;
ptr = GET_FIRST(&Msg_scrollback_used_list);
while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
if (ptr->source != HUD_SOURCE_HIDDEN) {
if (count == Scroll_offset) {
pos = y;
break;
}
y += font_height + ptr->y;
count++;
}
ptr = GET_NEXT(ptr);
}
Scroll_offset = count = y = 0;
ptr = GET_FIRST(&Msg_scrollback_used_list);
while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
if (ptr->source != HUD_SOURCE_HIDDEN) {
if (y <= pos + delta)
Scroll_offset = count;
y += font_height + ptr->y;
count++;
}
ptr = GET_NEXT(ptr);
}
} else {
pos = Scroll_offset * font_height;
pos += delta;
Scroll_offset = pos / font_height;
}
}
示例15: GET_FIRST
BOOL ship_select::OnInitDialog()
{
int i, flags;
object *ptr;
wlist_size = wplist_size = 0;
CDialog::OnInitDialog();
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list))
{
flags = ptr->flags & ~OF_TEMP_MARKED;
if (flags & OF_MARKED)
flags |= OF_TEMP_MARKED;
else
flags &= ~OF_TEMP_MARKED;
ptr->flags = flags;
ptr = GET_NEXT(ptr);
}
list_size = 0;
create_list();
GetDlgItem(IDC_FILTER_SHIPS_FRIENDLY)->EnableWindow(m_filter_ships);
GetDlgItem(IDC_FILTER_SHIPS_HOSTILE)->EnableWindow(m_filter_ships);
GetDlgItem(IDC_FILTER_SHIPS_NEUTRAL)->EnableWindow(m_filter_ships);
GetDlgItem(IDC_FILTER_SHIPS_UNKNOWN)->EnableWindow(m_filter_ships);
// Elements 0 - wlist_size are wings, and elements wlist_size - wplist_size are waypoint paths
m_wing_list.ResetContent();
wlist_size = 0;
for (i=0; i<MAX_WINGS; i++)
{
if (Wings[i].wave_count) {
m_wing_list.AddItem(Wings[i].name, RGB(255,255,0));
//m_wing_list.AddString(Wings[i].name);
wing_sel_last[wlist_size] = 0;
wing_index[wlist_size++] = i;
}
}
/*wplist_size = wlist_size;
for (i=0; i<Num_waypoint_lists; i++) {
//m_wing_list.AddString(Waypoint_lists[i].name);
wing_sel_last[wplist_size] = 0;
wing_index[wplist_size++] = i;
}*/
BOOL bRet = m_cBrush.CreateSolidBrush(RGB(0, 0, 0));
m_hBrush = (HBRUSH)m_cBrush;
SetTimer(1, 100, 0);
return TRUE;
}