AI upgrades should complete successfully

This commit is contained in:
mathusummut
2018-06-23 23:38:12 +02:00
parent 812db7279d
commit 6b6a4fb4de
4 changed files with 29 additions and 30 deletions

View File

@@ -561,7 +561,8 @@ namespace
throw throw
megaglest_runtime_error(szBuf); megaglest_runtime_error(szBuf);
} }
if (unit->getProgress2() != NULL) Command* currentCommand = unit->getCurrCommand();
if (currentCommand != NULL && currentCommand->getCommandType()->commandTypeClass == CommandClass::ccUpgrade && commandType->commandTypeClass != CommandClass::ccAttack)
return result; return result;
const UnitType * const UnitType *
unitType = unit->getType(); unitType = unit->getType();
@@ -661,7 +662,8 @@ namespace
throw throw
megaglest_runtime_error(szBuf); megaglest_runtime_error(szBuf);
} }
if (unit->getProgress2() != NULL) Command* currentCommand = unit->getCurrCommand();
if (currentCommand != NULL && currentCommand->getCommandType()->commandTypeClass == CommandClass::ccUpgrade && commandType->commandTypeClass != CommandClass::ccAttack)
return result; return result;
const UnitType * const UnitType *
unitType = unit->getType(); unitType = unit->getType();
@@ -750,7 +752,8 @@ namespace
throw throw
megaglest_runtime_error(szBuf); megaglest_runtime_error(szBuf);
} }
if (unit->getProgress2() != NULL) Command* currentCommand = unit->getCurrCommand();
if (currentCommand != NULL && currentCommand->getCommandType()->commandTypeClass == CommandClass::ccUpgrade && commandType->commandTypeClass != CommandClass::ccAttack)
return result; return result;
const UnitType * const UnitType *
unitType = unit->getType(); unitType = unit->getType();
@@ -838,7 +841,8 @@ namespace
throw throw
megaglest_runtime_error(szBuf); megaglest_runtime_error(szBuf);
} }
if (unit->getProgress2() != NULL) Command* currentCommand = unit->getCurrCommand();
if (currentCommand != NULL && currentCommand->getCommandType()->commandTypeClass == CommandClass::ccUpgrade && commandType->commandTypeClass != CommandClass::ccAttack)
return result; return result;
const UnitType * const UnitType *
unitType = unit->getType(); unitType = unit->getType();

View File

