New Look to Client.cpp
I recoded Client.cpp from the beginning to make the code flow better and to get rid of the 10000 mile long if then else loop that it had. What I do was replaced that with a switch that sent you to the function that holds the commands. There are 8 functions each of them represents a status on the server. (Normal,Privuser,Vprivuser,Questtroupe,GM,LeadGM,S erverOP, and VHServerOp). Each other these functions contains only the information for their status. It starts at the highest level that you can access, then is flows downhill from there until it gets to a Normal User. Let me explain: Your a GM and you use the command #kill (somemob) instead of having to go through every command trying to find the one it was looking for (like the old version did), it simply calls the function for that status group, and it retrieves it much faster since it has about 80% less information to sort through. If the command is a lower status command, it then goes down a step in the status chain to the next rung, and it looks for it there, and so on until it gets to the lowest one. Since most users dont have access to the large list of commands at the top there was no reason to have them search through it. Okies Im done rambling on hehe time to goto bed :) Anyways to sum it up this will save quite a bit of time and overhead by using this method.
Add the following to client.h: Code:
bool NormalUser(const char* message, const char* targetname); |
error compliing new client.cpp
C:\eqemusrc\zone\client.cpp(2357) : error C2248: 'RunQuery' : cannot access protected member declared in class 'Database'
C:\eqemusrc\zone\../common/database.h(263) : see declaration of 'RunQuery' C:\eqemusrc\zone\client.cpp(2862) : error C2248: 'RunQuery' : cannot access protected member declared in class 'Database' C:\eqemusrc\zone\../common/database.h(263) : see declaration of 'RunQuery' C:\eqemusrc\zone\client.cpp(2890) : error C2248: 'RunQuery' : cannot access protected member declared in class 'Database' C:\eqemusrc\zone\../common/database.h(263) : see declaration of 'RunQuery' C:\eqemusrc\zone\client.cpp(2922) : error C2248: 'RunQuery' : cannot access protected member declared in class 'Database' C:\eqemusrc\zone\../common/database.h(263) : see declaration of 'RunQuery' |
Oh oops I forgot to add another change I made. Change the following in database.h:
Code:
protected: Code:
bool RunQuery(const char* query, int32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, int32* affected_rows = 0, int32* errnum = 0, bool retry = true); Code:
else if ((strcasecmp(sep.arg[0], "#listpetition") == 0) && CheckAccess(cmdlevel, 100)) { Just do one or the other though. I recommend keeping the petition commands so you can handle petitions :P |
Use this version instead, it includes a fix for gms zoning into cshome.
|
All you have done is split the if statement into little bits. The cascading down routine is probably more in-efficient than the long if-then-else.
|
Not really, its still more efficient because with the old client.cpp, if the command was near the bottom it had to go through everyone of the statements before it. Now it only goes through the statements if it needs to.
|
All times are GMT -4. The time now is 06:34 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.