Beispiel #1
0
static quick_save() {
	/* printf("Writing adventure.data...\n"); */
	f = fopen("adventure.data",WRITE_MODE);
	if(f == NULL){printf("Can't open file!\n"); return(0);}
	init_reading = FALSE;
	init_cksum = 1;
	quick_io();
	fwrite(&init_cksum,4,1,f);
	fclose(f);
	return(0);
}
Beispiel #2
0
static quick_save() {
	char *save_path;

	save_path = malloc(100);
	snprintf(save_path, 100, "%s/.adventure.data", getenv("HOME"));

	printf("Writing adventure.data...\n");
	f = fopen(save_path, WRITE_MODE);
	if(f == NULL){printf("Can't open file!\n"); return(0);}
	init_reading = FALSE;
	init_cksum = 1;
	quick_io();
	fwrite(&init_cksum,4,1,f);
	fclose(f);
	free(save_path);
	return(0);
}
Beispiel #3
0
static quick_init() {
#ifdef AMIGA
	f = fopen("ram:adventure.data", READ_MODE);
#else
	extern char *getenv();
	char *adv = getenv("ADVENTURE");
	f = NULL;
	if(adv)f = fopen(adv,READ_MODE);
#endif
	if(f == NULL)f = fopen("adventure.data",READ_MODE);
	if(f == NULL)return(FALSE);
	init_reading = TRUE;
	init_cksum = 1;
	quick_io();
	if(fread(&K,4,1,f) == 1) init_cksum -= K; else init_cksum = 1;
	fclose(f);
	if(init_cksum != 0)printf("Checksum error!\n");
	return(init_cksum == 0);
}
Beispiel #4
0
static quick_init() {
	char *adv = getenv("ADVENTURE");
	char *load_path;

	f = NULL;
	if(adv)f = fopen(adv,READ_MODE);

	if(f == NULL) {
		load_path = malloc(100);
		snprintf(load_path, 100, "%s/.adventure.data", getenv("HOME"));
		f = fopen(load_path, READ_MODE);
		free(load_path);
	}
	if(f == NULL)return(FALSE);
	init_reading = TRUE;
	init_cksum = 1;
	quick_io();
	if(fread(&K,4,1,f) == 1) init_cksum -= K; else init_cksum = 1;
	fclose(f);
	if(init_cksum != 0)printf("Checksum error!\n");
	return(init_cksum == 0);
}