1 /*-------------------------------------------------------------------------------
2 
3 	BARONY
4 	File: book.hpp
5 	Desc: declarations and such for readable books
6 
7 	Copyright 2013-2016 (c) Turning Wheel LLC, all rights reserved.
8 	See LICENSE for details.
9 
10 -------------------------------------------------------------------------------*/
11 
12 #pragma once
13 
14 #include "main.hpp"
15 
16 //TODO: The book name will need to be replaced with books[item->appearnce%numbooks]->name as opposed to item->name in the inventory.
17 typedef struct book_t
18 {
19 	char* text; //The total book's text. Do not render this.
20 
21 	char* name; //The book's name. Must be created before the pages are created.
22 	char* bookgui_render_title; //The name converted so that it's ready to render in the book GUI. Splits it across lines and everything.
23 	int bookgui_render_title_numlines; //How many lines the title takes up.
24 
25 	list_t pages; //The pages in the book. Make a node, point it at this, iterate the whole book and render the text the node gives you access to. This list should be created in init or whenever the book GUI's read area changes. Or maybe it should be created runtime for the book GUI. We'll see. In either case, do something to account for the GUI changing size.
26 } book_t;
27 
28 extern book_t** books;
29 extern int numbooks;
30 
31 void createBooks();
32 void createBook(book_t* book); //Take's a book and generates all of its pages.
33 
34 //void formatTitle(book_t* book); //Prepares the book's title for rendering in the book GUI.
35 int getBook(char const * const booktitle); // returns the appearance index number for the book with the given title
36