[sword-devel] book arithmetic error in engine, Matthew -> Malachi

Karl Kleinpaste karl at kleinpaste.org
Sun Mar 14 07:51:34 MST 2010

I could use a clue for what I'm seeing in the engine when changing books.

Xiphos' navbar provides arrow buttons for navigating up/down a single
book, plus the spinner which provides the same function.  The code which
reacts to this is:

	VerseKey vkey;
	tmpkey = backend->get_valid_key(navbar.key->str);
	vkey = tmpkey;
	book = (direction)?(vkey.Book()+1):(vkey.Book()-1);
	tmpkey = g_strdup_printf("%s 1:1",vkey.getBookName());

Pretty straightforward.  When Xiphos is sitting on Matthew, hitting the
up button should result in a new selection of "Malachi 1:1" in the final
setting of tmpkey, but what we actually get in that case is "Zechariah
1:1".  The engine has mis-analyzed where "one backward from Matthew" is.

I've looked at the usage of Book (that is, getBook and setBook) in
sword/src/keys/versekey.cpp, and I am a bit mystified by where this
mis-setting can occur.

More information about the sword-devel mailing list