summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt5
-rw-r--r--conf-tmpl/msg_athena.conf6
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/clif.c65
-rw-r--r--src/map/guild.c10
-rw-r--r--src/map/guild.h6
-rw-r--r--src/map/party.c5
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/trade.c5
-rw-r--r--src/map/trade.h2
10 files changed, 58 insertions, 50 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 056bb1d34..0f93f5145 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/12
+ * Updated clif_disp_onlyself to not use dynamic memory and write directly
+ to the player's buffer. [Skotlex]
+ * Updated @noask to also tell the user what he has just rejected (added
+ msg_athena entries for each of the different requests). Also updated it to
+ use clif_disp_onlyself. [Skotlex]
* Fixed a pair of missing initializers in the clif storage functions.
[Skotlex]
* @heal no longer displays a healing animation. Fixes the client believing
diff --git a/conf-tmpl/msg_athena.conf b/conf-tmpl/msg_athena.conf
index 6b2093486..0315b71db 100644
--- a/conf-tmpl/msg_athena.conf
+++ b/conf-tmpl/msg_athena.conf
@@ -378,6 +378,12 @@
390: Autorejecting is activated.
391: Autorejecting is deactivated.
392: You request has been rejected by autoreject option.
+393: Autorejected trade request from %s.
+394: Autorejected party invite from %s.
+395: Autorejected guild invite from %s.
+396: Autorejected alliance request from %s.
+397: Autorejected opposition request from %s.
+398: Autorejected friend request from %s.
// Messages of others (not for GM commands)
// ----------------------------------------
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 9ac4af66b..073382f71 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8332,7 +8332,7 @@ atcommand_trade(
if (!message || !*message)
return -1;
if((pl_sd=map_nick2sd((char *) message)) != NULL) {
- trade_traderequest(sd, pl_sd->bl.id);
+ trade_traderequest(sd, pl_sd);
return 0;
}
return -1;
diff --git a/src/map/clif.c b/src/map/clif.c
index f23ab19ee..d08c9c0c5 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7342,21 +7342,16 @@ void clif_sitting(struct map_session_data *sd)
*/
int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len)
{
- unsigned char *buf;
-
+ int fd;
nullpo_retr(0, sd);
-
- buf = (unsigned char*)aMallocA((len + 5)*sizeof(unsigned char));
-
- WBUFW(buf, 0) = 0x17f;
- WBUFW(buf, 2) = len + 5;
- memcpy(WBUFP(buf,4), mes, len);
-
- clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
-
- if(buf) aFree(buf);
-
- return 0;
+ fd = sd->fd;
+ if (!fd || !len) return 0; //Disconnected player.
+ WFIFOHEAD(fd, len+5);
+ WFIFOW(fd, 0) = 0x17f;
+ WFIFOW(fd, 2) = len + 5;
+ memcpy(WFIFOP(fd,4), mes, len);
+ WFIFOSET(fd, WFIFOW(fd,2));
+ return 1;
}
/*==========================================
@@ -9288,6 +9283,20 @@ void clif_parse_ChatLeave(int fd,struct map_session_data *sd)
chat_leavechat(sd);
}
+//Handles notifying asker and rejecter of what has just ocurred.
+//Type is used to determine the correct msg_txt to use:
+//0:
+static void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type)
+{
+ char *msg, output[256];
+ // Your request has been rejected by autoreject option.
+ msg = msg_txt(392);
+ clif_disp_onlyself(src, msg, strlen(msg));
+ //Notice that a request was rejected.
+ snprintf(output, 256, msg_txt(393+type), src->status.name, 256);
+ clif_disp_onlyself(target, output, strlen(output));
+}
+
/*==========================================
* 取引要請を相手に送る
*------------------------------------------
@@ -9301,13 +9310,12 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
- // Your request has been rejected by autoreject option.
- clif_displaymessage(fd, msg_txt(392));
+ clif_noask_sub(sd, t_sd, 0);
return;
}
if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 1){
- trade_traderequest(sd,RFIFOL(sd->fd,2));
+ trade_traderequest(sd,t_sd);
} else
clif_skill_fail(sd,1,0,0);
}
@@ -10020,12 +10028,11 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) {
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
- // Your request has been rejected by autoreject option.
- clif_displaymessage(fd, msg_txt(392));
+ clif_noask_sub(sd, t_sd, 1);
return;
}
- party_invite(sd, RFIFOL(fd,2));
+ party_invite(sd, t_sd);
}
/*==========================================
@@ -10253,12 +10260,11 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd) {
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
- // Your request has been rejected by autoreject option.
- clif_displaymessage(fd, msg_txt(392));
+ clif_noask_sub(sd, t_sd, 2);
return;
}
- guild_invite(sd,RFIFOL(fd,2));
+ guild_invite(sd,t_sd);
}
/*==========================================
@@ -10327,12 +10333,11 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) {
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
- // Your request has been rejected by autoreject option.
- clif_displaymessage(fd, msg_txt(392));
+ clif_noask_sub(sd, t_sd, 3);
return;
}
- guild_reqalliance(sd,RFIFOL(fd,2));
+ guild_reqalliance(sd,t_sd);
}
/*==========================================
@@ -10366,12 +10371,11 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) {
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
- // Your request has been rejected by autoreject option.
- clif_displaymessage(fd, msg_txt(392));
+ clif_noask_sub(sd, t_sd, 4);
return;
}
- guild_opposition(sd,RFIFOL(fd,2));
+ guild_opposition(sd,t_sd);
}
/*==========================================
@@ -10902,8 +10906,7 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) {
// @noask [LuzZza]
if(f_sd->state.noask) {
- // Your request has been rejected by autoreject option.
- clif_displaymessage(fd, msg_txt(392));
+ clif_noask_sub(sd, f_sd, 5);
return;
}
diff --git a/src/map/guild.c b/src/map/guild.c
index 78ef6188d..2515cc4a3 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -630,15 +630,13 @@ int guild_recv_info(struct guild *sg)
// ギルドへの勧誘
-int guild_invite(struct map_session_data *sd,int account_id)
+int guild_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
- struct map_session_data *tsd;
struct guild *g;
int i;
nullpo_retr(0, sd);
- tsd= map_id2sd(account_id);
g=guild_search(sd->status.guild_id);
if(tsd==NULL || g==NULL)
@@ -1266,9 +1264,8 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag)
return 0;
}
// ギルド同盟要求
-int guild_reqalliance(struct map_session_data *sd,int account_id)
+int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
{
- struct map_session_data *tsd= map_id2sd(account_id);
struct guild *g[2];
int i;
@@ -1386,9 +1383,8 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
return 0;
}
// ギルド敵対
-int guild_opposition(struct map_session_data *sd,int char_id)
+int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd)
{
- struct map_session_data *tsd=map_id2sd(char_id);
struct guild *g;
int i;
diff --git a/src/map/guild.h b/src/map/guild.h
index 697480136..c59e2f4b3 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -39,7 +39,7 @@ int guild_request_info(int guild_id);
int guild_recv_noinfo(int guild_id);
int guild_recv_info(struct guild *sg);
int guild_npc_request_info(int guild_id,const char *ev);
-int guild_invite(struct map_session_data *sd,int account_id);
+int guild_invite(struct map_session_data *sd,struct map_session_data *tsd);
int guild_reply_invite(struct map_session_data *sd,int guild_id,int flag);
int guild_member_added(int guild_id,int account_id,int char_id,int flag);
int guild_leave(struct map_session_data *sd,int guild_id,
@@ -50,13 +50,13 @@ int guild_explusion(struct map_session_data *sd,int guild_id,
int account_id,int char_id,const char *mes);
int guild_skillup(struct map_session_data *sd,int skill_num,int flag);
void guild_block_skill(struct map_session_data *sd, int time);
-int guild_reqalliance(struct map_session_data *sd,int account_id);
+int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd);
int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag);
int guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2);
int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,
int flag,const char *name1,const char *name2);
int guild_delalliance(struct map_session_data *sd,int guild_id,int flag);
-int guild_opposition(struct map_session_data *sd,int char_id);
+int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd);
int guild_check_alliance(int guild_id1, int guild_id2, int flag);
int guild_send_memberinfoshort(struct map_session_data *sd,int online);
diff --git a/src/map/party.c b/src/map/party.c
index 4e3eafecd..474322966 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -230,9 +230,8 @@ int party_recv_info(struct party *sp)
return 0;
}
-int party_invite(struct map_session_data *sd,int account_id)
+int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
- struct map_session_data *tsd= map_id2sd(account_id);
struct party_data *p=party_search(sd->status.party_id);
int i,flag=0;
@@ -253,7 +252,7 @@ int party_invite(struct map_session_data *sd,int account_id)
for(i=0;i<MAX_PARTY;i++){
if(p->party.member[i].account_id == 0) //Room for a new member.
flag = 1;
- if(p->party.member[i].account_id==account_id &&
+ if(p->party.member[i].account_id==tsd->status.account_id &&
p->party.member[i].char_id==tsd->status.char_id){
clif_party_inviteack(sd,tsd->status.name,0);
return 0;
diff --git a/src/map/party.h b/src/map/party.h
index c305a6f51..9debe642b 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -20,7 +20,7 @@ struct party_data *party_searchname(char *str);
int party_create(struct map_session_data *sd,char *name, int item, int item2);
int party_created(int account_id,int char_id,int fail,int party_id,char *name);
int party_request_info(int party_id);
-int party_invite(struct map_session_data *sd,int account_id);
+int party_invite(struct map_session_data *sd,struct map_session_data *tsd);
int party_member_added(int party_id,int account_id,int char_id,int flag);
int party_leave(struct map_session_data *sd);
int party_removemember(struct map_session_data *sd,int account_id,char *name);
diff --git a/src/map/trade.c b/src/map/trade.c
index 3597eed71..236be38c2 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -23,8 +23,7 @@
* Initiates a trade request.
*------------------------------------------
*/
-void trade_traderequest(struct map_session_data *sd, int target_id) {
- struct map_session_data *target_sd;
+void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd) {
int level;
nullpo_retv(sd);
@@ -34,7 +33,7 @@ void trade_traderequest(struct map_session_data *sd, int target_id) {
return; //Can't trade in notrade mapflag maps.
}
- if ((target_sd = map_id2sd(target_id)) == NULL || sd == target_sd) {
+ if (target_sd == NULL || sd == target_sd) {
clif_tradestart(sd, 1); // character does not exist
return;
}
diff --git a/src/map/trade.h b/src/map/trade.h
index 2114f5a42..a695a50e8 100644
--- a/src/map/trade.h
+++ b/src/map/trade.h
@@ -5,7 +5,7 @@
#define _TRADE_H_
#include "map.h"
-void trade_traderequest(struct map_session_data *sd,int target_id);
+void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd);
void trade_tradeack(struct map_session_data *sd,int type);
void trade_tradeadditem(struct map_session_data *sd,int index,int amount);
void trade_tradeok(struct map_session_data *sd);