WombatCoder
Chieftain
- Joined
- Sep 10, 2023
- Messages
- 4
Since this is my first post I have the urge to say thanks to everyone that have contributed to this great mod
Are dabbling with a few hacks to the trade system.
One of them is adding a page in the domestic advisor that list trade units, with the ability to select a unit when clicking it. I'm trying to use the selectUnit in CvGame.cpp, but can not get it to work. Nothing seems to happen, incl. no errors.
CvUnit.h and CyUnit.h have been update too.
CyUnitInterface2.cpp:
New page in the domestic advisor:
Are there any existing code that can give some hints or any other advice will be appreciated.
My next step is getting debugging up and running, so I can pry further into what is happening.
Havn't had the time to get a good idea of the ins and out of the code base yet and Python and C++ is not my main language. Have so fare managed with trail an error for getting things to work, so have almost no idea of what I'm doing (originally I was just trying to do some quick fixes)
Are this kind of question better suited for Discord?
Are dabbling with a few hacks to the trade system.
One of them is adding a page in the domestic advisor that list trade units, with the ability to select a unit when clicking it. I'm trying to use the selectUnit in CvGame.cpp, but can not get it to work. Nothing seems to happen, incl. no errors.
C++:
void CvUnit::select(bool val1, bool val2, bool val3) {
gDLL->getInterfaceIFace()->selectUnit(this, val1, val2, val3);
gDLL->getInterfaceIFace()->lookAtSelectionPlot();
// GC.getGame().selectUnit(this, val1, val2, val3);
// GC.getGame().lookAtSelectionPlot();
}
C++:
void CyUnit::select(bool val1, bool val2, bool val3)
{
if (m_pUnit)
m_pUnit->select(val1, val2, val3);
}
CvUnit.h and CyUnit.h have been update too.
CyUnitInterface2.cpp:
C++:
.def("select", &CyUnit::select, "void select(bool val1, bool val2, bool val3)")
New page in the domestic advisor:
Python:
player = gc.getPlayer(gc.getGame().getActivePlayer())
unit = player.getUnit(unitId)
unit.select(True, False, False)
Are there any existing code that can give some hints or any other advice will be appreciated.
My next step is getting debugging up and running, so I can pry further into what is happening.
Havn't had the time to get a good idea of the ins and out of the code base yet and Python and C++ is not my main language. Have so fare managed with trail an error for getting things to work, so have almost no idea of what I'm doing (originally I was just trying to do some quick fixes)
Are this kind of question better suited for Discord?