File: book.h

package info (click to toggle)
crossfire 1.75.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,168 kB
  • sloc: ansic: 83,169; sh: 4,659; perl: 1,736; lex: 1,443; makefile: 1,199; python: 43
file content (46 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/** @file book.h
 * Describes fundental parameters of 'books' - objects with type==BOOK
 */

#ifndef BOOK_H
#define BOOK_H

/**
 * Maximum message buf size for books. If this is changed, keep in mind that big
 * strings may be unreadable by the player as the tail of the message can scroll
 * over the beginning (as of v0.92.2).
 * @note
 * Note that the book messages are stored in the msg buf,
 * which is limited by 'HUGE_BUF' in the loader.
 */
#define BOOK_BUF        HUGE_BUF-10

/**
 * Defines the base value that BOOKSIZE should return for books with no weight.
 * @note
 * If little books arent getting enough text generated, enlarge this.
 */
#define BASE_BOOK_BUF   700

/**
 * Get the book buffer size for an individual book object. Make heavy books hold
 * more text but never let a book msg buffer exceed the max. size (BOOK_BUF)
 * @param xyz
 * The book object to calculate the buffer size for.
 */
#define BOOKSIZE(xyz)   BASE_BOOK_BUF+((xyz)->weight/10) > BOOK_BUF ? \
                                BOOK_BUF : BASE_BOOK_BUF+((xyz)->weight/10);
/**
 * Struct to store the message_type and message_subtype for signs and books used by the player.
 */
typedef struct {
    uint8_t message_type;     /**< Message type to be sent to the client. */
    uint8_t message_subtype;  /**< Message subtype to be sent to the client. */
} readable_message_type;

/**
 * One general message, from the lib/messages file.
 */
typedef struct GeneralMessage GeneralMessage;

#endif /* BOOK_H */