@@ -240,10 +240,10 @@ namespace Shared {
ftFont->Render(str, len); ftFont->Render(str, len);
//assertGl(); //assertGl();
GLenum error = glGetError(); GLenum error = glGetError();
if (error != GL_NO_ERROR) { /*if (error != GL_NO_ERROR) {
printf("\n[%s::%s] Line %d Error = %d [%s] for text [%s]\n", __FILE__, __FUNCTION__, __LINE__, error, gluErrorString(error), str); printf("\n[%s::%s] Line %d Error = %d [%s] for text [%s]\n", __FILE__, __FUNCTION__, __LINE__, error, gluErrorString(error), str);
fflush(stdout); fflush(stdout);
} }*/
if (ftFont->Error()) { if (ftFont->Error()) {
char szBuf[8096] = ""; char szBuf[8096] = "";
@@ -308,10 +308,10 @@ namespace Shared {
FTBBox box = ftFont->BBox(TextFTGL::langHeightText.c_str()); FTBBox box = ftFont->BBox(TextFTGL::langHeightText.c_str());
GLenum error = glGetError(); GLenum error = glGetError();
if (error != GL_NO_ERROR) { /*if (error != GL_NO_ERROR) {
printf("\n[%s::%s] Line %d Error = %d [%s] for text [%s]\n", __FILE__, __FUNCTION__, __LINE__, error, gluErrorString(error), str); printf("\n[%s::%s] Line %d Error = %d [%s] for text [%s]\n", __FILE__, __FUNCTION__, __LINE__, error, gluErrorString(error), str);
fflush(stdout); fflush(stdout);
} }*/
result = box.Upper().Yf() - box.Lower().Yf(); result = box.Upper().Yf() - box.Lower().Yf();
if (result == 0) { if (result == 0) {

View File

@@ -49,8 +49,8 @@ int evtlistcmp(struct eventlist * a, struct eventlist * b) {
return 0; return 0;
} }
/* Test data */ //Test data
static const char xmldata[] = /*static const char xmldata[] =
"<xmlroot>\n" "<xmlroot>\n"
" <elt1 att1=\"attvalue1\" att2=\"attvalue2\">" " <elt1 att1=\"attvalue1\" att2=\"attvalue2\">"
"character data" "character data"
@@ -58,7 +58,7 @@ static const char xmldata[] =
"<elt1b/>" "<elt1b/>"
"<elt1>\n<![CDATA[ <html>stuff !\n ]]> \n</elt1>\n" "<elt1>\n<![CDATA[ <html>stuff !\n ]]> \n</elt1>\n"
"<elt2a> \t<elt2b>chardata1</elt2b><elt2b> chardata2 </elt2b></elt2a>" "<elt2a> \t<elt2b>chardata1</elt2b><elt2b> chardata2 </elt2b></elt2a>"
"</xmlroot>"; "</xmlroot>";*/
static const struct event evtref[] = static const struct event evtref[] =
{ {

View File

@@ -57,7 +57,7 @@ int is_int(char const* s) {
return 1; return 1;
} }
static void DisplayInfos(struct UPNPUrls * urls, void DisplayInfos(struct UPNPUrls * urls,
struct IGDdatas * data) { struct IGDdatas * data) {
char externalIPAddress[40]; char externalIPAddress[40];
char connectionType[64]; char connectionType[64];
@@ -110,7 +110,7 @@ static void DisplayInfos(struct UPNPUrls * urls,
} }
} }
static void GetConnectionStatus(struct UPNPUrls * urls, void GetConnectionStatus(struct UPNPUrls * urls,
struct IGDdatas * data) { struct IGDdatas * data) {
unsigned int bytessent, bytesreceived, packetsreceived, packetssent; unsigned int bytessent, bytesreceived, packetsreceived, packetssent;
DisplayInfos(urls, data); DisplayInfos(urls, data);
@@ -122,7 +122,7 @@ static void GetConnectionStatus(struct UPNPUrls * urls,
printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived); printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived);
} }
static void ListRedirections(struct UPNPUrls * urls, void ListRedirections(struct UPNPUrls * urls,
struct IGDdatas * data) { struct IGDdatas * data) {
int r; int r;
int i = 0; int i = 0;
@@ -168,7 +168,7 @@ static void ListRedirections(struct UPNPUrls * urls,
} while (r == 0); } while (r == 0);
} }
static void NewListRedirections(struct UPNPUrls * urls, void NewListRedirections(struct UPNPUrls * urls,
struct IGDdatas * data) { struct IGDdatas * data) {
int r; int r;
int i = 0; int i = 0;
@@ -226,7 +226,7 @@ static void NewListRedirections(struct UPNPUrls * urls,
* 2 - get extenal ip address * 2 - get extenal ip address
* 3 - Add port mapping * 3 - Add port mapping
* 4 - get this port mapping from the IGD */ * 4 - get this port mapping from the IGD */
static void SetRedirectAndTest(struct UPNPUrls * urls, void SetRedirectAndTest(struct UPNPUrls * urls,
struct IGDdatas * data, struct IGDdatas * data,
const char * iaddr, const char * iaddr,
const char * iport, const char * iport,
@@ -293,8 +293,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
} }
} }
static void void RemoveRedirect(struct UPNPUrls * urls,
RemoveRedirect(struct UPNPUrls * urls,
struct IGDdatas * data, struct IGDdatas * data,
const char * eport, const char * eport,
const char * proto, const char * proto,
@@ -313,8 +312,7 @@ RemoveRedirect(struct UPNPUrls * urls,
printf("UPNP_DeletePortMapping() returned : %d\n", r); printf("UPNP_DeletePortMapping() returned : %d\n", r);
} }
static void void RemoveRedirectRange(struct UPNPUrls * urls,
RemoveRedirectRange(struct UPNPUrls * urls,
struct IGDdatas * data, struct IGDdatas * data,
const char * ePortStart, char const * ePortEnd, const char * ePortStart, char const * ePortEnd,
const char * proto, const char * manage) { const char * proto, const char * manage) {
@@ -337,7 +335,7 @@ RemoveRedirectRange(struct UPNPUrls * urls,
} }
/* IGD:2, functions for service WANIPv6FirewallControl:1 */ /* IGD:2, functions for service WANIPv6FirewallControl:1 */
static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data) { void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data) {
unsigned int bytessent, bytesreceived, packetsreceived, packetssent; unsigned int bytessent, bytesreceived, packetsreceived, packetssent;
int firewallEnabled = 0, inboundPinholeAllowed = 0; int firewallEnabled = 0, inboundPinholeAllowed = 0;
@@ -356,7 +354,7 @@ static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data) {
/* Test function /* Test function
* 1 - Add pinhole * 1 - Add pinhole
* 2 - Check if pinhole is working from the IGD side */ * 2 - Check if pinhole is working from the IGD side */
static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data, void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
const char * remoteaddr, const char * eport, const char * remoteaddr, const char * eport,
const char * intaddr, const char * iport, const char * intaddr, const char * iport,
const char * proto, const char * lease_time) { const char * proto, const char * lease_time) {
@@ -400,7 +398,7 @@ static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
/* Test function /* Test function
* 1 - Check if pinhole is working from the IGD side * 1 - Check if pinhole is working from the IGD side
* 2 - Update pinhole */ * 2 - Update pinhole */
static void GetPinholeAndUpdate(struct UPNPUrls * urls, struct IGDdatas * data, void GetPinholeAndUpdate(struct UPNPUrls * urls, struct IGDdatas * data,
const char * uniqueID, const char * lease_time) { const char * uniqueID, const char * lease_time) {
int isWorking = 0; int isWorking = 0;
int r; int r;
@@ -424,7 +422,7 @@ static void GetPinholeAndUpdate(struct UPNPUrls * urls, struct IGDdatas * data,
/* Test function /* Test function
* Get pinhole timeout * Get pinhole timeout
*/ */
static void GetPinholeOutboundTimeout(struct UPNPUrls * urls, struct IGDdatas * data, void GetPinholeOutboundTimeout(struct UPNPUrls * urls, struct IGDdatas * data,
const char * remoteaddr, const char * eport, const char * remoteaddr, const char * eport,
const char * intaddr, const char * iport, const char * intaddr, const char * iport,
const char * proto) { const char * proto) {
@@ -444,8 +442,7 @@ static void GetPinholeOutboundTimeout(struct UPNPUrls * urls, struct IGDdatas *
printf("GetOutboundPinholeTimeout: ([%s]:%s -> [%s]:%s) / Timeout = %d\n", intaddr, iport, remoteaddr, eport, timeout); printf("GetOutboundPinholeTimeout: ([%s]:%s -> [%s]:%s) / Timeout = %d\n", intaddr, iport, remoteaddr, eport, timeout);
} }
static void void GetPinholePackets(struct UPNPUrls * urls,
GetPinholePackets(struct UPNPUrls * urls,
struct IGDdatas * data, const char * uniqueID) { struct IGDdatas * data, const char * uniqueID) {
int r, pinholePackets = 0; int r, pinholePackets = 0;
if (!uniqueID) { if (!uniqueID) {
@@ -459,8 +456,7 @@ GetPinholePackets(struct UPNPUrls * urls,
printf("GetPinholePackets: Pinhole ID = %s / PinholePackets = %d\n", uniqueID, pinholePackets); printf("GetPinholePackets: Pinhole ID = %s / PinholePackets = %d\n", uniqueID, pinholePackets);
} }
static void void CheckPinhole(struct UPNPUrls * urls,
CheckPinhole(struct UPNPUrls * urls,
struct IGDdatas * data, const char * uniqueID) { struct IGDdatas * data, const char * uniqueID) {
int r, isWorking = 0; int r, isWorking = 0;
if (!uniqueID) { if (!uniqueID) {
@@ -474,8 +470,7 @@ CheckPinhole(struct UPNPUrls * urls,
printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking) ? "Yes" : "No"); printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking) ? "Yes" : "No");
} }
static void void RemovePinhole(struct UPNPUrls * urls,
RemovePinhole(struct UPNPUrls * urls,
struct IGDdatas * data, const char * uniqueID) { struct IGDdatas * data, const char * uniqueID) {
int r; int r;
if (!uniqueID) { if (!uniqueID) {