From: Daniel Koepke Subject: Player file converter Well, I had a bit of spare time earlier today and nothing to do, so I decided to write a quick little player file converter. Note that this isn't well tested and probably not the most flexible, but from what I can tell, it works. // Convert player files (char_file_u) // dkoepke@california.com #include "../conf.h" #include "../sysdep.h" #include "../structs.h" #include "../utils.h" typedef struct old_char_file_u { // char_player_data char name[MAX_NAME_LENGTH+1]; char description[EXDSCR_LENGTH]; char title[MAX_TITLE_LENGTH+1]; byte sex; byte race; byte level; sh_int hometown; time_t birth; int played; ubyte weight; ubyte height; char pwd[MAX_PWD_LENGTH+1]; struct char_special_data_saved char_specials_saved; struct player_special_data_saved player_specials_saved; struct char_ability_data abilities; struct char_point_data points; struct affected_type affected[MAX_AFFECT]; time_t last_logon; char host[HOST_LENGTH+1]; } OldData; typedef struct char_file_u NewData; NewData ConvertData(OldData old) { NewData new; int i; memmove((void *) &new, (const void *) &old, sizeof(OldData)); for (i=0;i<26;i++) new.colors[i]=7; // for testing purposes return (new); } void main(int argc, char **argv) { int recs, size = 0; FILE *fp, *nfp; char fn[128]; OldData old; NewData new; if (argc != 2) { printf("convplr \n"); exit(1); } sprintf(fn, "%s.new", argv[1]); if (!(fp = fopen(argv[1], "rb"))) { perror(argv[1]); exit(1); } else if (!(nfp = fopen(fn, "wb"))) { perror(fn); exit(1); } // get number of records fseek(fp, 0L, SEEK_END); // go to the end of the file size = ftell(fp); // tell us where we are (at the end, so file size) recs = size / sizeof(OldData); rewind(fp); if (size % sizeof(OldData)) { printf("Bad record count for old player file.\n"); exit(1); } for (size=0; size'; for instance, in the stock Circle directory, you'd do 'convplr lib/etc/players'. This will give you the file lib/etc/players.new o Move your old player file (players) to players.old and then move players.new to players. o Try to boot-up. If things don't work, you can remove the stuff you put in char_file_u and move players.old back to players to go back to how things were before. Note that the conversion program is only really for when you want to add something to char_file_u; changing existing stuff and deleting old stuff won't provide the correct results. Sorry, but it was only a 5 minute hack...:)