1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
private ["_locations","_sideID","_names","_skip","_curSel","_display","_map","_sorted"];
disableSerialization;
MenuAction = -1;
mouseButtonUp = -1;
_display = _this select 0;
_map = _display DisplayCtrl 19002;
if (isNull currentMission) then {ctrlSetText [19007,Format [localize "STR_WF_CurrentMission","N/A"]]} else {ctrlSetText [19007,Format [localize "STR_WF_CurrentMission",currentMission getVariable "name"]];};
_names = [];
_locations = [];
{_sideID = _x getVariable "sideID"; if (_sideID != sideID) then {_locations = _locations + [_x]}} forEach towns;
_sorted = [player,_locations] Call SortByDistance;
{_names = _names + [_x getVariable "name"]} forEach _sorted;
{lbAdd[19005,_x]} forEach _names;
if (count _sorted > 0) then {
lbSetCurSel[19005,0];
_map CtrlMapAnimAdd [2,.140,GetPos (_sorted select 0)];
CtrlMapAnimCommit _map;
};
while {alive player && dialog} do {
sleep 0.1;
if (Side player != sideJoined) exitWith {closeDialog 0};
if (!dialog) exitWith {};
//--- Accept Mision.
if (MenuAction == 1) then {
MenuAction = -1;
_skip = false;
if (!isNil "townTask") then {if (taskState townTask == "Succeeded") then {["TownRemove",currentMission] Call TaskSystem;currentMission = objNull}} ;
if (!isNull currentMission) then {hint (localize "STR_WF_Mission_Running");_skip = true};
if (!_skip) then {
_curSel = lbCurSel (19005);
currentMission = _sorted select _curSel;
ctrlSetText [19007,Format [localize "STR_WF_CurrentMission",currentMission getVariable "name"]];
//--- Task System.
["TownAdd",currentMission] Spawn TaskSystem;
};
};
//--- Abort Mision.
if (MenuAction == 2) then {
MenuAction = -1;
if (!isNull currentMission) then {
["TownRemove",currentMission] Call TaskSystem;
ctrlSetText [19007,Format [localize "STR_WF_CurrentMission","N/A"]];
currentMission = objNull;
hint (localize "STR_WF_Mission_Abort");
};
};
//--- Other Town selected.
if (MenuAction == 101) then {
MenuAction = -1;
_curSel = lbCurSel (19005);
CtrlMapAnimClear _map;
_map CtrlMapAnimAdd [2,.140,GetPos (_sorted select _curSel)];
CtrlMapAnimCommit _map;
};
};
|