variables.h

Wed, 19 Dec 2012 22:01:42 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Wed, 19 Dec 2012 22:01:42 +0200
changeset 69
29a3e669d648
parent 67
0a202714eea4
permissions
-rw-r--r--

So it turns out that the functions I thought were taking float are actually taking int. So, with the only reason for float removed, the float type is removed as well. I'd rather have fixed point anyway.

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

mercurial