| 1127 | } |
| 1128 | |
| 1129 | void CObjectDialog::OnObjectSwapButton() { |
| 1130 | int i; |
| 1131 | int cur; |
| 1132 | char name[200]; |
| 1133 | |
| 1134 | cur = SendDlgItemMessage(IDC_SWAP_SOURCE_COMBO, CB_GETCURSEL, 0, 0); |
| 1135 | SendDlgItemMessage(IDC_SWAP_SOURCE_COMBO, CB_GETLBTEXT, cur, (LPARAM)(LPCTSTR)name); |
| 1136 | int s_id = FindObjectIDName(name); |
| 1137 | |
| 1138 | cur = SendDlgItemMessage(IDC_SWAP_DEST_COMBO, CB_GETCURSEL, 0, 0); |
| 1139 | SendDlgItemMessage(IDC_SWAP_DEST_COMBO, CB_GETLBTEXT, cur, (LPARAM)(LPCTSTR)name); |
| 1140 | int d_id = FindObjectIDName(name); |
| 1141 | |
| 1142 | if (s_id >= 0 && d_id >= 0) { |
| 1143 | for (i = 0; i <= Highest_object_index; i++) { |
| 1144 | if (Objects[i].type == OBJ_ROBOT || Objects[i].type == OBJ_CLUTTER || Objects[i].type == OBJ_POWERUP || |
| 1145 | Objects[i].type == OBJ_BUILDING) { |
| 1146 | if (Objects[i].id == s_id) { |
| 1147 | vector pos = Objects[i].pos; |
| 1148 | matrix orient = Objects[i].orient; |
| 1149 | int room = Objects[i].roomnum; |
| 1150 | int parent = Objects[i].parent_handle; |
| 1151 | |
| 1152 | char temp_name[256]; |
| 1153 | temp_name[0] = '\0'; |
| 1154 | |
| 1155 | if (Objects[i].name) { |
| 1156 | strcpy(temp_name, Objects[i].name); |
| 1157 | } |
| 1158 | |
| 1159 | ObjDelete(i); |
| 1160 | int o_index = ObjCreate(Object_info[d_id].type, d_id, room, &pos, &orient, parent); |
| 1161 | |
| 1162 | if (temp_name[0] != '\0') { |
| 1163 | Objects[o_index].name = (char *)mem_malloc(strlen(temp_name) + 1); |
| 1164 | strcpy(Objects[o_index].name, temp_name); |
| 1165 | } |
| 1166 | } |
| 1167 | } |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | World_changed = 1; |
| 1172 | |
| 1173 | UpdateDialog(); |
| 1174 | } |
| 1175 | |
| 1176 | void CObjectDialog::OnSelendokRegroundCombo() { |
| 1177 | int cur; |
nothing calls this directly
no test coverage detected