@@ -170,6 +170,7 @@ function alternative_manage_views(x1, y1) {
170170 }
171171}
172172
173+ // / @mixin
173174function scr_ui_manage () {
174175 if (combat != 0 ) {
175176 exit;
@@ -684,153 +685,133 @@ function scr_ui_manage() {
684685 potential_tooltip = [];
685686 health_tooltip = [];
686687 promotion_tooltip = [];
687- var repetitions = min (man_max, man_see);
688688
689689 // tooltip text to tell you if a unit is eligible for special roles
690690
691691 if (!obj_controller.view_squad ) {
692+ var repetitions = min (man_max, man_see);
692693 man_count = 0 ;
694+
695+ var _specialist_slots = [
696+ {
697+ search_params: {},
698+ role_group_params: {
699+ group: " captain_candidates" ,
700+ location: " " ,
701+ opposite: false
702+ },
703+ purpose: $" {scr_roman_numerals()[managing - 1]} Company Captain Candidates" ,
704+ purpose_code: " captain_promote" ,
705+ button_text: " New Captain Required" ,
706+ unit_check: " captain"
707+ },
708+ {
709+ search_params: {
710+ stat: [[" weapon_skill" , 44 , " more" ]]
711+ },
712+ role_group_params: {
713+ group: [SPECIALISTS_STANDARD, true , true ],
714+ location: " " ,
715+ opposite: true
716+ },
717+ purpose: $" {scr_roman_numerals()[managing - 1]} Champion Candidates" ,
718+ purpose_code: " champion_promote" ,
719+ button_text: " Champion Required" ,
720+ unit_check: " champion"
721+ },
722+ {
723+ search_params: {
724+ companies: managing
725+ },
726+ role_group_params: {
727+ group: [SPECIALISTS_STANDARD, true , true ],
728+ location: " " ,
729+ opposite: true
730+ },
731+ purpose: $" {scr_roman_numerals()[managing - 1]} Company Ancient Candidates" ,
732+ purpose_code: " ancient_promote" ,
733+ button_text: " Ancient Required" ,
734+ unit_check: " ancient"
735+ },
736+ {
737+ search_params: {
738+ companies: [managing, 0 ]
739+ },
740+ role_group_params: {
741+ group: [SPECIALISTS_CHAPLAINS, false , false ],
742+ location: " " ,
743+ opposite: false
744+ },
745+ purpose: $" {scr_roman_numerals()[managing - 1]} Company Chaplain Candidates" ,
746+ purpose_code: " chaplain_promote" ,
747+ button_text: " Chaplain Required" ,
748+ unit_check: " chaplain"
749+ },
750+ {
751+ search_params: {
752+ companies: [managing, 0 ]
753+ },
754+ role_group_params: {
755+ group: [SPECIALISTS_APOTHECARIES, false , false ],
756+ location: " " ,
757+ opposite: false
758+ },
759+ purpose: $" {scr_roman_numerals()[managing - 1]} Company Apothecary Candidates" ,
760+ purpose_code: " apothecary_promote" ,
761+ button_text: " Apothecary Required" ,
762+ unit_check: " apothecary"
763+ },
764+ {
765+ search_params: {
766+ companies: [managing, 0 ]
767+ },
768+ role_group_params: {
769+ group: [SPECIALISTS_TECHS, false , false ],
770+ location: " " ,
771+ opposite: false
772+ },
773+ purpose: $" {scr_roman_numerals()[managing - 1]} Company Tech Marine Candidates" ,
774+ purpose_code: " tech_marine_promote" ,
775+ button_text: " Tech Marine Required" ,
776+ unit_check: " tech_marine"
777+ },
778+ {
779+ search_params: {
780+ companies: [managing, 0 ]
781+ },
782+ role_group_params: {
783+ group: [SPECIALISTS_LIBRARIANS, false , false ],
784+ location: " " ,
785+ opposite: false
786+ },
787+ purpose: $" {scr_roman_numerals()[managing - 1]} Company Librarian Candidates" ,
788+ purpose_code: " librarian_promote" ,
789+ button_text: " Librarian Required" ,
790+ unit_check: " lib"
791+ }
792+ ];
793+
794+ command_slots_count = array_length (_specialist_slots);
795+
693796 if (managing > 0 && managing <= 10 ) {
694- var captain_exists = company_data.captain != " none" ;
695- var champion_exists = company_data.champion != " none" ;
696- var ancient_exists = company_data.ancient != " none" ;
697- var chaplain_exists = company_data.chaplain != " none" ;
698- var apothecary_exists = company_data.apothecary != " none" ;
699- var techmarine_exists = company_data.tech_marine != " none" ;
700- var librarian_exists = company_data.lib != " none" ;
701- }
702- var _clicked = false ;
703- for (var i = 0 ; i < repetitions; i++) {
704- if (managing > 0 && managing <= 10 && (!captain_exists || !champion_exists || !ancient_exists || !chaplain_exists || !techmarine_exists || !apothecary_exists || !librarian_exists)) {
705- if (!captain_exists) {
706- _clicked = role_slot_draw (xx, yy, " Captain Required" );
707- if (_clicked) {
708- role_slot_assign ({}, {
709- group: SPECIALISTS_CAPTAIN_CANDIDATES,
710- location: " " ,
711- opposite: false
712- }, $" {scr_roman_numerals()[managing - 1]} Company Captain Candidates" , " captain_promote" );
713- }
714- yy += 20 ;
715- captain_exists = true ;
716- if (managing == -1 ) {
717- exit;
718- }
719- continue ;
720- }
721- if (!champion_exists) {
722- _clicked = role_slot_draw (xx, yy, " Champion Required" );
723- if (_clicked) {
724- role_slot_assign ({
725- companies: managing,
726- " stat" : [
727- [" weapon_skill" , 44 , " more" ]
728- ]
729- }, {
730- group: [SPECIALISTS_STANDARD, true , true ],
731- location: " " ,
732- opposite: true
733- }, $" {scr_roman_numerals()[managing - 1]} Champion Candidates" , " champion_promote" );
734- }
735- yy += 20 ;
736- champion_exists = true ;
737- if (managing == -1 ) {
738- exit;
739- }
740- continue ;
741- }
742- if (!ancient_exists) {
743- _clicked = role_slot_draw (xx, yy, " Ancient Required" );
744- if (_clicked) {
745- role_slot_assign ({
746- companies: managing
747- }, {
748- group: [SPECIALISTS_STANDARD, true , true ],
749- location: " " ,
750- opposite: true
751- }, $" {scr_roman_numerals()[managing - 1]} Company Ancient Candidates" , " ancient_promote" );
752- }
753- yy += 20 ;
754- ancient_exists = true ;
755- if (managing == -1 ) {
756- exit;
757- }
758- continue ;
759- }
760- if (!chaplain_exists) {
761- _clicked = role_slot_draw (xx, yy, " Chaplain Required" );
797+ for (var r = 0 ; r < array_length (_specialist_slots); r++) {
798+ var role = _specialist_slots[r];
799+ if (company_data[$ role.unit_check ] == " none" ) {
800+ var _clicked = role_slot_draw (xx, yy, role.button_text );
762801 if (_clicked) {
763- role_slot_assign ({
764- companies: [managing, 0 ]
765- }, {
766- group: [SPECIALISTS_CHAPLAINS, false , false ],
767- location: " " ,
768- opposite: false
769- }, $" {scr_roman_numerals()[managing - 1]} Company Chaplain Candidates" , " chaplain_promote" );
802+ role_slot_assign (role.search_params , role.role_group_params , role.purpose , role.purpose_code );
770803 }
771804 yy += 20 ;
772- chaplain_exists = true ;
773805 if (managing == -1 ) {
774806 exit;
775807 }
776- continue ;
777- }
778- if (!apothecary_exists) {
779- _clicked = role_slot_draw (xx, yy, " Apothecary Required" );
780- if (_clicked) {
781- role_slot_assign ({
782- companies: [managing, 0 ]
783- }, {
784- group: [SPECIALISTS_APOTHECARIES, false , false ],
785- location: " " ,
786- opposite: false
787- }, $" {scr_roman_numerals()[managing - 1]} Company Apothecary Candidates" , " apothecary_promote" );
788- }
789- yy += 20 ;
790- apothecary_exists = true ;
791- if (managing == -1 ) {
792- exit;
793- }
794- continue ;
795- }
796- if (!techmarine_exists) {
797- _clicked = role_slot_draw (xx, yy, " Tech Marine Required" );
798- if (_clicked) {
799- role_slot_assign ({
800- companies: [managing, 0 ]
801- }, {
802- group: [SPECIALISTS_TECHS, false , false ],
803- location: " " ,
804- opposite: false
805- }, $" {scr_roman_numerals()[managing - 1]} Company Tech Marine Candidates" , " tech_marine_promote" );
806- }
807- yy += 20 ;
808- techmarine_exists = true ;
809- if (managing == -1 ) {
810- exit;
811- }
812- continue ;
813- }
814- if (!librarian_exists) {
815- _clicked = role_slot_draw (xx, yy, " Librarian Required" );
816- if (_clicked) {
817- role_slot_assign ({
818- companies: [managing, 0 ]
819- }, {
820- group: [SPECIALISTS_LIBRARIANS, false , false ],
821- location: " " ,
822- opposite: false
823- }, $" {scr_roman_numerals()[managing - 1]} Company Librarian Candidates" , " librarian_promote" );
824- }
825- yy += 20 ;
826- librarian_exists = true ;
827- if (managing == -1 ) {
828- exit;
829- }
830- continue ;
808+ repetitions--;
831809 }
832810 }
833-
811+ }
812+
813+ for (var i = 0 ; i < max (0 , repetitions); i++) {
814+
834815 if (sel >= array_length (display_unit)) {
835816 break ;
836817 }
0 commit comments