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

Add: Marker texts are now localized to client #430

Merged
merged 22 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/cache/hd_cache.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if (isNil {_cache getVariable "btc_hd_cache"} && {_explosive} && {_damage > 0.6}
deleteVehicle btc_cache_obj;
_marker = createmarker [format ["btc_cache_%1", btc_cache_n], btc_cache_pos];
_marker setmarkertype "hd_destroy";
_marker setMarkerText format ["Cached %1 destroyed", btc_cache_n];
[_marker,{localize "STR_BTC_HAM_O_EH_HDCACHE_MRK"},btc_cache_n] remoteExec ["btc_fnc_set_markerText",0,true]; //Cached %1 destroyed
Copy link
Owner

Choose a reason for hiding this comment

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

remoteexec only client side (-2) not all (0).

Do it for all remoteexec :/

Copy link
Author

Choose a reason for hiding this comment

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

This is the reason for the execution on all machines.

A possible solution is this (for example):

[_marker,{localize "STR_BTC_HAM_O_EH_HDCACHE_MRK"},btc_cache_n] remoteExec ["btc_fnc_set_markerText", [0, -2] select isDedicated, true];

But so you have extra code.

// Vehicle needs assistance
_marker setMarkerSize [1, 1];
_marker setMarkerColor "ColorRed";
if (btc_debug_log) then {
Expand All @@ -38,4 +39,4 @@ if (isNil {_cache getVariable "btc_hd_cache"} && {_explosive} && {_damage > 0.6}
[0] remoteExec ["btc_fnc_show_hint", 0];

[] spawn {[] call btc_fnc_cache_find_pos;};
} else {0};
} else {0};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
params [
["_marker", ""],
["_text", ""],
["_arg", ""]
];
//only run on client
if (isDedicated) exitWith {};
Copy link
Owner

Choose a reason for hiding this comment

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

This function is only compiled client side so there are no way this function could be executed on isDedicated (https://github.com/1kuemmel1/HeartsAndMinds/blob/8dd845701e68a3e0309429e4a93bc6dcc75f175b/%3DBTC%3Dco%4030_Hearts_and_Minds.Altis/core/fnc/compile.sqf#L245).

As I understand, Guillustio choosed to only compile function where there are supposed to works. By this way, the loading is faster because there are less function to compile (only usefull function are compiled) and you avoid this type of check in every function and call :)

Copy link
Author

Choose a reason for hiding this comment

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

I am Sorry. That's my fault: I used this function in another project some month ago. And the snippets are remnant. I will remove them.


//check parameters
if !((typeName _marker) isEqualTo "STRING") then {_marker = str _marker;};
Copy link
Owner

Choose a reason for hiding this comment

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

createMarker only return string, nop?
Is there situation where this function is call by H&M with a _marker not a string ?

Copy link
Author

Choose a reason for hiding this comment

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

same as above


//check marker
if ((getMarkerPos _marker) isEqualTo [0,0,0]) exitWith {};
Copy link
Owner

Choose a reason for hiding this comment

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

This mean you can't create a marker at position [0,0,0].

Copy link
Author

Choose a reason for hiding this comment

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

same as above


//check text for localization code
if ((typeName _text) isEqualTo "CODE") then {
_text = call _text;
};

//set markerText
_marker setMarkerTextLocal format [_text, _arg];
1 change: 1 addition & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ if (!isDedicated) then {
btc_fnc_systemchat_debug = compile preprocessFileLineNumbers "core\fnc\common\systemchat_debug.sqf";
btc_fnc_show_hint = compile preprocessFileLineNumbers "core\fnc\common\show_hint.sqf";
btc_fnc_intro = compile preprocessFileLineNumbers "core\fnc\common\intro.sqf";
btc_fnc_set_markerText = compile preprocessFileLineNumbers "core\fnc\common\set_markerText.sqf";
Copy link
Owner

Choose a reason for hiding this comment

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

btc_fnc_set_markerTextLocal may be ?

Copy link
Author

Choose a reason for hiding this comment

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

Good idea I will change this.


//CIV
btc_fnc_civ_add_leaflets = compile preprocessFileLineNumbers "core\fnc\civ\add_leaflets.sqf";
Expand Down
3 changes: 1 addition & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/veh_killed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ _vehicle = _this select 0;
_marker = createmarker [format ["m_%1",_vehicle],getPos _vehicle];
_marker setMarkerType "mil_box";
_marker setMarkerColor "ColorRed";
_marker setMarkerText format [(localize "STR_BTC_HAM_O_EH_VEHKILLED_MRK"),getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName")]; // %1 wreck

[_marker,{localize "STR_BTC_HAM_O_EH_VEHKILLED_MRK"},(getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName"))] remoteExec ["btc_fnc_set_markerText",0,true];
Copy link
Owner

Choose a reason for hiding this comment

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

Why not a simple [_marker,"STR_BTC_HAM_O_EH_VEHKILLED_MRK",(getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName"))] remoteExec ["btc_fnc_set_markerText",0,true]; ?

Then in btc_fnc_set_markerText and check isLocalized ? instead of :

//check text for localization code
if ((typeName _text) isEqualTo "CODE") then {
    _text = call _text;
};

Do it for all remoteexec with {localize

Copy link
Author

Choose a reason for hiding this comment

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

done 😄

_vehicle setVariable ["marker",_marker];

if (isServer) then {btc_rep_malus_veh_killed spawn btc_fnc_rep_change} else {btc_rep_malus_veh_killed remoteExec ["btc_fnc_rep_change", 2];};
4 changes: 2 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/mil/hd_hideout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (_explosive && {_damage > 0.6}) then {

_marker = createmarker [format ["btc_hideout_%1_destroyed", _id], getpos _hideout];
_marker setmarkertype "hd_destroy";
_marker setMarkerText format ["Hideout %1 destroyed", _id];
[_marker,{localize "STR_BTC_HAM_O_EH_HDHIDEOUT_MRK"},_id] remoteExec ["btc_fnc_set_markerText",0,true]; //Cached %1 destroyed
_marker setMarkerSize [1, 1];
_marker setMarkerColor "ColorRed";

Expand All @@ -42,4 +42,4 @@ if (_explosive && {_damage > 0.6}) then {
//Notification
[2,count btc_hideouts] remoteExec ["btc_fnc_show_hint", 0];
if (btc_debug_log) then {diag_log format ["btc_fnc_mil_hd_hideout: _this = %1 ; POS %2 ID %3",_this,getpos _hideout,_id];};
} else {0};
} else {0};
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ btc_side_jip_data = [14,getPos _city1,_city1 getVariable "name"];
//// Create markers \\\\
_marker1 = createmarker [format ["sm_2_%1",getPos _city1],getPos _city1];
_marker1 setmarkertype "hd_flag";
_marker1 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"); //Convoy Start
[_marker,{localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Convoy Start
Copy link
Owner

@Vdauphin Vdauphin Nov 13, 2017

Choose a reason for hiding this comment

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

The JIP should be removed at the end of side mission see exemple 7.

You could handle this by two way :

  • [] remoteExec ["someScriptCommand", targets, Object or Group or netId ]; see the "JIP (Optional):" section in remoteexec

  • Or get the JIP ID returned by remoteexec and remove it in this function here. When the marker is deleted, delete also the JIP remoteexec you created (if no JIP ID use "").

    Something like this could work (I wrote the concept):

    {
      params ["_marker", "_JIP_ID"];
      deletemarker _marker;
      if !(_JIP_ID isequalto "") then remoteExec ["", _JIP_ID]; 
    } foreach [["marker name1", "JIP ID1"],["marker name2", "JIP ID2"]];
    

Copy link
Author

Choose a reason for hiding this comment

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

I´ve changed something. Please take a look.

_marker1 setMarkerSize [0.6, 0.6];

_marker2 = createmarker [format ["sm_2_%1",_pos2],_pos2];
_marker2 setmarkertype "hd_flag";
_marker2 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKEND"); //Convoy End
[_marker,{localize "STR_BTC_HAM_SIDE_CONVOY_MRKEND"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Convoy End
_marker2 setMarkerSize [0.6, 0.6];

_area = createmarker [format ["sm_%1",_pos2],_pos2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ for "_i" from 1 to (1 + round random 2) do {
//// Create marker \\\\
_marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_CHECKPOINT_MRK"); //Checkpoint
[_marker,{localize "STR_BTC_HAM_SIDE_CHECKPOINT_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Checkpoint
_marker setMarkerColor "ColorRed";
_marker setMarkerSize [0.6, 0.6];
_markers pushback _marker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ btc_side_jip_data = [8,_pos,_city getVariable "name"];
//// Create marker \\\\
_marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_CIVTREAT_MRK"); // Civil need help
//_marker setmarkertext (localize "STR_BTC_HAM_SIDE_CIVTREAT_MRK"); // Civil need help
[_marker,{localize "STR_BTC_HAM_SIDE_CIVTREAT_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Civil need help
_marker setMarkerSize [0.6, 0.6];

//// Create civ on _pos \\\\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ btc_side_jip_data = [10,_vehpos,_city getVariable "name"];
//// Create marker \\\\
_marker = createmarker [format ["sm_2_%1",_vehpos],_vehpos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_CIVTREAT_MRK"); //Civil need help
[_marker,{localize "STR_BTC_HAM_SIDE_CIVTREAT_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Civil need help
_marker setMarkerSize [0.6, 0.6];

//// Create civ on _vehpos \\\\
Expand Down
4 changes: 2 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/convoy.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ btc_side_jip_data = [12,_pos1,_city1 getVariable "name"];
//// Create markers \\\\
_marker1 = createmarker [format ["sm_2_%1",_pos1],_pos1];
_marker1 setmarkertype "hd_flag";
_marker1 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"); //Convoy start
[_marker,{localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Convoy start
_marker1 setMarkerSize [0.6, 0.6];

_marker2 = createmarker [format ["sm_2_%1",_pos2],_pos2];
_marker2 setmarkertype "hd_flag";
_marker2 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKEND"); //Convoy end
[_marker,{localize "STR_BTC_HAM_SIDE_CONVOY_MRKEND"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Convoy end
_marker2 setMarkerSize [0.6, 0.6];

_area = createmarker [format ["sm_%1",_pos2],_pos2];
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/hack.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _city setVariable ["spawn_more",true];

private _marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_HACK_MRK"); //Terminal
[_marker,{localize "STR_BTC_HAM_SIDE_HACK_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Terminal
_marker setMarkerSize [0.6, 0.6];

//// Create terminal \\\\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ btc_side_jip_data = [15,getPos _city,_city getVariable "name"];
//// Marker
_marker = createmarker [format ["sm_2_%1",getPos _house],getPos _house];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_HOSTAGE_MRK"); //Hostage
[_marker,{localize "STR_BTC_HAM_SIDE_HOSTAGE_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Hostage
_marker setMarkerSize [0.6, 0.6];

_city setVariable ["spawn_more",true];
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/mines.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _area setmarkercolor "colorBlue";

_marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_MINES_MRK"); //Mines
[_marker,{localize "STR_BTC_HAM_SIDE_MINES_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Mines
_marker setMarkerSize [0.6, 0.6];

_mines = [];
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/supply.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _area setmarkercolor "colorBlue";

_marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_SUPPLIES_MRK"); //Supplies
[_marker,{localize "STR_BTC_HAM_SIDE_SUPPLIES_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Supplies
_marker setMarkerSize [0.6, 0.6];

waitUntil {sleep 5; (btc_side_aborted || btc_side_failed || count (nearestObjects [_pos, [btc_supplies_mat], 30]) > 0)};
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/tower.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _area setmarkercolor "colorBlue";

_marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_TOWER_MRK"); //Radio Tower
[_marker,{localize "STR_BTC_HAM_SIDE_TOWER_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Radio Tower
_marker setMarkerSize [0.6, 0.6];

//// Randomise composition \\\\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ _area setmarkercolor "colorBlue";

_marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_UNDERWATER_MRK"); //Generator
[_marker,{localize "STR_BTC_HAM_SIDE_UNDERWATER_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Generator
_marker setMarkerSize [0.6, 0.6];


Expand All @@ -58,7 +58,7 @@ _group = [_pos,8, 1 + round random 5,0.8] call btc_fnc_mil_create_group;
[_pos,20, 2 + round random 4,0.5] call btc_fnc_mil_create_group;

_pos = getPosASL _generator;
leader _group setPosASL [_pos select 0, _pos select 1, (_pos select 2) + 1 + random 1];
(leader (_group select 0)) setPosASL [_pos select 0, _pos select 1, (_pos select 2) + 1 + random 1];
Copy link
Owner

Choose a reason for hiding this comment

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

Should not be here, may be you based your branch on your last PR, doesn't matter :)

Copy link
Author

Choose a reason for hiding this comment

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

My mistake, sorry.


waitUntil {sleep 5; (btc_side_aborted || btc_side_failed || !Alive _generator )};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _area setmarkercolor "colorBlue";

_marker = createmarker [format ["sm_2_%1",_pos],_pos];
_marker setmarkertype "hd_flag";
_marker setmarkertext (localize "STR_BTC_HAM_SIDE_VEHICLE_MRK"); // Vehicle needs assistance
[_marker,{localize "STR_BTC_HAM_SIDE_VEHICLE_MRK"}] remoteExec ["btc_fnc_set_markerText",0,true]; // Vehicle needs assistance
_marker setMarkerSize [0.6, 0.6];

_veh_type = selectRandom btc_civ_type_veh;
Expand Down
12 changes: 11 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1555,12 +1555,22 @@
<German>Alle Verstecke sind zerstört, nun sind die Oplitas besiegt! Mission erfüllt</German>
</Key>
</Container>
<Container name="Other: Wreck Marker ">
<Container name="Other: Markers ">
<Key ID="STR_BTC_HAM_O_EH_VEHKILLED_MRK">
<Original>%1 wreck</Original>
<English>%1 wreck</English>
<German>%1 Wrack</German>
</Key>
<Key ID="STR_BTC_HAM_O_EH_HDHIDEOUT_MRK">
<Original>Hideout %1 destroyed</Original>
<English>Hideout %1 destroyed</English>
<German>Versteck %1 wurde zerstört</German>
</Key>
<Key ID="STR_BTC_HAM_O_EH_HDCACHE_MRK">
<Original>Cached %1 destroyed</Original>
<English>Cached %1 destroyed</English>
<German>Waffenlager %1 wurde zerstört</German>
</Key>
</Container>
<Container name="Other: Basics">
<Key ID="STR_BTC_HAM_O_BASIC_DEFAULT">
Expand Down