Page 1 of 1

Rules for System Timers

Posted: Tue Dec 04, 2012 12:57 pm
by John Adams
I finally broke down and asked my C++ guys at work what it is called when you have a function "ZoneServer(...)", then a colon ":" followed by parameters "regenTimer(6000)" and then the code starts "{". I had no idea how to google this, because I didn't know what it was called. Apparently, they are known as Default Values

http://www.cplusplus.com/forum/beginner/30983/

Now that I know this, and the reason this is in the Rules forum, is because one of my TODO's is to enhance the rules system by allowing configurable timers without forcing a recompile. I learned that all of these default values would function just the same if they were down in the body of the constructor, too... and apparently, this is just a matter of preference (LE's original design).

If I wanted a regenTimer to actually be 3000, I'd have to change the value and recompile the code.

My idea is to make this a Rule, and call it from within the constructor (or actually a function call from the constructor to "Init()" or something safe), and set these timers based on our Rules System.

I am posting this question to see if our devs see anything wrong with this concept, or if I am missing something. This comes about because I was designing how to add a timer for Zone Weather, a TODO in 0.7.3 coming up next year. While I am here, maybe it would be a good time to Rule-ify these Zone and World timers?

Example:
Remove regenTimer(6000) from ZoneServer() : regenTimer(6000) and put it into the constructor like this:

Code: Select all

	regenTimer.Start(rule_manager.GetGlobalRule(R_Zone, RegenTimer)->GetInt32());
(which of course, could be incorrect and likely needs to be in an Init() call instead, but just for-exampling)

What do you think?

Re: Rules for System Timers

Posted: Tue Dec 04, 2012 7:10 pm
by Scatman
I don't see a problem with this. At least not right now :P

Re: Rules for System Timers

Posted: Wed Dec 05, 2012 10:50 am
by John Adams
LOL Scat, well it compiles, so it must be good!

I'll be working on this the next couple days, and if testing goes okay I will commit for you guys to try, too.