21 Dec 11, 04:13AM
That is exactly what I thought, yet using a log of the map writing, I got something more like 516.
Log: http://pastebin.com/raw.php?i=cuKYBMKt
Code that generated the log:
And a read out of the values of n when I loaded the map, I got this:
code that generated that:
This is the code that I think I am misunderstanding, memset and memcpy to be specific. I am more associated with AC C(++) rather than standard use C(++).
Log: http://pastebin.com/raw.php?i=cuKYBMKt
Code that generated the log:
[SELECT ALL] Code:
loopk(cubicsize)
{
sqr *s = &world[k];
#define c(f) (s->f==t->f)
// 4 types of blocks, to compress a bit:
// 255 (2): same as previous block + count
// 254 (3): same as previous, except light // deprecated
// SOLID (5)
// anything else (9)
if (!py) conoutf("Adding cube %d. Type %d", k, s->type );
if(SOLID(s))
{
if(t && c(type) && c(wtex) && c(vdelta))
{
sc++;
if (!py) conoutf("\tDuplicate");
}
else
{
spurge;
if (!py) conoutf("\tSolid! vtex: %d vdelta: %d", s->wtex, s->vdelta );
f->putchar(s->type);
f->putchar(s->wtex);
f->putchar(s->vdelta);
}
}
else
{
if(t && c(type) && c(floor) && c(ceil) && c(ctex) && c(ftex) && c(utex) && c(wtex) && c(vdelta) && c(tag))
{
sc++;
if (!py) conoutf("\tDuplicate");
}
else
{
spurge;
if (!py) conoutf("\tNot Solid! floor: %d ceil: %d wtex: %d ftex: %d, ctex: %d, vdelta: %d, utex: %d, tag: %d", s->floor, s->ceil, s->wtex, s->ftex, s->ctex, s->vdelta, s->utex, s->tag );
f->putchar(s->type);
f->putchar(s->floor);
f->putchar(s->ceil);
f->putchar(s->wtex);
f->putchar(s->ftex);
f->putchar(s->ctex);
f->putchar(s->vdelta);
f->putchar(s->utex);
f->putchar(s->tag);
}
}
t = s;
}
spurge;
delete f;
conoutf("wrote map file %s", cgzname);
}
And a read out of the values of n when I loaded the map, I got this:
[SELECT ALL] Code:
n: 255
n: 255
n: 9
code that generated that:
[SELECT ALL] Code:
if(!t || (n = f->getchar()) < 0) { delete f; f = NULL; k--; continue; }
conoutf("n: %d", n);
This is the code that I think I am misunderstanding, memset and memcpy to be specific. I am more associated with AC C(++) rather than standard use C(++).
[SELECT ALL] Code:
memset(c, tmp, n);
for(int i = 0; i<n; i++, k++) memcpy(&world[k], t, sizeof(sqr));