summaryrefslogtreecommitdiff
path: root/src/map/npc.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-01-09 00:18:53 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-01-09 00:43:27 -0800
commitf0a87e4f7f5377498960429e96be5dff183c8326 (patch)
tree2661728f73f3c163e971d94cd123ef6e378264aa /src/map/npc.cpp
parentf2fd4885c2a906414e0f36acf95d252e5a9d5805 (diff)
downloadtmwa-f0a87e4f7f5377498960429e96be5dff183c8326.tar.gz
tmwa-f0a87e4f7f5377498960429e96be5dff183c8326.tar.bz2
tmwa-f0a87e4f7f5377498960429e96be5dff183c8326.tar.xz
tmwa-f0a87e4f7f5377498960429e96be5dff183c8326.zip
Make incoming packets read-only
Diffstat (limited to 'src/map/npc.cpp')
-rw-r--r--src/map/npc.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 0e406c2..df75216 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -363,7 +363,7 @@ void npc_do_ontimer_sub(db_key_t key, db_val_t data, int *c, int option)
char temp[10];
char event[50];
- if (ev->nd->bl.id == (int) *c && (p = strchr(p, ':')) && p
+ if (ev->nd->bl.id == *c && (p = strchr(p, ':')) && p
&& strncasecmp("::OnTimer", p, 8) == 0)
{
sscanf(&p[9], "%s", temp);
@@ -851,7 +851,7 @@ int npc_buysellsel(struct map_session_data *sd, int id, int type)
*------------------------------------------
*/
int npc_buylist(struct map_session_data *sd, int n,
- unsigned short *item_list)
+ const uint16_t *item_list)
{
struct npc_data *nd;
double z;
@@ -969,7 +969,7 @@ int npc_buylist(struct map_session_data *sd, int n,
*------------------------------------------
*/
int npc_selllist(struct map_session_data *sd, int n,
- unsigned short *item_list)
+ const uint16_t *item_list)
{
double z;
int i, skill, itemamount = 0;
@@ -1700,7 +1700,9 @@ int npc_parse_function(char *, char *, char *w3, char *,
p = (char *) calloc(50, sizeof(char));
strncpy(p, w3, 49);
- strdb_insert(script_get_userfunc_db(), p, script);
+ // db_val_t takes a void *, we do restore safely ...
+ ScriptCode *script_ = const_cast<ScriptCode *>(script);
+ strdb_insert(script_get_userfunc_db(), p, script_);
// label_db=script_get_label_db();