Re: [BUG][CODE]Bug in do_time in bpl>=15

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 01/06/01


On Sat, 6 Jan 2001, Peter Ajamian wrote:

> If you want to account for this you can modify the first if statement
> in my code as follows...

I actually did this without even thinking about it, since I retyped it
rather than cut-and-pasted.  Never noticed your version did not.  Mine is:

  ord = day % 100;
  suf = "th";

  if ((ord / 10) != 1) {
    switch (ord % 10) {
    case 1:
      suf = "st";
      break;
    case 2:
      suf = "nd";
      break;
    case 3:
      suf = "rd";
      break;
    }
  }

But, as you pointed out, there's no need to store the digit we're
switching on for the ordinal, so I'll use your second version:

  suf = "th";

  if (((day % 100) / 10) != 1) {
    switch (day % 10) {
    case 1:
      suf = "st";
      break;
    case 2:
      suf = "nd";
      break;
    case 3:
      suf = "rd";
      break;
    }
  }

The reason for supporting more than what stock does in this is that,
ideally, CircleMUD should be easy to change without having to track down a
bunch of little glitches resulting from the change.  do_time() and the
associated code is actually a place that deserves some additional work.
I'll deal with it later, unless someone wants to supply a patch to move
the hard-coded mud-time numbers (e.g., 35 is the number of days in a
month, 7 is the number of days in a week) into #defines in structs.h.

-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/03/01 PST