Changeset 1409

Show
Ignore:
Timestamp:
05/23/09 16:26:49 (16 months ago)
Author:
magnate
Message:

Include character history in chardumps, closing #677

Location:
trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/externs.h

    r1405 r1409  
    353353bool history_lose_artifact(byte a_idx); 
    354354void history_display(void); 
     355void dump_history(ang_file *file); 
    355356 
    356357/* init2.c */ 
  • trunk/src/files.c

    r1407 r1409  
    11021102        text_out_indent = text_out_wrap = 0; 
    11031103 
     1104        /* Dump character history */ 
     1105        dump_history(fp); 
     1106        file_putf(fp, "\n\n"); 
    11041107 
    11051108        /* Dump options */ 
  • trunk/src/history.c

    r1219 r1409  
    416416        return; 
    417417} 
     418 
     419 
     420/* Dump character history to a file, which we assume is already open. */ 
     421void dump_history(ang_file *file) 
     422{ 
     423        int i; 
     424        char buf[90]; 
     425 
     426        file_putf(file, "============================================================\n"); 
     427        file_putf(file, "                   CHAR.\n"); 
     428        file_putf(file, "|   TURN  | DEPTH |LEVEL| EVENT\n"); 
     429        file_putf(file, "============================================================\n"); 
     430 
     431        for (i = 0; i < (last_printable_item() + 1); i++) 
     432        { 
     433                /* Skip not-yet-IDd artifacts */ 
     434                if (history_masked(i)) continue; 
     435 
     436                strnfmt(buf, sizeof(buf), "%10d%7d\'%5d   %s", 
     437                                history_list[i].turn, 
     438                                history_list[i].dlev * 50, 
     439                                history_list[i].clev, 
     440                                history_list[i].event); 
     441 
     442                if (history_list[i].type & HISTORY_ARTIFACT_LOST) 
     443                                my_strcat(buf, " (LOST)", sizeof(buf)); 
     444 
     445                file_putf(file, buf); 
     446                file_putf(file, "\n"); 
     447        } 
     448 
     449        return; 
     450}