Skip to content

Commit

Permalink
bug fix in dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
Manticore-007 committed Jul 23, 2023
1 parent fefa249 commit 3710e34
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "openrct2-peep-editor",
"author": "Manticore-007",
"license": "MIT",
"version": "23.5.17",
"version": "23.7.23",
"description": "",
"main": "app.js",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions src/helpers/selectedPeep.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { staffType } from "../enums/staffTypes";

export let selectedPeep: Guest|Staff;
let selectedStaff: Staff;
export let selectedStaffType: number = -1;
export let selectedStaffCostume: number = -1;

export function setSelectedPeep(entity: Guest|Staff): void
{
selectedPeep = entity;
selectedStaff = <Staff>selectedPeep
selectedStaffCostume = selectedStaff.costume;
selectedStaffType = staffType.indexOf(selectedStaff.staffType);
}
3 changes: 3 additions & 0 deletions src/helpers/staffGetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { colourList } from "../enums/colours";
import { costume } from "../enums/costumes";
import { staffTypeLabel } from "../enums/staffTypes";
import { sideWindow } from "../ui/sideWindow";
import { selectedStaffCostume, selectedStaffType } from "./selectedPeep";
import { disableUpdateCoordinates, disableUpdateEnergy, disableUpdateStaffColour, updateCoordinates, updateEnergy, updateStaffColour } from "./updates";
import { windowId } from "./windowProperties";

Expand All @@ -26,6 +27,7 @@ export function getColourStaff(staff: Staff): void
export function getCostume(staff: Staff): void
{
const dropdown = ui.getWindow(sideWindow).findWidget<DropdownWidget>("dropdown-costume");
dropdown.selectedIndex = selectedStaffCostume;
if (staff.costume > 251) {
dropdown.text = costume[staff.costume - 208];
}
Expand All @@ -36,6 +38,7 @@ export function getStaffType(peep: Staff): void
{
const dropdown = ui.getWindow(sideWindow).findWidget<DropdownWidget>("dropdown-staff-type");
dropdown.text = staffTypeLabel[peep.staffType];
dropdown.selectedIndex = selectedStaffType;
}

export function getCoordinates(staff: Staff): void
Expand Down

0 comments on commit 3710e34

Please sign in to comment.