Add all the connected room to the selected list Parameters: room - the starting room Returns: the number of rooms added to the list
| 143 | // Parameters: room - the starting room |
| 144 | // Returns: the number of rooms added to the list |
| 145 | int SelectConnectedRooms(int roomnum) { |
| 146 | int count; |
| 147 | int s; |
| 148 | |
| 149 | if (IsRoomSelected(roomnum)) // this room already selected? |
| 150 | return 0; |
| 151 | |
| 152 | // Add this rooom to selected list |
| 153 | Selected_rooms[N_selected_rooms++] = roomnum; |
| 154 | count = 1; |
| 155 | |
| 156 | State_changed = 1; |
| 157 | |
| 158 | // Now add this room's children |
| 159 | for (s = 0; s < Rooms[roomnum].num_portals; s++) { |
| 160 | if (Rooms[roomnum].portals[s].croom != -1) |
| 161 | count += SelectConnectedRooms(Rooms[roomnum].portals[s].croom); |
| 162 | } |
| 163 | |
| 164 | return count; |
| 165 | } |
| 166 | |
| 167 | static int *Save_selected_rooms; |
| 168 | static int N_save_selected_rooms = -1; //-1 means empty list |
no test coverage detected