Re: [code] memory question.

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 10/08/97

On Wed, 8 Oct 1997, --Ben Horner-- wrote:

-+2) Another small question the rollor in circlemud returns 6 values
-+(1-18), stored in table, why does table[0], table[1], value return higher
-+values? where is this setting?, I have notcied that this must be set on
-+purpose because for sorcerers there roll for int is table[0], but thieves
-+use dex as table[0], and warriors con table[0].

Look at roll_real_abils() in class.c, this does it right here:

  for (k = 0; k < 6; k++)
    if (table[k] < temp) {
      temp ^= table[k];
      table[k] ^= temp;
      temp ^= table[k];

This swaps temp and table[k]'s values.  So if temp was 6, and
table[k] was 5, it'd swap it so that temp was 5 and table[k] was
6, and continue through swapping the variables so that the highest
are at the front...of course, it's a kindof strange way to do
things, but it actually does work (when implemented properly). :)

Daniel Koepke -:- -:-  [Shadowlord/Nether]

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/08/00 PST