X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Feditor.c;h=086988438429ca414f8b1c73591498112a6007fc;hb=325decda20f8562b0ce596370d53882979e517c8;hp=0f8b1ba7c027557b07be3754b8891a424d9746af;hpb=343ecd1bed93fa862903ff981ede342825f14401;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index 0f8b1ba7..08698843 100644 --- a/src/editor.c +++ b/src/editor.c @@ -6218,7 +6218,7 @@ static void CreateControlButtons(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; } @@ -6284,7 +6284,7 @@ static void CreateControlButtons(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; } @@ -6337,7 +6337,7 @@ static void CreateControlButtons(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; } @@ -6431,7 +6431,7 @@ static void CreateCounterButtons(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -6493,7 +6493,7 @@ static void CreateCounterButtons(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -6551,7 +6551,7 @@ static void CreateDrawingAreas(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -6624,7 +6624,7 @@ static void CreateTextInputGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; } @@ -6673,7 +6673,7 @@ static void CreateTextAreaGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; } @@ -6752,7 +6752,7 @@ static void CreateSelectboxGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -6836,7 +6836,7 @@ static void CreateTextbuttonGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -6892,7 +6892,7 @@ static void CreateGraphicbuttonGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -7007,7 +7007,7 @@ static void CreateScrollbarGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; } @@ -7067,7 +7067,7 @@ static void CreateCheckbuttonGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -7132,7 +7132,7 @@ static void CreateRadiobuttonGadgets(void) GDI_END); if (gi == NULL) - Error(ERR_EXIT, "cannot create gadget"); + Fail("cannot create gadget"); level_editor_gadget[id] = gi; right_gadget_border[id] = @@ -12071,7 +12071,7 @@ static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y, mode == CB_BRUSH_TO_CLIPBOARD_SMALL) SDL_SetClipboardText(text); else - printf("%s", text); // print brush data to console + Print("%s", text); // print brush data to console and log file return; } @@ -12162,6 +12162,9 @@ static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y, ptr++; } + // remap some (historic, now obsolete) elements + element = getMappedElement(element); + if (element >= NUM_FILE_ELEMENTS) element = EL_UNKNOWN; @@ -12237,6 +12240,36 @@ static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y, lev_fieldx = level.fieldx = brush_width; lev_fieldy = level.fieldy = brush_height; + boolean use_em_engine = TRUE; + boolean use_sp_engine = TRUE; + boolean use_mm_engine = TRUE; + + for (x = 0; x < MAX_LEV_FIELDX; x++) + { + for (y = 0; y < MAX_LEV_FIELDY; y++) + { + int element = Tile[x][y]; + + if (!IS_EM_ELEMENT(element) && !ELEM_IS_PLAYER(element)) + use_em_engine = FALSE; + + if (!IS_SP_ELEMENT(element)) + use_sp_engine = FALSE; + + if (!IS_MM_ELEMENT(element) && element != EL_EMPTY) + use_mm_engine = FALSE; + } + } + + level.game_engine_type = (use_em_engine ? GAME_ENGINE_TYPE_EM : + use_sp_engine ? GAME_ENGINE_TYPE_SP : + use_mm_engine ? GAME_ENGINE_TYPE_MM : + GAME_ENGINE_TYPE_RND); + + // update element selection list + ReinitializeElementList(); + ModifyEditorElementList(); + SetBorderElement(); DrawEditModeWindow(); @@ -13773,7 +13806,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) } else { - ChangeEditModeWindow(last_edit_mode); + ChangeEditModeWindow(ED_MODE_DRAWING); ClickOnGadget(level_editor_gadget[last_level_drawing_function], MB_LEFTBUTTON); @@ -13938,7 +13971,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) } else { - ChangeEditModeWindow(last_edit_mode); + ChangeEditModeWindow(ED_MODE_DRAWING); } break;