EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   Features.h (https://www.eqemulator.org/forums/showthread.php?t=26408)

Rocker8956 10-02-2008 01:58 PM

Features.h
 
Does anyone see an issue with me adding
#include "database.h" to Zone\features.h ?

If not should I put it before or after
Code:

#ifndef FEATURES_H
#define FEATURES_H

(Sorry if that was a dumb question)

I want to include database.h so some of the following are pulled from the database instead of hard coded

Code:

#define ZONE_AUTOSHUTDOWN_DELAY                5000
That will allow us to keep a dynamic zone open for longer than 5 seconds after it is empty (I think)

Some others that should probably be pulled from the database (unless it would add to much overhead)
Code:

//the min ratio at which a mob's speed is reduced
#define FLEE_HP_MINSPEED 10
//number of tics to try to run straight away before looking again
#define FLEE_RUN_DURATION 1000
//number of miliseconds between when a mob will check its flee state
//this is only checked when the mob is damaged.
#define FLEE_CHECK_TIMER 2000
#define HIGHEST_CAN_SET_SKILL 400

#define SKILL_MAX_LEVEL 75

#define SACRIFICE_MIN_LEVEL 50
#define SACRIFICE_ITEMID 9963

#define MIN_RANGED_ATK_RANGE 25

Some of these are probably no longer referenced in the code. (I did not have time to check them all) Also, there are a lot more in feature.h that I did not paste into this post.

Derision 10-02-2008 02:50 PM

Quote:

Originally Posted by Rocker8956 (Post 157528)

I want to include database.h so some of the following are pulled from the database instead of hard coded

Code:

#define ZONE_AUTOSHUTDOWN_DELAY                5000

Maybe I am misunderstanding, but you want to replace this with a Rule ?

In that case, you could just add, e.g.

Code:

RULE_INT ( Zone, ZoneAutoShutdownDelay, 5000 )
to common/ruletypes.h, delete the #define ZONE_AUTOSHUTDOWN_DELAY and then just replace any references to ZONE_AUTOSHUTDOWN_DELAY with RuleI(Zone, ZoneAutoShutdownDelay), and you don't need to include database.h in features.h.

Rocker8956 10-02-2008 03:46 PM

You understood me correctly. I must not be awake yet, need more coffee.
The rule would be the best way to go for the shutdown timer since it is only used a few times.

I was just thinking since so many things seem to be hard coded into features.h having them pulled from the database would allow for more customization. Though using rules or the variables (from the variables table) would work better since they are loaded when the server starts.

Changing it in features.h would help later if someone wants to adjust the way it is pulled. They would only need to change it in features.h instead of finding each reference.

Any thoughts?

Derision 10-02-2008 04:11 PM

I think all the examples from features.h you listed would be best done as rules. The variables table in the DB predates the Rules system and is generally considered as deprecated. Rules are superior because you can specifiy a default value in common/ruletypes.h, override them in the rule_values table, and update them on the fly (mostly) using the #rules reload command.

I would wait and see if KLS has an opinion before proceeding.


All times are GMT -4. The time now is 07:33 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.