> From: "Soren P. Skou" <serces@MUD.DK>
> Subject: [Code] 5 = 7?!?
>
>
> roomno = world[ch->in_room].number;
> ones = roomno % 10; /* 12345 = 5 */
> tmp = roomno / 10; /* 12345 = 1234 */
> tens = tmp % 10; /* 1234 = 4 */
> tmp = tmp / 10; /* 1234 = 123 */
> hundreds = tmp % 10; /* 123 = 3 */
> tmp = tmp / 10; /* 123 = 12 */
> thousands = tmp % 10; /* 12 = 2 */
> if (tmp > 0)
> tenthousands = tmp / 10; /* 12 = 1 */
> else
> tenthousands = 0;
>
> If anyone can see the error or find a better way, then please tell
> me. :) I'll update the portal/arcane name spell after that.
>
> *cry* Help.
>
> /Serces
>
Try it like this instead.
roomno = world[ch->in_room].number;
tenthousands = roomno / 10000;
tmp = roomno - tenthousands*10000;
thousands = tmp / 1000;
tmp = tmp - thousands * 1000;
hundreds = tmp / 100;
tmp = tmp - hundreds * 100;
tens = tmp / 10;
ones = tmp - tens * 10;
/Johan
+------------------------------------------------------------+
| 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/08/00 PST