1 /*
2  * Seven Kingdoms: Ancient Adversaries
3  *
4  * Copyright 1997,1998 Enlight Software Ltd.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 //Filename    : OMLINK.H
22 //Description : Header file of object Multiple Linker
23 
24 #ifndef __OMLINK_H
25 #define __OMLINK_H
26 
27 #ifndef __ODYNARRB_H
28 #include <ODYNARRB.h>
29 #endif
30 
31 //--------- Define struct MLinkNode -----------//
32 
33 struct MLinkNode
34 {
35    int  dest_recno;    // destination recno of the linkage
36    int  next_link;     // next linkage of the client
37    char link_type;     // client defined linkage type
38 };
39 
40 //----------- Define class MLink -----------//
41 
42 class MLink : public DynArrayB
43 {
44 private:
45    MLinkNode* cur_node;	 // for temporary storage, allow first_dest(), next_dest()
46 			 // first_node() & next_node() to have quicker access
47 public:
48    MLink();
49 
50    void linkin(int&,int,int=0);
51    int  linkout(int&,int);
52    void clean_link(int&);
53 	void update(int,int,int,int=0);
54 	void zap();
55 
56    int  check_exist(int,int);
57    int  dest_count(int);
58 
59    int  first_dest(int);
60    int  next_dest();
61 
62    // write_file() and read_file() use DynArrayB::write_file() and read_file() directly
63 
64    MLinkNode* first_node(int);
65    MLinkNode* next_node();
66 };
67 
68 //---------------------------------------------//
69 
70 #endif
71