Cube  Diff

Differences From Artifact [a9d5711584]:

To Artifact [7be3522f11]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// worldio.cpp: loading & saving of maps and savegames

#include "cube.h"

#import "Entity.h"

struct persistent_entity {
	short x, y, z; // cube aligned position
	short attr1;
	uchar type; // type is one of the above
	uchar attr2, attr3, attr4;
};

void
backup(OFString *name, OFString *backupname)
{
	[OFFileManager.defaultManager removeItemAtPath:backupname];
	[OFFileManager.defaultManager moveItemAtPath:name toPath:backupname];








|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// worldio.cpp: loading & saving of maps and savegames

#include "cube.h"

#import "Entity.h"

struct persistent_entity {
	short x, y, z; // cube aligned position
	short attr1;
	unsigned char type; // type is one of the above
	unsigned char attr2, attr3, attr4;
};

void
backup(OFString *name, OFString *backupname)
{
	[OFFileManager.defaultManager removeItemAtPath:backupname];
	[OFFileManager.defaultManager moveItemAtPath:name toPath:backupname];
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		}
	}
}

// these two are used by getmap/sendmap.. transfers compressed maps directly

void
writemap(OFString *mname, int msize, uchar *mdata)
{
	setnames(mname);
	backup(cgzname, bakname);

	FILE *f = fopen([cgzname cStringWithEncoding:OFLocale.encoding], "wb");
	if (!f) {
		conoutf(@"could not write map to %@", cgzname);






|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		}
	}
}

// these two are used by getmap/sendmap.. transfers compressed maps directly

void
writemap(OFString *mname, int msize, unsigned char *mdata)
{
	setnames(mname);
	backup(cgzname, bakname);

	FILE *f = fopen([cgzname cStringWithEncoding:OFLocale.encoding], "wb");
	if (!f) {
		conoutf(@"could not write map to %@", cgzname);