From c58d9c72a80bee415cca0285f32186535a38c8a0 Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 26 Sep 2014 02:42:16 +0000 Subject: [PATCH] Propagate for variables in d2x-rebirth/main/escort.cpp --- d2x-rebirth/main/escort.cpp | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/d2x-rebirth/main/escort.cpp b/d2x-rebirth/main/escort.cpp index fc578d8e4..5f62cb3fe 100644 --- a/d2x-rebirth/main/escort.cpp +++ b/d2x-rebirth/main/escort.cpp @@ -209,13 +209,12 @@ void create_bfs_list(segnum_t start_seg, segnum_t bfs_list[], unsigned &length, visited[start_seg] = true; while ((head != tail) && (head < max_segs)) { - int i; segment *cursegp; segnum_t curseg = bfs_list[tail++]; cursegp = &Segments[curseg]; - for (i=0; ichildren[i]; if (IS_CHILD(connected_seg) && (!visited[connected_seg])) { @@ -238,7 +237,6 @@ void create_bfs_list(segnum_t start_seg, segnum_t bfs_list[], unsigned &length, // AND he has never yet, since being initialized for level, been allowed to talk. static int ok_for_buddy_to_talk(void) { - int i; segment *segp; if (Buddy_objnum == object_none) @@ -255,7 +253,7 @@ static int ok_for_buddy_to_talk(void) segp = &Segments[buddy->segnum]; - for (i=0; isides[i].wall_num; if (wall_num != wall_none) { @@ -575,14 +573,13 @@ static objnum_t exists_in_mine_2(segnum_t segnum, int objtype, int objid, int sp // ----------------------------------------------------------------------------- static segnum_t exists_fuelcen_in_mine(segnum_t start_seg) { - int segindex; segnum_t bfs_list[MAX_SEGMENTS]; unsigned length; create_bfs_list(start_seg, bfs_list, length); segnum_t segnum; - for (segindex=0; segindexctype.ai_info.ail; if (ailp->mode != AIM_THIEF_ATTACK) return 0; @@ -1464,7 +1456,7 @@ static int attempt_to_steal_item_3(object *objp, int player_num) return 1; // Makes it more likely to steal primary than secondary. - for (i=0; i<2; i++) + for (int i=0; i<2; i++) if (maybe_steal_primary_weapon(player_num, Primary_weapon)) return 1; @@ -1490,7 +1482,7 @@ static int attempt_to_steal_item_3(object *objp, int player_num) if (maybe_steal_flag_item(player_num, PLAYER_FLAGS_MAP_ALL)) return 1; - for (i=MAX_SECONDARY_WEAPONS-1; i>=0; i--) { + for (int i=MAX_SECONDARY_WEAPONS-1; i>=0; i--) { if (maybe_steal_primary_weapon(player_num, i)) return 1; if (maybe_steal_secondary_weapon(player_num, i)) @@ -1523,7 +1515,6 @@ static int attempt_to_steal_item_2(object *objp, int player_num) // updating Stolen_items information, deselecting, etc. int attempt_to_steal_item(vobjptridx_t objp, int player_num) { - int i; int rval = 0; if (objp->ctype.ai_info.dying_start_time) @@ -1531,7 +1522,7 @@ int attempt_to_steal_item(vobjptridx_t objp, int player_num) rval += attempt_to_steal_item_2(objp, player_num); - for (i=0; i<3; i++) { + for (int i=0; i<3; i++) { if (!rval || (d_rand() < 11000)) { // about 1/3 of time, steal another item rval += attempt_to_steal_item_2(objp, player_num); } else @@ -1556,14 +1547,12 @@ int attempt_to_steal_item(vobjptridx_t objp, int player_num) // Indicate no items have been stolen. void init_thief_for_level(void) { - int i; - Stolen_items.fill(255); Assert (MAX_STOLEN_ITEMS >= 3*2); // Oops! Loop below will overwrite memory! if (!(Game_mode & GM_MULTI)) - for (i=0; i<3; i++) { + for (int i=0; i<3; i++) { Stolen_items[2*i] = POW_SHIELD_BOOST; Stolen_items[2*i+1] = POW_ENERGY; } @@ -1574,9 +1563,7 @@ void init_thief_for_level(void) // -------------------------------------------------------------------------------------------------------------- void drop_stolen_items(object *objp) { - int i; - - for (i=0; imtype.phys_info.velocity, &objp->pos, objp->segnum);