src/variables.h

changeset 72
03e4d9db3fd9
parent 71
11f23fabf8a6
child 73
1ee9b312dc18
equal deleted inserted replaced
71:11f23fabf8a6 72:03e4d9db3fd9
1 /* 1 #ifndef BOTC_VARIABLES_H
2 * botc source code 2 #define BOTC_VARIABLES_H
3 * Copyright (C) 2012 Santeri `Dusk` Piippo
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * 3. Neither the name of the developer nor the names of its contributors may
15 * be used to endorse or promote products derived from this software without
16 * specific prior written permission.
17 * 4. Redistributions in any form must be accompanied by information on how to
18 * obtain complete source code for the software and any accompanying
19 * software that uses the software. The source code must either be included
20 * in the distribution or be available for no more than the cost of
21 * distribution plus a nominal fee, and must be freely redistributable
22 * under reasonable conditions. For an executable file, complete source
23 * code means the source code for all modules it contains. It does not
24 * include source code for modules or files that typically accompany the
25 * major components of the operating system on which the executable file
26 * runs.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 */
40 3
41 #ifndef __VARIABLES_H__
42 #define __VARIABLES_H__
43 #include "str.h" 4 #include "str.h"
44 #include "scriptreader.h" 5 #include "scriptreader.h"
45 6
46 struct ScriptVar { 7 struct ScriptVar {
47 str name; 8 string name;
48 str statename; 9 string statename;
49 type_e type; 10 type_e type;
50 int value; 11 int value;
51 unsigned int index; 12 unsigned int index;
52 }; 13 };
53 14
54 extern array<ScriptVar> g_GlobalVariables; 15 extern list<ScriptVar> g_GlobalVariables;
55 extern array<ScriptVar> g_LocalVariables; 16 extern list<ScriptVar> g_LocalVariables;
56 17
57 #define ITERATE_GLOBAL_VARS(u) \ 18 #define ITERATE_GLOBAL_VARS(u) \
58 for (u = 0; u < MAX_SCRIPT_VARIABLES; u++) 19 for (u = 0; u < MAX_SCRIPT_VARIABLES; u++)
59 #define ITERATE_SCRIPT_VARS(g) \ 20 #define ITERATE_SCRIPT_VARS(g) \
60 for (g = g_ScriptVariable; g != NULL; g = g->next) 21 for (g = g_ScriptVariable; g != null; g = g->next)
61 22
62 ScriptVar* DeclareGlobalVariable (ScriptReader* r, type_e type, str name); 23 ScriptVar* DeclareGlobalVariable (ScriptReader* r, type_e type, string name);
63 deprecated unsigned int CountGlobalVars (); 24 deprecated unsigned int CountGlobalVars ();
64 ScriptVar* FindGlobalVariable (str name); 25 ScriptVar* FindGlobalVariable (string name);
65 26
66 #endif // __VARIABLES_H__ 27 #endif // BOTC_VARIABLES_H

mercurial