MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ShowPilotPicDialogListCallback

Function ShowPilotPicDialogListCallback

Descent3/pilot.cpp:3698–3737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3696} PPicDlgInfo;
3697
3698void ShowPilotPicDialogListCallback(int index) {
3699 if (index == PPicDlgInfo.curr_index)
3700 return;
3701
3702 int new_idx = index;
3703
3704 if (PPicDlgInfo.blank_bmp != PPicDlgInfo.curr_bmp) {
3705 bm_FreeBitmap(PPicDlgInfo.curr_bmp);
3706 PPicDlgInfo.curr_bmp = -1;
3707 }
3708
3709 if (index == 0) {
3710 //<none> is selected
3711 PPicDlgInfo.curr_bmp = PPicDlgInfo.blank_bmp;
3712 } else {
3713 if (index <= PPicDlgInfo.size) {
3714 int handle = PPic_GetBitmapHandle(PPicDlgInfo.id_list[index - 1]);
3715 if (handle <= BAD_BITMAP_HANDLE) {
3716 mprintf(0, "Couldn't get ID#%d's bitmap\n", PPicDlgInfo.id_list[index - 1]);
3717 Int3();
3718 PPicDlgInfo.curr_bmp = PPicDlgInfo.blank_bmp;
3719 new_idx = 0;
3720 } else {
3721 PPicDlgInfo.curr_bmp = handle;
3722 }
3723 } else {
3724 mprintf(0, "Invalid index\n");
3725 Int3();
3726 PPicDlgInfo.curr_bmp = PPicDlgInfo.blank_bmp;
3727 new_idx = 0;
3728 }
3729 }
3730
3731 // change the bitmap
3732 UIBitmapItem bmp_item(PPicDlgInfo.curr_bmp);
3733 PPicDlgInfo.bmp_disp->SetTitle(&bmp_item);
3734
3735 PPicDlgInfo.curr_index = new_idx;
3736 PPicDlgInfo.listbox->SetCurrentIndex(new_idx);
3737}
3738
3739// -------------------------------------------------------
3740// ShowPilotPicDialog

Callers 1

ShowPilotPicDialogFunction · 0.85

Calls 4

bm_FreeBitmapFunction · 0.85
PPic_GetBitmapHandleFunction · 0.85
SetTitleMethod · 0.45
SetCurrentIndexMethod · 0.45

Tested by

no test coverage detected