Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate non-default background positions from design.ini, allow 2.8-style default positions #352

Merged
merged 4 commits into from
Jan 9, 2021

Conversation

in1tiate
Copy link
Member

clang-format kinda messed up the diff, so here's what actually changed:

QStringList pos_list = {};
for (QString key : default_pos.keys()) {
  if (file_exists(ao_app->get_image_suffix(
          ao_app->get_background_path(default_pos[key]))) || // if we have 2.8-style positions, e.g. def.png, wit.webp, hld.apng
      file_exists(
          ao_app->get_image_suffix(ao_app->get_background_path(key)))) { // if we have pre-2.8-style positions, e.g. defenseempty.png
    pos_list.append(default_pos[key]);
  }
}
for (QString pos : ao_app->read_design_ini("positions", ao_app->get_background_path("design.ini")).split(",")) {
  if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(pos)))) {
    pos_list.append(pos);
  }
}

Per the title, this makes two non-breaking changes to the way pos_dropdown is populated.

  • Positions specified in a background's design.ini, separated with a comma like so:
    positions=def2,pro2,custom8
    
    will be added to pos_dropdown if the corresponding files exist.
  • The default positions (currently def, pro, wit, jud, hld, hlp, jur, and sea) previously checked only for AO1-style filenames (e.g. defenseempty, prohelperstand for def and hlp respectively) but will now check for 2.8-style filenames as well, allowing for the eventual removal of support for AO1-style hardcoded positions entirely down the road by providing a feasible alternative.

@in1tiate in1tiate added engine/assets Issues related to INI parsing, path resolution, and asset loading enhancement Request for functionality not present ui Issues related to the user interface (non-viewport related) labels Dec 16, 2020
@oldmud0 oldmud0 added this to the 2.9 milestone Dec 28, 2020
@oldmud0
Copy link
Member

oldmud0 commented Dec 28, 2020

How do you define an overlay (desk) for these custom positions?

@in1tiate
Copy link
Member Author

The overlay is supplied by an image named [position]_overlay - currently this is the only way to use overlays on custom positions.

Copy link
Contributor

@Crystalwarrior Crystalwarrior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, travis complaining about macos is annoying though

@Crystalwarrior Crystalwarrior merged commit 5b09dd4 into AttorneyOnline:master Jan 9, 2021
@in1tiate in1tiate deleted the pos-populate branch January 9, 2021 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine/assets Issues related to INI parsing, path resolution, and asset loading enhancement Request for functionality not present ui Issues related to the user interface (non-viewport related)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Populate position dropdown with locally available positions
3 participants