The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

minor ... something ... in nanny.cpp

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Dawn Of Time Forum Index » Incorrectly reported 'suspect bugs' within the actual codebase
View previous topic :: View next topic  
Author Message
derek



Joined: 23 Sep 2007
Posts: 125

PostPosted: Sun Jan 03, 2010 3:12 pm    Post subject: minor ... something ... in nanny.cpp Reply with quote

This doesn't appear to be causing any trouble, but I while I was poking around in nanny.cpp today, I noticed this bit of the switch in void nanny( connection_data *d, char *argument ) appear to be reversed in the order they are called. This code is the same in 1.69R, as well.
Code:
      case CON_GET_NEW_CLASS:         nanny_get_new_class(d, argument); break;
      case CON_REROLL_STATS:         nanny_reroll_stats(d, argument); break;


Back to top
View user's profile Send private message
Blackout



Joined: 16 Aug 2003
Posts: 26

PostPosted: Wed Mar 10, 2010 10:37 pm    Post subject: Reply with quote

Ermm, in a case switch with breaks it doesn't matter which order the entries are hit. Each entry in a case switch represents an exclusive possibility. It will be CON_GET_NEW_CLASS ooor CON_REROLL_STATS, it will in theory, never be both. As a result, if it were at the top of the switch or at the bottom, it would still only be possible to hit it in one situation. The only time in a case switch that order of cases matters is when a case has no break statement and has a case after it like so:

Code:

switch(test){
case 1: function_1(info);
case 2: function_2(info);
             break;
}


In the above situation, if test is 1, it will do function_1 and then do function_2 and then hit a break. If test is 2, it will only do function_2 before hitting a break. Ah, the beauty of case switches.



_________________
"I could really get around to hating you if I didn't procrastinate so much."

The Third Turning Mud -- Wheel of Time Reimagined
tangent.dune.net 5600
Shaitan, Owner/Head Implementor
Back to top
View user's profile Send private message Send e-mail
derek



Joined: 23 Sep 2007
Posts: 125

PostPosted: Thu Mar 11, 2010 12:55 pm    Post subject: Reply with quote

Yeah, it's not a problem, exactly, it's just inconsistent. nanny's already confusing enough without adding needlessly to the confusion, imo.

Of course, maybe it helps encourage people to avoid screwing around with it too much in the first place Wink


Back to top
View user's profile Send private message
Daos



Joined: 29 Jan 2003
Posts: 1216
Location: United States

PostPosted: Sun Mar 21, 2010 5:46 am    Post subject: Reply with quote

derek wrote:
nanny's already confusing enough without adding needlessly to the confusion, imo.


Heh, I know what you mean. I remember dealing with that file when adding additional creation options. It definitely can be a headache.



_________________
- Daos

http://www.dawnoftime.org
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kalahn
Codebase Developer


Joined: 18 Jan 2003
Posts: 710
Location: New Zealand

PostPosted: Sat Sep 04, 2010 10:39 pm    Post subject: Reply with quote

As discussed, makes no functional difference, I have swapped them over for the next release to help new coders.

- Kal


Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    The Dawn Of Time Forum Index » Incorrectly reported 'suspect bugs' within the actual codebase All times are GMT + 13 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin