forked from github/server
asserts
This commit is contained in:
parent
1d47c99f18
commit
e04184b673
2 changed files with 7 additions and 3 deletions
|
@ -431,11 +431,12 @@ cr_regions(variant var, char * buffer, const void * userdata)
|
|||
{
|
||||
faction * f = (faction*)userdata;
|
||||
const arg_regions * rdata = (const arg_regions *)var.v;
|
||||
char * wp = buffer;
|
||||
|
||||
if (rdata!=NULL && rdata->nregions>0) {
|
||||
region * r = rdata->regions[0];
|
||||
int i, z = r->planep?r->planep->id:0;
|
||||
char * wp = buffer;
|
||||
|
||||
wp += sprintf(wp, "\"%d %d %d", region_x(r, f), region_y(r, f), z);
|
||||
for (i=1;i!=rdata->nregions;++i) {
|
||||
r = rdata->regions[i];
|
||||
|
@ -443,6 +444,8 @@ cr_regions(variant var, char * buffer, const void * userdata)
|
|||
wp += sprintf(wp, ", %d %d %d", region_x(r, f), region_y(r, f), z);
|
||||
}
|
||||
strcat(wp, "\"");
|
||||
} else {
|
||||
strcpy(buffer, "\"\"");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ curse_read(attrib * a, FILE * f)
|
|||
|
||||
/* beim Einlesen sind noch nicht alle units da, muss also
|
||||
* zwischengespeichert werden. */
|
||||
if (mageid.i == -1){
|
||||
if (mageid.i < 0) {
|
||||
c->magician = (unit *)NULL;
|
||||
} else {
|
||||
ur_add(mageid, (void**)&c->magician, resolve_unit);
|
||||
|
@ -230,8 +230,9 @@ curse_write(const attrib * a, FILE * f)
|
|||
/* copied from c_clearflag */
|
||||
flags = (c->flags & ~CURSE_ISNEW) | (c->type->flags & CURSE_ISNEW);
|
||||
|
||||
if (c->magician) {
|
||||
if (c->magician && c->magician->number) {
|
||||
mage_no = c->magician->no;
|
||||
assert(mage_no>0);
|
||||
} else {
|
||||
mage_no = -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue