X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Feditor.c;h=fe5dc3589467eb20eadc0f66da11f37212034e9c;hb=6504e94ad5344b188eae829e8136b804437e70bf;hp=669991b70ed6949d05077e1a6c64e488e6a46099;hpb=2a66260e017880b41a1ffb93f7de12e4d4d83f0f;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index 669991b7..fe5dc358 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1261,6 +1261,18 @@ int editor_element[] = }; int elements_in_list = sizeof(editor_element)/sizeof(int); +static char *getElementInfoText(int element) +{ + char *info_text = "unknown"; + + if (element < num_element_info) + info_text = element_info[element]; + else + Error(ERR_WARN, "no element description for element %d", element); + + return info_text; +} + static void ScrollMiniLevel(int from_x, int from_y, int scroll) { int x,y; @@ -1475,7 +1487,7 @@ static void CreateControlButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, - GDI_INFO_TEXT, element_info[editor_element[i]], + GDI_INFO_TEXT, getElementInfoText(editor_element[i]), GDI_X, DX + gd_xoffset, GDI_Y, DY + gd_yoffset, GDI_WIDTH, ED_ELEMENTLIST_XSIZE, @@ -2664,7 +2676,7 @@ static void DrawPropertiesWindow() SY + ystart * MINI_TILEY - MINI_TILEY/2); DrawTextF((xstart + 3) * MINI_TILEX, (ystart + 1) * MINI_TILEY, - font_color, element_info[properties_element]); + font_color, getElementInfoText(properties_element)); num_elements_in_level = 0; for (y=0; ybitmap, &gd->x, &gd->y); - ModifyGadget(gi, GDI_INFO_TEXT, element_info[element], GDI_END); + ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END); MapGadget(gi); } break; @@ -4167,7 +4179,7 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) } else if (drawing_function == GADGET_ID_PICK_ELEMENT) DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW, - "%s", element_info[Feld[lx][ly]]); + "%s", getElementInfoText(Feld[lx][ly])); else DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW, "Level position: %d, %d", lx, ly);