1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
504 | * Start of misc. readable functions used by others functions in this file |
504 | * Start of misc. readable functions used by others functions in this file |
505 | * |
505 | * |
506 | *****************************************************************************/ |
506 | *****************************************************************************/ |
507 | |
507 | |
508 | static titlelist * |
508 | static titlelist * |
509 | get_empty_booklist (void) |
509 | get_empty_booklist () |
510 | { |
510 | { |
511 | titlelist *bl = new titlelist; |
511 | titlelist *bl = new titlelist; |
512 | |
512 | |
513 | bl->number = 0; |
513 | bl->number = 0; |
514 | bl->first_book = NULL; |
514 | bl->first_book = NULL; |
515 | bl->next = NULL; |
515 | bl->next = NULL; |
516 | return bl; |
516 | return bl; |
517 | } |
517 | } |
518 | |
518 | |
519 | static title * |
519 | static title * |
520 | get_empty_book (void) |
520 | get_empty_book () |
521 | { |
521 | { |
522 | title *t = new title; |
522 | title *t = new title; |
523 | |
523 | |
524 | t->name = NULL; |
524 | t->name = NULL; |
525 | t->archname = NULL; |
525 | t->archname = NULL; |
… | |
… | |
619 | /* init_book_archive() - if not called before, initialise the info list |
619 | /* init_book_archive() - if not called before, initialise the info list |
620 | * This reads in the bookarch file into memory. bookarch is the file |
620 | * This reads in the bookarch file into memory. bookarch is the file |
621 | * created and updated across multiple runs of the program. |
621 | * created and updated across multiple runs of the program. |
622 | */ |
622 | */ |
623 | static void |
623 | static void |
624 | init_book_archive (void) |
624 | init_book_archive () |
625 | { |
625 | { |
626 | FILE *fp; |
626 | FILE *fp; |
627 | int comp, nroftitle = 0; |
627 | int comp, nroftitle = 0; |
628 | char buf[MAX_BUF], fname[MAX_BUF], *cp; |
628 | char buf[MAX_BUF], fname[MAX_BUF], *cp; |
629 | title *book = NULL; |
629 | title *book = NULL; |
… | |
… | |
744 | * |
744 | * |
745 | * This is the function called by the main routine to initialise |
745 | * This is the function called by the main routine to initialise |
746 | * all the readable information. |
746 | * all the readable information. |
747 | */ |
747 | */ |
748 | void |
748 | void |
749 | init_readable (void) |
749 | init_readable () |
750 | { |
750 | { |
751 | static int did_this; |
751 | static int did_this; |
752 | |
752 | |
753 | if (did_this) |
753 | if (did_this) |
754 | return; |
754 | return; |
… | |
… | |
1348 | |
1348 | |
1349 | /* properties of the artifact */ |
1349 | /* properties of the artifact */ |
1350 | tmp = object::create (); |
1350 | tmp = object::create (); |
1351 | add_abilities (tmp, art->item); |
1351 | add_abilities (tmp, art->item); |
1352 | tmp->type = type; |
1352 | tmp->type = type; |
1353 | SET_FLAG (tmp, FLAG_IDENTIFIED); |
1353 | tmp->set_flag (FLAG_IDENTIFIED); |
1354 | if ((ch = describe_item (tmp, 0)) && strlen (ch) > 1) |
1354 | if ((ch = describe_item (tmp, 0)) && strlen (ch) > 1) |
1355 | buf << "\rProperties of this artifact include:\r" << ch << "\n"; |
1355 | buf << "\rProperties of this artifact include:\r" << ch << "\n"; |
1356 | |
1356 | |
1357 | tmp->destroy (); |
1357 | tmp->destroy (); |
1358 | |
1358 | |
… | |
… | |
1801 | * Writeback routine for updating the bookarchive. |
1801 | * Writeback routine for updating the bookarchive. |
1802 | * |
1802 | * |
1803 | ****************************************************************************/ |
1803 | ****************************************************************************/ |
1804 | /* write_book_archive() - write out the updated book archive */ |
1804 | /* write_book_archive() - write out the updated book archive */ |
1805 | void |
1805 | void |
1806 | write_book_archive (void) |
1806 | write_book_archive () |
1807 | { |
1807 | { |
1808 | FILE *fp; |
1808 | FILE *fp; |
1809 | int index = 0; |
1809 | int index = 0; |
1810 | char fname[MAX_BUF]; |
1810 | char fname[MAX_BUF]; |
1811 | title *book = NULL; |
1811 | title *book = NULL; |