… | |
… | |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | /* This file contains code relevant to the BOOKS hack -- designed |
25 | /* This file contains code relevant to the BOOKS hack -- designed |
… | |
… | |
817 | else |
818 | else |
818 | t = t->next; |
819 | t = t->next; |
819 | |
820 | |
820 | #ifdef ARCHIVE_DEBUG |
821 | #ifdef ARCHIVE_DEBUG |
821 | if (t) |
822 | if (t) |
822 | LOG (llevDebug, "Found title match (list %d): %s %s (%d)\n", msgtype, t->name, t->authour, t->msg_index); |
823 | LOG (llevDebug, "Found title match (list %d): %s %s (%d)\n", msgtype, &t->name, &t->authour, t->msg_index); |
823 | #endif |
824 | #endif |
824 | |
825 | |
825 | return t; |
826 | return t; |
826 | } |
827 | } |
827 | |
828 | |
… | |
… | |
975 | |
976 | |
976 | /* We have stuff we need to write now */ |
977 | /* We have stuff we need to write now */ |
977 | need_to_write_bookarchive = 1; |
978 | need_to_write_bookarchive = 1; |
978 | |
979 | |
979 | #ifdef ARCHIVE_DEBUG |
980 | #ifdef ARCHIVE_DEBUG |
980 | LOG (llevDebug, "Archiving new title: %s %s (%d)\n", book->name, book->title, msgtype); |
981 | LOG (llevDebug, "Archiving new title: %s %s (%d)\n", &book->name, &book->title, msgtype); |
981 | #endif |
982 | #endif |
982 | |
983 | |
983 | } |
984 | } |
984 | |
985 | |
985 | |
986 | |
… | |
… | |
1051 | if (numb == maxnames) |
1052 | if (numb == maxnames) |
1052 | { |
1053 | { |
1053 | #ifdef ARCHIVE_DEBUG |
1054 | #ifdef ARCHIVE_DEBUG |
1054 | LOG (llevDebug, "titles for list %d full (%d possible).\n", msgtype, maxnames); |
1055 | LOG (llevDebug, "titles for list %d full (%d possible).\n", msgtype, maxnames); |
1055 | #endif |
1056 | #endif |
1056 | break; |
|
|
1057 | } |
1057 | } |
1058 | /* shouldnt change map-maker books */ |
1058 | /* shouldnt change map-maker books */ |
1059 | else if (!book->title) |
1059 | else if (!book->title) |
1060 | do |
1060 | do |
1061 | { |
1061 | { |
… | |
… | |
1076 | */ |
1076 | */ |
1077 | |
1077 | |
1078 | if (tries == MAX_TITLE_CHECK || numb == maxnames) |
1078 | if (tries == MAX_TITLE_CHECK || numb == maxnames) |
1079 | { /* got to check maxnames again */ |
1079 | { /* got to check maxnames again */ |
1080 | #ifdef ARCHIVE_DEBUG |
1080 | #ifdef ARCHIVE_DEBUG |
1081 | LOG (llevDebug, "Failed to obtain unique title for %s %s (names:%d/%d)\n", book->name, book->title, numb, maxnames); |
1081 | LOG (llevDebug, "Failed to obtain unique title for %s %s (names:%d/%d)\n", &book->name, &book->title, numb, maxnames); |
1082 | #endif |
1082 | #endif |
1083 | /* restore old book properties here */ |
1083 | /* restore old book properties here */ |
1084 | book->title = old_title; |
1084 | book->title = old_title; |
1085 | |
1085 | |
1086 | if (rndm (4)) |
1086 | if (rndm (4)) |
… | |
… | |
1270 | /* Note that the value this returns is not based on level */ |
1270 | /* Note that the value this returns is not based on level */ |
1271 | tmp = get_next_mon (tmp); |
1271 | tmp = get_next_mon (tmp); |
1272 | } |
1272 | } |
1273 | |
1273 | |
1274 | #ifdef BOOK_MSG_DEBUG |
1274 | #ifdef BOOK_MSG_DEBUG |
1275 | LOG (llevDebug, "\n mon_info_msg() created strng: %d\n", strlen (retbuf)); |
1275 | LOG (llevDebug, "\n mon_info_msg() created string: %d\n", strlen (retbuf)); |
1276 | fprintf (logfile, " MADE THIS:\n%s\n", retbuf); |
1276 | LOG (llevDebug, " MADE THIS:\n%s\n", retbuf); |
1277 | #endif |
1277 | #endif |
1278 | |
1278 | |
1279 | return retbuf; |
1279 | return retbuf; |
1280 | } |
1280 | } |
1281 | |
1281 | |
… | |
… | |
1349 | |
1349 | |
1350 | /* separator of items */ |
1350 | /* separator of items */ |
1351 | strcpy (buf, "--- \n"); |
1351 | strcpy (buf, "--- \n"); |
1352 | |
1352 | |
1353 | /* Name */ |
1353 | /* Name */ |
1354 | if (art->allowed != NULL && strcmp (art->allowed->name, "All")) |
1354 | if (art->allowed && art->allowed->name != shstr_All) |
1355 | { |
1355 | { |
1356 | linked_char *temp, *next = art->allowed; |
1356 | linked_char *temp, *next = art->allowed; |
1357 | |
1357 | |
1358 | do |
1358 | do |
1359 | { |
1359 | { |
… | |
… | |
1405 | art = art->next; |
1405 | art = art->next; |
1406 | book_entries--; |
1406 | book_entries--; |
1407 | } |
1407 | } |
1408 | |
1408 | |
1409 | #ifdef BOOK_MSG_DEBUG |
1409 | #ifdef BOOK_MSG_DEBUG |
1410 | LOG (llevDebug, "artifact_msg() created strng: %d\n", strlen (retbuf)); |
1410 | LOG (llevDebug, "artifact_msg() created string: %d\n", strlen (retbuf)); |
1411 | fprintf (logfile, " MADE THIS:\n%s", retbuf); |
1411 | LOG (llevDebug, " MADE THIS:\n%s", retbuf); |
1412 | #endif |
1412 | #endif |
1413 | return retbuf; |
1413 | return retbuf; |
1414 | } |
1414 | } |
1415 | |
1415 | |
1416 | /***************************************************************************** |
1416 | /***************************************************************************** |
… | |
… | |
1472 | } |
1472 | } |
1473 | else |
1473 | else |
1474 | { |
1474 | { |
1475 | strcat (retbuf, "\n"); |
1475 | strcat (retbuf, "\n"); |
1476 | } |
1476 | } |
|
|
1477 | |
|
|
1478 | #ifdef BOOK_MSG_DEBUG |
|
|
1479 | LOG (llevDebug, "spellpath_msg() created string: %d\n", strlen (retbuf)); |
|
|
1480 | LOG (llevDebug, " MADE THIS:\n%s", retbuf); |
|
|
1481 | #endif |
1477 | return retbuf; |
1482 | return retbuf; |
1478 | } |
1483 | } |
1479 | |
1484 | |
1480 | /* formula_msg() - generate a message detailing the properties |
1485 | /* formula_msg() - generate a message detailing the properties |
1481 | * of a randomly selected alchemical formula. |
1486 | * of a randomly selected alchemical formula. |
… | |
… | |
1536 | op_name = at->object::name; |
1541 | op_name = at->object::name; |
1537 | else |
1542 | else |
1538 | LOG (llevError, "formula_msg() can't find arch %s for formula.\n", op_name); |
1543 | LOG (llevError, "formula_msg() can't find arch %s for formula.\n", op_name); |
1539 | |
1544 | |
1540 | /* item name */ |
1545 | /* item name */ |
1541 | if (strcmp (formula->title, "NONE")) |
1546 | if (formula->title != shstr_NONE) |
1542 | { |
1547 | { |
1543 | sprintf (retbuf, "%sThe %s of %s", retbuf, op_name, &formula->title); |
1548 | sprintf (retbuf, "%sThe %s of %s", retbuf, op_name, &formula->title); |
1544 | /* This results in things like pile of philo. sulfur. |
1549 | /* This results in things like pile of philo. sulfur. |
1545 | * while philo. sulfur may look better, without this, |
1550 | * while philo. sulfur may look better, without this, |
1546 | * you get things like 'the wise' because its missing the |
1551 | * you get things like 'the wise' because its missing the |
… | |
… | |
1559 | strcat (retbuf, at->title); |
1564 | strcat (retbuf, at->title); |
1560 | strcat (title, " "); |
1565 | strcat (title, " "); |
1561 | strcat (title, at->title); |
1566 | strcat (title, at->title); |
1562 | } |
1567 | } |
1563 | } |
1568 | } |
|
|
1569 | |
1564 | /* Lets name the book something meaningful ! */ |
1570 | /* Lets name the book something meaningful ! */ |
1565 | book->name = title; |
1571 | book->name = title; |
1566 | book->title = NULL; |
1572 | book->title = NULL; |
1567 | |
1573 | |
1568 | /* ingredients to make it */ |
1574 | /* ingredients to make it */ |
… | |
… | |
1804 | { /* we got no information beyond the preamble! */ |
1810 | { /* we got no information beyond the preamble! */ |
1805 | strcat (retbuf, " [Unfortunately the rest of the information is\n"); |
1811 | strcat (retbuf, " [Unfortunately the rest of the information is\n"); |
1806 | strcat (retbuf, " hopelessly garbled!]\n ---\n"); |
1812 | strcat (retbuf, " hopelessly garbled!]\n ---\n"); |
1807 | } |
1813 | } |
1808 | #ifdef BOOK_MSG_DEBUG |
1814 | #ifdef BOOK_MSG_DEBUG |
1809 | LOG (llevDebug, "\n god_info_msg() created strng: %d\n", strlen (retbuf)); |
1815 | LOG (llevDebug, "\n god_info_msg() created string: %d\n", strlen (retbuf)); |
1810 | fprintf (logfile, " MADE THIS:\n%s", retbuf); |
1816 | LOG (llevDebug, " MADE THIS:\n%s", retbuf); |
1811 | #endif |
1817 | #endif |
1812 | return retbuf; |
1818 | return retbuf; |
1813 | } |
1819 | } |
1814 | |
1820 | |
1815 | /* tailor_readable_ob()- The main routine. This chooses a random |
1821 | /* tailor_readable_ob()- The main routine. This chooses a random |