Skip to content

Commit

Permalink
Merge pull request #3 from pavanvo/feat/hotkeys
Browse files Browse the repository at this point in the history
merge develop into hotkeys
  • Loading branch information
Rampoina authored Aug 13, 2022
2 parents 329671a + 83e90b7 commit ef14062
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
# Kinda guessing this using supertux + my own build scripts as guides.
run: cmake --no-warn-unused-cli -B ${{github.workspace}}/build -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 16 2019" -T host=x64 -A x64 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
run: cmake --no-warn-unused-cli -B ${{github.workspace}}/build -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 17 2022" -T host=x64 -A x64 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE

- name: Build Mega Glest
# Build your program with the given configuration
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ IF("${CPACK_GENERATOR}" STREQUAL "NSIS")
SET(CPACK_NSIS_DISPLAY_NAME "MegaGlest")
SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/mk/windoze/glest.ico")
SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/mk/windoze/megaglest.ico")
SET(CPACK_NSIS_URL_INFO_ABOUT "http://megaglest.org")
SET(CPACK_NSIS_URL_INFO_ABOUT "https://megaglest.org")
ENDIF()

INCLUDE(CPack)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
**This is the game engine source code repository.**

MegaGlest (http://megaglest.org) is a libre software cross
MegaGlest (https://megaglest.org) is a libre software cross
platform real-time strategy game.

![logo](http://megaglest.org/uploads/megaglest2011/logo/logo.png)
![logo](https://megaglest.org/uploads/megaglest2011/logo/logo.png)

MegaGlest is an entertaining free (freeware and free software)
and open source cross-platform 3D real-time strategy (RTS) game,
Expand All @@ -14,10 +14,10 @@ like the unit models, are crafted with great attention to
detail. A lot of additional game data can be downloaded from
within the game at no cost.

[**MegaGlest Downloads**](http://megaglest.org/download.html)
[**MegaGlest Downloads**](https://megaglest.org/download.html)

![gif](http://megaglest.org/uploads/images/screenshots/game_screens.gif)
[> game trailer <](http://downloads.megaglest.org/videos/megaglest_game_trailer_lq.webm)
![gif](https://megaglest.org/uploads/images/screenshots/game_screens.gif)
[> game trailer <](https://downloads.megaglest.org/videos/megaglest_game_trailer_lq.webm)

If you want to compile MegaGlest yourself, you should read the following:

Expand Down
2 changes: 1 addition & 1 deletion data/glest_game
6 changes: 3 additions & 3 deletions docs/README.compiling-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Developed on Linux with glibc, little endian CPU. While MacIntel builds exist
(for some versions of the game), MegaGlest does not currently work on big
endian CPUs like PPC (though some unfinished patches for vanilla Glest float
around on the forums, e.g. http://forum.megaglest.org/?topic=1426#).
around on the forums, e.g. https://forum.megaglest.org/?topic=1426#).

~~~~~~~~~~~~~~~~~~~~~~ 2. Building and Installation ~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -131,7 +131,7 @@ BSD distributions. Please see the website, forums and wiki for details.
AMD APUs (the graphics chips embedded into AMD processors).

--- Crashing ---
* Check the forums at http://forums.megaglest.org/
* Check the forums at https://forums.megaglest.org/
* Please report any crashes and freezes that are not yet described on the forums,
preferably with a gdb backtrace from a debugging enabled build
(cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo)
Expand All @@ -146,7 +146,7 @@ BSD distributions. Please see the website, forums and wiki for details.
https://docs.megaglest.org/Main_Page

* Forums
http://forums.megaglest.org/
https://forums.megaglest.org/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5. Contact + Credits ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* MegaGlest is developed by:
Expand Down
4 changes: 2 additions & 2 deletions docs/README.compiling-windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ directory tree the %AppData% environment variable points to.
* Try to get updated graphics drivers.

-- The game crashes ---
* Check the forums at http://forums.megaglest.org/
* Check the forums at https://forums.megaglest.org/
* Please report any other crashes and freezes that are not yet described on
the forums, preferably with a backtrace from a debugging enabled build

Expand All @@ -127,7 +127,7 @@ directory tree the %AppData% environment variable points to.
https://docs.megaglest.org/Main_Page

* Forums
http://forums.megaglest.org/
https://forums.megaglest.org/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5. Contact + Credits ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* MegaGlest is developed by:
Expand Down
4 changes: 2 additions & 2 deletions docs/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ megaglest --help
Further information:

- The MegaGlest website:
http://megaglest.org
https://megaglest.org

- The MegaGlest wiki:
http://wiki.megaglest.org
Expand All @@ -291,7 +291,7 @@ their own by reading up on available documentation before getting in touch.

- Post to the forums:
If you are reporting a bug, please be sure to read the bug reporting guide.
http://forum.megaglest.org
https://forum.megaglest.org

- Contact us on IRC:
Network: irc.libera.chat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Setup.Package

postinstall = function(package)
if MojoSetup.promptyn(_("MegaGlest Visit Website Title"), _("MegaGlest Visit Website Prompt")) then
MojoSetup.launchbrowser("http://megaglest.org/get-started.html")
MojoSetup.launchbrowser("https://megaglest.org/get_started")
end
end,

Expand Down
2 changes: 1 addition & 1 deletion mk/windoze/Installer/MegaGlestInstaller.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ FunctionEnd
Function .onInstSuccess

MessageBox MB_YESNO "Would you like to view our getting started page on megaglest.org?" IDNO noLaunchWebsite
ExecShell open 'http://megaglest.org/get-started.html'
ExecShell open 'https://megaglest.org/get_started'

noLaunchWebsite:

Expand Down
4 changes: 2 additions & 2 deletions mk/windoze/Installer/make_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ cd "$CURRENTDIR"

# We need the AccessControl plugin for nsis and place this in plugins directory
# original from http://nsis.sourceforge.net/AccessControl_plug-in
wget http://downloads.megaglest.org/windowsInstallerHelp/AccessControl.dll -P plugins
wget http://downloads.megaglest.org/windowsInstallerHelp/AccessControl.txt -P plugins
wget https://downloads.megaglest.org/windowsInstallerHelp/AccessControl.dll -P plugins
wget https://downloads.megaglest.org/windowsInstallerHelp/AccessControl.txt -P plugins

makensis MegaGlestInstaller.nsi

34 changes: 28 additions & 6 deletions source/glest_game/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,11 +708,18 @@ void Gui::mouseDownDisplayUnitSkills(int posDisplay) {
else {
activeCommandType= NULL;
activeCommandClass= display.getCommandClass(posDisplay);
if (activeCommandClass == ccAttack) {
unit= selection.getUnitFromCC(ccAttack);
}

}

//give orders depending on command type
if(activeCommandClass != ccNull){
const CommandType *ct= selection.getUnit(0)->getType()->getFirstCtOfClass(activeCommandClass);
if (activeCommandClass == ccAttack) {
ct = selection.getUnitFromCC(ccAttack)->getType()->getFirstCtOfClass(activeCommandClass);
}
if(activeCommandType!=NULL && activeCommandType->getClass()==ccBuild){
assert(selection.isUniform());
selectingBuilding= true;
Expand Down Expand Up @@ -851,8 +858,13 @@ void Gui::computeInfoString(int posDisplay){
const UnitType *ut= selection.getFrontUnit()->getType();
CommandClass cc= display.getCommandClass(posDisplay);
if(cc!=ccNull){
display.setInfoText(hotkey+lang.getString("CommonCommand") + ": " + ut->getFirstCtOfClass(cc)->toString(true) + "\n");
}
if (cc == ccAttack) {
const Unit* attackingUnit = selection.getUnitFromCC(ccAttack);
display.setInfoText(hotkey+lang.getString("CommonCommand") + ": " + attackingUnit->getType()->getFirstCtOfClass(cc)->toString(true) + "\n");
} else {
display.setInfoText(hotkey+lang.getString("CommonCommand") + ": " + ut->getFirstCtOfClass(cc)->toString(true) + "\n");
}
}
}
}
}
Expand Down Expand Up @@ -1049,11 +1061,20 @@ void Gui::computeDisplay(){

//printf("computeDisplay i = %d cc = %d isshared = %d basicPos = %d\n",i,cc,isSharedCommandClass(cc),basicPos);

const Unit* attackingUnit = NULL;
if (cc == ccAttack) {
attackingUnit = selection.getUnitFromCC(ccAttack);
}
auto ccPos = CommandHelper::getBasicPos(cc);
if(isSharedCommandClass(cc)){
display.setDownLighted(basicPos + ccPos, true);
display.setDownImage(basicPos + ccPos, ut->getFirstCtOfClass(cc)->getImage());
display.setCommandClass(basicPos + ccPos, cc);
if((cc == ccAttack && attackingUnit != NULL) || isSharedCommandClass(cc)){
display.setDownLighted(basicPos+ccPos, true);

if (cc == ccAttack && attackingUnit != NULL) {
display.setDownImage(basicPos+ccPos, attackingUnit->getType()->getFirstCtOfClass(cc)->getImage());
} else {
display.setDownImage(basicPos+ccPos, ut->getFirstCtOfClass(cc)->getImage());
}
display.setCommandClass(basicPos+ccPos, cc);
} else {
display.setDownImage(basicPos+ccPos, ut->getCancelImage());
display.setCommandType(basicPos+ccPos, NULL);
Expand Down Expand Up @@ -1216,6 +1237,7 @@ bool Gui::isSharedCommandClass(CommandClass commandClass){
return true;
}


void Gui::computeSelected(bool doubleClick, bool force){
Selection::UnitContainer units;

Expand Down
10 changes: 10 additions & 0 deletions source/glest_game/gui/selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,16 @@ void Selection::removeUnitFromGroup(int groupIndex,int unitId) {
}
}

const Unit* Selection::getUnitFromCC(CommandClass commandClass){
const Unit *unit = NULL;
for(int i=0; i<(int)selectedUnits.size(); ++i){
const Unit *unit= selectedUnits[i];
const CommandType *ct= unit->getType()->getFirstCtOfClass(commandClass);
if(ct != NULL && ct->getClass() == commandClass) return unit;
}
return unit;
}

//vector<Unit*> Selection::getUnitsForGroup(int groupIndex) {
// if(groupIndex < 0 || groupIndex >= maxGroups) {
// throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex));
Expand Down
1 change: 1 addition & 0 deletions source/glest_game/gui/selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class Selection: public UnitObserver {
const Unit *getUnit(int i) const {return selectedUnits[i];}
Unit *getUnitPtr(int i) {return selectedUnits[i];}
const Unit *getFrontUnit() const {return selectedUnits.front();}
const Unit *getUnitFromCC(CommandClass commandClass);
Vec3f getRefPos() const;
bool hasUnit(const Unit* unit) const;

Expand Down
1 change: 1 addition & 0 deletions source/glest_game/types/unit_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ const Level *UnitType::getLevel(string name) const {

const CommandType *UnitType::getFirstCtOfClass(CommandClass commandClass) const{
if(firstCommandTypeOfClass[commandClass] == NULL) {
return NULL;
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] commandClass = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,commandClass);

/*
Expand Down
4 changes: 2 additions & 2 deletions source/tools/support/linux/system_report
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ common_info () {
echo " sudo find -type f -name $Exec_2 /" >&2
echo >&2
echo "Please be aware that this script is written to work with installations created" >&2
echo "using the installation instructions on http://megaglest.org. It may or may not" >&2
echo "using the installation instructions on https://megaglest.org. It may or may not" >&2
echo "work with variants of MegaGlest which were packaged by your Linux distribution." >&2
echo >&2; exit 1
}
Expand Down Expand Up @@ -386,7 +386,7 @@ echo ' take note of this new location/URL/Internet address and make it available
echo ' the MegaGlest developers. Unless you were instructed to do otherwise, please'
echo ' post both the Internet address of where you uploaded to and a verbose'
echo ' description of the issues you are experiencing at'
echo ' http://forum.megaglest.org'
echo ' https://forum.megaglest.org'
echo ''
echo ' Thank you for making it easy for us to assist you,'
echo ''
Expand Down

0 comments on commit ef14062

Please sign in to comment.