commit 9a19e955fbf67dd61d2a9152ab23aec898d4d248
Author: Roel Kluin <roel.kluin@gmail.com>
Date: Mon Jun 11 00:20:19 2012 +0200
Bugfix: during building placement we can now correctly select another
idle villager for the job.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
diff --git a/binaries/data/mods/public/gui/session/input.js b/binaries/data/mods/public/gui/session/input.js
index b724acd..24f32a5 100644
a
|
b
|
function updateBuildingPlacementPreview()
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
149 | | function initBuildingPlacementView(ev) |
| 149 | function initBuildingPlacementView() |
150 | 150 | { |
151 | 151 | if (placementSupport.mode === "wall") |
152 | 152 | { |
… |
… |
function handleInputAfterGui(ev)
|
1054 | 1054 | var sptr = ev.hotkey.split("."); |
1055 | 1055 | var now = new Date(); |
1056 | 1056 | if ((now.getTime() - doublePressTimer < doublePressTime) && (ev.hotkey == prevHotkey) && ev.hotkey.indexOf("selection.group.select.") == 0) { |
1057 | | performGroup("snap", sptr[3], ev); |
| 1057 | performGroup("snap", sptr[3]); |
1058 | 1058 | } |
1059 | 1059 | else |
1060 | 1060 | { |
1061 | | performGroup(sptr[2], sptr[3], ev); |
| 1061 | performGroup(sptr[2], sptr[3]); |
1062 | 1062 | |
1063 | 1063 | doublePressTimer = now.getTime(); |
1064 | 1064 | prevHotkey = ev.hotkey; |
… |
… |
function handleInputAfterGui(ev)
|
1214 | 1214 | { |
1215 | 1215 | case "mousemotion": |
1216 | 1216 | placementSupport.position = Engine.GetTerrainAtScreenPoint(ev.x, ev.y); |
1217 | | initBuildingPlacementView(ev); |
| 1217 | initBuildingPlacementView(); |
1218 | 1218 | return false; // continue processing mouse motion |
1219 | 1219 | |
1220 | 1220 | case "mousebuttondown": |
… |
… |
function handleInputAfterGui(ev)
|
1264 | 1264 | if (ev.hotkey.indexOf("selection.group.action.") == 0) |
1265 | 1265 | { // can switch buildings |
1266 | 1266 | var sptr = ev.hotkey.split("."); |
1267 | | performGroup(sptr[2], sptr[3], ev); |
| 1267 | performGroup(sptr[2], sptr[3]); |
1268 | 1268 | } |
1269 | 1269 | } |
1270 | 1270 | break; |
… |
… |
function getActionForSelection(player, selection)
|
1623 | 1623 | break; |
1624 | 1624 | case ACTION_BUILD: |
1625 | 1625 | if (state.buildEntities && state.buildEntities.length) { |
1626 | | inputState = INPUT_PRESELECTEDACTION; |
| 1626 | if (inputState != INPUT_BUILDING_PLACEMENT) |
| 1627 | inputState = INPUT_PRESELECTEDACTION; |
1627 | 1628 | return state.buildEntities; |
1628 | 1629 | } |
1629 | 1630 | break; |
… |
… |
function getActionForSelection(player, selection)
|
1662 | 1663 | } |
1663 | 1664 | |
1664 | 1665 | // Performs the specified group |
1665 | | function performGroup(action, nr, ev) |
| 1666 | function performGroup(action, nr) |
1666 | 1667 | { |
1667 | 1668 | if (nr == "reset") |
1668 | 1669 | { |
… |
… |
function performGroup(action, nr, ev)
|
1744 | 1745 | // N.B. sets inputState = INPUT_BUILDING_PLACEMENT: |
1745 | 1746 | startBuildingPlacement(lst); |
1746 | 1747 | placementSupport.position = Engine.GetTerrainAtScreenPoint(mouseX, mouseY); |
1747 | | initBuildingPlacementView(ev); |
| 1748 | initBuildingPlacementView(); |
1748 | 1749 | } |
1749 | 1750 | break; |
1750 | 1751 | case ACTION_TRAIN: |
… |
… |
function findEntity(classes, mode)
|
1858 | 1859 | { |
1859 | 1860 | if (!getActionForSelection(player, [newEntity]).length) |
1860 | 1861 | resetPreselectedAction(); |
| 1862 | else if (preSelectedAction == ACTION_BUILD) |
| 1863 | updateBuildingPlacementPreview(); |
1861 | 1864 | |
1862 | 1865 | lastEntity = newEntity; |
1863 | 1866 | g_Selection.reset(); |
commit fc4d8b422f85397eda4b78de2cf849d146b33ab1
Author: Roel Kluin <roel.kluin@gmail.com>
Date: Sun Jun 10 23:32:05 2012 +0200
Fixes reset hotkey
Fixes stance
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg
index 1f7c35c..5201210 100644
a
|
b
|
hotkey.selection.group.action.9 = "Shift+K"
|
202 | 202 | hotkey.selection.group.action.10 = "Shift+L" |
203 | 203 | hotkey.selection.group.action.11 = Colon |
204 | 204 | hotkey.selection.group.action.12 = DoubleQuote |
205 | | hotkey.selection.group.reset.action = ForwardSlash |
| 205 | hotkey.selection.group.action.reset = ForwardSlash |
206 | 206 | |
207 | 207 | ; > SESSION CONTROLS |
208 | 208 | hotkey.session.kill = Delete ; Destroy selected units |
diff --git a/binaries/data/mods/public/gui/session/input.js b/binaries/data/mods/public/gui/session/input.js
index 8775bb3..b724acd 100644
a
|
b
|
function findGatherType(gatherer, supply)
|
185 | 185 | |
186 | 186 | function resetPreselectedAction() |
187 | 187 | { |
188 | | placementSupport.Reset(); |
| 188 | preSelectedAction = ACTION_NONE; |
189 | 189 | inputState = INPUT_NORMAL; |
190 | 190 | _optionsOfpreSelected = []; |
| 191 | placementSupport.Reset(); // or a hotkey may leave a building snapshot |
| 192 | updateCursorAndTooltip(); |
191 | 193 | |
192 | 194 | } |
193 | 195 | |
… |
… |
function handleInputAfterGui(ev)
|
1070 | 1072 | switch (ev.type) |
1071 | 1073 | { |
1072 | 1074 | case "mousebuttondown": |
1073 | | if (ev.button == SDL_BUTTON_LEFT && preSelectedAction != ACTION_NONE) |
| 1075 | if (ev.button == SDL_BUTTON_LEFT && preSelectedAction) |
1074 | 1076 | { |
1075 | 1077 | var action = determineAction(ev.x, ev.y); |
1076 | 1078 | resetPreselectedAction(); |
… |
… |
function handleInputAfterGui(ev)
|
1078 | 1080 | break; |
1079 | 1081 | return doAction(action, ev); |
1080 | 1082 | } |
1081 | | else if (ev.button == SDL_BUTTON_RIGHT && preSelectedAction != ACTION_NONE) |
| 1083 | else if (ev.button == SDL_BUTTON_RIGHT) |
1082 | 1084 | { |
1083 | 1085 | resetPreselectedAction(); |
1084 | 1086 | break; |
… |
… |
function getActionForSelection(player, selection)
|
1638 | 1640 | if (!hasClass(state, "Unit") || hasClass(state, "Animal") || state.garrisonHolder) |
1639 | 1641 | break; |
1640 | 1642 | |
1641 | | if (preSelectedAction == STANCE) |
| 1643 | if (preSelectedAction == ACTION_STANCE) |
1642 | 1644 | return ["violent", "aggressive", "passive", "defensive", "standground"]; |
1643 | 1645 | if (ret.length) // minimimum is 2 units for formation to be enabled |
1644 | 1646 | return Engine.GuiInterfaceCall("GetAvailableFormations"); |
… |
… |
function getActionForSelection(player, selection)
|
1662 | 1664 | // Performs the specified group |
1663 | 1665 | function performGroup(action, nr, ev) |
1664 | 1666 | { |
| 1667 | if (nr == "reset") |
| 1668 | { |
| 1669 | resetPreselectedAction(); |
| 1670 | return; |
| 1671 | } |
1665 | 1672 | switch (action) |
1666 | 1673 | { |
1667 | 1674 | case "snap": |
… |
… |
function performGroup(action, nr, ev)
|
1795 | 1802 | } |
1796 | 1803 | } |
1797 | 1804 | break; |
1798 | | case "reset": |
1799 | | resetPreselectedAction(); |
1800 | | break; |
1801 | 1805 | } |
1802 | 1806 | } |
1803 | 1807 | |