Add script hook onNewTurn to the end of AfterSwitchHedgehog. This should signal the very start of a new turn, immediately after CurrentTeam is switched.
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}