Go Back   RunUO - Ultima Online Emulation > RunUO > Core Modifications > Other

Other Cant find a category above, use this one! Core mods not listed above go here!

Reply
 
Thread Tools Display Modes
Old 06-30-2007, 04:02 PM   #1 (permalink)
Forum Expert
 
Ohms_Law's Avatar
 
Join Date: Sep 2004
Age: 37
Posts: 1,006
Default Multiple Processor test logic in Main()

In the Main method (svn 187), there's some logic to test for multiple processors. The original code is all at the (relative) beginning of the main method (starts at ~ line 410):

Code:
			int processorCount = Environment.ProcessorCount;

			if( processorCount > 1 )
				m_MultiProcessor = true;

			if( m_MultiProcessor || Is64Bit )
				Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", processorCount, processorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" );

			m_ProcessorCount = processorCount;
For the field definitions, the original is:
Code:
		private static bool m_MultiProcessor;
		private static int m_ProcessorCount;
it's probably better to do:
Code:
        private static bool m_MultiProcessor;

        public static bool MultiProcessor
        {
            get
            {
                if(Environment.ProcessorCount > 1)
                    m_MultiProcessor = true;
                else
                    m_MultiProcessor = false;
                return m_MultiProcessor;
            }
            set
            {
                m_MultiProcessor = value;
            }
        }
(hungarian notation... *puke*)

and then all that's needed in the main method is:
Code:
            if(MultiProcessor || Is64Bit)
                Console.WriteLine("Core: Optimizing for {0} {2}processor{1}", processorCount, processorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "");
Ohms_Law is offline   Reply With Quote
Old 07-09-2007, 03:20 PM   #2 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
Default

Its all relative, but if your trying to point out these semi-useless quirks(which is all just coding preference tbh) why didnt you go into 100% constructive detail and just do

Code:
        public static bool MultiProcessor
        {
           get
            {
                return (Environment.ProcessorCount > 1);
            }
        }
remove the set, since you cant set your processor count in the fucking 1st place, remove m_MultiProcessor and m_ProcessorCount.... your picky...
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO

Last edited by Jeff; 07-09-2007 at 03:22 PM.
Jeff is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5