374 if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, VHM_RECT, NULL)) |
374 if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, VHM_RECT, NULL)) |
375 _tree_to_plant = -1; |
375 _tree_to_plant = -1; |
376 break; |
376 break; |
377 |
377 |
378 case 16: // place trees randomly over the landscape |
378 case 16: // place trees randomly over the landscape |
379 LowerWindowWidget(w, 16); |
379 w->LowerWidget(16); |
380 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
380 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
381 SndPlayFx(SND_15_BEEP); |
381 SndPlayFx(SND_15_BEEP); |
382 PlaceTreesRandomly(); |
382 PlaceTreesRandomly(); |
383 MarkWholeScreenDirty(); |
383 MarkWholeScreenDirty(); |
384 break; |
384 break; |
1218 } else { |
1218 } else { |
1219 strecpy(orig_str_buf, _edit_str_buf, lastof(orig_str_buf)); |
1219 strecpy(orig_str_buf, _edit_str_buf, lastof(orig_str_buf)); |
1220 WP(w, querystr_d).orig = orig_str_buf; |
1220 WP(w, querystr_d).orig = orig_str_buf; |
1221 } |
1221 } |
1222 |
1222 |
1223 LowerWindowWidget(w, QUERY_STR_WIDGET_TEXT); |
1223 w->LowerWidget(QUERY_STR_WIDGET_TEXT); |
1224 WP(w, querystr_d).caption = caption; |
1224 WP(w, querystr_d).caption = caption; |
1225 WP(w, querystr_d).afilter = afilter; |
1225 WP(w, querystr_d).afilter = afilter; |
1226 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, realmaxlen, maxwidth); |
1226 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, realmaxlen, maxwidth); |
1227 } |
1227 } |
1228 |
1228 |
1597 case WE_TIMEOUT: |
1597 case WE_TIMEOUT: |
1598 /* This test protects against using widgets 11 and 12 which are only available |
1598 /* This test protects against using widgets 11 and 12 which are only available |
1599 * in those two saveload mode */ |
1599 * in those two saveload mode */ |
1600 if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break; |
1600 if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break; |
1601 |
1601 |
1602 if (IsWindowWidgetLowered(w, 11)) { // Delete button clicked |
1602 if (w->IsWidgetLowered(11)) { // Delete button clicked |
1603 if (!FiosDelete(WP(w, querystr_d).text.buf)) { |
1603 if (!FiosDelete(WP(w, querystr_d).text.buf)) { |
1604 ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); |
1604 ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); |
1605 } else { |
1605 } else { |
1606 BuildFileList(); |
1606 BuildFileList(); |
1607 /* Reset file name to current date on successful delete */ |
1607 /* Reset file name to current date on successful delete */ |
1608 if (_saveload_mode == SLD_SAVE_GAME) GenerateFileName(); |
1608 if (_saveload_mode == SLD_SAVE_GAME) GenerateFileName(); |
1609 } |
1609 } |
1610 |
1610 |
1611 UpdateTextBufferSize(&WP(w, querystr_d).text); |
1611 UpdateTextBufferSize(&WP(w, querystr_d).text); |
1612 SetWindowDirty(w); |
1612 SetWindowDirty(w); |
1613 } else if (IsWindowWidgetLowered(w, 12)) { // Save button clicked |
1613 } else if (w->IsWidgetLowered(12)) { // Save button clicked |
1614 _switch_mode = SM_SAVE; |
1614 _switch_mode = SM_SAVE; |
1615 FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name)); |
1615 FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name)); |
1616 |
1616 |
1617 /* In the editor set up the vehicle engines correctly (date might have changed) */ |
1617 /* In the editor set up the vehicle engines correctly (date might have changed) */ |
1618 if (_game_mode == GM_EDITOR) StartupEngines(); |
1618 if (_game_mode == GM_EDITOR) StartupEngines(); |
1689 } |
1689 } |
1690 |
1690 |
1691 assert((uint)mode < lengthof(saveload_captions)); |
1691 assert((uint)mode < lengthof(saveload_captions)); |
1692 w = AllocateWindowDesc(sld); |
1692 w = AllocateWindowDesc(sld); |
1693 w->widget[1].data = saveload_captions[mode]; |
1693 w->widget[1].data = saveload_captions[mode]; |
1694 LowerWindowWidget(w, 7); |
1694 w->LowerWidget(7); |
1695 |
1695 |
1696 WP(w, querystr_d).afilter = CS_ALPHANUMERAL; |
1696 WP(w, querystr_d).afilter = CS_ALPHANUMERAL; |
1697 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 240); |
1697 InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 240); |
1698 |
1698 |
1699 /* pause is only used in single-player, non-editor mode, non-menu mode. It |
1699 /* pause is only used in single-player, non-editor mode, non-menu mode. It |