- loads of code cleanup based on verbose output from the latest git version of cppcheck
This commit is contained in:
parent
2a80dd7c3c
commit
5e42c6dc03
|
@ -804,7 +804,7 @@ void MainWindow::onMouseMove(wxMouseEvent &event){
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
||||||
try {
|
try {
|
||||||
string fileName;
|
//string fileName;
|
||||||
fileDialog->SetWildcard(wxT("G3D files (*.g3d)|*.g3d;*.G3D"));
|
fileDialog->SetWildcard(wxT("G3D files (*.g3d)|*.g3d;*.G3D"));
|
||||||
fileDialog->SetMessage(wxT("Selecting Glest Model for current view."));
|
fileDialog->SetMessage(wxT("Selecting Glest Model for current view."));
|
||||||
|
|
||||||
|
@ -834,7 +834,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
||||||
try {
|
try {
|
||||||
string fileName;
|
//string fileName;
|
||||||
fileDialog->SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
fileDialog->SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
||||||
|
|
||||||
if(isControlKeyPressed == true) {
|
if(isControlKeyPressed == true) {
|
||||||
|
@ -868,7 +868,7 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
||||||
try {
|
try {
|
||||||
string fileName;
|
//string fileName;
|
||||||
fileDialog->SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
fileDialog->SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
||||||
|
|
||||||
if(isControlKeyPressed == true) {
|
if(isControlKeyPressed == true) {
|
||||||
|
@ -902,7 +902,7 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
||||||
|
|
||||||
void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
||||||
try {
|
try {
|
||||||
string fileName;
|
//string fileName;
|
||||||
fileDialog->SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
fileDialog->SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
||||||
|
|
||||||
if(isControlKeyPressed == true) {
|
if(isControlKeyPressed == true) {
|
||||||
|
@ -1411,7 +1411,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
int height = 1;
|
int height = 1;
|
||||||
|
|
||||||
if(fileExists(unitXML) == true) {
|
if(fileExists(unitXML) == true) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,unitXML.c_str(),idx);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %u\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,unitXML.c_str(),idx);
|
||||||
|
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(unitXML,Properties::getTagReplacementValues());
|
xmlTree.load(unitXML,Properties::getTagReplacementValues());
|
||||||
|
@ -1427,7 +1427,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
|
|
||||||
string particleFile = dir + folderDelimiter + particlePath;
|
string particleFile = dir + folderDelimiter + particlePath;
|
||||||
{
|
{
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %u\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(particleFile,Properties::getTagReplacementValues());
|
xmlTree.load(particleFile,Properties::getTagReplacementValues());
|
||||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||||
|
@ -1435,7 +1435,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %u\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||||
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
||||||
projectileParticleSystemType->load(NULL, dir, //### we don't know if there are overrides in the unit XML
|
projectileParticleSystemType->load(NULL, dir, //### we don't know if there are overrides in the unit XML
|
||||||
|
@ -1466,7 +1466,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||||
renderer->manageParticleSystem(ps);
|
renderer->manageParticleSystem(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loaded [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loaded [%s] idx = %u\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||||
}
|
}
|
||||||
SetTitle(ToUnicode(titlestring));
|
SetTitle(ToUnicode(titlestring));
|
||||||
|
|
||||||
|
|
|
@ -729,9 +729,9 @@ void AiInterface::loadGame(const XmlNode *rootNode, Faction *faction) {
|
||||||
|
|
||||||
timer = aiInterfaceNode->getAttribute("timer")->getIntValue();
|
timer = aiInterfaceNode->getAttribute("timer")->getIntValue();
|
||||||
// int factionIndex;
|
// int factionIndex;
|
||||||
factionIndex = aiInterfaceNode->getAttribute("factionIndex")->getIntValue();
|
//factionIndex = aiInterfaceNode->getAttribute("factionIndex")->getIntValue();
|
||||||
// int teamIndex;
|
// int teamIndex;
|
||||||
teamIndex = aiInterfaceNode->getAttribute("teamIndex")->getIntValue();
|
//teamIndex = aiInterfaceNode->getAttribute("teamIndex")->getIntValue();
|
||||||
// //config
|
// //config
|
||||||
// bool redir;
|
// bool redir;
|
||||||
redir = aiInterfaceNode->getAttribute("redir")->getIntValue() != 0;
|
redir = aiInterfaceNode->getAttribute("redir")->getIntValue() != 0;
|
||||||
|
|
|
@ -921,8 +921,8 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||||
int currentProducerIndex = producers[i];
|
int currentProducerIndex = producers[i];
|
||||||
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %d,producers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %d,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,14 +953,14 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||||
|
|
||||||
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %d,producers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %d,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
if(prIndex >= producers.size()) {
|
if(prIndex >= producers.size()) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
printf("In [%s::%s Line: %d] prIndex >= producers.size(), currentProducerIndex = %d, i = %d,producers.size() = %lu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,(unsigned long)producers.size());
|
printf("In [%s::%s Line: %d] prIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = %lu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,(unsigned long)producers.size());
|
||||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %d,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)producers.size());
|
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)producers.size());
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1019,14 +1019,14 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||||
|
|
||||||
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %d,backupProducers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)backupProducers.size());
|
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)backupProducers.size());
|
||||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %d,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)backupProducers.size());
|
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)backupProducers.size());
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
if(prIndex >= backupProducers.size()) {
|
if(prIndex >= backupProducers.size()) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %d,backupProducers.size() = %lu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,(unsigned long)backupProducers.size());
|
printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = %lu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,(unsigned long)backupProducers.size());
|
||||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %d,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)backupProducers.size());
|
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)backupProducers.size());
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1392,7 +1392,7 @@ void AiRuleBuild::buildSpecific(const BuildTask *bt) {
|
||||||
if(ai->getAiInterface()->isFreeCells(tryPos - Vec2i(spacing), bt->getUnitType()->getSize() + spacing * 2, fLand)) {
|
if(ai->getAiInterface()->isFreeCells(tryPos - Vec2i(spacing), bt->getUnitType()->getSize() + spacing * 2, fLand)) {
|
||||||
enemies.clear();
|
enemies.clear();
|
||||||
ai->getAiInterface()->getWorld()->getUnitUpdater()->findEnemiesForCell(tryPos,bt->getUnitType()->getSize(),enemySightDistanceToAvoid,ai->getAiInterface()->getMyFaction(),enemies,true);
|
ai->getAiInterface()->getWorld()->getUnitUpdater()->findEnemiesForCell(tryPos,bt->getUnitType()->getSize(),enemySightDistanceToAvoid,ai->getAiInterface()->getMyFaction(),enemies,true);
|
||||||
if(enemies.size() <= 0) {
|
if(enemies.empty() == true) {
|
||||||
searchPos = tryPos;
|
searchPos = tryPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1408,7 +1408,7 @@ void AiRuleBuild::buildSpecific(const BuildTask *bt) {
|
||||||
if(ai->getAiInterface()->isFreeCells(tryPos - Vec2i(spacing), bt->getUnitType()->getSize() + spacing * 2, fLand)) {
|
if(ai->getAiInterface()->isFreeCells(tryPos - Vec2i(spacing), bt->getUnitType()->getSize() + spacing * 2, fLand)) {
|
||||||
enemies.clear();
|
enemies.clear();
|
||||||
ai->getAiInterface()->getWorld()->getUnitUpdater()->findEnemiesForCell(tryPos,bt->getUnitType()->getSize(),enemySightDistanceToAvoid,ai->getAiInterface()->getMyFaction(),enemies,true);
|
ai->getAiInterface()->getWorld()->getUnitUpdater()->findEnemiesForCell(tryPos,bt->getUnitType()->getSize(),enemySightDistanceToAvoid,ai->getAiInterface()->getMyFaction(),enemies,true);
|
||||||
if(enemies.size() <= 0) {
|
if(enemies.empty() == true) {
|
||||||
searchPos = tryPos;
|
searchPos = tryPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,7 +287,7 @@ private:
|
||||||
|
|
||||||
//bool canUnitMoveSoon(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2);
|
//bool canUnitMoveSoon(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2);
|
||||||
inline bool canUnitMoveSoon(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2) {
|
inline bool canUnitMoveSoon(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2) {
|
||||||
bool result = true;
|
//bool result = true;
|
||||||
|
|
||||||
// std::map<int,std::map<Field,BadUnitNodeList> > &badCellList = factions[unit->getFactionIndex()].badCellList;
|
// std::map<int,std::map<Field,BadUnitNodeList> > &badCellList = factions[unit->getFactionIndex()].badCellList;
|
||||||
// if(badCellList.find(unit->getType()->getSize()) != badCellList.end()) {
|
// if(badCellList.find(unit->getType()->getSize()) != badCellList.end()) {
|
||||||
|
@ -308,7 +308,7 @@ private:
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
result = map->aproxCanMoveSoon(unit, pos1, pos2);
|
bool result = map->aproxCanMoveSoon(unit, pos1, pos2);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,14 @@ string getCrashDumpFileName(){
|
||||||
}
|
}
|
||||||
|
|
||||||
string getPlatformNameString() {
|
string getPlatformNameString() {
|
||||||
static string platform = "";
|
static string platform;
|
||||||
if(platform == "") {
|
if(platform == "") {
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
platform = "Windows";
|
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
platform = "W-MINGW";
|
platform = "W-MINGW";
|
||||||
|
#else
|
||||||
|
platform = "Windows";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
|
@ -55,9 +57,11 @@ string getPlatformNameString() {
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
platform = "MacOSX";
|
platform = "MacOSX";
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
platform = "GNU";
|
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
platform = "L-MINGW";
|
platform = "L-MINGW";
|
||||||
|
#else
|
||||||
|
platform = "GNU";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -281,7 +281,7 @@ void Logger::renderLoadingScreen() {
|
||||||
void Logger::setCancelLoadingEnabled(bool value) {
|
void Logger::setCancelLoadingEnabled(bool value) {
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
const Metrics &metrics= Metrics::getInstance();
|
const Metrics &metrics= Metrics::getInstance();
|
||||||
string containerName = "logger";
|
//string containerName = "logger";
|
||||||
//buttonCancel.registerGraphicComponent(containerName,"buttonCancel");
|
//buttonCancel.registerGraphicComponent(containerName,"buttonCancel");
|
||||||
buttonCancel.init((metrics.getVirtualW() / 2) - (125 / 2), 50 * metrics.getVirtualH() / 100, 125);
|
buttonCancel.init((metrics.getVirtualW() / 2) - (125 / 2), 50 * metrics.getVirtualH() / 100, 125);
|
||||||
buttonCancel.setText(lang.get("Cancel"));
|
buttonCancel.setText(lang.get("Cancel"));
|
||||||
|
|
|
@ -136,7 +136,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
||||||
if(text.empty() == false) {
|
if(text.empty() == false) {
|
||||||
|
|
||||||
if(customCB == NULL) {
|
if(customCB == NULL) {
|
||||||
string playerName = gameNetworkInterface->getHumanPlayerName();
|
//string playerName = gameNetworkInterface->getHumanPlayerName();
|
||||||
int playerIndex = gameNetworkInterface->getHumanPlayerIndex();
|
int playerIndex = gameNetworkInterface->getHumanPlayerIndex();
|
||||||
|
|
||||||
if(this->manualPlayerNameOverride != "") {
|
if(this->manualPlayerNameOverride != "") {
|
||||||
|
|
|
@ -768,7 +768,7 @@ vector<Texture2D *> Game::processTech(string techName) {
|
||||||
vector<Texture2D *> logoFiles;
|
vector<Texture2D *> logoFiles;
|
||||||
bool enableFactionTexturePreview = Config::getInstance().getBool("FactionPreview","true");
|
bool enableFactionTexturePreview = Config::getInstance().getBool("FactionPreview","true");
|
||||||
if(enableFactionTexturePreview) {
|
if(enableFactionTexturePreview) {
|
||||||
string currentTechName_factionPreview = techName;
|
//string currentTechName_factionPreview = techName;
|
||||||
|
|
||||||
vector<string> factions;
|
vector<string> factions;
|
||||||
vector<string> techPaths = Config::getInstance().getPathListForType(ptTechs);
|
vector<string> techPaths = Config::getInstance().getPathListForType(ptTechs);
|
||||||
|
@ -780,10 +780,9 @@ vector<Texture2D *> Game::processTech(string techName) {
|
||||||
if(factions.empty() == false) {
|
if(factions.empty() == false) {
|
||||||
for(unsigned int factionIdx = 0; factionIdx < factions.size(); ++factionIdx) {
|
for(unsigned int factionIdx = 0; factionIdx < factions.size(); ++factionIdx) {
|
||||||
bool loadingImageUsed = false;
|
bool loadingImageUsed = false;
|
||||||
string factionLogo = "";
|
|
||||||
string currentFactionName_factionPreview = factions[factionIdx];
|
string currentFactionName_factionPreview = factions[factionIdx];
|
||||||
|
|
||||||
factionLogo = Game::extractFactionLogoFile(
|
string factionLogo = Game::extractFactionLogoFile(
|
||||||
loadingImageUsed,
|
loadingImageUsed,
|
||||||
currentFactionName_factionPreview,
|
currentFactionName_factionPreview,
|
||||||
"",
|
"",
|
||||||
|
@ -1612,7 +1611,7 @@ void Game::update() {
|
||||||
bool keepFactions = world.getQueuedScenarioKeepFactions();
|
bool keepFactions = world.getQueuedScenarioKeepFactions();
|
||||||
world.setQueuedScenario("",false);
|
world.setQueuedScenario("",false);
|
||||||
|
|
||||||
vector<string> results;
|
//vector<string> results;
|
||||||
const vector<string> &dirList = Config::getInstance().getPathListForType(ptScenarios);
|
const vector<string> &dirList = Config::getInstance().getPathListForType(ptScenarios);
|
||||||
string scenarioFile = Scenario::getScenarioPath(dirList, name);
|
string scenarioFile = Scenario::getScenarioPath(dirList, name);
|
||||||
|
|
||||||
|
@ -2491,34 +2490,34 @@ void Game::mouseDownLeft(int x, int y) {
|
||||||
popupMenuSwitchTeams.setEnabled(false);
|
popupMenuSwitchTeams.setEnabled(false);
|
||||||
popupMenuSwitchTeams.setVisible(false);
|
popupMenuSwitchTeams.setVisible(false);
|
||||||
|
|
||||||
bool isNetworkGame = this->gameSettings.isNetworkGame();
|
//bool isNetworkGame = this->gameSettings.isNetworkGame();
|
||||||
|
|
||||||
int teamIndex = switchTeamIndexMap[result.first];
|
int teamIndex = switchTeamIndexMap[result.first];
|
||||||
switch(teamIndex) {
|
switch(teamIndex) {
|
||||||
case CREATE_NEW_TEAM:
|
case CREATE_NEW_TEAM:
|
||||||
{
|
{
|
||||||
int newTeam = getFirstUnusedTeamNumber();
|
int newTeam = getFirstUnusedTeamNumber();
|
||||||
if(isNetworkGame == true) {
|
//if(isNetworkGame == true) {
|
||||||
const Faction *faction = world.getThisFaction();
|
const Faction *faction = world.getThisFaction();
|
||||||
commander.trySwitchTeam(faction,newTeam);
|
commander.trySwitchTeam(faction,newTeam);
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
const Faction *faction = world.getThisFaction();
|
// const Faction *faction = world.getThisFaction();
|
||||||
commander.trySwitchTeam(faction,newTeam);
|
// commander.trySwitchTeam(faction,newTeam);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CANCEL_SWITCH_TEAM:
|
case CANCEL_SWITCH_TEAM:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(isNetworkGame == true) {
|
//if(isNetworkGame == true) {
|
||||||
const Faction *faction = world.getThisFaction();
|
const Faction *faction = world.getThisFaction();
|
||||||
commander.trySwitchTeam(faction,teamIndex);
|
commander.trySwitchTeam(faction,teamIndex);
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
const Faction *faction = world.getThisFaction();
|
// const Faction *faction = world.getThisFaction();
|
||||||
commander.trySwitchTeam(faction,teamIndex);
|
// commander.trySwitchTeam(faction,teamIndex);
|
||||||
}
|
//}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2746,7 +2745,6 @@ void Game::mouseDownLeft(int x, int y) {
|
||||||
Vec2i surfaceCellPos = map->toSurfCoords(targetPos);
|
Vec2i surfaceCellPos = map->toSurfCoords(targetPos);
|
||||||
|
|
||||||
MarkedCell mc(targetPos,world.getThisFaction(),"placeholder for note",world.getThisFaction()->getStartLocationIndex());
|
MarkedCell mc(targetPos,world.getThisFaction(),"placeholder for note",world.getThisFaction()->getStartLocationIndex());
|
||||||
cellMarkedData = mc;
|
|
||||||
|
|
||||||
//printf("#2 ADDED in marked list pos [%s] markedCells.size() = %lu\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size());
|
//printf("#2 ADDED in marked list pos [%s] markedCells.size() = %lu\n",surfaceCellPos.getString().c_str(),mapMarkedCellList.size());
|
||||||
|
|
||||||
|
@ -3027,11 +3025,12 @@ void Game::mouseMove(int x, int y, const MouseState *ms) {
|
||||||
{
|
{
|
||||||
//float ymult = Config::getInstance().getCameraInvertYAxis() ? -0.2f : 0.2f;
|
//float ymult = Config::getInstance().getCameraInvertYAxis() ? -0.2f : 0.2f;
|
||||||
//float xmult = Config::getInstance().getCameraInvertXAxis() ? -0.2f : 0.2f;
|
//float xmult = Config::getInstance().getCameraInvertXAxis() ? -0.2f : 0.2f;
|
||||||
float ymult = 0.2f;
|
|
||||||
float xmult = 0.2f;
|
|
||||||
|
|
||||||
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
if(currentCameraFollowUnit==NULL){
|
if(currentCameraFollowUnit==NULL){
|
||||||
|
float ymult = 0.2f;
|
||||||
|
float xmult = 0.2f;
|
||||||
|
|
||||||
gameCamera.transitionVH(-(y - lastMousePos.y) * ymult, (lastMousePos.x - x) * xmult);
|
gameCamera.transitionVH(-(y - lastMousePos.y) * ymult, (lastMousePos.x - x) * xmult);
|
||||||
}
|
}
|
||||||
mouseX=lastMousePos.x;
|
mouseX=lastMousePos.x;
|
||||||
|
|
|
@ -2063,7 +2063,6 @@ int ScriptManager::DisplayFormattedText(LuaHandle* luaHandle) {
|
||||||
//lua_lock(luaHandle);
|
//lua_lock(luaHandle);
|
||||||
//luaC_checkGC(luaHandle);
|
//luaC_checkGC(luaHandle);
|
||||||
|
|
||||||
const int max_args_allowed = 8;
|
|
||||||
int args = lua_gettop(luaHandle);
|
int args = lua_gettop(luaHandle);
|
||||||
if(lua_checkstack(luaHandle, args+1)) {
|
if(lua_checkstack(luaHandle, args+1)) {
|
||||||
LuaArguments luaArguments(luaHandle);
|
LuaArguments luaArguments(luaHandle);
|
||||||
|
@ -2073,6 +2072,7 @@ int ScriptManager::DisplayFormattedText(LuaHandle* luaHandle) {
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"DisplayFormattedText args = %d!\n",args);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"DisplayFormattedText args = %d!\n",args);
|
||||||
|
|
||||||
|
const int max_args_allowed = 8;
|
||||||
if(args == 1) {
|
if(args == 1) {
|
||||||
thisScriptManager->DisplayFormattedText(fmt.c_str());
|
thisScriptManager->DisplayFormattedText(fmt.c_str());
|
||||||
}
|
}
|
||||||
|
@ -2171,7 +2171,6 @@ if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags
|
||||||
//lua_lock(luaHandle);
|
//lua_lock(luaHandle);
|
||||||
//luaC_checkGC(luaHandle);
|
//luaC_checkGC(luaHandle);
|
||||||
|
|
||||||
const int max_args_allowed = 8;
|
|
||||||
int args = lua_gettop(luaHandle);
|
int args = lua_gettop(luaHandle);
|
||||||
if(lua_checkstack(luaHandle, args+1)) {
|
if(lua_checkstack(luaHandle, args+1)) {
|
||||||
LuaArguments luaArguments(luaHandle);
|
LuaArguments luaArguments(luaHandle);
|
||||||
|
@ -2181,6 +2180,7 @@ if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"DisplayFormattedText args = %d!\n",args);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"DisplayFormattedText args = %d!\n",args);
|
||||||
|
|
||||||
|
const int max_args_allowed = 8;
|
||||||
if(args == 1) {
|
if(args == 1) {
|
||||||
thisScriptManager->addConsoleLangText(Lang::getInstance().getScenarioString(fmt).c_str());
|
thisScriptManager->addConsoleLangText(Lang::getInstance().getScenarioString(fmt).c_str());
|
||||||
}
|
}
|
||||||
|
@ -2252,7 +2252,6 @@ int ScriptManager::DisplayFormattedLangText(LuaHandle* luaHandle) {
|
||||||
//lua_lock(luaHandle);
|
//lua_lock(luaHandle);
|
||||||
//luaC_checkGC(luaHandle);
|
//luaC_checkGC(luaHandle);
|
||||||
|
|
||||||
const int max_args_allowed = 8;
|
|
||||||
int args = lua_gettop(luaHandle);
|
int args = lua_gettop(luaHandle);
|
||||||
if(lua_checkstack(luaHandle, args+1)) {
|
if(lua_checkstack(luaHandle, args+1)) {
|
||||||
LuaArguments luaArguments(luaHandle);
|
LuaArguments luaArguments(luaHandle);
|
||||||
|
@ -2262,6 +2261,7 @@ int ScriptManager::DisplayFormattedLangText(LuaHandle* luaHandle) {
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"DisplayFormattedText args = %d!\n",args);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"DisplayFormattedText args = %d!\n",args);
|
||||||
|
|
||||||
|
const int max_args_allowed = 8;
|
||||||
if(args == 1) {
|
if(args == 1) {
|
||||||
thisScriptManager->DisplayFormattedLangText(Lang::getInstance().getScenarioString(fmt).c_str());
|
thisScriptManager->DisplayFormattedLangText(Lang::getInstance().getScenarioString(fmt).c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Glest{ namespace Game{
|
||||||
PlayerStats::PlayerStats() {
|
PlayerStats::PlayerStats() {
|
||||||
control = ctClosed;
|
control = ctClosed;
|
||||||
resourceMultiplier=1.0f;
|
resourceMultiplier=1.0f;
|
||||||
factionTypeName = "";
|
//factionTypeName = "";
|
||||||
personalityType = fpt_Normal;
|
personalityType = fpt_Normal;
|
||||||
teamIndex = 0;
|
teamIndex = 0;
|
||||||
victory = false;
|
victory = false;
|
||||||
|
@ -27,7 +27,7 @@ PlayerStats::PlayerStats() {
|
||||||
deaths = 0;
|
deaths = 0;
|
||||||
unitsProduced = 0;
|
unitsProduced = 0;
|
||||||
resourcesHarvested = 0;
|
resourcesHarvested = 0;
|
||||||
playerName = "";
|
//playerName = "";
|
||||||
playerLeftBeforeEnd = false;
|
playerLeftBeforeEnd = false;
|
||||||
timePlayerLeft = -1;
|
timePlayerLeft = -1;
|
||||||
playerColor = Vec3f(0,0,0);
|
playerColor = Vec3f(0,0,0);
|
||||||
|
@ -108,7 +108,7 @@ string PlayerStats::getStats() const {
|
||||||
// class Stats
|
// class Stats
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
void Stats::init(int factionCount, int thisFactionIndex, const string& description, const string techName) {
|
void Stats::init(int factionCount, int thisFactionIndex, const string& description, const string &techName) {
|
||||||
this->thisFactionIndex= thisFactionIndex;
|
this->thisFactionIndex= thisFactionIndex;
|
||||||
this->factionCount= factionCount;
|
this->factionCount= factionCount;
|
||||||
this->description= description;
|
this->description= description;
|
||||||
|
|
|
@ -78,7 +78,7 @@ private:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Stats() {
|
Stats() {
|
||||||
description = "";
|
//description = "";
|
||||||
factionCount = 0;
|
factionCount = 0;
|
||||||
thisFactionIndex = 0;
|
thisFactionIndex = 0;
|
||||||
|
|
||||||
|
@ -89,11 +89,11 @@ public:
|
||||||
totalEndGameConcurrentUnitCount = 0;
|
totalEndGameConcurrentUnitCount = 0;
|
||||||
isMasterserverMode = false;
|
isMasterserverMode = false;
|
||||||
timePlayed = 0;
|
timePlayed = 0;
|
||||||
techName = "";
|
//techName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(int factionCount, int thisFactionIndex, const string &description,
|
void init(int factionCount, int thisFactionIndex, const string &description,
|
||||||
const string techName);
|
const string &techName);
|
||||||
|
|
||||||
string getDescription() const {return description;}
|
string getDescription() const {return description;}
|
||||||
int getThisFactionIndex() const {return thisFactionIndex;}
|
int getThisFactionIndex() const {return thisFactionIndex;}
|
||||||
|
|
|
@ -343,13 +343,15 @@ bool Lang::hasString(const string &s, string uselanguage, bool fallbackToDefault
|
||||||
if(otherLanguageStrings.find(uselanguage) == otherLanguageStrings.end()) {
|
if(otherLanguageStrings.find(uselanguage) == otherLanguageStrings.end()) {
|
||||||
loadStrings(uselanguage, otherLanguageStrings[uselanguage], false);
|
loadStrings(uselanguage, otherLanguageStrings[uselanguage], false);
|
||||||
}
|
}
|
||||||
string result2 = otherLanguageStrings[uselanguage].getString(s);
|
//string result2 = otherLanguageStrings[uselanguage].getString(s);
|
||||||
|
otherLanguageStrings[uselanguage].getString(s);
|
||||||
//printf("#b result2 [%s]\n",result2.c_str());
|
//printf("#b result2 [%s]\n",result2.c_str());
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string result2 = strings.getString(s);
|
//string result2 = strings.getString(s);
|
||||||
|
strings.getString(s);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,11 @@ bool Renderer::renderText3DEnabled = true;
|
||||||
const float SKIP_INTERPOLATION_DISTANCE = 20.0f;
|
const float SKIP_INTERPOLATION_DISTANCE = 20.0f;
|
||||||
const string DEFAULT_CHAR_FOR_WIDTH_CALC = "V";
|
const string DEFAULT_CHAR_FOR_WIDTH_CALC = "V";
|
||||||
|
|
||||||
|
enum PROJECTION_TO_INFINITY {
|
||||||
|
pti_D_IS_ZERO,
|
||||||
|
pti_N_OVER_D_IS_OUTSIDE
|
||||||
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class MeshCallbackTeamColor
|
// class MeshCallbackTeamColor
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -1069,11 +1074,6 @@ void Renderer::loadCameraMatrix(const Camera *camera) {
|
||||||
glTranslatef(-position.x, -position.y, -position.z);
|
glTranslatef(-position.x, -position.y, -position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PROJECTION_TO_INFINITY {
|
|
||||||
D_IS_ZERO,
|
|
||||||
N_OVER_D_IS_OUTSIDE
|
|
||||||
};
|
|
||||||
|
|
||||||
static Vec2i _unprojectMap(const Vec2i& pt,const GLdouble* model,const GLdouble* projection,const GLint* viewport,const char* label=NULL) {
|
static Vec2i _unprojectMap(const Vec2i& pt,const GLdouble* model,const GLdouble* projection,const GLint* viewport,const char* label=NULL) {
|
||||||
Vec3d a,b;
|
Vec3d a,b;
|
||||||
/* note viewport[3] is height of window in pixels */
|
/* note viewport[3] is height of window in pixels */
|
||||||
|
@ -1139,11 +1139,11 @@ static Vec2i _unprojectMap(const Vec2i& pt,const GLdouble* model,const GLdouble*
|
||||||
#else
|
#else
|
||||||
if(fabs(d) < 0.00001)
|
if(fabs(d) < 0.00001)
|
||||||
#endif
|
#endif
|
||||||
throw D_IS_ZERO;
|
throw pti_D_IS_ZERO;
|
||||||
|
|
||||||
const float nd = -(norm.x*w.x + norm.y*w.y + norm.z*w.z) / d;
|
const float nd = -(norm.x*w.x + norm.y*w.y + norm.z*w.z) / d;
|
||||||
if(nd < 0.0 || nd >= 1.0)
|
if(nd < 0.0 || nd >= 1.0)
|
||||||
throw N_OVER_D_IS_OUTSIDE;
|
throw pti_N_OVER_D_IS_OUTSIDE;
|
||||||
|
|
||||||
const Vec3f i = start + u*nd;
|
const Vec3f i = start + u*nd;
|
||||||
//const Vec2i pos(i.x,i.z);
|
//const Vec2i pos(i.x,i.z);
|
||||||
|
@ -1521,7 +1521,7 @@ void Renderer::computeVisibleQuad() {
|
||||||
visibleQuad.p[3].x,visibleQuad.p[3].y);
|
visibleQuad.p[3].x,visibleQuad.p[3].y);
|
||||||
|
|
||||||
for(unsigned int i = 0; i < quadCache.frustumData.size(); ++i) {
|
for(unsigned int i = 0; i < quadCache.frustumData.size(); ++i) {
|
||||||
printf("\nFrustrum #%d [%lu]: ",i,quadCache.frustumData.size());
|
printf("\nFrustrum #%u [%lu]: ",i,quadCache.frustumData.size());
|
||||||
vector<float> &frustumDataInner = quadCache.frustumData[i];
|
vector<float> &frustumDataInner = quadCache.frustumData[i];
|
||||||
for(unsigned int j = 0; j < frustumDataInner.size(); ++j) {
|
for(unsigned int j = 0; j < frustumDataInner.size(); ++j) {
|
||||||
printf("[%f]",quadCache.frustumData[i][j]);
|
printf("[%f]",quadCache.frustumData[i][j]);
|
||||||
|
@ -1704,14 +1704,12 @@ void Renderer::renderMouse2d(int x, int y, int anim, float fade) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float color1 = 0.0, color2 = 0.0;
|
|
||||||
|
|
||||||
float fadeFactor = fade + 1.f;
|
float fadeFactor = fade + 1.f;
|
||||||
|
|
||||||
anim= anim * 2 - maxMouse2dAnim;
|
anim= anim * 2 - maxMouse2dAnim;
|
||||||
|
|
||||||
color2= (abs(anim*(int)fadeFactor)/static_cast<float>(maxMouse2dAnim))/2.f+0.4f;
|
float color2= (abs(anim*(int)fadeFactor)/static_cast<float>(maxMouse2dAnim))/2.f+0.4f;
|
||||||
color1= (abs(anim*(int)fadeFactor)/static_cast<float>(maxMouse2dAnim))/2.f+0.8f;
|
float color1= (abs(anim*(int)fadeFactor)/static_cast<float>(maxMouse2dAnim))/2.f+0.8f;
|
||||||
|
|
||||||
glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_LINE_BIT);
|
glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_LINE_BIT);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
@ -4914,10 +4912,9 @@ void Renderer::renderUnits(const int renderFps) {
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool modelRenderStarted = false;
|
|
||||||
|
|
||||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||||
if(qCache.visibleQuadUnitList.empty() == false) {
|
if(qCache.visibleQuadUnitList.empty() == false) {
|
||||||
|
bool modelRenderStarted = false;
|
||||||
for(int visibleUnitIndex = 0;
|
for(int visibleUnitIndex = 0;
|
||||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||||
|
@ -5861,8 +5858,8 @@ void Renderer::renderMinimap(){
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
int x1 = 0;
|
int x1;
|
||||||
int y1 = 0;
|
int y1;
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
x1 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang-pi/5)));
|
x1 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang-pi/5)));
|
||||||
y1 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang-pi/5))));
|
y1 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang-pi/5))));
|
||||||
|
@ -5871,8 +5868,8 @@ void Renderer::renderMinimap(){
|
||||||
y1 = my + mh - (y-static_cast<int>(20*cos(ang-pi/5)));
|
y1 = my + mh - (y-static_cast<int>(20*cos(ang-pi/5)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int x2 = 0;
|
int x2;
|
||||||
int y2 = 0;
|
int y2;
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
x2 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang+pi/5)));
|
x2 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang+pi/5)));
|
||||||
y2 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang+pi/5))));
|
y2 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang+pi/5))));
|
||||||
|
@ -7337,9 +7334,9 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
|
||||||
|
|
||||||
//assertGl();
|
//assertGl();
|
||||||
|
|
||||||
bool modelRenderStarted = false;
|
|
||||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||||
if(qCache.visibleQuadUnitList.empty() == false) {
|
if(qCache.visibleQuadUnitList.empty() == false) {
|
||||||
|
bool modelRenderStarted = false;
|
||||||
for(int visibleUnitIndex = 0;
|
for(int visibleUnitIndex = 0;
|
||||||
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
|
||||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||||
|
@ -7467,10 +7464,9 @@ vector<Object *> Renderer::renderObjectsFast(bool renderingShadows, bool resour
|
||||||
|
|
||||||
assertGl();
|
assertGl();
|
||||||
|
|
||||||
bool modelRenderStarted = false;
|
|
||||||
|
|
||||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||||
if(qCache.visibleObjectList.empty() == false) {
|
if(qCache.visibleObjectList.empty() == false) {
|
||||||
|
bool modelRenderStarted = false;
|
||||||
for(int visibleIndex = 0;
|
for(int visibleIndex = 0;
|
||||||
visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) {
|
visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) {
|
||||||
Object *o = qCache.visibleObjectList[visibleIndex];
|
Object *o = qCache.visibleObjectList[visibleIndex];
|
||||||
|
@ -8149,9 +8145,9 @@ void Renderer::renderProgressBar3D(int size, int x, int y, Font3D *font, int cus
|
||||||
currentSize = (int)((double)customWidth * ((double)size / 100.0));
|
currentSize = (int)((double)customWidth * ((double)size / 100.0));
|
||||||
}
|
}
|
||||||
maxSize = customWidth;
|
maxSize = customWidth;
|
||||||
if(maxSize <= 0) {
|
//if(maxSize <= 0) {
|
||||||
maxSize = maxProgressBar;
|
// maxSize = maxProgressBar;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
if(prefixLabel != "") {
|
if(prefixLabel != "") {
|
||||||
renderText = prefixLabel + renderText;
|
renderText = prefixLabel + renderText;
|
||||||
|
@ -8201,9 +8197,9 @@ void Renderer::renderProgressBar(int size, int x, int y, Font2D *font, int custo
|
||||||
currentSize = (int)((double)customWidth * ((double)size / 100.0));
|
currentSize = (int)((double)customWidth * ((double)size / 100.0));
|
||||||
}
|
}
|
||||||
maxSize = customWidth;
|
maxSize = customWidth;
|
||||||
if(maxSize <= 0) {
|
//if(maxSize <= 0) {
|
||||||
maxSize = maxProgressBar;
|
// maxSize = maxProgressBar;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
if(prefixLabel != "") {
|
if(prefixLabel != "") {
|
||||||
renderText = prefixLabel + renderText;
|
renderText = prefixLabel + renderText;
|
||||||
|
@ -8410,7 +8406,7 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<int,bool> unitRenderedList;
|
//std::map<int,bool> unitRenderedList;
|
||||||
|
|
||||||
if(visibleFrameUnitList.empty() == false) {
|
if(visibleFrameUnitList.empty() == false) {
|
||||||
//printf("Render Unit titles ON\n");
|
//printf("Render Unit titles ON\n");
|
||||||
|
@ -8428,7 +8424,7 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) {
|
||||||
renderText3D(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
|
renderText3D(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unitRenderedList[unit->getId()] = true;
|
//unitRenderedList[unit->getId()] = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]";
|
string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]";
|
||||||
|
@ -8473,7 +8469,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<int,bool> unitRenderedList;
|
//std::map<int,bool> unitRenderedList;
|
||||||
|
|
||||||
if(visibleFrameUnitList.empty() == false) {
|
if(visibleFrameUnitList.empty() == false) {
|
||||||
//printf("Render Unit titles ON\n");
|
//printf("Render Unit titles ON\n");
|
||||||
|
@ -8490,7 +8486,7 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
|
||||||
renderText(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
|
renderText(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unitRenderedList[unit->getId()] = true;
|
//unitRenderedList[unit->getId()] = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]";
|
string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]";
|
||||||
|
@ -9457,16 +9453,13 @@ void Renderer::renderVideoLoading(int progressPercent) {
|
||||||
|
|
||||||
static Chrono cycle(true);
|
static Chrono cycle(true);
|
||||||
static float anim = 0.0f;
|
static float anim = 0.0f;
|
||||||
static bool animCycleUp = true;
|
|
||||||
|
|
||||||
if(CoreData::getInstance().getMenuFontBig3D() != NULL) {
|
if(CoreData::getInstance().getMenuFontBig3D() != NULL) {
|
||||||
|
|
||||||
int renderX = 0;
|
|
||||||
int renderY = 0;
|
|
||||||
int w= metrics.getVirtualW();
|
int w= metrics.getVirtualW();
|
||||||
renderX = (w / 2) - (CoreData::getInstance().getMenuFontBig3D()->getMetrics()->getTextWidth(textToRender) / 2);
|
int renderX = (w / 2) - (CoreData::getInstance().getMenuFontBig3D()->getMetrics()->getTextWidth(textToRender) / 2);
|
||||||
int h= metrics.getVirtualH();
|
int h= metrics.getVirtualH();
|
||||||
renderY = (h / 2) + (CoreData::getInstance().getMenuFontBig3D()->getMetrics()->getHeight(textToRender) / 2);
|
int renderY = (h / 2) + (CoreData::getInstance().getMenuFontBig3D()->getMetrics()->getHeight(textToRender) / 2);
|
||||||
|
|
||||||
renderText3D(
|
renderText3D(
|
||||||
textToRender,
|
textToRender,
|
||||||
|
@ -9484,6 +9477,7 @@ void Renderer::renderVideoLoading(int progressPercent) {
|
||||||
swapBuffers();
|
swapBuffers();
|
||||||
|
|
||||||
if(cycle.getCurMillis() % 50 == 0) {
|
if(cycle.getCurMillis() % 50 == 0) {
|
||||||
|
static bool animCycleUp = true;
|
||||||
if(animCycleUp == true) {
|
if(animCycleUp == true) {
|
||||||
anim += 0.1;
|
anim += 0.1;
|
||||||
if(anim > 1.f) {
|
if(anim > 1.f) {
|
||||||
|
|
|
@ -353,7 +353,7 @@ const string BattleEnd::getTimeString(int frames) {
|
||||||
int minutes=(int) framesleft / (float)GameConstants::updateFps / 60.0;
|
int minutes=(int) framesleft / (float)GameConstants::updateFps / 60.0;
|
||||||
framesleft=framesleft-minutes*60*GameConstants::updateFps;
|
framesleft=framesleft-minutes*60*GameConstants::updateFps;
|
||||||
int seconds=(int) framesleft / (float)GameConstants::updateFps;
|
int seconds=(int) framesleft / (float)GameConstants::updateFps;
|
||||||
framesleft=framesleft-seconds*GameConstants::updateFps;
|
//framesleft=framesleft-seconds*GameConstants::updateFps;
|
||||||
|
|
||||||
string hourstr=intToStr(hours);
|
string hourstr=intToStr(hours);
|
||||||
if(hours<10) hourstr="0"+hourstr;
|
if(hours<10) hourstr="0"+hourstr;
|
||||||
|
|
|
@ -216,7 +216,7 @@ Intro::Intro(Program *program):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(models.size() == 0) {
|
if(models.empty() == true) {
|
||||||
introPath = data_path + "data/core/menu/main_model/intro*.g3d";
|
introPath = data_path + "data/core/menu/main_model/intro*.g3d";
|
||||||
//vector<string> introModels;
|
//vector<string> introModels;
|
||||||
findAll(introPath, introModels, false, false);
|
findAll(introPath, introModels, false, false);
|
||||||
|
|
|
@ -1278,7 +1278,7 @@ void setupLogging(Config &config, bool haveSpecialOutputCommandLineOption) {
|
||||||
void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
||||||
World &world, bool purgeUnusedFiles,bool purgeDuplicateFiles,
|
World &world, bool purgeUnusedFiles,bool purgeDuplicateFiles,
|
||||||
bool showDuplicateFiles, bool svnPurgeFiles,double &purgedMegaBytes) {
|
bool showDuplicateFiles, bool svnPurgeFiles,double &purgedMegaBytes) {
|
||||||
string file = tilesetPath + tilesetName + "/" + tilesetName + ".xml";
|
//string file = tilesetPath + tilesetName + "/" + tilesetName + ".xml";
|
||||||
Checksum checksum;
|
Checksum checksum;
|
||||||
|
|
||||||
bool techtree_errors = false;
|
bool techtree_errors = false;
|
||||||
|
@ -1940,7 +1940,7 @@ void runTechValidationForPath(string techPath, string techName,
|
||||||
if(fileExt == "wav" || fileExt == "ogg") {
|
if(fileExt == "wav" || fileExt == "ogg") {
|
||||||
off_t fileSize = getFileSize(duplicateFile);
|
off_t fileSize = getFileSize(duplicateFile);
|
||||||
|
|
||||||
printf("#1 [%d / %lu] removing duplicate [%s]\n",idx,fileList.size(),duplicateFile.c_str());
|
printf("#1 [%u / %lu] removing duplicate [%s]\n",idx,fileList.size(),duplicateFile.c_str());
|
||||||
|
|
||||||
if(idx == 0) {
|
if(idx == 0) {
|
||||||
newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile);
|
newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile);
|
||||||
|
@ -2166,6 +2166,7 @@ void runTechValidationReport(int argc, char** argv) {
|
||||||
|
|
||||||
// Did the user pass a specific scenario to validate?
|
// Did the user pass a specific scenario to validate?
|
||||||
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_VALIDATE_SCENARIO]) + string("=")) == true) {
|
if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_VALIDATE_SCENARIO]) + string("=")) == true) {
|
||||||
|
|
||||||
int foundParamIndIndex = -1;
|
int foundParamIndIndex = -1;
|
||||||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_VALIDATE_SCENARIO]) + string("="),&foundParamIndIndex);
|
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_VALIDATE_SCENARIO]) + string("="),&foundParamIndIndex);
|
||||||
|
|
||||||
|
@ -2174,7 +2175,7 @@ void runTechValidationReport(int argc, char** argv) {
|
||||||
Tokenize(filterList,paramPartTokens,"=");
|
Tokenize(filterList,paramPartTokens,"=");
|
||||||
|
|
||||||
if(paramPartTokens.size() >= 2) {
|
if(paramPartTokens.size() >= 2) {
|
||||||
vector<string> optionList;
|
//vector<string> optionList;
|
||||||
string validateScenarioName = paramPartTokens[1];
|
string validateScenarioName = paramPartTokens[1];
|
||||||
|
|
||||||
printf("Filtering scenario: %s\n",validateScenarioName.c_str());
|
printf("Filtering scenario: %s\n",validateScenarioName.c_str());
|
||||||
|
@ -2191,7 +2192,7 @@ void runTechValidationReport(int argc, char** argv) {
|
||||||
|
|
||||||
bool scenarioFound = false;
|
bool scenarioFound = false;
|
||||||
World world;
|
World world;
|
||||||
double purgedMegaBytes=0;
|
//double purgedMegaBytes=0;
|
||||||
std::vector<string> filteredFactionList;
|
std::vector<string> filteredFactionList;
|
||||||
|
|
||||||
vector<string> scenarioPaths = config.getPathListForType(ptScenarios);
|
vector<string> scenarioPaths = config.getPathListForType(ptScenarios);
|
||||||
|
@ -2416,9 +2417,6 @@ void runTilesetValidationReport(int argc, char** argv) {
|
||||||
//disableBacktrace=true;
|
//disableBacktrace=true;
|
||||||
printf("====== Started Validation ======\n");
|
printf("====== Started Validation ======\n");
|
||||||
|
|
||||||
bool showDuplicateFiles = true;
|
|
||||||
bool purgeUnusedFiles = false;
|
|
||||||
|
|
||||||
//double purgedMegaBytes=0;
|
//double purgedMegaBytes=0;
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
|
|
||||||
|
@ -2432,11 +2430,12 @@ void runTilesetValidationReport(int argc, char** argv) {
|
||||||
Tokenize(filterList,paramPartTokens,"=");
|
Tokenize(filterList,paramPartTokens,"=");
|
||||||
|
|
||||||
if(paramPartTokens.size() >= 2) {
|
if(paramPartTokens.size() >= 2) {
|
||||||
vector<string> optionList;
|
//vector<string> optionList;
|
||||||
string validateTilesetName = paramPartTokens[1];
|
string validateTilesetName = paramPartTokens[1];
|
||||||
|
|
||||||
printf("Filtering tileset: %s\n",validateTilesetName.c_str());
|
printf("Filtering tileset: %s\n",validateTilesetName.c_str());
|
||||||
|
|
||||||
|
bool purgeUnusedFiles = false;
|
||||||
if(paramPartTokens.size() >= 3) {
|
if(paramPartTokens.size() >= 3) {
|
||||||
if(paramPartTokens[2] == "purgeunused") {
|
if(paramPartTokens[2] == "purgeunused") {
|
||||||
purgeUnusedFiles = true;
|
purgeUnusedFiles = true;
|
||||||
|
@ -2449,7 +2448,9 @@ void runTilesetValidationReport(int argc, char** argv) {
|
||||||
|
|
||||||
World world;
|
World world;
|
||||||
double purgedMegaBytes=0;
|
double purgedMegaBytes=0;
|
||||||
std::vector<string> filteredFactionList;
|
bool showDuplicateFiles = true;
|
||||||
|
|
||||||
|
//std::vector<string> filteredFactionList;
|
||||||
|
|
||||||
vector<string> tilesetPaths = config.getPathListForType(ptTilesets);
|
vector<string> tilesetPaths = config.getPathListForType(ptTilesets);
|
||||||
for(int idx = 0; idx < tilesetPaths.size(); idx++) {
|
for(int idx = 0; idx < tilesetPaths.size(); idx++) {
|
||||||
|
@ -2622,7 +2623,7 @@ void CheckForDuplicateData() {
|
||||||
string duplicateWarnings="";
|
string duplicateWarnings="";
|
||||||
|
|
||||||
{
|
{
|
||||||
vector<string> results;
|
//vector<string> results;
|
||||||
|
|
||||||
string scenarioDir = "";
|
string scenarioDir = "";
|
||||||
vector<string> pathList = config.getPathListForType(ptMaps,scenarioDir);
|
vector<string> pathList = config.getPathListForType(ptMaps,scenarioDir);
|
||||||
|
@ -3070,19 +3071,20 @@ int glestMain(int argc, char** argv) {
|
||||||
//# define STREFLOP_NO_DENORMALS
|
//# define STREFLOP_NO_DENORMALS
|
||||||
// streflop_init<streflop::Simple>();
|
// streflop_init<streflop::Simple>();
|
||||||
|
|
||||||
const char *instruction_set = "[none]";
|
|
||||||
const char *denormals = "[denormals]";
|
|
||||||
|
|
||||||
#if defined(STREFLOP_SSE)
|
#if defined(STREFLOP_SSE)
|
||||||
instruction_set = "[SSE]";
|
const char *instruction_set = "[SSE]";
|
||||||
#elif defined(STREFLOP_X87)
|
#elif defined(STREFLOP_X87)
|
||||||
instruction_set = "[X87]";
|
const char *instruction_set = "[X87]";
|
||||||
#elif defined(STREFLOP_SOFT)
|
#elif defined(STREFLOP_SOFT)
|
||||||
instruction_set = "[SOFTFLOAT]";
|
const char *instruction_set = "[SOFTFLOAT]";
|
||||||
|
#else
|
||||||
|
const char *instruction_set = "[none]";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(STREFLOP_NO_DENORMALS)
|
#if defined(STREFLOP_NO_DENORMALS)
|
||||||
denormals = "[no-denormals]";
|
const char *denormals = "[no-denormals]";
|
||||||
|
#else
|
||||||
|
const char *denormals = "[denormals]";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf(" - using STREFLOP %s - %s\n",instruction_set,denormals);
|
printf(" - using STREFLOP %s - %s\n",instruction_set,denormals);
|
||||||
|
@ -4526,7 +4528,7 @@ int glestMain(int argc, char** argv) {
|
||||||
renderer.clearBuffers();
|
renderer.clearBuffers();
|
||||||
renderer.clearZBuffer();
|
renderer.clearZBuffer();
|
||||||
renderer.reset2d();
|
renderer.reset2d();
|
||||||
sprintf(szTextBuf,"Please wait, converting models [%d of %lu] ...",i,(long int)models.size());
|
sprintf(szTextBuf,"Please wait, converting models [%u of %lu] ...",i,(long int)models.size());
|
||||||
|
|
||||||
if(CoreData::getInstance().getMenuFontBig3D() != NULL) {
|
if(CoreData::getInstance().getMenuFontBig3D() != NULL) {
|
||||||
renderer.renderText3D(
|
renderer.renderText3D(
|
||||||
|
@ -4550,7 +4552,7 @@ int glestMain(int argc, char** argv) {
|
||||||
|
|
||||||
Model *model = renderer.newModel(rsGlobal);
|
Model *model = renderer.newModel(rsGlobal);
|
||||||
try {
|
try {
|
||||||
printf("About to load model [%s] [%d of %lu]\n",file.c_str(),i,(long int)models.size());
|
printf("About to load model [%s] [%u of %lu]\n",file.c_str(),i,(long int)models.size());
|
||||||
model->load(file);
|
model->load(file);
|
||||||
modelLoadedOk = true;
|
modelLoadedOk = true;
|
||||||
}
|
}
|
||||||
|
@ -4695,8 +4697,9 @@ int glestMain(int argc, char** argv) {
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
bool skip = true;
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
bool skip = true;
|
||||||
DWORD nNumberOfCharsToRead = 1024;
|
DWORD nNumberOfCharsToRead = 1024;
|
||||||
DWORD nRead = 0;
|
DWORD nRead = 0;
|
||||||
INPUT_RECORD irInRec[1025];
|
INPUT_RECORD irInRec[1025];
|
||||||
|
@ -4717,7 +4720,7 @@ int glestMain(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
skip = false;
|
bool skip = false;
|
||||||
#endif
|
#endif
|
||||||
if(skip == false) {
|
if(skip == false) {
|
||||||
getline(cin, command);
|
getline(cin, command);
|
||||||
|
|
|
@ -205,10 +205,8 @@ void Program::initNormal(WindowGl *window){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::initSavedGame(WindowGl *window,bool masterserverMode, string saveGameFile) {
|
void Program::initSavedGame(WindowGl *window,bool masterserverMode, string saveGameFile) {
|
||||||
MainMenu* mainMenu= NULL;
|
|
||||||
|
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
MainMenu *mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
|
|
||||||
if(saveGameFile == "") {
|
if(saveGameFile == "") {
|
||||||
|
@ -237,38 +235,30 @@ void Program::initSavedGame(WindowGl *window,bool masterserverMode, string saveG
|
||||||
|
|
||||||
void Program::initServer(WindowGl *window, bool autostart,bool openNetworkSlots,
|
void Program::initServer(WindowGl *window, bool autostart,bool openNetworkSlots,
|
||||||
bool masterserverMode) {
|
bool masterserverMode) {
|
||||||
MainMenu* mainMenu= NULL;
|
|
||||||
|
|
||||||
//this->masterserverMode = masterserverMode;
|
//this->masterserverMode = masterserverMode;
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
MainMenu *mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, openNetworkSlots, pNewGame, autostart, NULL, masterserverMode));
|
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, openNetworkSlots, pNewGame, autostart, NULL, masterserverMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::initServer(WindowGl *window, GameSettings *settings) {
|
void Program::initServer(WindowGl *window, GameSettings *settings) {
|
||||||
MainMenu* mainMenu= NULL;
|
|
||||||
|
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
MainMenu *mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, false, pNewGame, true, settings));
|
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, false, pNewGame, true, settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::initClient(WindowGl *window, const Ip &serverIp, int portNumber) {
|
void Program::initClient(WindowGl *window, const Ip &serverIp, int portNumber) {
|
||||||
MainMenu* mainMenu= NULL;
|
|
||||||
|
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
MainMenu *mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
mainMenu->setState(new MenuStateJoinGame(this, mainMenu, true, serverIp,portNumber));
|
mainMenu->setState(new MenuStateJoinGame(this, mainMenu, true, serverIp,portNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::initClientAutoFindHost(WindowGl *window) {
|
void Program::initClientAutoFindHost(WindowGl *window) {
|
||||||
MainMenu* mainMenu= NULL;
|
|
||||||
|
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
MainMenu *mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
bool autoFindHost = true;
|
bool autoFindHost = true;
|
||||||
mainMenu->setState(new MenuStateJoinGame(this, mainMenu, &autoFindHost));
|
mainMenu->setState(new MenuStateJoinGame(this, mainMenu, &autoFindHost));
|
||||||
|
@ -276,10 +266,8 @@ void Program::initClientAutoFindHost(WindowGl *window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::initScenario(WindowGl *window, string autoloadScenarioName) {
|
void Program::initScenario(WindowGl *window, string autoloadScenarioName) {
|
||||||
MainMenu* mainMenu= NULL;
|
|
||||||
|
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
MainMenu *mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
mainMenu->setState(new MenuStateScenario(this, mainMenu, false,
|
mainMenu->setState(new MenuStateScenario(this, mainMenu, false,
|
||||||
Config::getInstance().getPathListForType(ptScenarios),autoloadScenarioName));
|
Config::getInstance().getPathListForType(ptScenarios),autoloadScenarioName));
|
||||||
|
|
|
@ -108,7 +108,7 @@ void MenuStateAbout::reloadUI() {
|
||||||
buttonReturn.setText(lang.get("Return"));
|
buttonReturn.setText(lang.get("Return"));
|
||||||
labelAdditionalCredits.setText(additionalCredits);
|
labelAdditionalCredits.setText(additionalCredits);
|
||||||
|
|
||||||
if(additionalCredits == "") {
|
//if(additionalCredits == "") {
|
||||||
for(int i= 0; i < aboutStringCount1; ++i){
|
for(int i= 0; i < aboutStringCount1; ++i){
|
||||||
labelAbout1[i].setText(getAboutString1(i));
|
labelAbout1[i].setText(getAboutString1(i));
|
||||||
}
|
}
|
||||||
|
@ -116,16 +116,16 @@ void MenuStateAbout::reloadUI() {
|
||||||
for(int i= 0; i < aboutStringCount2; ++i){
|
for(int i= 0; i < aboutStringCount2; ++i){
|
||||||
labelAbout2[i].setText(getAboutString2(i));
|
labelAbout2[i].setText(getAboutString2(i));
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
for(int i= 0; i < aboutStringCount1; ++i){
|
// for(int i= 0; i < aboutStringCount1; ++i){
|
||||||
labelAbout1[i].setText(getAboutString1(i));
|
// labelAbout1[i].setText(getAboutString1(i));
|
||||||
}
|
// }
|
||||||
|
|
||||||
for(int i= 0; i < aboutStringCount2; ++i){
|
// for(int i= 0; i < aboutStringCount2; ++i){
|
||||||
labelAbout2[i].setText(getAboutString2(i));
|
// labelAbout2[i].setText(getAboutString2(i));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
for(int i= 0; i < teammateCount; ++i) {
|
for(int i= 0; i < teammateCount; ++i) {
|
||||||
labelTeammateName[i].setText(getTeammateName(i));
|
labelTeammateName[i].setText(getTeammateName(i));
|
||||||
|
|
|
@ -136,7 +136,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
int aHeadPos=240;
|
int aHeadPos=240;
|
||||||
int aPos=aHeadPos-labelOffset;
|
int aPos=aHeadPos-labelOffset;
|
||||||
int networkHeadPos=700;
|
int networkHeadPos=700;
|
||||||
int xoffset=0;
|
//int xoffset=0;
|
||||||
|
|
||||||
//state
|
//state
|
||||||
labelStatus.registerGraphicComponent(containerName,"labelStatus");
|
labelStatus.registerGraphicComponent(containerName,"labelStatus");
|
||||||
|
@ -163,7 +163,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
|
|
||||||
// fog - o - war
|
// fog - o - war
|
||||||
// @350 ? 300 ?
|
// @350 ? 300 ?
|
||||||
xoffset=70;
|
int xoffset=70;
|
||||||
labelFogOfWar.registerGraphicComponent(containerName,"labelFogOfWar");
|
labelFogOfWar.registerGraphicComponent(containerName,"labelFogOfWar");
|
||||||
labelFogOfWar.init(xoffset+100, aHeadPos, 130);
|
labelFogOfWar.init(xoffset+100, aHeadPos, 130);
|
||||||
labelFogOfWar.setText(lang.get("FogOfWar"));
|
labelFogOfWar.setText(lang.get("FogOfWar"));
|
||||||
|
@ -247,7 +247,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
listBoxPlayerStatus.setItems(playerStatuses);
|
listBoxPlayerStatus.setItems(playerStatuses);
|
||||||
|
|
||||||
// Network Frame Period
|
// Network Frame Period
|
||||||
xoffset=0;
|
//xoffset=0;
|
||||||
|
|
||||||
xoffset=70;
|
xoffset=70;
|
||||||
//map listBox
|
//map listBox
|
||||||
|
|
|
@ -554,7 +554,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
||||||
checkBoxEnablePrivacy.registerGraphicComponent(containerName,"checkBoxEnablePrivacy");
|
checkBoxEnablePrivacy.registerGraphicComponent(containerName,"checkBoxEnablePrivacy");
|
||||||
checkBoxEnablePrivacy.init(currentColumnStart ,currentLine );
|
checkBoxEnablePrivacy.init(currentColumnStart ,currentLine );
|
||||||
checkBoxEnablePrivacy.setValue(config.getBool("PrivacyPlease","false"));
|
checkBoxEnablePrivacy.setValue(config.getBool("PrivacyPlease","false"));
|
||||||
currentLine-=lineOffset;
|
//currentLine-=lineOffset;
|
||||||
// end
|
// end
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
|
|
|
@ -133,7 +133,8 @@ void MenuStateRoot::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
|
||||||
if(popupMenu.mouseClick(x, y)) {
|
if(popupMenu.mouseClick(x, y)) {
|
||||||
std::pair<int,string> result = popupMenu.mouseClickedMenuItem(x, y);
|
//std::pair<int,string> result = popupMenu.mouseClickedMenuItem(x, y);
|
||||||
|
popupMenu.mouseClickedMenuItem(x, y);
|
||||||
|
|
||||||
//printf("In popup callback menuItemSelected [%s] menuIndexSelected = %d\n",result.second.c_str(),result.first);
|
//printf("In popup callback menuItemSelected [%s] menuIndexSelected = %d\n",result.second.c_str(),result.first);
|
||||||
}
|
}
|
||||||
|
@ -267,7 +268,7 @@ void MenuStateRoot::render() {
|
||||||
logoMainW, logoMainH,
|
logoMainW, logoMainH,
|
||||||
extraLogo, GraphicComponent::getFade());
|
extraLogo, GraphicComponent::getFade());
|
||||||
|
|
||||||
currentX += extraLogo->getPixmap()->getW();
|
//currentX += extraLogo->getPixmap()->getW();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer.renderButton(&buttonNewGame);
|
renderer.renderButton(&buttonNewGame);
|
||||||
|
|
|
@ -122,12 +122,10 @@ ClientInterface::~ClientInterface() {
|
||||||
void ClientInterface::connect(const Ip &ip, int port) {
|
void ClientInterface::connect(const Ip &ip, int port) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
||||||
|
|
||||||
delete clientSocket;
|
|
||||||
clientSocket = NULL;
|
|
||||||
|
|
||||||
this->ip = ip;
|
this->ip = ip;
|
||||||
this->port = port;
|
this->port = port;
|
||||||
|
|
||||||
|
delete clientSocket;
|
||||||
clientSocket= new ClientSocket();
|
clientSocket= new ClientSocket();
|
||||||
clientSocket->setBlock(false);
|
clientSocket->setBlock(false);
|
||||||
clientSocket->connect(ip, port);
|
clientSocket->connect(ip, port);
|
||||||
|
|
|
@ -1159,8 +1159,6 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
// just the 'wrong' amount of lag (but not enough to be horrible for a disconnect)
|
// just the 'wrong' amount of lag (but not enough to be horrible for a disconnect)
|
||||||
if(Config::getInstance().getBool("AutoClientLagCorrection","true") == true) {
|
if(Config::getInstance().getBool("AutoClientLagCorrection","true") == true) {
|
||||||
double LAG_CHECK_GRACE_PERIOD = 15;
|
double LAG_CHECK_GRACE_PERIOD = 15;
|
||||||
double maxFrameCountLagAllowed = 10;
|
|
||||||
double maxClientLagTimeAllowed = 8;
|
|
||||||
|
|
||||||
if(this->serverInterface->getGameStartTime() > 0 &&
|
if(this->serverInterface->getGameStartTime() > 0 &&
|
||||||
difftime((long int)time(NULL),this->serverInterface->getGameStartTime()) >= LAG_CHECK_GRACE_PERIOD) {
|
difftime((long int)time(NULL),this->serverInterface->getGameStartTime()) >= LAG_CHECK_GRACE_PERIOD) {
|
||||||
|
@ -1169,6 +1167,9 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
double clientLagCount = (gameSettings.getNetworkFramePeriod() > 0 ? (clientLag / gameSettings.getNetworkFramePeriod()) : 0);
|
double clientLagCount = (gameSettings.getNetworkFramePeriod() > 0 ? (clientLag / gameSettings.getNetworkFramePeriod()) : 0);
|
||||||
double clientLagTime = difftime((long int)time(NULL),this->getLastReceiveCommandListTime());
|
double clientLagTime = difftime((long int)time(NULL),this->getLastReceiveCommandListTime());
|
||||||
|
|
||||||
|
double maxFrameCountLagAllowed = 10;
|
||||||
|
double maxClientLagTimeAllowed = 8;
|
||||||
|
|
||||||
// New lag check
|
// New lag check
|
||||||
if((maxFrameCountLagAllowed > 0 && clientLagCount > maxFrameCountLagAllowed) ||
|
if((maxFrameCountLagAllowed > 0 && clientLagCount > maxFrameCountLagAllowed) ||
|
||||||
(maxClientLagTimeAllowed > 0 && clientLagTime > maxClientLagTimeAllowed)) {
|
(maxClientLagTimeAllowed > 0 && clientLagTime > maxClientLagTimeAllowed)) {
|
||||||
|
|
|
@ -38,14 +38,14 @@ bool CommandGroupUnitSorterId::operator()(const int l, const int r) {
|
||||||
printf("Error lUnit == NULL for id = %d factionIndex = %d\n",l,faction->getIndex());
|
printf("Error lUnit == NULL for id = %d factionIndex = %d\n",l,faction->getIndex());
|
||||||
|
|
||||||
for(unsigned int i = 0; i < faction->getUnitCount(); ++i) {
|
for(unsigned int i = 0; i < faction->getUnitCount(); ++i) {
|
||||||
printf("%d / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName().c_str());
|
printf("%u / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!rUnit) {
|
if(!rUnit) {
|
||||||
printf("Error rUnit == NULL for id = %d factionIndex = %d\n",r,faction->getIndex());
|
printf("Error rUnit == NULL for id = %d factionIndex = %d\n",r,faction->getIndex());
|
||||||
|
|
||||||
for(unsigned int i = 0; i < faction->getUnitCount(); ++i) {
|
for(unsigned int i = 0; i < faction->getUnitCount(); ++i) {
|
||||||
printf("%d / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName().c_str());
|
printf("%u / %d id = %d [%s]\n",i,faction->getUnitCount(),faction->getUnit(i)->getId(),faction->getUnit(i)->getType()->getName().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,14 +140,14 @@ bool CommandGroupUnitSorter::compare(const Unit *l, const Unit *r) {
|
||||||
// }
|
// }
|
||||||
else {
|
else {
|
||||||
//Command *commandPeer = j.unit->getCurrrentCommandThreadSafe();
|
//Command *commandPeer = j.unit->getCurrrentCommandThreadSafe();
|
||||||
if( commandPeer != NULL && commandPeer->getCommandType() != NULL &&
|
//if( commandPeer != NULL && commandPeer->getCommandType() != NULL &&
|
||||||
(commandPeer->getCommandType()->getClass() != ccMove &&
|
// (commandPeer->getCommandType()->getClass() != ccMove &&
|
||||||
commandPeer->getCommandType()->getClass() != ccAttack)) {
|
// commandPeer->getCommandType()->getClass() != ccAttack)) {
|
||||||
result = l->getId() < r->getId();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result = (l->getId() < r->getId());
|
result = (l->getId() < r->getId());
|
||||||
}
|
//}
|
||||||
|
//else {
|
||||||
|
// result = (l->getId() < r->getId());
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("Sorting, unit [%d - %s] cmd [%s] | unit2 [%d - %s] cmd [%s] result = %d\n",this->unit->getId(),this->unit->getFullName().c_str(),(this->unit->getCurrCommand() == NULL ? "NULL" : this->unit->getCurrCommand()->toString().c_str()),j.unit->getId(),j.unit->getFullName().c_str(),(j.unit->getCurrCommand() == NULL ? "NULL" : j.unit->getCurrCommand()->toString().c_str()),result);
|
//printf("Sorting, unit [%d - %s] cmd [%s] | unit2 [%d - %s] cmd [%s] result = %d\n",this->unit->getId(),this->unit->getFullName().c_str(),(this->unit->getCurrCommand() == NULL ? "NULL" : this->unit->getCurrCommand()->toString().c_str()),j.unit->getId(),j.unit->getFullName().c_str(),(j.unit->getCurrCommand() == NULL ? "NULL" : j.unit->getCurrCommand()->toString().c_str()),result);
|
||||||
|
@ -181,7 +181,7 @@ void Faction::sortUnitsByCommandGroups() {
|
||||||
printf("#1 Error unitId not found for id = %d [%s] factionIndex = %d\n",unitId,units[i]->getType()->getName().c_str(),this->getIndex());
|
printf("#1 Error unitId not found for id = %d [%s] factionIndex = %d\n",unitId,units[i]->getType()->getName().c_str(),this->getIndex());
|
||||||
|
|
||||||
for(unsigned int j = 0; j < units.size(); ++j) {
|
for(unsigned int j = 0; j < units.size(); ++j) {
|
||||||
printf("%d / %d id = %d [%s]\n",j,(int)units.size(),units[j]->getId(),units[j]->getType()->getName().c_str());
|
printf("%u / %d id = %d [%s]\n",j,(int)units.size(),units[j]->getId(),units[j]->getType()->getName().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unitIds.push_back(unitId);
|
unitIds.push_back(unitId);
|
||||||
|
@ -198,7 +198,7 @@ void Faction::sortUnitsByCommandGroups() {
|
||||||
printf("#2 Error unitId not found for id = %d factionIndex = %d\n",unitId,this->getIndex());
|
printf("#2 Error unitId not found for id = %d factionIndex = %d\n",unitId,this->getIndex());
|
||||||
|
|
||||||
for(unsigned int j = 0; j < units.size(); ++j) {
|
for(unsigned int j = 0; j < units.size(); ++j) {
|
||||||
printf("%d / %d id = %d [%s]\n",j,(int)units.size(),units[j]->getId(),units[j]->getType()->getName().c_str());
|
printf("%u / %d id = %d [%s]\n",j,(int)units.size(),units[j]->getId(),units[j]->getType()->getName().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,6 +389,10 @@ void FactionThread::execute() {
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
Faction::Faction() {
|
Faction::Faction() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Faction::init() {
|
||||||
unitsMutex = new Mutex();
|
unitsMutex = new Mutex();
|
||||||
texture = NULL;
|
texture = NULL;
|
||||||
//lastResourceTargettListPurge = 0;
|
//lastResourceTargettListPurge = 0;
|
||||||
|
@ -1866,9 +1870,7 @@ string Faction::getCacheStats() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Faction::toString() const {
|
std::string Faction::toString() const {
|
||||||
std::string result = "";
|
std::string result = "FactionIndex = " + intToStr(this->index) + "\n";
|
||||||
|
|
||||||
result = "FactionIndex = " + intToStr(this->index) + "\n";
|
|
||||||
result += "teamIndex = " + intToStr(this->teamIndex) + "\n";
|
result += "teamIndex = " + intToStr(this->teamIndex) + "\n";
|
||||||
result += "startLocationIndex = " + intToStr(this->startLocationIndex) + "\n";
|
result += "startLocationIndex = " + intToStr(this->startLocationIndex) + "\n";
|
||||||
result += "thisFaction = " + intToStr(this->thisFaction) + "\n";
|
result += "thisFaction = " + intToStr(this->thisFaction) + "\n";
|
||||||
|
|
|
@ -157,6 +157,15 @@ public:
|
||||||
Faction();
|
Faction();
|
||||||
~Faction();
|
~Faction();
|
||||||
|
|
||||||
|
Faction(const Faction& obj) {
|
||||||
|
init();
|
||||||
|
throw megaglest_runtime_error("class Faction is NOT safe to copy!");
|
||||||
|
}
|
||||||
|
Faction & operator=(const Faction& obj) {
|
||||||
|
init();
|
||||||
|
throw megaglest_runtime_error("class Faction is NOT safe to assign!");
|
||||||
|
}
|
||||||
|
|
||||||
inline const bool * aproxCanMoveSoonCached(int size, Field field, const Vec2i &pos1, const Vec2i &pos2) const {
|
inline const bool * aproxCanMoveSoonCached(int size, Field field, const Vec2i &pos1, const Vec2i &pos2) const {
|
||||||
const bool *result = NULL;
|
const bool *result = NULL;
|
||||||
// std::map<int,std::map<Field, std::map<Vec2i,bool> > >::const_iterator iterFind1 = mapSharedPathFinderCache.find(size);
|
// std::map<int,std::map<Field, std::map<Vec2i,bool> > >::const_iterator iterFind1 = mapSharedPathFinderCache.find(size);
|
||||||
|
@ -319,6 +328,7 @@ public:
|
||||||
void loadGame(const XmlNode *rootNode, int factionIndex,GameSettings *settings,World *world);
|
void loadGame(const XmlNode *rootNode, int factionIndex,GameSettings *settings,World *world);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void init();
|
||||||
void resetResourceAmount(const ResourceType *rt);
|
void resetResourceAmount(const ResourceType *rt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -192,8 +192,6 @@ bool Object::getWalkable() const{
|
||||||
|
|
||||||
void Object::setResource(const ResourceType *resourceType, const Vec2i &pos){
|
void Object::setResource(const ResourceType *resourceType, const Vec2i &pos){
|
||||||
delete resource;
|
delete resource;
|
||||||
resource = NULL;
|
|
||||||
|
|
||||||
resource= new Resource();
|
resource= new Resource();
|
||||||
resource->init(resourceType, pos);
|
resource->init(resourceType, pos);
|
||||||
initParticlesFromTypes(resourceType->getObjectParticleSystemTypes());
|
initParticlesFromTypes(resourceType->getObjectParticleSystemTypes());
|
||||||
|
|
|
@ -138,7 +138,7 @@ void UnitPathBasic::addToLastPathCache(const Vec2i &path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i UnitPathBasic::pop(bool removeFrontPos) {
|
Vec2i UnitPathBasic::pop(bool removeFrontPos) {
|
||||||
if(pathQueue.size() <= 0) {
|
if(pathQueue.empty() == true) {
|
||||||
throw megaglest_runtime_error("pathQueue.size() = " + intToStr(pathQueue.size()));
|
throw megaglest_runtime_error("pathQueue.size() = " + intToStr(pathQueue.size()));
|
||||||
}
|
}
|
||||||
Vec2i p= pathQueue.front();
|
Vec2i p= pathQueue.front();
|
||||||
|
@ -148,9 +148,7 @@ Vec2i UnitPathBasic::pop(bool removeFrontPos) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
std::string UnitPathBasic::toString() const {
|
std::string UnitPathBasic::toString() const {
|
||||||
std::string result = "";
|
std::string result = "unit path blockCount = " + intToStr(blockCount) + " pathQueue size = " + intToStr(pathQueue.size());
|
||||||
|
|
||||||
result = "unit path blockCount = " + intToStr(blockCount) + " pathQueue size = " + intToStr(pathQueue.size());
|
|
||||||
for(int idx = 0; idx < pathQueue.size(); ++idx) {
|
for(int idx = 0; idx < pathQueue.size(); ++idx) {
|
||||||
result += " index = " + intToStr(idx) + " " + pathQueue[idx].getString();
|
result += " index = " + intToStr(idx) + " " + pathQueue[idx].getString();
|
||||||
}
|
}
|
||||||
|
@ -200,9 +198,7 @@ void WaypointPath::condense() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UnitPath::toString() const {
|
std::string UnitPath::toString() const {
|
||||||
std::string result = "";
|
std::string result = "unit path blockCount = " + intToStr(blockCount) + " pathQueue size = " + intToStr(size());
|
||||||
|
|
||||||
result = "unit path blockCount = " + intToStr(blockCount) + " pathQueue size = " + intToStr(size());
|
|
||||||
result += " path = ";
|
result += " path = ";
|
||||||
for (const_iterator it = begin(); it != end(); ++it) {
|
for (const_iterator it = begin(); it != end(); ++it) {
|
||||||
result += " [" + intToStr(it->x) + "," + intToStr(it->y) + "]";
|
result += " [" + intToStr(it->x) + "," + intToStr(it->y) + "]";
|
||||||
|
@ -2084,7 +2080,7 @@ bool Unit::update() {
|
||||||
//printf("+ #2 APPLY ATTACK BOOST SELF PARTICLE to unit [%s - %d]\n",this->getType()->getName().c_str(),this->getId());
|
//printf("+ #2 APPLY ATTACK BOOST SELF PARTICLE to unit [%s - %d]\n",this->getType()->getName().c_str(),this->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(currentAttackBoostOriginatorEffect.currentAttackBoostUnits.size() <= 0) {
|
else if(currentAttackBoostOriginatorEffect.currentAttackBoostUnits.empty() == true) {
|
||||||
if(currentAttackBoostOriginatorEffect.currentAppliedEffect != NULL) {
|
if(currentAttackBoostOriginatorEffect.currentAppliedEffect != NULL) {
|
||||||
delete currentAttackBoostOriginatorEffect.currentAppliedEffect;
|
delete currentAttackBoostOriginatorEffect.currentAppliedEffect;
|
||||||
currentAttackBoostOriginatorEffect.currentAppliedEffect = NULL;
|
currentAttackBoostOriginatorEffect.currentAppliedEffect = NULL;
|
||||||
|
|
|
@ -257,7 +257,7 @@ std::string UpgradeManager::toString() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpgradeManager::saveGame(XmlNode *rootNode) {
|
void UpgradeManager::saveGame(XmlNode *rootNode) {
|
||||||
std::map<string,string> mapTagReplacements;
|
//std::map<string,string> mapTagReplacements;
|
||||||
XmlNode *upgrademanagerNode = rootNode->addChild("UpgradeManager");
|
XmlNode *upgrademanagerNode = rootNode->addChild("UpgradeManager");
|
||||||
|
|
||||||
for(unsigned int i = 0; i < upgrades.size(); ++i) {
|
for(unsigned int i = 0; i < upgrades.size(); ++i) {
|
||||||
|
|
|
@ -850,9 +850,7 @@ bool FactionType::factionUsesResourceType(const ResourceType *rt) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FactionType::toString() const {
|
std::string FactionType::toString() const {
|
||||||
std::string result = "";
|
std::string result = "Faction Name: " + name + "\n";
|
||||||
|
|
||||||
result = "Faction Name: " + name + "\n";
|
|
||||||
|
|
||||||
result += "Unit Type List count = " + intToStr(this->getUnitTypeCount()) + "\n";
|
result += "Unit Type List count = " + intToStr(this->getUnitTypeCount()) + "\n";
|
||||||
for(int i=0; i<unitTypes.size();i++) {
|
for(int i=0; i<unitTypes.size();i++) {
|
||||||
|
|
|
@ -1020,9 +1020,7 @@ string UnitType::getName(bool translatedValue) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UnitType::toString() const {
|
std::string UnitType::toString() const {
|
||||||
std::string result = "";
|
std::string result = "Unit Name: [" + name + "] id = " + intToStr(id);
|
||||||
|
|
||||||
result = "Unit Name: [" + name + "] id = " + intToStr(id);
|
|
||||||
result += " maxHp = " + intToStr(maxHp);
|
result += " maxHp = " + intToStr(maxHp);
|
||||||
result += " hpRegeneration = " + intToStr(hpRegeneration);
|
result += " hpRegeneration = " + intToStr(hpRegeneration);
|
||||||
result += " maxEp = " + intToStr(maxEp);
|
result += " maxEp = " + intToStr(maxEp);
|
||||||
|
|
|
@ -611,7 +611,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
||||||
//resource requirements
|
//resource requirements
|
||||||
int index = 0;
|
int index = 0;
|
||||||
const XmlNode *resourceRequirementsNode= upgradeNode->getChild("resource-requirements");
|
const XmlNode *resourceRequirementsNode= upgradeNode->getChild("resource-requirements");
|
||||||
hasDup = false;
|
|
||||||
costs.resize(resourceRequirementsNode->getChildCount());
|
costs.resize(resourceRequirementsNode->getChildCount());
|
||||||
for(int i = 0; i < costs.size(); ++i) {
|
for(int i = 0; i < costs.size(); ++i) {
|
||||||
const XmlNode *resourceNode= resourceRequirementsNode->getChild("resource", i);
|
const XmlNode *resourceNode= resourceRequirementsNode->getChild("resource", i);
|
||||||
|
|
|
@ -857,7 +857,7 @@ bool Map::canMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, std::m
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBadHarvestPos = false;
|
bool isBadHarvestPos = false;
|
||||||
if(unit != NULL) {
|
//if(unit != NULL) {
|
||||||
Command *command= unit->getCurrCommand();
|
Command *command= unit->getCurrCommand();
|
||||||
if(command != NULL) {
|
if(command != NULL) {
|
||||||
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
||||||
|
@ -865,7 +865,7 @@ bool Map::canMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, std::m
|
||||||
isBadHarvestPos = true;
|
isBadHarvestPos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(unit == NULL || isBadHarvestPos == true) {
|
if(unit == NULL || isBadHarvestPos == true) {
|
||||||
if(lookupCache != NULL) {
|
if(lookupCache != NULL) {
|
||||||
|
@ -952,7 +952,7 @@ bool Map::aproxCanMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, s
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBadHarvestPos = false;
|
bool isBadHarvestPos = false;
|
||||||
if(unit != NULL) {
|
//if(unit != NULL) {
|
||||||
Command *command= unit->getCurrCommand();
|
Command *command= unit->getCurrCommand();
|
||||||
if(command != NULL) {
|
if(command != NULL) {
|
||||||
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
||||||
|
@ -960,7 +960,7 @@ bool Map::aproxCanMove(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2, s
|
||||||
isBadHarvestPos = true;
|
isBadHarvestPos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(unit == NULL || isBadHarvestPos == true) {
|
if(unit == NULL || isBadHarvestPos == true) {
|
||||||
if(lookupCache != NULL) {
|
if(lookupCache != NULL) {
|
||||||
|
|
|
@ -435,7 +435,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBadHarvestPos = false;
|
bool isBadHarvestPos = false;
|
||||||
if(unit != NULL) {
|
//if(unit != NULL) {
|
||||||
Command *command= unit->getCurrCommand();
|
Command *command= unit->getCurrCommand();
|
||||||
if(command != NULL) {
|
if(command != NULL) {
|
||||||
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
const HarvestCommandType *hct = dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
||||||
|
@ -443,7 +443,7 @@ public:
|
||||||
isBadHarvestPos = true;
|
isBadHarvestPos = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
if(unit == NULL || isBadHarvestPos == true) {
|
if(unit == NULL || isBadHarvestPos == true) {
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
||||||
|
|
||||||
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
|
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
|
||||||
XmlNode* playerNode=NULL;
|
XmlNode* playerNode=NULL;
|
||||||
string factionTypeName="";
|
//string factionTypeName="";
|
||||||
ControlType factionControl;
|
ControlType factionControl;
|
||||||
|
|
||||||
if(playersNode->hasChildAtIndex("player",i)) {
|
if(playersNode->hasChildAtIndex("player",i)) {
|
||||||
|
|
|
@ -1987,7 +1987,6 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
|
||||||
ProjectileParticleSystem *psProj = 0;
|
ProjectileParticleSystem *psProj = 0;
|
||||||
SplashParticleSystem *psSplash;
|
|
||||||
|
|
||||||
const AttackSkillType *ast= static_cast<const AttackSkillType*>(unit->getCurrSkill());
|
const AttackSkillType *ast= static_cast<const AttackSkillType*>(unit->getCurrSkill());
|
||||||
ParticleSystemTypeProjectile *pstProj= ast->getProjParticleType();
|
ParticleSystemTypeProjectile *pstProj= ast->getProjParticleType();
|
||||||
|
@ -2020,8 +2019,8 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
||||||
}
|
}
|
||||||
|
|
||||||
//splash
|
//splash
|
||||||
if(pstSplash!=NULL){
|
if(pstSplash != NULL) {
|
||||||
psSplash= pstSplash->create();
|
SplashParticleSystem *psSplash= pstSplash->create();
|
||||||
psSplash->setPos(endPos);
|
psSplash->setPos(endPos);
|
||||||
psSplash->setVisible(visible);
|
psSplash->setVisible(visible);
|
||||||
if(unit->getFaction()->getTexture()) {
|
if(unit->getFaction()->getTexture()) {
|
||||||
|
|
|
@ -1220,9 +1220,7 @@ void World::addConsoleTextWoLang(const string &text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const string World::getSystemMacroValue(const string key) {
|
const string World::getSystemMacroValue(const string key) {
|
||||||
string result = "";
|
std::string result = key;
|
||||||
|
|
||||||
result = key;
|
|
||||||
bool tagApplied = Properties::applyTagsToValue(result);
|
bool tagApplied = Properties::applyTagsToValue(result);
|
||||||
if(tagApplied == false) {
|
if(tagApplied == false) {
|
||||||
result = "";
|
result = "";
|
||||||
|
|
|
@ -286,8 +286,10 @@ int glob( char const *pattern
|
||||||
if(new_buffer == NULL)
|
if(new_buffer == NULL)
|
||||||
{
|
{
|
||||||
result = GLOB_NOSPACE;
|
result = GLOB_NOSPACE;
|
||||||
free(buffer);
|
if(buffer) {
|
||||||
buffer = NULL;
|
free(buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +317,10 @@ int glob( char const *pattern
|
||||||
if(new_buffer == NULL)
|
if(new_buffer == NULL)
|
||||||
{
|
{
|
||||||
result = GLOB_NOSPACE;
|
result = GLOB_NOSPACE;
|
||||||
free(buffer);
|
if(buffer) {
|
||||||
|
free(buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -402,7 +407,10 @@ int glob( char const *pattern
|
||||||
if(NULL == pp)
|
if(NULL == pp)
|
||||||
{
|
{
|
||||||
result = GLOB_NOSPACE;
|
result = GLOB_NOSPACE;
|
||||||
free(buffer);
|
if(buffer) {
|
||||||
|
free(buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue