Added Save and Load functions for DESTROYED_BUILDING

This commit is contained in:
mr-russ 2003-02-09 07:19:18 +00:00
parent fa69854e1f
commit e6afed86b3
2 changed files with 16 additions and 2 deletions

View file

@ -591,6 +591,11 @@ local SCM CclUnit(SCM list)
list=gh_cdr(list);
unit->IX=gh_scm2int(gh_car(value));
unit->IY=gh_scm2int(gh_cadr(value));
} else if( gh_eq_p(value,gh_symbol2scm("seenpixel")) ) {
value=gh_car(list);
list=gh_cdr(list);
unit->SeenIX=gh_scm2int(gh_car(value));
unit->SeenIY=gh_scm2int(gh_cadr(value));
} else if( gh_eq_p(value,gh_symbol2scm("frame")) ) {
unit->Frame=gh_scm2int(gh_car(list));
list=gh_cdr(list);
@ -615,6 +620,8 @@ local SCM CclUnit(SCM list)
unit->Burning=1;
} else if( gh_eq_p(value,gh_symbol2scm("destroyed")) ) {
unit->Destroyed=1;
} else if( gh_eq_p(value,gh_symbol2scm("seendestroyed")) ) {
unit->SeenDestroyed=1;
} else if( gh_eq_p(value,gh_symbol2scm("removed")) ) {
unit->Removed=1;
} else if( gh_eq_p(value,gh_symbol2scm("selected")) ) {

View file

@ -4144,7 +4144,10 @@ global void SaveUnit(const Unit* unit,FILE* file)
// 'type and 'player must be first, needed to create the unit slot
fprintf(file,"'type '%s ",unit->Type->Ident);
fprintf(file,"'seen-type '%s ",unit->Type->Ident);
if( unit->SeenType ) {
fprintf(file,"'seen-type '%s ",unit->SeenType->Ident);
}
fprintf(file,"'player %d\n ",unit->Player->Player);
if( unit->Name ) {
@ -4170,9 +4173,10 @@ global void SaveUnit(const Unit* unit,FILE* file)
fprintf(file,"'stats 'S%08X\n ",(int)unit->Stats);
}
#else
fprintf (file, "'stats %d\n " ,unit->Player->Player);
fprintf(file, "'stats %d\n " ,unit->Player->Player);
#endif
fprintf(file,"'pixel '(%d %d) ",unit->IX,unit->IY);
fprintf(file,"'seenpixel '(%d %d) ",unit->SeenIX,unit->SeenIY);
fprintf(file,"'%sframe %d ",
unit->Frame<0 ? "flipped-" : "" ,unit->Frame<0?-unit->Frame:unit->Frame);
if( unit->SeenFrame!=UnitNotSeen ) {
@ -4192,6 +4196,9 @@ global void SaveUnit(const Unit* unit,FILE* file)
if( unit->Destroyed ) {
fprintf(file," 'destroyed");
}
if( unit->SeenDestroyed ) {
fprintf(file," 'seendestroyed");
}
if( unit->Removed ) {
fprintf(file," 'removed");
}