In order to avoid creating strings and doing lots of string comparisons, readnode uses a variable length id-to-id mapping table that allows it to just compare the internal ids that RELOAD Nodes have. But that table (or rather the relevant entries in it) needs to be created the first time it's used. Each function has a different set of node names it uses in a readnode and thus asks to have inserted in the table. The bug was that memory allocation was only done the first time any function containing a readnode needed the table, rather than any time entries need to be updated.
Most uses of READNODE probably aren't so performance critical that this approach helps. But I guess the real premature optimisation was only updating the entries in the table needed for the *current* function rather than just building a table that can be used from any function. At some point I want to rewrite this system and simplify. On 4 December 2013 15:10, James Paige <[email protected]> wrote: > Yay! Thanks for the fix. > > I read over the changes, but it went a bit over my head. But I am very glad > it is fixed. > > Working with reload is getting pretty pleasant. I am getting more > comfortable with using it. > > --- > James > > > > On Tue, Dec 3, 2013 at 5:42 PM, Ralph Versteegen <[email protected]> wrote: >> >> Whoops, that was a pretty serious bug. Took me a while to understand. >> >> On 4 December 2013 06:40, James Paige <[email protected]> wrote: >> > tmc, I have a puzzling READNODE error that I don't understand. >> > >> > If you open an rpg file that does not yet have any purchase information, >> > and >> > try to add a new product, the product node will be added to the >> > general.reld >> > reload document, but the purchase menu will not refresh properly. This >> > debug >> > warning appears in c_debug.txt >> > >> > customsubs.rbas:5420, in edit_purchase_options_rebuild_menu: unexpected >> > node >> > products:/prod >> > >> > If you try several times to add new products, the nodes will be added, >> > but >> > the above warning will repeat. >> > >> > If you exit saving changes and re-open the rpg file, the product nodes >> > will >> > now appear in the purchase menu, and the "Add new product" button will >> > now >> > work normally with no problems. >> > >> > --- >> > James >> > >> > >> > _______________________________________________ >> > Ohrrpgce mailing list >> > [email protected] >> > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org >> > >> _______________________________________________ >> Ohrrpgce mailing list >> [email protected] >> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > > > > _______________________________________________ > Ohrrpgce mailing list > [email protected] > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
