solorni Report post Posted August 22, 2007 Today I was fighting in Egratia, and I right-misclicked on restore on my spellbar, making it disappear. So I went into my casting window, saw that restore was still there, and clicked on the "add this spell to your quickbar" icon. It appeared on the quickbar. But then when I went to use the quickbar, I clicked with no response. Over and over. No message like "spell failed" or "you need 4 HE and you have 0" (I did have HE, plenty of it). It was as if I was not clicking on it. I died to the clops I was fighting (losing a rost). The spellbar didn't work in the underworld either. I didn't try my other spells, so I don't know if it was just the restore or not. So I deleted the spell from the quickbar again, casting restore directly from the window. That worked. I added the spell to the quickbar again, and it seems to be fine now. But it was strange and I thought you should know. Share this post Link to post Share on other sites
ttlanhil Report post Posted August 23, 2007 To add a bit of information... When a spell is cast by quickbar, not spell window, the "add to spellbar" button is corrupted (not sure why) which causes problems like this. Share this post Link to post Share on other sites
Sayre Report post Posted August 23, 2007 Just as an aside, and I am not sure whether it applies to your case solorni, but if the spell window is open, I notice that messages for spells do not seem to come up, it was like the spell wasn't working, but the messages WERE coming up, just in the spell window. S. Share this post Link to post Share on other sites
Grum Report post Posted August 23, 2007 Maybe this post should be in Programming, but answering here is easier To add a bit of information... When a spell is cast by quickbar, not spell window, the "add to spellbar" button is corrupted (not sure why) which causes problems like this. Not exactly sure what's going on there, but I think there's a bug in add_spell_to_quickbar(). Last time I used the magic quickbar is ages ago, so I don't know exactly how it's supposed to work, but looking at add_spell_to_quickbar(), it seems that new spells are always added at the bottom, and when the bar is full, the last spell should be replaced. Except that it never is: if(mqb_data[6]) { free(mqb_data[6]); } for(i=1; i<7 && mqb_data[i] != NULL; ++i); mqb_data[i]=(mqbdata*)calloc(1,sizeof(mqbdata)); memcpy(mqb_data[i], mqb_data[0], sizeof(mqbdata)); First of all, I think that free() is unnecessary, since we can simply overwrite the memory that's already allocated. But what's worse is that after the free(), the pointer isn't set to NULL, so the for loop runs up to 7, and which we try to assign to mqb_data[7], outside the array. I'm unable to test atm, so ttl (or someone else who can program and who has these issues), could you try to fix this and see if it helps? Share this post Link to post Share on other sites
ttlanhil Report post Posted August 23, 2007 Wow, that's nasty (it's things like that that make me want to wrap up free() to always set =NULL as well, just so it's a bit safer... Or just use a language like C++ to avoid half of the problems). changing to <6 and always (and I mean always, apart from high-usage (eg many times per frame) functions where it is either clearly documented where it's reused, or is reallocated immediately) setting free()d pointers to NULL should fix that. But I don't think it's the problem here, because, as far as I can tell, that would only break when the quickbar is full. And it currently breaks even when the spellbar is not (and has not been) full. I don't have the time to fix it myself, though. Share this post Link to post Share on other sites
Grum Report post Posted August 23, 2007 Changed to for (i = 1; i < 7; i++) { if (mqb_data[i] == NULL) { // Free slot mqb_data[i] = calloc(1, sizeof (mqbdata)); break; } } if (i >= 7) // No free slot, overwrite the last entry i = 6; memcpy (mqb_data[i], mqb_data[0], sizeof (mqbdata)); Committed, not tested, shouldn't cause extra trouble though. Share this post Link to post Share on other sites
solorni Report post Posted August 23, 2007 wow, you guys are fast at locating the problem and solution! I hope it can be fixed so it doesn't happen to someone else...losing a rost to a program error sucks so much more than just dying. Just as an aside, and I am not sure whether it applies to your case solorni, but if the spell window is open, I notice that messages for spells do not seem to come up, it was like the spell wasn't working, but the messages WERE coming up, just in the spell window. In this case, I only had the spellbar open a short time. By the time I was in the underworld, it was closed and I clicked a bunch of times without message or results. My magic is 38, so I fail restore rarely. With the 20+ clicks I tried, I concluded that the spell itself was not working, not just the messages. hope that helps. Share this post Link to post Share on other sites