summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-01-07 03:41:22 +0100
committerHaru <haru@dotalux.com>2016-02-24 20:57:34 +0100
commit9aa8a3b09ee2c491b55259ee433af7f39308ca37 (patch)
treef23571319dc25bdcb7efd56df9fc1eab6be32588 /src/map/pet.c
parent931d716e1000b50a66b012815a412619d16fc957 (diff)
downloadhercules-9aa8a3b09ee2c491b55259ee433af7f39308ca37.tar.gz
hercules-9aa8a3b09ee2c491b55259ee433af7f39308ca37.tar.bz2
hercules-9aa8a3b09ee2c491b55259ee433af7f39308ca37.tar.xz
hercules-9aa8a3b09ee2c491b55259ee433af7f39308ca37.zip
Added const qualifier to several variable/argument pointers
- This is necessary for compatibility with a const RFIFOP. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index c6f7e8cca..71d8d1eb3 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -646,7 +646,7 @@ int pet_menu(struct map_session_data *sd,int menunum)
return 0;
}
-int pet_change_name(struct map_session_data *sd,char *name)
+int pet_change_name(struct map_session_data *sd, const char *name)
{
int i;
struct pet_data *pd;
@@ -664,19 +664,23 @@ int pet_change_name(struct map_session_data *sd,char *name)
return intif_rename_pet(sd, name);
}
-int pet_change_name_ack(struct map_session_data *sd, char* name, int flag)
+int pet_change_name_ack(struct map_session_data *sd, const char *name, int flag)
{
struct pet_data *pd = sd->pd;
+ char *newname = NULL;
if (!pd) return 0;
- normalize_name(name," ");//bugreport:3032
+ newname = aStrndup(name, NAME_LENGTH-1);
+ normalize_name(newname, " ");//bugreport:3032 // FIXME[Haru]: This should be normalized by the inter-server (so that it's const here)
- if ( !flag || !strlen(name) ) {
+ if (flag == 0 || strlen(newname) == 0) {
clif->message(sd->fd, msg_sd(sd,280)); // You cannot use this name for your pet.
clif->send_petstatus(sd); //Send status so client knows oet name change got rejected.
+ aFree(newname);
return 0;
}
- memcpy(pd->pet.name, name, NAME_LENGTH);
+ memcpy(pd->pet.name, newname, NAME_LENGTH);
+ aFree(newname);
clif->charnameack (0,&pd->bl);
pd->pet.rename_flag = 1;
clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom);