15 May, 2009, boblinski wrote in the 41st comment:
Votes: 0
Sharmair said:
From your symptoms, it looks like you are saving the affected2_by flag, but the affected
struct (spell effect) is either not being saved or loaded correctly. Show us the code for
saving (should be at almost the end of fwrite_char() in save.c, probably a loop using paf
and writing with the tag of Affc) and loading (in fread_char() in save.c the Affc if in the A
case). Other then this, I would look in your pfile and see if you have the Affc line (should
be right before the objects). If that looks ok, then I would check if you have some code
stripping the spell effect but not clearing the affected2_by flag.


Hmmm, I think it may be as you said.. this is what I have at the end of fread_char() in save.c:

for (paf = ch->affected; paf != NULL; paf = paf->next)
{
if (paf->type < 0 || paf->type >= MAX_SKILL)
continue;

fprintf (fp, "Affc '%s' %3d %3d %3d %3d %3d %10d\n",
skill_table[paf->type].name,
paf->where,
paf->level,
paf->duration, paf->modifier, paf->location, paf->bitvector);
}

fprintf (fp, "End\n\n");
return;
}


What should it look like? Just duplicate and make it "ch->affected2" and "Affc2" ?
15 May, 2009, Sharmair wrote in the 42nd comment:
Votes: 0
No, you don't want to make a 2nd affected list. Really, this part of the code should not have to
be changed (and the code here for writing does look right) for the affected2_by changes. I would
do a couple things, first, I would check the pfile and make sure it is actually saving there, then
I would have another spell affect (so you have at least two, and make the other something other
then an affected2_by spell effect) when you log off to see if it is a problem with all spell effects,
or just the affected2_by ones. Another thing I would check (though is a long shot) is to make sure
gsn_focus is valid (in the range of 0 to MAX_SKILL).
15 May, 2009, boblinski wrote in the 43rd comment:
Votes: 0
Upon further investigation… it appears that the affect IS saved when logging on/off..

but it is when the spell fades that it doesn't completely disappear..

Here's what I mean:
Quote
<10000hp 10000m 10000mv> aff

You are affected by the following spells:
Spell: focus : modifies none by 0 for 0 hours

<10000hp 10000m 10000mv>
You begin to lose focus on your surroundings.

<10000hp 10000m 10000mv> affect

You are not affected by any spells.

<10000hp 10000m 10000mv> focus

You are already focusing on your surroundings.


I also checked in the pfile before and after the affect wore-off..

Before:
Gr 'weaponsmaster'
Affc 'focus' 6 27 19 0 0 2
End


After:
Gr 'weaponsmaster'
End
15 May, 2009, boblinski wrote in the 44th comment:
Votes: 0
I thought this might help… no idea what is going on with this stupid thing:

interp.h"(140,20):	DECLARE_DO_FUN(	do_focus		); 
merc.h"(1012,13): #define AFF_FOCUS (B)
merc.h"(2100,20): extern sh_int gsn_focus;
act_info.c"(3119,9): void do_focus (CHAR_DATA * ch, char *argument)
act_info.c"(3123,31): if (IS_AFFECTED2 (ch, AFF_FOCUS))
act_info.c"(3125,34): send_to_char ("You are already focusing on your surroundings.\r\n", ch);
act_info.c"(3129,32): send_to_char ("You attempt to focus on your surroundings.\r\n", ch);
act_info.c"(3131,48): if (number_percent () < get_skill (ch, gsn_focus))
act_info.c"(3133,29): check_improve (ch, gsn_focus, TRUE, 3);
act_info.c"(3135,23): af.type = gsn_focus;
act_info.c"(3140,28): af.bitvector = AFF_FOCUS;
act_info.c"(3145,32): check_improve (ch, gsn_focus, FALSE, 3);
act_info.c"(3146,29): send_to_char ("You try to focus but get distracted.\r\n", ch);
act_move.c"(280,63): || (IS_AFFECTED2 (ch, AFF_CREEP) && IS_AFFECTED2 (fch, AFF_FOCUS))))
act_move.c"(299,63): || (IS_AFFECTED2 (ch, AFF_CREEP) && IS_AFFECTED2 (fch, AFF_FOCUS))))
const.c"(2051,7): "focus", {53, 53, 1, 12}, {0, 0, 4, 6},
const.c"(2053,11): &gsn_focus, SLOT (0), 0, 12,
const.c"(2054,29): "", "You begin to lose focus on your surroundings.", ""},
db.c"(161,12): sh_int gsn_focus;
handler.c"(2713,30): && (!IS_AFFECTED2 (ch, AFF_FOCUS)
handler.c"(2903,19): if (vector & AFF_FOCUS)
handler.c"(2904,24): strcat (buf, " focus");
interp.c"(271,7): {"focus", do_focus, POS_STANDING, 0, LOG_NORMAL, 1},
tables.c"(170,4): {"focus", B, TRUE},
15 May, 2009, Sharmair wrote in the 45th comment:
Votes: 0
Ok, that would point more to the part of affect_modify() (handler.c) that is supposed to remove
the affected2_by effect flags. Close to the top of affect_modify() there should be an if based
on fAdd, the first (true) part of the if is for when you are adding an effect, and the else (false)
part is for when you are removing an effect. That false part should have a case for TO_AFFECTS2
that does a REMOVE_BIT of the ch->affected2_by flag set.

As a note here. You would also get the same thing if the character was also wearing an object
that gave the affected2_by flag (maybe put on after the spell was cast). I don't see any evidence
here that is the case, but thought I should mention the possibility.
40.0/45