From a842ddca86f32b2de4fb764951011a1db5df1793 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 3 Mar 2013 01:03:33 +0000 Subject: [PATCH] Move */editor/autosave.c -> similar/editor/autosave.c --- SConstruct | 3 +- d2x-rebirth/editor/autosave.c | 197 --------------------- {d1x-rebirth => similar}/editor/autosave.c | 0 3 files changed, 1 insertion(+), 199 deletions(-) delete mode 100644 d2x-rebirth/editor/autosave.c rename {d1x-rebirth => similar}/editor/autosave.c (100%) diff --git a/SConstruct b/SConstruct index df6bd9d23..081c71834 100644 --- a/SConstruct +++ b/SConstruct @@ -324,6 +324,7 @@ class DXXProgram(DXXCommon): ] ] similar_editor_sources = [os.path.join('similar', f) for f in [ +'editor/autosave.c', 'editor/elight.c', 'editor/fixseg.c', 'editor/info.c', @@ -579,7 +580,6 @@ class D1XProgram(DXXProgram): self.editor_sources = [os.path.join(self.srcdir, f) for f in [ 'editor/centers.c', 'editor/curves.c', -'editor/autosave.c', 'editor/eglobal.c', 'editor/ehostage.c', 'editor/eobject.c', @@ -739,7 +739,6 @@ class D2XProgram(DXXProgram): self.editor_sources = [os.path.join(self.srcdir, f) for f in [ 'editor/centers.c', 'editor/curves.c', -'editor/autosave.c', 'editor/eglobal.c', 'editor/ehostage.c', 'editor/eobject.c', diff --git a/d2x-rebirth/editor/autosave.c b/d2x-rebirth/editor/autosave.c deleted file mode 100644 index 8f2de1443..000000000 --- a/d2x-rebirth/editor/autosave.c +++ /dev/null @@ -1,197 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - -/* - * - * Autosave system: - * Saves current mine to disk to prevent loss of work, and support undo. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "dxxerror.h" - -#include "inferno.h" -#include "editor.h" -#include "u_mem.h" -#include "ui.h" - -#define AUTOSAVE_PERIOD 5 // Number of minutes for timed autosave - -int Autosave_count; -int Autosave_numfiles; -int Autosave_total; -int undo_count; -int original; - -int Timer_save_flag=0; -int Autosave_flag; -int save_second=-1; - -char undo_status[10][100]; - -void init_autosave(void) { -// int i; - - Autosave_count = 0; - Autosave_numfiles = 0; - Autosave_flag = 0; - undo_count = 0; - //MALLOC( undo_status, char *, 10 ); - //for (i=0; i<10; i++) - // MALLOC( undo_status[i], char, 100 ); - autosave_mine(mine_filename); -} - -void close_autosave(void) { - int i; - char *delname, *ext; - - for (i=0;i 0) undo_count--; - if (Autosave_count > 9) Autosave_count -= 10; - if (Autosave_numfiles < 10) - Autosave_numfiles++; - if (Autosave_total < 10) - Autosave_total++; - - d_free(savename); - - } - -} - - -void print_clock( int seconds, char message[10] ) { - int w,h,aw; - char *p; - - // Make colon flash - if (seconds & 1) - if ((p = strchr(message, ':')) != NULL) - *p = ' '; - - gr_set_current_canvas( NULL ); - gr_set_fontcolor( CBLACK, CGREY ); - gr_get_string_size( message, &w, &h, &aw ); - gr_setcolor( CGREY ); - gr_rect( 700, 0, 799, h+1 ); - gr_string( 700, 0, message ); - gr_set_fontcolor( CBLACK, CWHITE ); -} - -static char the_time[14]; // changed from 10, I don't think that was long enough - -void clock_message( int seconds, char *format, ... ) { - va_list ap; - - va_start(ap, format); - vsprintf(the_time, format, ap); - va_end(ap); - - print_clock(seconds, the_time); -} - - -struct tm Editor_time_of_day; - -void set_editor_time_of_day() -{ - time_t ltime; - - time( <ime ); - Editor_time_of_day = *localtime( <ime ); -} - -void TimedAutosave(char *name) -{ - int month,day,hour,minute,second; - - month = (Editor_time_of_day.tm_mon) + 1; - day = Editor_time_of_day.tm_mday; - minute = Editor_time_of_day.tm_min; - hour = Editor_time_of_day.tm_hour; - second = Editor_time_of_day.tm_sec; - - if (hour > 12) hour-=12; - - //if (second!=save_second) - { - save_second = second; - clock_message(second, "%d/%d %d:%02d", month, day, hour, minute); - } - - -#ifndef DEMO - if (minute%AUTOSAVE_PERIOD != 0) - Timer_save_flag = 1; - - if ((minute%AUTOSAVE_PERIOD == 0) && (Timer_save_flag)) { - time_t ltime; - - autosave_mine(name); - Timer_save_flag = 0; - time( <ime ); - diagnostic_message("Mine Autosaved at %s\n", ctime(<ime)); - } -#endif - -} - - -int undo( void ) { - Int3(); - return 2; -} - diff --git a/d1x-rebirth/editor/autosave.c b/similar/editor/autosave.c similarity index 100% rename from d1x-rebirth/editor/autosave.c rename to similar/editor/autosave.c