Skip to content

Commit

Permalink
Add Meta as alternative to Alt when giving scout orders.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyp committed Mar 21, 2011
1 parent 500f19b commit fe4d13f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions lib/framework/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,9 @@ extern UDWORD inputGetKey(utf_32_char *unicode);
/** Clear the input buffer. */
extern void inputClearBuffer(void);

static inline bool specialOrderKeyDown()
{
return keyDown(KEY_LALT) || keyDown(KEY_RALT) || keyDown(KEY_LMETA) || keyDown(KEY_RMETA);
}

#endif
12 changes: 6 additions & 6 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ void processMouseClickInput(void)
{
item = MT_OWNDROID;
}
else if ((keyDown(KEY_LALT) || keyDown(KEY_RALT)) &&
else if (specialOrderKeyDown() &&
(ObjUnderMouse != NULL) &&
ObjUnderMouse->player == selectedPlayer)
{
Expand Down Expand Up @@ -1025,13 +1025,13 @@ void processMouseClickInput(void)
item = MT_BLOCKING;
}

if ((keyDown(KEY_LALT) || keyDown(KEY_RALT)) && selection == SC_DROID_TRANSPORTER &&
if (specialOrderKeyDown() && selection == SC_DROID_TRANSPORTER &&
arnMPointers[item][selection] == CURSOR_MOVE && bMultiPlayer)
{
// Alt+move = disembark transporter
pie_SetMouse(CURSOR_DISEMBARK, war_GetColouredCursor());
}
else if ((keyDown(KEY_LALT) || keyDown(KEY_RALT)) && selection == SC_DROID_DIRECT &&
else if (specialOrderKeyDown() && selection == SC_DROID_DIRECT &&
arnMPointers[item][selection] == CURSOR_MOVE)
{
// Alt+move = scout
Expand Down Expand Up @@ -1606,7 +1606,7 @@ void dealWithDroidSelect(DROID *psDroid, bool bDragBox)
bGotGroup = true;
}
}
if (keyDown(KEY_LALT) || keyDown(KEY_RALT))
if (specialOrderKeyDown())
{
/* We only want to select weapon units if ALT is down on a drag */
if (psDroid->asWeaps[0].nStat > 0)
Expand Down Expand Up @@ -1681,7 +1681,7 @@ static void dealWithLMBDroid(DROID* psDroid, SELECTION_TYPE selection)
// select/deselect etc. the droid
dealWithDroidSelect(psDroid, false);
}
else if ((keyDown(KEY_LALT) || keyDown(KEY_RALT)) && ownDroid)
else if (specialOrderKeyDown() && ownDroid)
{
// try to attack your own unit
orderSelectedObjAdd(selectedPlayer, (BASE_OBJECT*)psDroid, ctrlShiftDown());
Expand Down Expand Up @@ -1878,7 +1878,7 @@ static void dealWithLMBStructure(STRUCTURE* psStructure, SELECTION_TYPE selectio
if (!bRightClickOrders) printStructureInfo(psStructure);

/* Got to be built. Also, you can't 'select' derricks */
if (!keyDown(KEY_LALT) && !keyDown(KEY_RALT) && (psStructure->status == SS_BUILT) &&
if (!specialOrderKeyDown() && (psStructure->status == SS_BUILT) &&
(psStructure->pStructureType->type != REF_RESOURCE_EXTRACTOR) && ownStruct)
{
if (bRightClickOrders)
Expand Down
4 changes: 2 additions & 2 deletions src/order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2695,7 +2695,7 @@ void orderSelectedLoc(uint32_t player, uint32_t x, uint32_t y, bool add)
continue;
}

order = chooseOrderLoc(psCurr, x, y, (keyDown(KEY_LALT) || keyDown(KEY_RALT)));
order = chooseOrderLoc(psCurr, x, y, specialOrderKeyDown());
// see if the order can be added to the list
if (order != DORDER_NONE && !(add && orderDroidLocAdd(psCurr, order, x, y)))
{
Expand Down Expand Up @@ -3027,7 +3027,7 @@ void orderSelectedObjAdd(UDWORD player, BASE_OBJECT *psObj, bool add)
continue;
}

order = chooseOrderObj(psCurr, psObj, (keyDown(KEY_LALT) || keyDown(KEY_RALT)));
order = chooseOrderObj(psCurr, psObj, specialOrderKeyDown());
// see if the order can be added to the list
if (!(add && orderDroidObjAdd(psCurr, order, &psObj)))
{
Expand Down

3 comments on commit fe4d13f

@dak180
Copy link
Contributor

@dak180 dak180 commented on fe4d13f Mar 22, 2011

Choose a reason for hiding this comment

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

This seems to me to be a very bad idea as the "meta" key (or "Command" as it is known on the mac) is used for both system and application shortcuts already I have no idea how they might interact but I suspect that it would not lead to anything good.

@Zarel
Copy link
Contributor

@Zarel Zarel commented on fe4d13f Apr 2, 2011

Choose a reason for hiding this comment

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

I agree with dak180.

@dak180
Copy link
Contributor

@dak180 dak180 commented on fe4d13f Apr 2, 2011

Choose a reason for hiding this comment

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

@Cyp
It may be a good idea to revert this; why would you want another way to trigger the alt key in any case?

Please sign in to comment.