Register for your free account! | Forgot your password?

You last visited: Today at 11:55

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C++] Event Bugfix

Discussion on [C++] Event Bugfix within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2014
Posts: 268
Received Thanks: 373
[C++] Event Bugfix

Hey,

German:

English (not perfect ):

#UPDATE#:
I've written an example code to demonstrate you the bug in an easier way (at least for ppl who can program a bit).
Example result of the output WITHOUT my fix:
Example result of the output WITH my fix:
I added the 2 example files in the appendix - you just has to include the file "ExampleEventbug.h" in your cmd.cpp, write a function like this:
Code:
ACMD (do_call_example_script)
{
	CallExampleScript(ch);
}
And add the function into the command-list; just add the following code in the "cmd_info"-array:
Code:
{ "call_example_script",	do_call_example_script,	0,	POS_DEAD,	GM_IMPLEMENTOR },
Now you can go ingame (after compiling) and check out the output when you enter "/call_example_script" with and without my fix - you'll see same results as i've shown you in the screens. So without the 2. event won't be executed and with it will be.
#END OF UPDATE#

Vielleicht hilft es ja dem Einen oder Anderem

Kind Regards
Attached Files
File Type: rar Update.rar (665 Bytes, 103 views)
Lefloyd is offline  
Thanks
17 Users
Old 11/15/2014, 23:59   #2

 
.Raicon's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 1,033
Received Thanks: 1,168
Wie gewohnt, schlicht und einfach erklärt.

Danke für das Release.


LG .Raicon
.Raicon is offline  
Old 11/16/2014, 01:44   #3
 
.BasH^#'s Avatar
 
elite*gold: 0
Join Date: May 2010
Posts: 221
Received Thanks: 65
Danke ich war schon am verzweifeln
.BasH^# is offline  
Thanks
1 User
Old 11/16/2014, 05:55   #4
 
LovecKrys's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 210
Received Thanks: 199
And now in english.
LovecKrys is offline  
Old 11/16/2014, 06:29   #5
 
elite*gold: 0
Join Date: Jan 2014
Posts: 268
Received Thanks: 373
Added in english. If someone wanna write a better english translation - he may.
Lefloyd is offline  
Thanks
2 Users
Old 11/17/2014, 12:06   #6
 
elite*gold: 0
Join Date: Jan 2014
Posts: 268
Received Thanks: 373
#UPDATE#
I've got a request to give you an example for the bug - maybe I was a bit inaccurate in describing it. Well, I've added an example-file that you can compile and see how the fix works.

Kind Regards
Lefloyd is offline  
Old 11/17/2014, 15:19   #7
 
lollo_9_1's Avatar
 
elite*gold: 100
Join Date: Jun 2009
Posts: 168
Received Thanks: 711
Quote:
Originally Posted by Lefloyd View Post
#UPDATE#
I've got a request to give you an example for the bug - maybe I was a bit inaccurate in describing it. Well, I've added an example-file that you can compile and see how the fix works.

Kind Regards
I tried the code inside the ExampleEventbug.cpp file, but it worked fine without using your fix: (I just pasted it inside cmd.cpp)

It's a test server so, that character is the only one logged in. (I tried to spawn mobs/kill them/kill regen-spawned mobs/pull all/respawn all, but it didn't get bugs)

If we consider your two screenshots (1. 2. ) we can easily figure out that event1 and event2 are pointing to the same queueElementPtr. So, when you call event_cancel(&f_pkEvent1); you are instead calling event_cancel(&f_pkEvent2);, due to an incrementing issue that moves f_pkEvent1 to f_pkEvent1"-1" and f_pkEvent2 (f_pkEvent1"+1" in theory) to f_pkEvent1. (f_pkEvent1->q_el-1 to be more precise) (is this what you wrote above in the first post?)
Why? When you call f_pkEvent2 = event_create(example_event2, info, PASSES_PER_SEC(3)); you're adding a new event in the event list using the function, which adds the event at the end of the list if it doesn't find a clone (or a greater one, but I don't think this is the case), which means you already have this event in your event list and you, but only you, got this bug due to a weird implementation you made.
If other people got this bug using not-so-modded-source-files, maybe the trigger of such issue is to refer to something else. I haven't got it yet.
I don't think a trivial the_event->q_el = NULL; could make the difference in there. (it's just a pointer, otherwise we would have thought about an overloaded assignment operator fault)

Speaking of which, is dominion_manager.cpp part of the files to test or did you put it in the .rar instead of ExampleEventbug.h?
lollo_9_1 is offline  
Thanks
2 Users
Old 11/17/2014, 15:34   #8
 
elite*gold: 0
Join Date: Jan 2014
Posts: 268
Received Thanks: 373
Thanks for your reply lollo_9_1, that what you explained was that what I tried to explain. I also thought when I found out the source of the bug that the bug would not be there ANY time because some times the address will be refered by some other things before the new create_event is called, but in my files it occurs when I don't add my fix. And yes, this NULL set will fix the bug (when it would occur) because the event_cancel set's the "bCancel" variable in the queueElement that is refered through "q_el" from the eventPtr. If the eventPtr has the reference of the queueElement of another event (the new event) it will cancel it - if there is a NULL pointer it will do nothing. That's why this fix works. And yes, it won't occur everytime but it CAN occur - I know this for sure because it does occur at my files if I haven't changed the position of the NULL pointer setting..

I hope you understand what I'm trying to say, I knew why the error came (I explained it in my first post) I just send the pictures to show you what the results can be like.

€dit: And no, the dominion_manager wasn't a part of the example, sorry for uploading it.^^ I've already deleted it in the rar-file.
€dit2: And why it doesn't work at you (the error) is because your queueElementPtr hadn't be the same - maybe it's also different from system to system if the bug occurs. But there can be the case, that it occurs.^^
€dit3: Aaand without my fix I'd wonder if he wouldn't set the bCancel of a address which is already destroyed... and I can't believe that this is good

Kind Regards
Lefloyd is offline  
Old 11/17/2014, 19:05   #9
 
.iRyan's Avatar
 
elite*gold: 850
Join Date: Nov 2014
Posts: 63
Received Thanks: 79
Thanks for this release!
.iRyan is offline  
Reply


Similar Threads Similar Threads
3.3.5a Mangos BugFix
01/07/2013 - WoW Private Server - 6 Replies
Hallo, Mir sind heute auf meinem Server drei Bugs aufgefallen einmal am Luftschift in der ICC stehen keine NPCS der globlin für die rakete und der andere dass es losfährt. Dann konnte mit meinem Pala keine Plattenrüsstung in Dala kaufen es wurde zwar Platte angezeigt aber ich konnte sie net tragen... Und dann auf der GM Insel waren keinerlei NPC`s Wie behebt man den solche Bugs wo genau muss man da suchen ?
Bugfix für den Relogbug
12/23/2012 - 4Story - 7 Replies
Moin ich wollt mal fragen ob einer von euch den Fix für den "items sind nach relog weg bug" kennt und ihn verrät da es echt nervt wenn man normal spielen möchte mfg ;D
[PHP] Bugfix suche
06/28/2010 - Web Development - 4 Replies
Hallo leute, ich hab hier ein kleines Script geschrieben class mysql { function verbindung($server,$name,$pw) { mysql_connect($server,$name,$pw); } function datenbankauswahl($auswahl)



All times are GMT +2. The time now is 11:55.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.