I will show you how you can enable Right-Click on minimap feature. It allows you to quickly send units to any location on the minimap
What you need
You must have source code of glest version 3.1.2
You need a text editor
You must know how to compile code.
Let's go
1. Open gui/gui.h
Find this on line 177:
void giveDefaultOrders(int x, int y);
Replace it by:
void giveDefaultOrders(Vec2i targetPos);
Go to line 169 and add this:
void mouseDownLeftMinimap(int x, int y);
void mouseDownRightMinimap(int x, int y);
(must be in public section)
2. Open gui/gui.cpp
Add this to line 221:
void Gui::mouseDownLeftMinimap(int x, int y){
if(!isSelectingPos()){
gameCamera->setPos(Vec2f(static_cast<float>(x), static_cast<float>(y)));
}
}
void Gui::mouseDownRightMinimap(int one, int two){
if(!isSelectingPos()){
if(selection.isComandable()){
Vec2i targetPos;
targetPos.x= one;
targetPos.y= two;
// go
giveDefaultOrders(targetPos);
}
}
}
Find this on line 217:
giveDefaultOrders(x, y);
Replace by:
// compute target
Vec2i targetPos;
const Unit *targetUnit= NULL;
if(computeTarget(Vec2i(x, y), targetPos, targetUnit)){
giveDefaultOrders(targetPos);
} else {
console->addStdMessage("InvalidPosition");
}
Find:
void Gui::giveDefaultOrders(int x, int y){
//compute target
const Unit *targetUnit= NULL;
Vec2i targetPos;
if(!computeTarget(Vec2i(x, y), targetPos, targetUnit)){
console->addStdMessage("InvalidPosition");
return;
}
Replace by:
void Gui::giveDefaultOrders(Vec2i targetPos){
//compute target
const Unit *targetUnit= NULL;
3. Open game/game.cpp
Find on line 381:
if(!gui.isSelectingPos()){
gameCamera.setPos(Vec2f(static_cast<float>(xCell), static_cast<float>(yCell)));
}
Replace by:
gui.mouseDownLeftMinimap(xCell, yCell);
Find:
void Game::mouseDownRight(int x, int y){
gui.mouseDownRightGraphics(x, y);
}
Replace by:
void Game::mouseDownRight(int x, int y){
Map *map= world.getMap();
const Metrics &metrics= Metrics::getInstance();
//minimap panel
if(metrics.isInMinimap(x, y) && !gui.isSelectingPos()){
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)){
gui.mouseDownRightMinimap(xCell, yCell);
}
} else {
gui.mouseDownRightGraphics(x, y);
}
}
THAT'S ALL! COMPILE & ENJOY!