1 #pragma once
2 
3 //********************************************************************************************
4 //*
5 //*    This file is part of Egoboo.
6 //*
7 //*    Egoboo is free software: you can redistribute it and/or modify it
8 //*    under the terms of the GNU General Public License as published by
9 //*    the Free Software Foundation, either version 3 of the License, or
10 //*    (at your option) any later version.
11 //*
12 //*    Egoboo is distributed in the hope that it will be useful, but
13 //*    WITHOUT ANY WARRANTY; without even the implied warranty of
14 //*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //*    General Public License for more details.
16 //*
17 //*    You should have received a copy of the GNU General Public License
18 //*    along with Egoboo.  If not, see <http://www.gnu.org/licenses/>.
19 //*
20 //********************************************************************************************
21 
22 /// @file IDSZ_map.h
23 /// @brief
24 
25 #include "egoboo_typedef.h"
26 
27 #if defined(__cplusplus)
28 extern "C"
29 {
30 #endif
31 
32 //--------------------------------------------------------------------------------------------
33 // CONSTANTS
34 //--------------------------------------------------------------------------------------------
35 
36 #define IDSZ_NOT_FOUND           -1
37 #define MAX_IDSZ_MAP_SIZE         64
38 
39 //--------------------------------------------------------------------------------------------
40 // struct s_IDSZ_node
41 //--------------------------------------------------------------------------------------------
42 
43 /// The definition of a single IDSZ element in a IDSZ map
44     struct s_IDSZ_node
45     {
46         IDSZ id;
47         int  level;
48     };
49     typedef struct s_IDSZ_node IDSZ_node_t;
50 
51 //--------------------------------------------------------------------------------------------
52 // PUBLIC FUNCTION PROTOTYPES
53 //--------------------------------------------------------------------------------------------
54 
55     void         idsz_map_init( IDSZ_node_t idsz_map[], const size_t idsz_map_len );
56     egoboo_rv    idsz_map_add( IDSZ_node_t idsz_map[], const size_t idsz_map_len, const IDSZ idsz, const int level );
57 
58     IDSZ_node_t* idsz_map_get( const IDSZ_node_t pidsz_map[], const size_t idsz_map_len, const IDSZ idsz );
59     IDSZ_node_t* idsz_map_iterate( const IDSZ_node_t pidsz_map[], const size_t idsz_map_len, int *iterator );
60     egoboo_rv    idsz_map_copy( const IDSZ_node_t pcopy_from[], const size_t idsz_map_len, IDSZ_node_t pcopy_to[] );
61 
62 //--------------------------------------------------------------------------------------------
63 //--------------------------------------------------------------------------------------------
64 
65 #if defined(__cplusplus)
66 }
67 #endif
68 
69 //--------------------------------------------------------------------------------------------
70 //--------------------------------------------------------------------------------------------
71 
72 #define _IDSZ_map_h
73