Re: [AD] patch for config.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Chris a écrit :

> This seems to be my biggest beef with the current config system.
> There's no way I can use the original allegro.cfg loaded by
> allegro_init (or wherever), but also have another mygame.cfg that can
> override some of those values with game-specific ones, and to have
> new/modified values written to mygame.cfg (they would go into
> allegro.cfg). 

It *can* be done with the current system, although this is not obvious. Here's
how I did it in my dialog editor:

  /* set the config file to dlg.cfg, keeping allegro.cfg as an override */
  char allegro_cfg_path[1024], tmp[256];
  set_config_file("mygame.cfg");
  if (find_allegro_resource(allegro_cfg_path,
                            uconvert_ascii("allegro.cfg", tmp),
                            0, 0, 0, 0, 0, sizeof(allegro_cfg_path)) == 0)
      override_config_file(allegro_cfg_path);

-- 
Julien Cugnière




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/