| 1 | /** @file book.h |
| 2 | * Describes fundental parameters of 'books' - objects with type==BOOK |
| 3 | */ |
| 4 | |
| 5 | #ifndef BOOK_H |
| 6 | #define BOOK_H |
| 7 | |
| 8 | /** |
| 9 | * Maximum message buf size for books. If this is changed, keep in mind that big |
| 10 | * strings may be unreadable by the player as the tail of the message can scroll |
| 11 | * over the beginning (as of v0.92.2). |
| 12 | * @note |
| 13 | * Note that the book messages are stored in the msg buf, |
| 14 | * which is limited by 'HUGE_BUF' in the loader. |
| 15 | */ |
| 16 | #define BOOK_BUF HUGE_BUF-10 |
| 17 | |
| 18 | /** |
| 19 | * Defines the base value that BOOKSIZE should return for books with no weight. |
| 20 | * @note |
| 21 | * If little books arent getting enough text generated, enlarge this. |
| 22 | */ |
| 23 | #define BASE_BOOK_BUF 700 |
| 24 | |
| 25 | /** |
| 26 | * Get the book buffer size for an individual book object. Make heavy books hold |
| 27 | * more text but never let a book msg buffer exceed the max. size (BOOK_BUF) |
| 28 | * @param xyz |
| 29 | * The book object to calculate the buffer size for. |
| 30 | */ |
| 31 | #define BOOKSIZE(xyz) BASE_BOOK_BUF+((xyz)->weight/10) > BOOK_BUF ? \ |
| 32 | BOOK_BUF : BASE_BOOK_BUF+((xyz)->weight/10); |
| 33 | /** |
| 34 | * Struct to store the message_type and message_subtype for signs and books used by the player. |
| 35 | */ |
| 36 | typedef struct { |
| 37 | uint8_t message_type; /**< Message type to be sent to the client. */ |
| 38 | uint8_t message_subtype; /**< Message subtype to be sent to the client. */ |
| 39 | } readable_message_type; |
| 40 | |
| 41 | /** |
| 42 | * One general message, from the lib/messages file. |
| 43 | */ |
| 44 | typedef struct GeneralMessage GeneralMessage; |
| 45 | |
| 46 | #endif /* BOOK_H */ |