i was pondering the problems associated with the say spell function, specifically the infinite loop that occurs when one makes a new spell with a character that is not in the syllable structure while (*(lbuf + ofs)) { for (j = 0; *(syls[j].org); j++) { if (!strncmp(syls[j].org, lbuf + ofs, strlen(syls[j].org))) { strcat(buf, syls[j].news); ofs += strlen(syls[j].org); } } here is what i believe the code to be doing, the while checks to see if the point in the lbuf array that we are currently at has something in it, then the for loop checks through the syllable structure to see if there is a match with the current point in the lbuf, if there is a match, then copy the magic speach of the structure into buf, increase ofs to the length of the magic speach, if nothing matches, ofs never gets increased, so the while loop will always be true, stuck at the same point, what if we just added an ofs++; after the for loop? while (*(lbuf + ofs)) { for (j = 0; *(syls[j].org); j++) { if (!strncmp(syls[j].org, lbuf + ofs, strlen(syls[j].org))) { strcat(buf, syls[j].news); ofs += strlen(syls[j].org); } ofs++; } im not sure, so im posting this here for the scrutiny of the community, my thinking goes, if we went through the whole for loop to check through the whole syllable structure, and nothing turned up, then skip over the point in our original word, and lets move onto something that will match _________________________________________________________ DO YOU YAHOO!? Get your free @yahoo.com address at http://mail.yahoo.com +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST