Hi all! I am sending 3 diff files today, here is a description of each of them. I would really apreciate if someone more experienced than me checks the code, and if you think it's stable enough commit them to the CVS. Despite gros' advice about doing the changes to the 1.5.0-patch i made it on the main branch (after i could understand what a branch was hehe). I hope i did it right. Any comments will be apreciated. cf_me.diff - this is a very simple file. Aparently the time the changes i made for the 'me command was commited to the CVS something weird happened and this simple row that is missing makes the command not to work. The rest of the needed code (command_me function and it's header) are already put in place. cf_set_reply.diff - well this is the new stuff :-) The 'set_reply command used without parameters, saves in a player field called reply_to the name of the last player that told you something until now. Then the reply command was modifies to use this value instead of the last_tell field if it was already set, if it was not set or was deletted this command will behave as always did. To remove the value of the reply_to field type 'set_reply -r To view who is stored into the reply_to field type 'set_reply -v This command will also work if the player to the one you are replying logs out and comes back again, the value will still be set to him/her if you didnt remove/reset it (i thought it's useful for crashing clients). But still if the player is logged off we wont be able to tell him anything. cf_set_reply&me.diff - just in case you wanted to commit both together since they are in my point of view very simple changes :-) Greetings, Katia. -- +-----------------------------+ | Karla Mª Stenger Sábat | | Pando . Canelones . Uruguay | | kstenger at montevideo.com.uy | +-----------------------------+ -------------- next part -------------- ? .tm_project.cache ? Makefile ? autom4te.cache ? config.log ? config.status ? crossfire.prj ? crossfire.pws ? libtool ? common/.deps ? common/Makefile ? common/st6KFc92 ? crossedit/.deps ? crossedit/.libs ? crossedit/Makefile ? crossedit/crossedit ? crossedit/Cnv/.deps ? crossedit/Cnv/Makefile ? crossedit/bitmaps/Makefile ? crossedit/doc/Makefile ? crossedit/include/Makefile ? devel/.deps ? devel/.libs ? devel/Makefile ? devel/crossfire-config ? doc/Makefile ? doc/Developers/Makefile ? doc/playbook/Makefile ? doc/playbook-html/Makefile ? doc/scripts/Makefile ? doc/spell-docs/Makefile ? doc/spoiler/Makefile ? doc/spoiler-html/Makefile ? include/Makefile ? include/autoconf.h ? include/stamp-h1 ? lib/Makefile ? lib/checkarch.pl ? lib/collect.pl ? plugin/.deps ? plugin/Makefile ? random_maps/.deps ? random_maps/.libs ? random_maps/Makefile ? random_maps/random_map ? server/.deps ? server/.libs ? server/Makefile ? server/crossfire ? socket/.deps ? socket/Makefile ? utils/Makefile ? utils/add_throw.perl ? utils/crossloop ? utils/crossloop.pl ? utils/crossloop.pl.tmpl ? utils/crossloop.tmpl ? utils/crossloop.web ? utils/metaserver.pl ? utils/scores.pl Index: include/player.h =================================================================== RCS file: /cvsroot/crossfire/crossfire/include/player.h,v retrieving revision 1.33 diff -u -r1.33 player.h --- include/player.h 13 Sep 2003 05:01:34 -0000 1.33 +++ include/player.h 16 Sep 2003 03:31:31 -0000 @@ -161,6 +161,7 @@ char killer[BIG_NAME]; /* Who killed this player. */ char last_tell[MAX_NAME]; /* last player that told you something [mids 01/14/2002] */ + char reply_to[MAX_NAME]; /* player to the one we want to reply */ char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ char input_buf[MAX_BUF]; /* Holds command to run */ Index: include/sproto.h =================================================================== RCS file: /cvsroot/crossfire/crossfire/include/sproto.h,v retrieving revision 1.96 diff -u -r1.96 sproto.h --- include/sproto.h 13 Sep 2003 05:01:34 -0000 1.96 +++ include/sproto.h 16 Sep 2003 03:31:32 -0000 @@ -73,6 +73,7 @@ int command_orcknuckle(object *op, char *params); int command_shout(object *op, char *params); int command_tell(object *op, char *params); +int command_sreply(object *op, char *params); int command_reply(object *op, char *params); int command_nod(object *op, char *params); int command_dance(object *op, char *params); Index: server/c_chat.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/server/c_chat.c,v retrieving revision 1.15 diff -u -r1.15 c_chat.c --- server/c_chat.c 28 Jul 2003 05:19:35 -0000 1.15 +++ server/c_chat.c 16 Sep 2003 03:31:33 -0000 @@ -162,8 +162,62 @@ return 1; } -/* Reply to last person who told you something [mids 01/14/2002] */ -int command_reply (object *op, char *params) { +/* Sets the value of the reply_to field of a player */ +int command_sreply(object *op, char *params) { + player *pl; + + if (params==NULL) { + /* check if player is still connected */ + pl=find_player(op->contr->last_tell); + + if (pl==NULL){ + new_draw_info(NDI_UNIQUE, 0, op, + "Can't set reply_to value, this player left."); + return 1; + } + else { + /* Update reply_to value */ + strcpy(op->contr->reply_to, pl->ob->name); + new_draw_info_format(NDI_UNIQUE, 0, op, + "Reply_to value set to %s.", pl->ob->name); + return 1; + } + } + + while (*params==' ') params++; + + if (!strncmp(params,"-r",2)) { + /* Remove the reply_to value */ + op->contr->reply_to[0] = '\0'; + new_draw_info(NDI_UNIQUE, 0, op, + "Reply_to value was removed."); + } + else if (!strncmp(params,"-v",2)) { + /* View the reply_to value if it exists */ + if (op->contr->reply_to==NULL) { + new_draw_info(NDI_UNIQUE, 0, op, + "You will reply to the last person that tells you something."); + } + else { + /* NOTE: reply_to can be set to a player that is not logged any more * + * we make the control on if he's logged or not in the reply command.* + * So, if the player comes back online we can still reply to him/her. */ + new_draw_info_format(NDI_UNIQUE, 0, op, + "You will reply to %s.", op->contr->reply_to); + } + } + else { + /* Unknown parameter */ + new_draw_info(NDI_UNIQUE, 0, op, + "Usage: \n 'set_reply\n 'set_reply -r\n 'set_reply -v"); + } + return 1; +} + + +/* Reply to last person who told you something [mids 01/14/2002] * + * or to the player set in the reply_to player field if it exists */ +int command_reply(object *op, char *params) { player *pl; if (params == NULL) { @@ -171,13 +225,16 @@ return 1; } - if (op->contr->last_tell[0] == '\0') { + if (op->contr->last_tell[0] == '\0' && op->contr->reply_to[0] == '\0') { new_draw_info(NDI_UNIQUE, 0, op, "You can't reply to nobody."); return 1; } /* Find player object of player to reply to and check if player still exists */ - pl = find_player(op->contr->last_tell); + if (op->contr->reply_to[0] == '\0') + pl = find_player(op->contr->last_tell); + else + pl = find_player(op->contr->reply_to); if (pl == NULL) { new_draw_info(NDI_UNIQUE, 0, op, "You can't reply, this player left."); @@ -188,9 +245,9 @@ strcpy(pl->last_tell, op->name); new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, - "%s tells you: %s", op->name, params); + "%s tells you: %s", op->name, params); new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, op, - "You tell to %s: %s", pl->ob->name, params); + "You tell %s: %s", pl->ob->name, params); return 1; } Index: server/commands.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/server/commands.c,v retrieving revision 1.39 diff -u -r1.39 commands.c --- server/commands.c 13 Sep 2003 05:02:09 -0000 1.39 +++ server/commands.c 16 Sep 2003 03:31:34 -0000 @@ -132,6 +132,7 @@ CommArray_s CommunicationCommands [] = { /* begin emotions */ {"tell", command_tell, 0.1}, + {"set_reply", command_sreply, 0.0}, {"reply", command_reply, 0.0}, {"say", command_say, 0.1}, {"shout", command_shout, 0.1}, -------------- next part -------------- ? .tm_project.cache ? Makefile ? autom4te.cache ? config.log ? config.status ? crossfire.prj ? crossfire.pws ? libtool ? common/.deps ? common/Makefile ? common/st6KFc92 ? crossedit/.deps ? crossedit/.libs ? crossedit/Makefile ? crossedit/crossedit ? crossedit/Cnv/.deps ? crossedit/Cnv/Makefile ? crossedit/bitmaps/Makefile ? crossedit/doc/Makefile ? crossedit/include/Makefile ? devel/.deps ? devel/.libs ? devel/Makefile ? devel/crossfire-config ? doc/Makefile ? doc/Developers/Makefile ? doc/playbook/Makefile ? doc/playbook-html/Makefile ? doc/scripts/Makefile ? doc/spell-docs/Makefile ? doc/spoiler/Makefile ? doc/spoiler-html/Makefile ? include/Makefile ? include/autoconf.h ? include/stamp-h1 ? lib/Makefile ? lib/checkarch.pl ? lib/collect.pl ? plugin/.deps ? plugin/Makefile ? random_maps/.deps ? random_maps/.libs ? random_maps/Makefile ? random_maps/random_map ? server/.deps ? server/.libs ? server/Makefile ? server/crossfire ? socket/.deps ? socket/Makefile ? utils/Makefile ? utils/add_throw.perl ? utils/crossloop ? utils/crossloop.pl ? utils/crossloop.pl.tmpl ? utils/crossloop.tmpl ? utils/crossloop.web ? utils/metaserver.pl ? utils/scores.pl Index: server/commands.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/server/commands.c,v retrieving revision 1.39 diff -u -r1.39 commands.c --- server/commands.c 13 Sep 2003 05:02:09 -0000 1.39 +++ server/commands.c 16 Sep 2003 03:59:07 -0000 @@ -135,6 +135,7 @@ {"reply", command_reply, 0.0}, {"say", command_say, 0.1}, {"shout", command_shout, 0.1}, + {"me", command_me, 0.1}, {"nod", command_nod, 0.0}, {"dance", command_dance, 0.0}, {"kiss", command_kiss, 0.0}, -------------- next part -------------- ? .tm_project.cache ? Makefile ? autom4te.cache ? config.log ? config.status ? crossfire.prj ? crossfire.pws ? libtool ? common/.deps ? common/Makefile ? common/st6KFc92 ? crossedit/.deps ? crossedit/.libs ? crossedit/Makefile ? crossedit/crossedit ? crossedit/Cnv/.deps ? crossedit/Cnv/Makefile ? crossedit/bitmaps/Makefile ? crossedit/doc/Makefile ? crossedit/include/Makefile ? devel/.deps ? devel/.libs ? devel/Makefile ? devel/crossfire-config ? doc/Makefile ? doc/Developers/Makefile ? doc/playbook/Makefile ? doc/playbook-html/Makefile ? doc/scripts/Makefile ? doc/spell-docs/Makefile ? doc/spoiler/Makefile ? doc/spoiler-html/Makefile ? include/Makefile ? include/autoconf.h ? include/stamp-h1 ? lib/Makefile ? lib/checkarch.pl ? lib/collect.pl ? plugin/.deps ? plugin/Makefile ? random_maps/.deps ? random_maps/.libs ? random_maps/Makefile ? random_maps/random_map ? server/.deps ? server/.libs ? server/Makefile ? server/crossfire ? socket/.deps ? socket/Makefile ? utils/Makefile ? utils/add_throw.perl ? utils/crossloop ? utils/crossloop.pl ? utils/crossloop.pl.tmpl ? utils/crossloop.tmpl ? utils/crossloop.web ? utils/metaserver.pl ? utils/scores.pl Index: include/player.h =================================================================== RCS file: /cvsroot/crossfire/crossfire/include/player.h,v retrieving revision 1.33 diff -u -r1.33 player.h --- include/player.h 13 Sep 2003 05:01:34 -0000 1.33 +++ include/player.h 16 Sep 2003 03:49:47 -0000 @@ -161,6 +161,7 @@ char killer[BIG_NAME]; /* Who killed this player. */ char last_tell[MAX_NAME]; /* last player that told you something [mids 01/14/2002] */ + char reply_to[MAX_NAME]; /* player to the one we want to reply */ char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ char input_buf[MAX_BUF]; /* Holds command to run */ Index: include/sproto.h =================================================================== RCS file: /cvsroot/crossfire/crossfire/include/sproto.h,v retrieving revision 1.96 diff -u -r1.96 sproto.h --- include/sproto.h 13 Sep 2003 05:01:34 -0000 1.96 +++ include/sproto.h 16 Sep 2003 03:49:49 -0000 @@ -73,6 +73,7 @@ int command_orcknuckle(object *op, char *params); int command_shout(object *op, char *params); int command_tell(object *op, char *params); +int command_sreply(object *op, char *params); int command_reply(object *op, char *params); int command_nod(object *op, char *params); int command_dance(object *op, char *params); Index: server/c_chat.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/server/c_chat.c,v retrieving revision 1.15 diff -u -r1.15 c_chat.c --- server/c_chat.c 28 Jul 2003 05:19:35 -0000 1.15 +++ server/c_chat.c 16 Sep 2003 03:49:50 -0000 @@ -162,8 +162,62 @@ return 1; } -/* Reply to last person who told you something [mids 01/14/2002] */ -int command_reply (object *op, char *params) { +/* Sets the value of the reply_to field of a player */ +int command_sreply(object *op, char *params) { + player *pl; + + if (params==NULL) { + /* check if player is still connected */ + pl=find_player(op->contr->last_tell); + + if (pl==NULL){ + new_draw_info(NDI_UNIQUE, 0, op, + "Can't set reply_to value, this player left."); + return 1; + } + else { + /* Update reply_to value */ + strcpy(op->contr->reply_to, pl->ob->name); + new_draw_info_format(NDI_UNIQUE, 0, op, + "Reply_to value set to %s.", pl->ob->name); + return 1; + } + } + + while (*params==' ') params++; + + if (!strncmp(params,"-r",2)) { + /* Remove the reply_to value */ + op->contr->reply_to[0] = '\0'; + new_draw_info(NDI_UNIQUE, 0, op, + "Reply_to value was removed."); + } + else if (!strncmp(params,"-v",2)) { + /* View the reply_to value if it exists */ + if (op->contr->reply_to==NULL) { + new_draw_info(NDI_UNIQUE, 0, op, + "You will reply to the last person that tells you something."); + } + else { + /* NOTE: reply_to can be set to a player that is not logged any more * + * we make the control on if he's logged or not in the reply command.* + * So, if the player comes back online we can still reply to him/her. */ + new_draw_info_format(NDI_UNIQUE, 0, op, + "You will reply to %s.", op->contr->reply_to); + } + } + else { + /* Unknown parameter */ + new_draw_info(NDI_UNIQUE, 0, op, + "Usage: \n 'set_reply\n 'set_reply -r\n 'set_reply -v"); + } + return 1; +} + + +/* Reply to last person who told you something [mids 01/14/2002] * + * or to the player set in the reply_to player field if it exists */ +int command_reply(object *op, char *params) { player *pl; if (params == NULL) { @@ -171,13 +225,16 @@ return 1; } - if (op->contr->last_tell[0] == '\0') { + if (op->contr->last_tell[0] == '\0' && op->contr->reply_to[0] == '\0') { new_draw_info(NDI_UNIQUE, 0, op, "You can't reply to nobody."); return 1; } /* Find player object of player to reply to and check if player still exists */ - pl = find_player(op->contr->last_tell); + if (op->contr->reply_to[0] == '\0') + pl = find_player(op->contr->last_tell); + else + pl = find_player(op->contr->reply_to); if (pl == NULL) { new_draw_info(NDI_UNIQUE, 0, op, "You can't reply, this player left."); @@ -188,9 +245,9 @@ strcpy(pl->last_tell, op->name); new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, - "%s tells you: %s", op->name, params); + "%s tells you: %s", op->name, params); new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, op, - "You tell to %s: %s", pl->ob->name, params); + "You tell %s: %s", pl->ob->name, params); return 1; } Index: server/commands.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/server/commands.c,v retrieving revision 1.39 diff -u -r1.39 commands.c --- server/commands.c 13 Sep 2003 05:02:09 -0000 1.39 +++ server/commands.c 16 Sep 2003 03:49:51 -0000 @@ -132,9 +132,11 @@ CommArray_s CommunicationCommands [] = { /* begin emotions */ {"tell", command_tell, 0.1}, + {"set_reply", command_sreply, 0.0}, {"reply", command_reply, 0.0}, {"say", command_say, 0.1}, {"shout", command_shout, 0.1}, + {"me", command_me, 0.1}, {"nod", command_nod, 0.0}, {"dance", command_dance, 0.0}, {"kiss", command_kiss, 0.0},