summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c49
-rw-r--r--src/map/clif.c37
-rw-r--r--src/map/guild.c4
-rw-r--r--src/map/npc.c8
-rw-r--r--src/map/party.c4
-rw-r--r--src/map/skill.c1
6 files changed, 61 insertions, 42 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b44eae946..b6304349e 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2377,7 +2377,7 @@ ACMD_FUNC(monster)
if (number <= 0)
number = 1;
- if (strlen(name) < 1)
+ if( !name[0] )
strcpy(name, "--ja--");
// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
@@ -2458,7 +2458,7 @@ ACMD_FUNC(monstersmall)
if (number <= 0)
number = 1;
- if (strlen(name) < 1)
+ if( !name[0] )
strcpy(name, "--ja--");
// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
@@ -2534,7 +2534,7 @@ ACMD_FUNC(monsterbig)
if (number <= 0)
number = 1;
- if (strlen(name) < 1)
+ if( !name[0] )
strcpy(name, "--ja--");
// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
@@ -5983,7 +5983,7 @@ ACMD_FUNC(changegm)
return -1;
}
- if (strlen(message)==0)
+ if( !message[0] )
{
clif_displaymessage(fd, "Command usage: @changegm <guildmember name>");
return -1;
@@ -6006,7 +6006,7 @@ ACMD_FUNC(changeleader)
{
nullpo_retr(-1, sd);
- if (strlen(message)==0)
+ if( !message[0] )
{
clif_displaymessage(fd, "Command usage: @changeleader <party member name>");
return -1;
@@ -7744,31 +7744,32 @@ ACMD_FUNC(monsterignore)
*------------------------------------------*/
ACMD_FUNC(fakename)
{
- char name[NAME_LENGTH];
nullpo_retr(-1, sd);
-
- if((!message || !*message) && strlen(sd->fakename) > 1) {
- sd->fakename[0]='\0';
- clif_charnameack(0, &sd->bl);
- clif_displaymessage(sd->fd,"Returned to real name.");
- return 0;
- }
- if (!message || !*message || sscanf(message, "%23[^\n]", name) < 1) {
- clif_displaymessage(sd->fd,"You must enter a name.");
+ if( !message || !*message )
+ {
+ if( sd->fakename[0] )
+ {
+ sd->fakename[0] = '\0';
+ clif_charnameack(0, &sd->bl);
+ clif_displaymessage(sd->fd, "Returned to real name.");
+ return 0;
+ }
+
+ clif_displaymessage(sd->fd, "You must enter a name.");
return -1;
}
- if(strlen(name) < 2) {
- clif_displaymessage(sd->fd,"Fake name must be at least two characters.");
+ if( strlen(message) < 2 )
+ {
+ clif_displaymessage(sd->fd, "Fake name must be at least two characters.");
return -1;
}
- memcpy(sd->fakename,name,NAME_LENGTH);
- sd->fakename[NAME_LENGTH-1] = '\0';
+ safestrncpy(sd->fakename, message, sizeof(sd->fakename));
clif_charnameack(0, &sd->bl);
- clif_displaymessage(sd->fd,"Fake name enabled.");
-
+ clif_displaymessage(sd->fd, "Fake name enabled.");
+
return 0;
}
@@ -7902,7 +7903,7 @@ ACMD_FUNC(duel)
return 0;
}
- if(strlen(message) > 0) {
+ if( message[0] ) {
if(sscanf(message, "%d", &maxpl) >= 1) {
if(maxpl < 2 || maxpl > 65535) {
clif_displaymessage(fd, msg_txt(357)); // "Duel: Invalid value."
@@ -8078,7 +8079,7 @@ ACMD_FUNC(clone)
*-----------------------------------*/
ACMD_FUNC(main)
{
- if(strlen(message) > 0) {
+ if( message[0] ) {
if(strcmpi(message, "on") == 0) {
if(!sd->state.mainchat) {
@@ -9164,7 +9165,7 @@ ACMD_FUNC(commands)
if( gm_lvl < atcommand_info[i].level2 && stristr(command,"charcommands") )
continue;
- slen = (unsigned int)strlen(atcommand_info[i].command);
+ slen = strlen(atcommand_info[i].command);
// flush the text buffer if this command won't fit into it
if( slen + cur - line_buff >= CHATBOX_SIZE )
diff --git a/src/map/clif.c b/src/map/clif.c
index 40e6d9b71..29404a373 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7624,7 +7624,9 @@ int clif_refresh(struct map_session_data *sd)
return 0;
}
-// updates the object's (bl) name on client
+/// Updates the object's (bl) name on client (ZC_ACK_REQNAME/ZC_ACK_REQNAMEALL)
+/// 0095 <unit id>.L <char name>.24B
+/// 0195 <unit id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B
int clif_charnameack (int fd, struct block_list *bl)
{
unsigned char buf[103];
@@ -7647,24 +7649,31 @@ int clif_charnameack (int fd, struct block_list *bl)
if (ssd->fd == fd && ssd->disguise)
WBUFL(buf,2) = -bl->id;
- if (strlen(ssd->fakename)>1) {
+ if( ssd->fakename[0] )
+ {
+ WBUFW(buf, 0) = cmd = 0x195;
memcpy(WBUFP(buf,6), ssd->fakename, NAME_LENGTH);
+ WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0;
break;
}
memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH);
-
- if (!battle_config.display_party_name) {
- if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL)
- p = party_search(ssd->status.party_id);
- }else{
- if (ssd->status.party_id > 0)
- p = party_search(ssd->status.party_id);
- }
- if( ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL )
+ if( ssd->status.party_id )
+ {
+ p = party_search(ssd->status.party_id);
+ }
+ if( ssd->status.guild_id )
{
- ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id);
- if( i < g->max_member ) ps = g->member[i].position;
+ if( ( g = guild_search(ssd->status.guild_id) ) != NULL )
+ {
+ ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id);
+ if( i < g->max_member ) ps = g->member[i].position;
+ }
+ }
+
+ if( !battle_config.display_party_name && g == NULL )
+ {// do not display party unless the player is also in a guild
+ p = NULL;
}
if (p == NULL && g == NULL)
@@ -7766,7 +7775,7 @@ int clif_charnameupdate (struct map_session_data *ssd)
nullpo_ret(ssd);
- if (strlen(ssd->fakename)>1)
+ if( ssd->fakename[0] )
return 0; //No need to update as the party/guild was not displayed anyway.
WBUFW(buf,0) = cmd;
diff --git a/src/map/guild.c b/src/map/guild.c
index 7b20808d6..e56b346ec 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -357,7 +357,9 @@ int guild_create(struct map_session_data *sd, const char *name)
nullpo_ret(sd);
safestrncpy(tname, name, NAME_LENGTH);
- if( strlen(trim(tname)) == 0 )
+ trim(tname);
+
+ if( !tname[0] )
return 0; // empty name
if( sd->status.guild_id )
diff --git a/src/map/npc.c b/src/map/npc.c
index 430c04f3c..95331ae5b 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -160,9 +160,13 @@ int npc_enable_sub(struct block_list *bl, va_list ap)
int npc_enable(const char* name, int flag)
{
- struct npc_data* nd = (struct npc_data*)strdb_get(npcname_db, name);
+ struct npc_data* nd = npc_name2id(name);
+
if (nd==NULL)
+ {
+ ShowError("npc_enable: Attempted to %s a non-existing NPC '%s' (flag=%d).\n", (flag&3) ? "show" : "hide", name, flag);
return 0;
+ }
if (flag&1)
nd->sc.option&=~OPTION_INVISIBLE;
@@ -1034,7 +1038,7 @@ struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* b
*------------------------------------------*/
int npc_globalmessage(const char* name, const char* mes)
{
- struct npc_data* nd = (struct npc_data *) strdb_get(npcname_db, name);
+ struct npc_data* nd = npc_name2id(name);
char temp[100];
if (!nd)
diff --git a/src/map/party.c b/src/map/party.c
index 21867c95a..47dba49e9 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -128,7 +128,9 @@ int party_create(struct map_session_data *sd,char *name,int item,int item2)
char tname[NAME_LENGTH];
safestrncpy(tname, name, NAME_LENGTH);
- if( strlen(trim(tname)) == 0 )
+ trim(tname);
+
+ if( !tname[0] )
{// empty name
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 160beeaef..d95d04134 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -398,6 +398,7 @@ int skillnotok (int skillid, struct map_session_data *sd)
break;
case MC_VENDING:
case MC_IDENTIFY:
+ case ALL_BUYING_STORE:
return 0; // always allowed
case WZ_ICEWALL:
// noicewall flag [Valaris]