summaryrefslogtreecommitdiff
path: root/src/map/script.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-01-01 03:07:16 +0100
committerHaru <haru@dotalux.com>2016-06-25 17:29:39 +0200
commit3dcdb2bbc6e9c06ebdec1e5ad2d18e93c1394a86 (patch)
treee5fc69b8554560ba9463078bdb524f0eef4b5e6a /src/map/script.h
parenta16cfeda0e57207cc655fb94415ee78b0c8520e6 (diff)
downloadhercules-3dcdb2bbc6e9c06ebdec1e5ad2d18e93c1394a86.tar.gz
hercules-3dcdb2bbc6e9c06ebdec1e5ad2d18e93c1394a86.tar.bz2
hercules-3dcdb2bbc6e9c06ebdec1e5ad2d18e93c1394a86.tar.xz
hercules-3dcdb2bbc6e9c06ebdec1e5ad2d18e93c1394a86.zip
Replaced script_code::script_buf with a VECTOR
- Fixes various signed/unsigned comparisons. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/script.h')
-rw-r--r--src/map/script.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/map/script.h b/src/map/script.h
index 77d734e52..dabebe89e 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -394,11 +394,20 @@ struct script_data {
struct reg_db *ref; ///< Reference to the scope's variables
};
+/**
+ * A script string buffer, used to hold strings used by the script engine.
+ */
+VECTOR_STRUCT_DECL(script_string_buf, char);
+
+/**
+ * Script buffer, used to hold parsed script data.
+ */
+VECTOR_STRUCT_DECL(script_buf, unsigned char);
+
// Moved defsp from script_state to script_stack since
// it must be saved when script state is RERUNLINE. [Eoe / jA 1094]
struct script_code {
- int script_size;
- unsigned char *script_buf;
+ struct script_buf script_buf;
struct reg_db local; ///< Local (npc) vars
unsigned short instances;
};
@@ -517,12 +526,6 @@ struct script_array {
unsigned int *members;/* member list */
};
-
-/**
- * A script string buffer, used to hold strings used by the script engine.
- */
-VECTOR_STRUCT_DECL(script_string_buf, char);
-
struct string_translation_entry {
uint8 lang_id;
char string[];
@@ -582,7 +585,7 @@ struct script_interface {
/* */
/// temporary buffer for passing around compiled bytecode
/// @see add_scriptb, set_label, parse_script
- VECTOR_DECL(unsigned char) buf;
+ struct script_buf buf;
/* */
struct script_syntax_data syntax;
/* */
@@ -711,8 +714,8 @@ struct script_interface {
const char * (*parse_syntax_close) (const char *p);
const char * (*parse_syntax_close_sub) (const char *p, int *flag);
const char * (*parse_syntax) (const char *p);
- c_op (*get_com) (unsigned char *scriptbuf, int *pos);
- int (*get_num) (unsigned char *scriptbuf, int *pos);
+ c_op (*get_com) (const struct script_buf *scriptbuf, int *pos);
+ int (*get_num) (const struct script_buf *scriptbuf, int *pos);
const char* (*op2name) (int op);
void (*reportsrc) (struct script_state *st);
void (*reportdata) (struct script_data *data);