Returns the current index of the given type
| 372 | |
| 373 | // Returns the current index of the given type |
| 374 | int GetCurrentIndex() { |
| 375 | int type = D3EditState.current_obj_type; |
| 376 | int current; |
| 377 | |
| 378 | switch (type) { |
| 379 | case OBJ_ROBOT: |
| 380 | current = D3EditState.current_robot; |
| 381 | break; |
| 382 | case OBJ_POWERUP: |
| 383 | current = D3EditState.current_powerup; |
| 384 | break; |
| 385 | case OBJ_CLUTTER: |
| 386 | current = D3EditState.current_clutter; |
| 387 | break; |
| 388 | case OBJ_BUILDING: |
| 389 | current = D3EditState.current_building; |
| 390 | break; |
| 391 | case OBJ_PLAYER: |
| 392 | return current_player; |
| 393 | break; |
| 394 | default: |
| 395 | Int3(); |
| 396 | } |
| 397 | |
| 398 | if (Object_info[current].type != type) { // current is of wrong type |
| 399 | current = GetObjectID(type); //...so get a new current |
| 400 | SetCurrentIndex(current); |
| 401 | } |
| 402 | |
| 403 | return current; |
| 404 | } |
| 405 | |
| 406 | ///////////////////////////////////////////////////////////////////////////// |
| 407 | // CObjectDialog message handlers |
no test coverage detected