summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c22
-rw-r--r--src/map/battleground.c3
-rw-r--r--src/map/battleground.h2
-rw-r--r--src/map/script.c6
-rw-r--r--src/map/storage.c4
-rw-r--r--src/map/vending.c14
6 files changed, 26 insertions, 25 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index eb48adc1d..4eb2051da 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -547,7 +547,7 @@ ACMD(jumpto) {
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -2747,7 +2747,7 @@ ACMD(recall) {
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -3072,7 +3072,7 @@ ACMD(kick)
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -5123,7 +5123,7 @@ ACMD(follow) {
return true;
}
- if ((pl_sd = map->nick2sd((char *)message)) == NULL)
+ if ((pl_sd = map->nick2sd((const char *)message)) == NULL)
{
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
@@ -5601,7 +5601,7 @@ ACMD(changegm) {
return false;
}
- if ((pl_sd=map->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
+ if ((pl_sd=map->nick2sd((const char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif->message(fd, msg_fd(fd,1184)); // Target character must be online and be a guild member.
return false;
}
@@ -5621,7 +5621,7 @@ ACMD(changeleader) {
return false;
}
- if (party->changeleader(sd, map->nick2sd((char *) message)))
+ if (party->changeleader(sd, map->nick2sd((const char *) message)))
return true;
return false;
}
@@ -6380,7 +6380,7 @@ ACMD(trade) {
return false;
}
- if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) {
+ if ( (pl_sd = map->nick2sd((const char *)message)) == NULL ) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -6423,7 +6423,7 @@ ACMD(unmute) {
return false;
}
- if ((pl_sd = map->nick2sd((char *)message)) == NULL)
+ if ((pl_sd = map->nick2sd((const char *)message)) == NULL)
{
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
@@ -7667,7 +7667,7 @@ ACMD(showdelay)
*------------------------------------------*/
ACMD(invite) {
unsigned int did = sd->duel_group;
- struct map_session_data *target_sd = map->nick2sd((char *)message);
+ struct map_session_data *target_sd = map->nick2sd((const char *)message);
if (did == 0)
{
@@ -7740,7 +7740,7 @@ ACMD(duel) {
duel->create(sd, maxpl);
} else {
struct map_session_data *target_sd;
- target_sd = map->nick2sd((char *)message);
+ target_sd = map->nick2sd((const char *)message);
if (target_sd != NULL) {
unsigned int newduel;
if ((newduel = duel->create(sd, 2)) != -1) {
@@ -7882,7 +7882,7 @@ ACMD(clone) {
return false;
}
- if ((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if ((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
diff --git a/src/map/battleground.c b/src/map/battleground.c
index d25aef851..ae80d0fc7 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -495,7 +495,8 @@ void bg_config_read(void) {
}
libconfig->destroy(&bg_conf);
}
-struct bg_arena *bg_name2arena (char *name) {
+struct bg_arena *bg_name2arena(const char *name)
+{
int i;
nullpo_retr(NULL, name);
for(i = 0; i < bg->arenas; i++) {
diff --git a/src/map/battleground.h b/src/map/battleground.h
index 639d91635..bb77db125 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -108,7 +108,7 @@ struct battleground_interface {
void (*init) (bool minimal);
void (*final) (void);
/* */
- struct bg_arena *(*name2arena) (char *name);
+ struct bg_arena *(*name2arena) (const char *name);
void (*queue_add) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
enum BATTLEGROUNDS_QUEUE_ACK (*can_queue) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
int (*id2pos) (int queue_id, int account_id);
diff --git a/src/map/script.c b/src/map/script.c
index 4b3bf960c..4ae667b37 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6651,7 +6651,7 @@ BUILDIN(getarraysize)
return true;
}
int script_array_index_cmp(const void *a, const void *b) {
- return ( *(unsigned int*)a - *(unsigned int*)b );
+ return ( *(const unsigned int*)a - *(const unsigned int*)b );
}
/// Deletes count or all the elements in an array, from the starting index.
@@ -11007,7 +11007,7 @@ BUILDIN(getstatus)
case 4: script_pushint(st, sd->sc.data[id]->val4); break;
case 5:
{
- struct TimerData* td = (struct TimerData*)timer->get(sd->sc.data[id]->timer);
+ const struct TimerData* td = (const struct TimerData*)timer->get(sd->sc.data[id]->timer);
if( td ) {
// return the amount of time remaining
@@ -19696,7 +19696,7 @@ BUILDIN(checkbound)
/* returns 0 when successful, 1 otherwise */
BUILDIN(bg_match_over) {
bool canceled = script_hasdata(st,3) ? true : false;
- struct bg_arena *arena = bg->name2arena((char*)script_getstr(st, 2));
+ struct bg_arena *arena = bg->name2arena((const char*)script_getstr(st, 2));
if( arena ) {
bg->match_over(arena,canceled);
diff --git a/src/map/storage.c b/src/map/storage.c
index f938a41ad..ceac85916 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -52,8 +52,8 @@ struct guild_storage_interface *gstorage;
*------------------------------------------*/
int storage_comp_item(const void *i1_, const void *i2_)
{
- struct item *i1 = (struct item *)i1_;
- struct item *i2 = (struct item *)i2_;
+ const struct item *i1 = (const struct item *)i1_;
+ const struct item *i2 = (const struct item *)i2_;
if (i1->nameid == i2->nameid)
return 0;
diff --git a/src/map/vending.c b/src/map/vending.c
index 6e74e6c3e..2346932ba 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -119,8 +119,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
z = 0; // zeny counter
w = 0; // weight counter
for( i = 0; i < count; i++ ) {
- short amount = *(uint16*)(data + 4*i + 0);
- short idx = *(uint16*)(data + 4*i + 2);
+ short amount = *(const uint16*)(data + 4*i + 0);
+ short idx = *(const uint16*)(data + 4*i + 2);
idx -= 2;
if( amount <= 0 )
@@ -185,8 +185,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
for( i = 0; i < count; i++ ) {
- short amount = *(uint16*)(data + 4*i + 0);
- short idx = *(uint16*)(data + 4*i + 2);
+ short amount = *(const uint16*)(data + 4*i + 0);
+ short idx = *(const uint16*)(data + 4*i + 2);
idx -= 2;
// vending item
@@ -266,9 +266,9 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
// filter out invalid items
i = 0;
for( j = 0; j < count; j++ ) {
- short index = *(uint16*)(data + 8*j + 0);
- short amount = *(uint16*)(data + 8*j + 2);
- unsigned int value = *(uint32*)(data + 8*j + 4);
+ short index = *(const uint16*)(data + 8*j + 0);
+ short amount = *(const uint16*)(data + 8*j + 2);
+ unsigned int value = *(const uint32*)(data + 8*j + 4);
index -= 2; // offset adjustment (client says that the first cart position is 2)