Debian Codegraph @

manage/megapage.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef MEGACELLPAGE_H
20 #define MEGACELLPAGE_H
21
22 #include "manage.h"
23 #include "megacell.h"
24 #include "cfile.h"
25 #include "pstypes.h"
26
27 struct mngs_megacell_page {
28 megacell megacell_struct;
29 char cellname[MAX_MEGACELL_WIDTH * MAX_MEGACELL_HEIGHT][PAGENAME_LEN];
30 };
31
32 // Megacell page functions
33 //---------------------------------------------------------------
34
35 // Given an open file pointer and a megacell_page struct, writes that megacellpage out
36 void mng_WriteMegacellPage(CFILE *outfile, mngs_megacell_page *megacellpage);
37
38 // Reads a megacell page from an open file. Returns 0 on error.
39 int mng_ReadMegacellPage(CFILE *infile, mngs_megacell_page *megacellpage);
40
41 // Given an open file pointer and a megacell_page struct, writes that megacellpage out
42 void mng_WriteNewMegacellPage(CFILE *outfile, mngs_megacell_page *megacellpage);
43
44 // Reads a megacell page from an open file. Returns 0 on error.
45 int mng_ReadNewMegacellPage(CFILE *infile, mngs_megacell_page *megacellpage);
46
47 // Reads in the megacellpage named "name" into megacellpage struct
48 // Returns 0 on error or couldn't find, else 1 if all is good
49 int mng_FindSpecificMegacellPage(char *name, mngs_megacell_page *megacellpage, int local);
50
51 // Given a megacell page, allocs a megacell and calls AssignMegacellPageToMegacell to actually
52 // load model and values. Rturns megacell handle on success, -1 if fail
53 int mng_SetAndLoadMegacell(mngs_megacell_page *megacellpage);
54
55 // Given a megacellpage and a megacell handle, attempts to make megacell n correspond to
56 // to the megacellpage.
57 // Returns 1 on success, 0 otherwise
58 int mng_AssignMegacellPageToMegacell(mngs_megacell_page *megacellpage, int n);
59
60 // Copies values from a Megacell into a megacell_page
61 void mng_AssignMegacellToMegacellPage(int n, mngs_megacell_page *megacellpage);
62
63 // Reads in a megacell page from the local table file, superseding any megacell
64 // already in RAM with that same name
65 void mng_LoadLocalMegacellPage(CFILE *);
66
67 // Reads in a page off the net
68 void mng_LoadNetMegacellPage(CFILE *);
69
70 #endif