Save shared vision

This commit is contained in:
jsalmon3 2003-02-12 00:34:22 +00:00
parent 826edd4bd5
commit 3daca72f8b
2 changed files with 16 additions and 2 deletions

View file

@ -10,7 +10,7 @@
//
/**@name player.c - The players. */
//
// (c) Copyright 1998,2000-2002 by Lutz Sammer
// (c) Copyright 1998-2003 by Lutz Sammer
//
// FreeCraft is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
@ -196,6 +196,10 @@ global void SavePlayers(FILE* file)
for( j=0; j<PlayerMax; ++j ) {
fputc((Players[i].Allied&(1<<j)) ? 'X' : '_',file);
}
fprintf(file,"\" 'shared-vision \"");
for( j=0; j<PlayerMax; ++j ) {
fputc((Players[i].SharedVision&(1<<j)) ? 'X' : '_',file);
}
fprintf(file,"\"\n 'start '(%d %d)\n",Players[i].StartX,
Players[i].StartY);

View file

@ -10,7 +10,7 @@
//
/**@name ccl_player.c - The player ccl functions. */
//
// (c) Copyright 2001,2002 by Lutz Sammer
// (c) Copyright 2001-2003 by Lutz Sammer
//
// FreeCraft is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
@ -172,6 +172,16 @@ local SCM CclPlayer(SCM list)
player->Allied|=(1<<i);
}
}
} else if( gh_eq_p(value,gh_symbol2scm("shared-vision")) ) {
str=gh_scm2newstr(gh_car(list),NULL);
list=gh_cdr(list);
for( i=0; i<PlayerMax && *str; ++i,++str ) {
if( *str=='-' || *str=='_' || *str==' ' ) {
player->SharedVision&=~(1<<i);
} else {
player->SharedVision|=(1<<i);
}
}
} else if( gh_eq_p(value,gh_symbol2scm("start")) ) {
value=gh_car(list);
list=gh_cdr(list);