npc equipment don't save

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

npc equipment don't save

Postby Urza » Tue Apr 27, 2010 4:51 am

Hi,
the command
Code: Select all
/mob equiptemplate save <EquipmentTemplateID>
don't work any longer.
New Templates don't save into database "npcequipment" without error message.

Please can anybody help?

greetings urza
User avatar
Urza
Developer
 
Posts: 671
Joined: Sun Jan 23, 2005 11:15 am
Website: http://www.juwesch.eu
Location: Germany/Delitzsch

Re: npc equipment don't save

Postby Urza » Fri Apr 30, 2010 4:52 am

Hi,
it don't works since Patch 2311.
greetings urza
User avatar
Urza
Developer
 
Posts: 671
Joined: Sun Jan 23, 2005 11:15 am
Website: http://www.juwesch.eu
Location: Germany/Delitzsch

Re: npc equipment don't save

Postby Graveen » Fri Apr 30, 2010 7:37 am

Hi Urza,

Can you detail me a procedure to reproduce the bug ? i tested 4 days ago - in fact just before your message - and it was working fine for me.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: npc equipment don't save

Postby Urza » Fri Apr 30, 2010 8:27 am

Hi Graveen,
I proceed as follows:

Code: Select all
/mob equiptemplate create
/mob equiptemplate add...
...
...
/mob equiptemplate close
/mob equiptemplate save test


then i get this message:
Code: Select all
Target mob equipment template is saved as  'test'


but in the table "npcequipment" is no entry with TemplateID "test" and if restart my server the NPC is "naked" :oops:
greetings urza
User avatar
Urza
Developer
 
Posts: 671
Joined: Sun Jan 23, 2005 11:15 am
Website: http://www.juwesch.eu
Location: Germany/Delitzsch

Re: npc equipment don't save

Postby Tolakram » Fri Apr 30, 2010 12:15 pm

Fixed.

Get latest revision.

Graveen, we need to review the intent of setting autosave to false, which prevents tables from adding objects. Urza, there is a warning from ObjectDatabase that will appear in your log: AddObject called on DataObject when AutoSave is False: table name

If you see any more of these let me know. I thought I have fixed all the instances, but I missed this one.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: npc equipment don't save

Postby Graveen » Fri Apr 30, 2010 12:53 pm

IIRC i let AutoSave to default = true (due to code design) and only enabled it on some rare cases. Basically, while itemtemplate is aimed at readonly table, autosave = false was suitable but... /item command need to save items.

The important point to consider is AutoSave was not used at all. Reenabling it helped my to fiabilize the process on Inventory, but basically, all tables could get rid of it, because the "save or not" is normally code controled - thus AutoSave is only a safety flag, certainly why it was removed.

I see you set some tables to AutoSave = false with the transaction & cache update. not sure how you use it, but if it bothers, don't set it explicitely (so AS = true) can be suitable.

Anyway, i think there should not be so much tables remaining where we need to set AutoSave to false in purpose. Basically, tables are used in R/W mode, while some that should be readonly (itemtemplate, npcequipment, npctemplate, mob, mobxloottemplate...) can be modified from ig with admin commands.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: npc equipment don't save

Postby Tolakram » Fri Apr 30, 2010 12:56 pm

I didn't set it to false .. . unless I'm losing my mind :)

Aha.

http://dolserver.svn.sourceforge.net/vi ... 02&r2=2311

It looks like many tables were bugged due to autosave being declared as a local static var and most likely not used at all. As soon as the local variable was removed during the refactoring this problem appeared. The code change above, while looking similar, actually changes the behavior and breaks the save.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: npc equipment don't save

Postby Graveen » Fri Apr 30, 2010 1:39 pm

Oh, sorry i thought 2329 was introducing AutoSave=false to NPCE, but it is not the case. This comes to my mind because i successfully checked - when i was fixing some bugs -the npcequipment behaviour and i got in the db what i expected. I certainly catch the change for an already in the db equipment.

In 2311, i moved the need of declaring static autosave & dirty to a possible override of the base class (and not a mandatory parameter as the default behaviour is generally identical).

Basically, are thee tables that must be autosave = false ? tables you don't want to allow AddObject() ?

Or, another possibility is AutoSave was used to tell the periodic tables save what tables should be saved into ? Because we have a readonly attribute iirc. Anyway, as it was not used in the code, it was not a problem, but perhaps the name is ambiguous for now. ;)
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: npc equipment don't save

Postby Tolakram » Fri Apr 30, 2010 2:04 pm

Name should probably be something like AllowSave which indicates exactly what it does.

And I'm not sure where or when it would be used, if at all.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: npc equipment don't save

Postby Graveen » Fri Apr 30, 2010 6:34 pm

At least in Inventory, and yes, we could get rid of it easily with an instance variable.

Conclusion: good bye, AutoSave. You 'll not miss us.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: npc equipment don't save

Postby Urza » Sat May 01, 2010 8:55 am

Hi,
thanks to all, now it works again correctly.
greetings urza
User avatar
Urza
Developer
 
Posts: 671
Joined: Sun Jan 23, 2005 11:15 am
Website: http://www.juwesch.eu
Location: Germany/Delitzsch

Re: npc equipment don't save

Postby stephenxpimentel » Sat May 01, 2010 3:09 pm

Tolakram wrote:Name should probably be something like AllowSave which indicates exactly what it does.

And I'm not sure where or when it would be used, if at all.


lmao agreed mark, I always set autosave to true in the custom DB tables, now i'm glad i did... even though the only reason i thought it would be needed is because if i didn't it wouldn't save correctly and i'd lose data... completely wrong but atleast i set it true, because it was always stuff that changed constantly. :D
Lets have some fun.
stephenxpimentel
Contributor
 
Posts: 1300
Joined: Wed Sep 19, 2007 5:09 pm

Re: npc equipment don't save

Postby Urza » Sun May 02, 2010 1:01 pm

Sorry Guys,
but is also in tables "PathPoints" and "Path".
New Path don't save.

greetings urza
User avatar
Urza
Developer
 
Posts: 671
Joined: Sun Jan 23, 2005 11:15 am
Website: http://www.juwesch.eu
Location: Germany/Delitzsch

Re: npc equipment don't save

Postby Tolakram » Sun May 02, 2010 4:00 pm

Fixed.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9189
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest