no return in void methods

This commit is contained in:
Titus Tscharntke 2013-02-05 22:00:50 +00:00
parent b2be14ca33
commit 3ea6a02d95
2 changed files with 35 additions and 19 deletions

View File

@ -736,23 +736,23 @@ void Ai::sendScoutPatrol(){
bool megaResourceAttack=(aiInterface->getControlType() == ctCpuMega || aiInterface->getControlType() == ctNetworkCpuMega)
&& random.randRange(0, 1) == 1;
std::vector<Vec2i> warningEnemyList = aiInterface->getEnemyWarningPositionList();
if(warningEnemyList.empty() == false) {
// Randomly check the enemy warning location list
if(random.randRange(0, 1) == 1) {
//for(int i = warningEnemyList.size() - 1; i <= 0; --i) {
// randomly pick a location from the location list
int i = random.randRange(0, warningEnemyList.size() - 1);
Vec2i &checkPos = warningEnemyList[i];
pos = checkPos;
possibleTargetFound = true;
aiInterface->removeEnemyWarningPositionFromList(checkPos);
// break;
//}
}
}
// std::vector<Vec2i> warningEnemyList = aiInterface->getEnemyWarningPositionList();
// if(warningEnemyList.empty() == false) {
// // Randomly check the enemy warning location list
// if(random.randRange(0, 1) == 1) {
// //for(int i = warningEnemyList.size() - 1; i <= 0; --i) {
//
// // randomly pick a location from the location list
// int i = random.randRange(0, warningEnemyList.size() - 1);
//
// Vec2i &checkPos = warningEnemyList[i];
// pos = checkPos;
// possibleTargetFound = true;
// aiInterface->removeEnemyWarningPositionFromList(checkPos);
// // break;
// //}
// }
// }
if(possibleTargetFound == false && (megaResourceAttack || ultraResourceAttack)) {
Map *map= aiInterface->getMap();
@ -794,6 +794,22 @@ void Ai::sendScoutPatrol(){
//else printf("is outside map\n");
}
}
std::vector<Vec2i> warningEnemyList = aiInterface->getEnemyWarningPositionList();
if( (possibleTargetFound == false) && (warningEnemyList.empty() == false)) {
for(int i = warningEnemyList.size() - 1; i <= 0; --i) {
Vec2i &checkPos = warningEnemyList[i];
if (random.randRange(0, 1) == 1 ) {
pos = checkPos;
possibleTargetFound = true;
warningEnemyList.clear();
} else {
aiInterface->removeEnemyWarningPositionFromList(checkPos);
}
break;
}
}
if(possibleTargetFound == false){
startLoc= (startLoc + 1) % aiInterface->getMapMaxPlayers();
pos= aiInterface->getStartLocation(startLoc);

View File

@ -1496,7 +1496,7 @@ void ScriptManager::setUnitPosition(int unitId, Vec2i pos) {
void ScriptManager::addCellMarker(Vec2i pos, int factionIndex, const string &note, const string &textureFile) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->addCellMarker(pos,factionIndex, note, textureFile);
world->addCellMarker(pos,factionIndex, note, textureFile);
}
void ScriptManager::removeCellMarker(Vec2i pos, int factionIndex) {
@ -1508,7 +1508,7 @@ void ScriptManager::removeCellMarker(Vec2i pos, int factionIndex) {
void ScriptManager::showMarker(Vec2i pos, int factionIndex, const string &note, const string &textureFile, int flashCount) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->showMarker(pos,factionIndex, note, textureFile, flashCount);
world->showMarker(pos,factionIndex, note, textureFile, flashCount);
}
int ScriptManager::getIsUnitAlive(int unitId) {