mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 07:52:51 +02:00
Fixed double right-click issue
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -92,6 +92,7 @@ $RECYCLE.BIN/
|
||||
*.exe
|
||||
*.msi
|
||||
*.pdb
|
||||
*.aps
|
||||
unsuccessfulbuild
|
||||
/mk/windows/dependencies/openssl
|
||||
/mk/windows/dependencies/src
|
||||
|
BIN
mk/shared/g3d_viewer.ico
Normal file
BIN
mk/shared/g3d_viewer.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
mk/shared/map_editor.ico
Normal file
BIN
mk/shared/map_editor.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
BIN
mk/shared/zetaglest.ico
Normal file
BIN
mk/shared/zetaglest.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
@@ -1 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "..\shared\g3dviewer.ico"
|
||||
IDI_ICON1 ICON DISCARDABLE "..\shared\g3d_viewer.ico"
|
||||
|
@@ -1 +0,0 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "..\shared\editor.ico"
|
@@ -18,8 +18,8 @@ copy /y ..\shared\glestkeys.ini bin\vs2017\glestkeys.ini
|
||||
copy /y ..\shared\servers.ini bin\vs2015\servers.ini
|
||||
copy /y ..\shared\servers.ini bin\vs2017\servers.ini
|
||||
|
||||
copy /y vs2015-32\g3dviewerWin32\Release\g3dviewer.exe bin\vs2015\g3dviewer-32.exe
|
||||
copy /y vs2017-32\g3dviewerWin32\Release\g3dviewer.exe bin\vs2017\g3dviewer-32.exe
|
||||
copy /y vs2015-32\g3d_viewerWin32\Release\g3d_viewer.exe bin\vs2015\g3d_viewer-32.exe
|
||||
copy /y vs2017-32\g3d_viewerWin32\Release\g3d_viewer.exe bin\vs2017\g3d_viewer-32.exe
|
||||
|
||||
copy /y vs2015-32\map_editorWin32\Release\map_editor.exe bin\vs2015\map_editor-32.exe
|
||||
copy /y vs2017-32\map_editorWin32\Release\map_editor.exe bin\vs2017\map_editor-32.exe
|
||||
@@ -27,8 +27,8 @@ copy /y vs2017-32\map_editorWin32\Release\map_editor.exe bin\vs2017\map_editor-3
|
||||
copy /y vs2015-32\zetaglest\zetaglest.exe bin\vs2015\zetaglest-32.exe
|
||||
copy /y vs2017-32\zetaglest\zetaglest.exe bin\vs2017\zetaglest-32.exe
|
||||
|
||||
copy /y vs2015-64\g3dviewerx64\Release\g3dviewer.exe bin\vs2015\g3dviewer-64.exe
|
||||
copy /y vs2017-64\g3dviewerx64\Release\g3dviewer.exe bin\vs2017\g3dviewer-64.exe
|
||||
copy /y vs2015-64\g3d_viewerx64\Release\g3d_viewer.exe bin\vs2015\g3d_viewer-64.exe
|
||||
copy /y vs2017-64\g3d_viewerx64\Release\g3d_viewer.exe bin\vs2017\g3d_viewer-64.exe
|
||||
|
||||
copy /y vs2015-64\map_editorx64\Release\map_editor.exe bin\vs2015\map_editor-64.exe
|
||||
copy /y vs2017-64\map_editorx64\Release\map_editor.exe bin\vs2017\map_editor-64.exe
|
||||
|
1
mk/windows/map_editor.rc
Normal file
1
mk/windows/map_editor.rc
Normal file
@@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "..\shared\map_editor.ico"
|
@@ -9,7 +9,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zetaglest", "zetaglest.vcxp
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g2xml", "g2xml.vcxproj", "{407355A4-D12A-4E3B-A7EB-A835E573B376}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dviewer", "g3dviewer.vcxproj", "{FE5C7C7C-F109-44F5-8329-25A4E24F162C}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3d_viewer", "g3d_viewer.vcxproj", "{FE5C7C7C-F109-44F5-8329-25A4E24F162C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_editor", "map_editor.vcxproj", "{5D09BE33-81EC-450B-8A7B-2E7B941ADC56}"
|
||||
EndProject
|
||||
|
@@ -12,9 +12,9 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{FE5C7C7C-F109-44F5-8329-25A4E24F162C}</ProjectGuid>
|
||||
<RootNamespace>g3dviewer</RootNamespace>
|
||||
<RootNamespace>g3d_viewer</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>g3dviewer</ProjectName>
|
||||
<ProjectName>g3d_viewer</ProjectName>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@@ -90,10 +90,10 @@
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3d_viewer</TargetName>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</GenerateManifest>
|
@@ -242,7 +242,7 @@
|
||||
<ClInclude Include="..\..\..\source\glest_map_editor\program.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest_editor.rc" />
|
||||
<ResourceCompile Include="..\map_editor.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\source\glest_game\global\config.cpp" />
|
||||
|
@@ -752,7 +752,7 @@
|
||||
<ClInclude Include="..\..\..\source\shared_lib\include\util\*.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest.rc" />
|
||||
<ResourceCompile Include="..\zetaglest.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\glest.ini">
|
||||
|
@@ -90,10 +90,10 @@
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3d_viewer</TargetName>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</GenerateManifest>
|
||||
|
@@ -316,7 +316,7 @@
|
||||
<ClInclude Include="..\..\..\source\glest_map_editor\program.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest_editor.rc" />
|
||||
<ResourceCompile Include="..\map_editor.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\source\glest_game\global\config.cpp" />
|
||||
|
@@ -564,7 +564,7 @@
|
||||
<ClInclude Include="..\..\..\source\shared_lib\include\util\*.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest.rc" />
|
||||
<ResourceCompile Include="..\zetaglest.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\glest.ini">
|
||||
|
@@ -9,7 +9,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zetaglest", "zetaglest.vcxp
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g2xml", "g2xml.vcxproj", "{407355A4-D12A-4E3B-A7EB-A835E573B376}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dviewer", "g3dviewer.vcxproj", "{FE5C7C7C-F109-44F5-8329-25A4E24F162C}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3d_viewer", "g3d_viewer.vcxproj", "{FE5C7C7C-F109-44F5-8329-25A4E24F162C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_editor", "map_editor.vcxproj", "{5D09BE33-81EC-450B-8A7B-2E7B941ADC56}"
|
||||
EndProject
|
||||
|
@@ -12,9 +12,9 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{FE5C7C7C-F109-44F5-8329-25A4E24F162C}</ProjectGuid>
|
||||
<RootNamespace>g3dviewer</RootNamespace>
|
||||
<RootNamespace>g3d_viewer</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>g3dviewer</ProjectName>
|
||||
<ProjectName>g3d_viewer</ProjectName>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@@ -90,10 +90,10 @@
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3d_viewer</TargetName>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</GenerateManifest>
|
@@ -242,7 +242,7 @@
|
||||
<ClInclude Include="..\..\..\source\glest_map_editor\program.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest_editor.rc" />
|
||||
<ResourceCompile Include="..\map_editor.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\source\glest_game\global\config.cpp" />
|
||||
|
@@ -752,7 +752,7 @@
|
||||
<ClInclude Include="..\..\..\source\shared_lib\include\util\*.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest.rc" />
|
||||
<ResourceCompile Include="..\zetaglest.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\glest.ini">
|
||||
|
@@ -90,10 +90,10 @@
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3dviewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g3d_viewer</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">g3d_viewer</TargetName>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">false</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</GenerateManifest>
|
||||
|
@@ -316,7 +316,7 @@
|
||||
<ClInclude Include="..\..\..\source\glest_map_editor\program.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest_editor.rc" />
|
||||
<ResourceCompile Include="..\map_editor.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\source\glest_game\global\config.cpp" />
|
||||
|
@@ -564,7 +564,7 @@
|
||||
<ClInclude Include="..\..\..\source\shared_lib\include\util\*.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\glest.rc" />
|
||||
<ResourceCompile Include="..\zetaglest.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\glest.ini">
|
||||
|
@@ -426,7 +426,7 @@ namespace
|
||||
const Vec2i & pos,
|
||||
const Unit * targetUnit,
|
||||
bool tryQueue,
|
||||
int unitCommandGroupId) const {
|
||||
int unitCommandGroupId, bool isMove) const {
|
||||
if (this->pauseNetworkCommands == true) {
|
||||
return std::pair < CommandResult, string >(crFailUndefined, "");
|
||||
}
|
||||
@@ -468,8 +468,6 @@ namespace
|
||||
command[i] = commandType;
|
||||
}
|
||||
Game* game = world->getGame();
|
||||
bool isMove = game->SendMove;
|
||||
game->SendMove = false;
|
||||
for (int i = 0; i < selection->getCount(); ++i) {
|
||||
const Unit * unit = selection->getUnit(i);
|
||||
const CommandType *commandType = command[i];
|
||||
@@ -691,7 +689,7 @@ namespace
|
||||
}
|
||||
|
||||
//add the command to the interface
|
||||
gameNetworkInterface->requestCommand(networkCommand);
|
||||
gameNetworkInterface->requestCommand(networkCommand, true);
|
||||
|
||||
//calculate the result of the command
|
||||
if (unit != NULL
|
||||
|
@@ -148,7 +148,7 @@ namespace
|
||||
string >
|
||||
tryGiveCommand(const Selection * selection, const Vec2i & pos,
|
||||
const Unit * targetUnit = NULL, bool tryQueue =
|
||||
false, int unitCommandGroupId = -1) const;
|
||||
false, int unitCommandGroupId = -1, bool isMove = false) const;
|
||||
CommandResult
|
||||
tryCancelCommand(const Selection * selection) const;
|
||||
void
|
||||
|
@@ -85,7 +85,6 @@ namespace Glest {
|
||||
aiInterfaces.clear();
|
||||
videoPlayer = NULL;
|
||||
playingStaticVideo = false;
|
||||
SendMove = false;
|
||||
mouse2d = 0;
|
||||
mouseX = 0;
|
||||
mouseY = 0;
|
||||
@@ -213,7 +212,6 @@ namespace Glest {
|
||||
GameConstants::updateFps = 40;
|
||||
GameConstants::cameraFps = 100;
|
||||
captureAvgTestStatus = false;
|
||||
SendMove = false;
|
||||
updateFpsAvgTest = 0;
|
||||
renderFpsAvgTest = 0;
|
||||
lastRenderLog2d = 0;
|
||||
@@ -360,7 +358,6 @@ namespace Glest {
|
||||
updateFpsAvgTest = 0;
|
||||
renderFpsAvgTest = 0;
|
||||
cameraDragAllowed = false;
|
||||
SendMove = false;
|
||||
|
||||
if (this->masterserverMode == true) {
|
||||
printf("Starting a new game...\n");
|
||||
@@ -5731,23 +5728,14 @@ namespace Glest {
|
||||
ym * (static_cast <
|
||||
float>(map->getH()) / metrics.getMinimapH()));
|
||||
|
||||
if (map->isInside(xCell, yCell)
|
||||
&& map->
|
||||
isInsideSurface(map->toSurfCoords(Vec2i(xCell, yCell)))) {
|
||||
if (checkRightDoubleClick())
|
||||
SendMove = true;
|
||||
if (map->isInside(xCell, yCell) && map->isInsideSurface(map->toSurfCoords(Vec2i(xCell, yCell))))
|
||||
gui.mouseDownRightGraphics(xCell, yCell, true);
|
||||
}
|
||||
} else {
|
||||
Vec2i targetPos;
|
||||
Vec2i screenPos(x, y);
|
||||
targetPos = getMouseCellPos();
|
||||
if (isValidMouseCellPos() == true &&
|
||||
map->isInsideSurface(map->toSurfCoords(targetPos)) == true) {
|
||||
if (checkRightDoubleClick())
|
||||
SendMove = true;
|
||||
if (isValidMouseCellPos() == true && map->isInsideSurface(map->toSurfCoords(targetPos)) == true)
|
||||
gui.mouseDownRightGraphics(x, y, false);
|
||||
}
|
||||
}
|
||||
} catch (const exception & ex) {
|
||||
char szBuf[8096] = "";
|
||||
@@ -5885,25 +5873,67 @@ namespace Glest {
|
||||
}
|
||||
}
|
||||
|
||||
bool Game::checkRightDoubleClick(void) {
|
||||
static Uint32 LastClickTicks;
|
||||
Uint32 CurrentClickTicks;
|
||||
/* The first time this function is called, LastClickTicks has not been initialised yet. */
|
||||
if (!LastClickTicks) {
|
||||
LastClickTicks = SDL_GetTicks();
|
||||
return false;
|
||||
} else {
|
||||
CurrentClickTicks = SDL_GetTicks();
|
||||
/* If the period between the two clicks is smaller or equal to a pre-defined number, we report a DoubleClick event. */
|
||||
if (CurrentClickTicks - LastClickTicks <= 400) {
|
||||
/* Update LastClickTicks and signal a DoubleClick. */
|
||||
LastClickTicks = CurrentClickTicks;
|
||||
return true;
|
||||
} else {
|
||||
/* Update LastClickTicks and signal a SingleClick. */
|
||||
LastClickTicks = CurrentClickTicks;
|
||||
return false;
|
||||
void Game::mouseDoubleClickRight(int x, int y) {
|
||||
if (this->masterserverMode == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (gameStarted == false || totalRenderFps <= 0)
|
||||
return;
|
||||
if (currentUIState != NULL) {
|
||||
currentUIState->mouseDoubleClickRight(x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
Map *map = world.getMap();
|
||||
const Metrics & metrics = Metrics::getInstance();
|
||||
|
||||
if (metrics.isInMinimap(x, y)) {
|
||||
int xm = x - metrics.getMinimapX();
|
||||
int ym = y - metrics.getMinimapY();
|
||||
int
|
||||
xCell =
|
||||
static_cast <
|
||||
int>(xm *
|
||||
(static_cast <
|
||||
float>(map->getW()) / metrics.getMinimapW()));
|
||||
int
|
||||
yCell =
|
||||
static_cast <
|
||||
int>(map->getH() -
|
||||
ym * (static_cast <
|
||||
float>(map->getH()) / metrics.getMinimapH()));
|
||||
|
||||
if (map->isInside(xCell, yCell) && map->isInsideSurface(map->toSurfCoords(Vec2i(xCell, yCell))))
|
||||
gui.mouseDoubleClickRightGraphics(xCell, yCell, true);
|
||||
} else {
|
||||
Vec2i targetPos;
|
||||
Vec2i screenPos(x, y);
|
||||
targetPos = getMouseCellPos();
|
||||
if (isValidMouseCellPos() == true && map->isInsideSurface(map->toSurfCoords(targetPos)) == true)
|
||||
gui.mouseDoubleClickRightGraphics(x, y, false);
|
||||
}
|
||||
} catch (const exception & ex) {
|
||||
char szBuf[8096] = "";
|
||||
snprintf(szBuf, 8096, "In [%s::%s Line: %d] Error [%s]\n",
|
||||
extractFileFromDirectoryPath(__FILE__).c_str(),
|
||||
__FUNCTION__, __LINE__, ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError, szBuf);
|
||||
if (SystemFlags::
|
||||
getSystemSettingType(SystemFlags::debugSystem).enabled)
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem, szBuf);
|
||||
|
||||
NetworkManager & networkManager = NetworkManager::getInstance();
|
||||
if (networkManager.getGameNetworkInterface() != NULL) {
|
||||
GameNetworkInterface *networkInterface =
|
||||
NetworkManager::getInstance().getGameNetworkInterface();
|
||||
networkInterface->sendTextMessage(szBuf, -1, true, "");
|
||||
sleep(10);
|
||||
networkManager.getGameNetworkInterface()->quitGame(true);
|
||||
}
|
||||
ErrorDisplayMessage(ex.what(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -87,7 +87,6 @@ namespace Glest {
|
||||
public CustomInputCallbackInterface, public ClientLagCallbackInterface {
|
||||
public:
|
||||
static const float highlightTime;
|
||||
bool SendMove;
|
||||
|
||||
private:
|
||||
typedef vector < Ai * > Ais;
|
||||
@@ -370,7 +369,6 @@ namespace Glest {
|
||||
virtual void updateCamera();
|
||||
virtual void render();
|
||||
virtual void tick();
|
||||
bool checkRightDoubleClick(void);
|
||||
|
||||
//event managing
|
||||
virtual bool textInput(std::string text);
|
||||
@@ -383,7 +381,7 @@ namespace Glest {
|
||||
virtual void mouseUpCenter(int x, int y);
|
||||
virtual void mouseUpLeft(int x, int y);
|
||||
virtual void mouseDoubleClickLeft(int x, int y);
|
||||
//virtual void mouseDoubleClickRight(int x, int y);
|
||||
virtual void mouseDoubleClickRight(int x, int y);
|
||||
virtual void eventMouseWheel(int x, int y, int zDelta);
|
||||
virtual void mouseMove(int x, int y, const MouseState * mouseState);
|
||||
|
||||
|
@@ -345,6 +345,22 @@ namespace Glest {
|
||||
}
|
||||
}
|
||||
|
||||
void Gui::mouseDoubleClickRightGraphics(int x, int y, bool prepared) {
|
||||
if (selectingPos || selectingMeetingPoint) {
|
||||
resetState();
|
||||
} else if (selection.isCommandable()) {
|
||||
if (prepared) {
|
||||
//Vec2i targetPos=game->getMouseCellPos();
|
||||
givePreparedDefaultOrders(x, y, true);
|
||||
} else {
|
||||
Vec2i targetPos = game->getMouseCellPos();
|
||||
if (game->isValidMouseCellPos() && world->getMap()->isInsideSurface(world->getMap()->toSurfCoords(targetPos)) == true)
|
||||
giveDefaultOrders(x, y, true);
|
||||
}
|
||||
}
|
||||
computeDisplay();
|
||||
}
|
||||
|
||||
void Gui::groupKey(int groupIndex) {
|
||||
if (isKeyDown(vkControl)) {
|
||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] groupIndex = %d\n", __FILE__, __FUNCTION__, __LINE__, groupIndex);
|
||||
@@ -459,7 +475,7 @@ namespace Glest {
|
||||
activeCommandClass = ccStop;
|
||||
}
|
||||
|
||||
void Gui::giveDefaultOrders(int x, int y) {
|
||||
void Gui::giveDefaultOrders(int x, int y, bool isMove) {
|
||||
//compute target
|
||||
//printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
@@ -470,23 +486,23 @@ namespace Glest {
|
||||
return;
|
||||
}
|
||||
//printf("In [%s::%s Line: %d] targetUnit = %p\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,targetUnit);
|
||||
giveDefaultOrders(targetPos.x, targetPos.y, targetUnit, true);
|
||||
giveDefaultOrders(targetPos.x, targetPos.y, targetUnit, true, isMove);
|
||||
//printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
void Gui::givePreparedDefaultOrders(int x, int y) {
|
||||
void Gui::givePreparedDefaultOrders(int x, int y, bool isMove) {
|
||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
giveDefaultOrders(x, y, NULL, false);
|
||||
giveDefaultOrders(x, y, NULL, false, isMove);
|
||||
}
|
||||
|
||||
void Gui::giveDefaultOrders(int x, int y, const Unit *targetUnit, bool paintMouse3d) {
|
||||
void Gui::giveDefaultOrders(int x, int y, const Unit *targetUnit, bool paintMouse3d, bool isMove) {
|
||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
bool queueKeyDown = isKeyDown(queueCommandKey);
|
||||
Vec2i targetPos = Vec2i(x, y);
|
||||
|
||||
//give order
|
||||
//printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
std::pair<CommandResult, string> result = commander->tryGiveCommand(&selection, targetPos, targetUnit, queueKeyDown);
|
||||
std::pair<CommandResult, string> result = commander->tryGiveCommand(&selection, targetPos, targetUnit, queueKeyDown, -1, isMove);
|
||||
|
||||
//printf("In [%s::%s Line: %d] selected units = %d result.first = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,selection.getCount(),result.first);
|
||||
|
||||
|
@@ -235,6 +235,7 @@ namespace Glest {
|
||||
void mouseUpLeftGraphics(int x, int y);
|
||||
void mouseMoveGraphics(int x, int y);
|
||||
void mouseDoubleClickLeftGraphics(int x, int y);
|
||||
void mouseDoubleClickRightGraphics(int x, int y, bool prepared);
|
||||
void groupKey(int groupIndex);
|
||||
void hotKey(SDL_KeyboardEvent key);
|
||||
|
||||
@@ -248,9 +249,9 @@ namespace Glest {
|
||||
private:
|
||||
|
||||
//orders
|
||||
void giveDefaultOrders(int x, int y);
|
||||
void giveDefaultOrders(int x, int y, const Unit *targetUnit, bool paintMouse3d);
|
||||
void givePreparedDefaultOrders(int x, int y);
|
||||
void giveDefaultOrders(int x, int y, bool isMove = false);
|
||||
void giveDefaultOrders(int x, int y, const Unit *targetUnit, bool paintMouse3d, bool isMove = false);
|
||||
void givePreparedDefaultOrders(int x, int y, bool isMove = false);
|
||||
void giveOneClickOrders();
|
||||
void giveTwoClickOrders(int x, int y, bool prepared);
|
||||
|
||||
|
@@ -682,9 +682,10 @@ namespace Shared {
|
||||
if (ticks - lastMouseDown[n] < DOUBLECLICKTIME
|
||||
&& abs(lastMouseX[n] - event.button.x) < DOUBLECLICKDELTA
|
||||
&& abs(lastMouseY[n] - event.button.y) < DOUBLECLICKDELTA) {
|
||||
|
||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
|
||||
eventMouseDown(event.button.x, event.button.y, button);
|
||||
//if (button != MouseButton::mbLeft) {
|
||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
|
||||
eventMouseDown(event.button.x, event.button.y, button);
|
||||
//}
|
||||
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
|
||||
eventMouseDoubleClick(event.button.x, event.button.y, button);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user