On Mon, Sep 02, 2002 at 12:10:19PM +0200, Peter d wrote:
>Hi!
>How do i make the poofins and poofouts saveable?
>what files and functions need to be modified?
I'd SWEAR this has been covered before... but since it took about 3
minutes, here: Note: This will ruin your rentfiles (amounting to a
pwipe), and enlarge them by MAX_POOFLEN*2 for each entry.
(I'm assuming you're still using binary pfiles, since last I checked,
ascii pfiles saved poofs)
Posting this here since I don't really think it's enough work to put on
the ftp site. This is against stock bpl21, not really stress-tested,
YMMV.
diff -Nupr src/act.wizard.c src.w/act.wizard.c
--- src/act.wizard.c Tue Apr 9 10:12:15 2002
+++ src.w/act.wizard.c Mon Sep 2 08:22:16 2002
@@ -1405,23 +1405,23 @@ ACMD(do_gecho)
ACMD(do_poofset)
{
- char **msg;
+ char *msg;
switch (subcmd) {
- case SCMD_POOFIN: msg = &(POOFIN(ch)); break;
- case SCMD_POOFOUT: msg = &(POOFOUT(ch)); break;
+ case SCMD_POOFIN: msg = (POOFIN(ch)); break;
+ case SCMD_POOFOUT: msg = (POOFOUT(ch)); break;
default: return;
}
skip_spaces(&argument);
if (*msg)
- free(*msg);
+ *msg = '\0';
if (!*argument)
- *msg = NULL;
+ *msg = '\0';
else
- *msg = strdup(argument);
+ snprintf(msg, MAX_POOFLEN, "%s", argument);
send_to_char(ch, "%s", OK);
}
diff -Nupr src/db.c src.w/db.c
--- src/db.c Tue Apr 9 10:12:15 2002
+++ src.w/db.c Mon Sep 2 08:24:16 2002
@@ -2235,8 +2235,6 @@ void store_to_char(struct char_file_u *s
ch->points = st->points;
ch->char_specials.saved = st->char_specials_saved;
ch->player_specials->saved = st->player_specials_saved;
- POOFIN(ch) = NULL;
- POOFOUT(ch) = NULL;
GET_LAST_TELL(ch) = NOBODY;
if (ch->points.max_mana < 100)
@@ -2786,6 +2784,8 @@ void init_char(struct char_data *ch)
GET_COND(ch, i) = (GET_LEVEL(ch) == LVL_IMPL ? -1 : 24);
GET_LOADROOM(ch) = NOWHERE;
+ snprintf(POOFIN(ch), MAX_POOFLEN, "poofs in.");
+ snprintf(POOFOUT(ch), MAX_POOFLEN, "poofs out.");
}
diff -Nupr src/structs.h src.w/structs.h
--- src/structs.h Sun Apr 14 14:24:24 2002
+++ src.w/structs.h Mon Sep 2 08:22:16 2002
@@ -812,9 +812,12 @@ struct char_special_data {
* in your new code. They will automatically be transferred from the
* playerfile into memory when players log in.
*/
+#define MAX_POOFLEN 80
struct player_special_data_saved {
byte skills[MAX_SKILLS+1]; /* array of skills plus skill 0 */
byte PADDING0; /* used to be spells_to_learn */
+ char poofin[MAX_POOFLEN];
+ char poofout[MAX_POOFLEN];
bool talks[MAX_TONGUE]; /* PC s Tongues 0 for NPC */
int wimp_level; /* Below this # of hit points, flee! */
byte freeze_level; /* Level of god who froze char, if any */
diff -Nupr src/utils.h src.w/utils.h
--- src/utils.h Tue Apr 9 09:09:55 2002
+++ src.w/utils.h Mon Sep 2 08:22:16 2002
@@ -318,8 +318,8 @@ void update_pos(struct char_data *victim
#define GET_FREEZE_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.freeze_level))
#define GET_BAD_PWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.bad_pws))
#define GET_TALK(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.talks[i]))
-#define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofin))
-#define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofout))
+#define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.poofin))
+#define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.poofout))
#define GET_LAST_OLC_TARG(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_targ))
#define GET_LAST_OLC_MODE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_mode))
#define GET_ALIASES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->aliases))
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT