[+] Ability to call some ui functions from lua
[+] Ability to scroll through idle workers list [-] Fixed ButtonButton handling in pie menu [-] Fixed UserButtons not clearing
This commit is contained in:
parent
11e825b9e3
commit
f5f28ea5cf
5 changed files with 30 additions and 4 deletions
src
|
@ -329,6 +329,13 @@ extern void SetHoldClickDelay(int delay);
|
|||
extern void UiTogglePause();
|
||||
/// Toggle big map
|
||||
extern void UiToggleBigMap();
|
||||
/// Toggle terrain display on/off.
|
||||
extern void UiToggleTerrain();
|
||||
/// Find the next idle worker
|
||||
extern void UiFindIdleWorker();
|
||||
/// Track unit, the viewport follows the unit.
|
||||
extern void UiTrackUnit();
|
||||
|
||||
/// Handle cheats
|
||||
extern int HandleCheats(const std::string &input);
|
||||
|
||||
|
|
|
@ -572,3 +572,9 @@ function MenuScreen()
|
|||
end
|
||||
$]
|
||||
|
||||
void CenterOnMessage();
|
||||
void ToggleShowMessages();
|
||||
void UiFindIdleWorker();
|
||||
void CycleViewportMode(int step);
|
||||
void UiToggleTerrain();
|
||||
void UiTrackUnit();
|
|
@ -87,6 +87,7 @@ char BigMapMode; /// Show only the map
|
|||
enum _iface_state_ InterfaceState; /// Current interface state
|
||||
bool GodMode; /// Invincibility cheat
|
||||
enum _key_state_ KeyState; /// current key state
|
||||
CUnit *LastIdleWorker; /// Last called idle worker
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Functions
|
||||
|
@ -425,7 +426,7 @@ static void UiRecallMapPosition(unsigned position)
|
|||
/**
|
||||
** Toggle terrain display on/off.
|
||||
*/
|
||||
static void UiToggleTerrain()
|
||||
void UiToggleTerrain()
|
||||
{
|
||||
UI.Minimap.WithTerrain ^= 1;
|
||||
if (UI.Minimap.WithTerrain) {
|
||||
|
@ -438,14 +439,24 @@ static void UiToggleTerrain()
|
|||
/**
|
||||
** Find the next idle worker, select it, and center on it
|
||||
*/
|
||||
static void UiFindIdleWorker()
|
||||
void UiFindIdleWorker()
|
||||
{
|
||||
if (ThisPlayer->FreeWorkers.empty()) {
|
||||
return;
|
||||
}
|
||||
CUnit *unit = ThisPlayer->FreeWorkers[0];
|
||||
if (LastIdleWorker) {
|
||||
std::vector<CUnit *>::const_iterator it = std::find(ThisPlayer->FreeWorkers.begin(),
|
||||
ThisPlayer->FreeWorkers.end(), LastIdleWorker);
|
||||
if (it != ThisPlayer->FreeWorkers.end()) {
|
||||
if (*it != ThisPlayer->FreeWorkers.back()) {
|
||||
unit = *(++it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (unit != NULL) {
|
||||
LastIdleWorker = unit;
|
||||
SelectSingleUnit(*unit);
|
||||
UI.StatusLine.Clear();
|
||||
ClearCosts();
|
||||
|
@ -469,7 +480,7 @@ static void UiToggleGrabMouse()
|
|||
/**
|
||||
** Track unit, the viewport follows the unit.
|
||||
*/
|
||||
static void UiTrackUnit()
|
||||
void UiTrackUnit()
|
||||
{
|
||||
//Check if player has selected at least 1 unit
|
||||
if (!Selected[0]) {
|
||||
|
|
|
@ -2135,8 +2135,9 @@ static void HandlePieMenuMouseSelection()
|
|||
|
||||
int pie = GetPieUnderCursor();
|
||||
if (pie != -1) {
|
||||
const ButtonCmd action = CurrentButtons[pie].Action;
|
||||
UI.ButtonPanel.DoClicked(pie);
|
||||
if (CurrentButtons[pie].Action == ButtonButton) {
|
||||
if (action == ButtonButton) {
|
||||
// there is a submenu => stay in piemenu mode
|
||||
// and recenter the piemenu around the cursor
|
||||
CursorStartScreenPos = CursorScreenPos;
|
||||
|
|
|
@ -336,6 +336,7 @@ void CleanUserInterface()
|
|||
delete UI.UpgradingButton;
|
||||
delete UI.ResearchingButton;
|
||||
UI.TransportingButtons.clear();
|
||||
UI.UserButtons.clear();
|
||||
|
||||
// Button Panel
|
||||
CGraphic::Free(UI.ButtonPanel.G);
|
||||
|
|
Loading…
Add table
Reference in a new issue