From 5068f3206d3185c723988770d6201a785507306b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Magnenat?= Date: Sat, 29 Apr 2023 11:37:52 +0200 Subject: [PATCH] Corrected ortograph of some core classes. --- libgag/include/FormatableString.h | 20 +- libgag/include/Toolkit.h | 2 +- libgag/src/FormatableString.cpp | 10 +- libgag/src/GUIProgressBar.cpp | 2 +- libgag/src/KeyPress.cpp | 10 +- libgag/src/StringTable.cpp | 2 +- src/AICastor.cpp | 92 +-- src/AICastor.h | 4 +- src/AIEcho.cpp | 94 +-- src/AIEcho.h | 40 +- src/AINicowar.cpp | 48 +- src/AINumbi.cpp | 26 +- src/AIWarrush.cpp | 36 +- src/BasePlayer.h | 2 +- src/Brush.cpp | 4 +- src/Building.cpp | 376 ++++----- src/Building.h | 96 +-- src/BuildingType.cpp | 86 +- src/BuildingType.h | 22 +- src/BuildingsTypes.cpp | 18 +- src/ChooseMapScreen.cpp | 6 +- src/CustomGameScreen.cpp | 2 +- src/EndGameScreen.cpp | 2 +- src/Engine.cpp | 16 +- src/FertilityCalculatorThread.cpp | 4 +- src/Game.cpp | 100 +-- src/GameEvent.cpp | 6 +- src/GameGUI.cpp | 464 +++++------ src/GameGUI.h | 34 +- src/GameGUIToolManager.cpp | 4 +- src/GlobalContainer.cpp | 16 +- src/GlobalContainer.h | 12 +- src/Gradient.h | 6 +- src/LANMenuScreen.cpp | 4 +- src/MainMenuScreen.cpp | 2 +- src/Map.cpp | 1062 ++++++++++++------------- src/Map.h | 256 +++--- src/MapEdit.cpp | 154 ++-- src/MapEdit.h | 4 +- src/MapEditDialog.cpp | 2 +- src/MapGenerationDescriptor.cpp | 20 +- src/MapGenerationDescriptor.h | 4 +- src/MapGenerator.cpp | 102 +-- src/MapGenerator.h | 2 +- src/MapThumbnail.cpp | 8 +- src/Minimap.cpp | 8 +- src/NetGamePlayerManager.cpp | 4 +- src/Order.cpp | 10 +- src/Order.h | 8 +- src/OverlayAreas.cpp | 28 +- src/OverlayAreas.h | 6 +- src/Race.cpp | 8 +- src/Race.h | 2 +- src/Ressource.cpp | 2 +- src/Ressource.h | 16 +- src/RessourceType.h | 12 +- src/RessourcesTypes.cpp | 4 +- src/RessourcesTypes.h | 4 +- src/SGSL.cpp | 16 +- src/ScriptEditorScreen.cpp | 10 +- src/SettingsScreen.cpp | 4 +- src/SoundMixer.cpp | 2 +- src/Team.cpp | 26 +- src/Team.h | 8 +- src/TeamStat.cpp | 72 +- src/Unit.cpp | 206 ++--- src/Unit.h | 14 +- src/UnitEditorScreen.cpp | 12 +- src/UnitEditorScreen.h | 2 +- src/UnitType.cpp | 20 +- src/UnitType.h | 4 +- src/Version.h | 12 +- src/YOGClientCommands.cpp | 6 +- src/YOGClientDownloadingMapScreen.cpp | 6 +- src/YOGClientLobbyScreen.cpp | 10 +- src/YOGClientMapDownloadScreen.cpp | 10 +- src/YOGClientMapUploadScreen.cpp | 8 +- 77 files changed, 1921 insertions(+), 1921 deletions(-) diff --git a/libgag/include/FormatableString.h b/libgag/include/FormatableString.h index 38653b246..642e95783 100644 --- a/libgag/include/FormatableString.h +++ b/libgag/include/FormatableString.h @@ -27,10 +27,10 @@ namespace GAGCore { /*! * string that can be used for argument substitution. * Example : - * FormatableString fs("Hello %0"); + * FormattableString fs("Hello %0"); * cout << fs.arg("World"); */ - class FormatableString : public std::string + class FormattableString : public std::string { private: /*! @@ -45,14 +45,14 @@ namespace GAGCore { public: - FormatableString() : std::string(), argLevel(0) { } + FormattableString() : std::string(), argLevel(0) { } /*! - * Creates a new FormatableString with format string set to s. + * Creates a new FormattableString with format string set to s. * \param s A string with indicators for argument substitution. * Each indicator is the % symbol followed by a number. The number * is the index of the corresponding argument (starting at %0). */ - FormatableString(const std::string &s) + FormattableString(const std::string &s) : std::string(s), argLevel(0) { } /*! @@ -63,7 +63,7 @@ namespace GAGCore { * \param fillChar Character used to pad the number to reach fieldWidth * \see arg(const T& value) */ - FormatableString &arg(int value, int fieldWidth = 0, int base = 10, char fillChar = ' '); + FormattableString &arg(int value, int fieldWidth = 0, int base = 10, char fillChar = ' '); /*! * Replace the next arg by an int value. @@ -73,7 +73,7 @@ namespace GAGCore { * \param fillChar Character used to pad the number to reach fieldWidth * \see arg(const T& value) */ - FormatableString &arg(unsigned value, int fieldWidth = 0, int base = 10, char fillChar = ' '); + FormattableString &arg(unsigned value, int fieldWidth = 0, int base = 10, char fillChar = ' '); /*! * Replace the next arg by a float value. @@ -83,14 +83,14 @@ namespace GAGCore { * \param fillChar Character used to pad the number to reach fieldWidth. * \see arg(const T& value) */ - FormatableString &arg(float value, int fieldWidth = 0, int precision = 6, char fillChar = ' '); + FormattableString &arg(float value, int fieldWidth = 0, int precision = 6, char fillChar = ' '); /*! * Replace the next arg by a value that can be passed to an ostringstream. * The first call to arg replace %0, the second %1, and so on. * \param value Value used to replace the current argument. */ - template FormatableString &arg(const T& value) + template FormattableString &arg(const T& value) { // transform value into std::string std::ostringstream oss; @@ -107,7 +107,7 @@ namespace GAGCore { * counter. * \param str New format string. */ - FormatableString& operator=(const std::string& str) ; + FormattableString& operator=(const std::string& str) ; /*! * Casts this string to a const char* diff --git a/libgag/include/Toolkit.h b/libgag/include/Toolkit.h index 93d50799a..29b6d71fe 100644 --- a/libgag/include/Toolkit.h +++ b/libgag/include/Toolkit.h @@ -31,7 +31,7 @@ namespace GAGCore class StringTable; class GraphicContext; - //! Toolkit is a ressource server + //! Toolkit is a resource server class Toolkit { private: diff --git a/libgag/src/FormatableString.cpp b/libgag/src/FormatableString.cpp index bc5c358e8..b251d2d08 100644 --- a/libgag/src/FormatableString.cpp +++ b/libgag/src/FormatableString.cpp @@ -27,7 +27,7 @@ #include namespace GAGCore { - void FormatableString::proceedReplace(const std::string &replacement) + void FormattableString::proceedReplace(const std::string &replacement) { std::ostringstream search; search << "%" << this->argLevel; @@ -43,7 +43,7 @@ namespace GAGCore { ++argLevel; } - FormatableString &FormatableString::arg(int value, int fieldWidth, int base, char fillChar) + FormattableString &FormattableString::arg(int value, int fieldWidth, int base, char fillChar) { std::ostringstream oss; oss << std::setbase(base); @@ -59,7 +59,7 @@ namespace GAGCore { return *this; } - FormatableString &FormatableString::arg(unsigned value, int fieldWidth, int base, char fillChar) + FormattableString &FormattableString::arg(unsigned value, int fieldWidth, int base, char fillChar) { std::ostringstream oss; oss << std::setbase(base); @@ -75,7 +75,7 @@ namespace GAGCore { return *this; } - FormatableString &FormatableString::arg(float value, int fieldWidth, int precision, char fillChar) + FormattableString &FormattableString::arg(float value, int fieldWidth, int precision, char fillChar) { std::ostringstream oss; oss.precision(precision); @@ -92,7 +92,7 @@ namespace GAGCore { return *this; } - FormatableString &FormatableString::operator=(const std::string& str) + FormattableString &FormattableString::operator=(const std::string& str) { this->assign(str); this->argLevel = 0; diff --git a/libgag/src/GUIProgressBar.cpp b/libgag/src/GUIProgressBar.cpp index 416ca9f4f..73a3e091a 100644 --- a/libgag/src/GUIProgressBar.cpp +++ b/libgag/src/GUIProgressBar.cpp @@ -75,7 +75,7 @@ namespace GAGGUI Style::style->drawProgressBar(parent->getSurface(), x, y+hDec, w, value, range); if (fontPtr) { - FormatableString text = FormatableString(format).arg((value*100)/range); + FormattableString text = FormattableString(format).arg((value*100)/range); int textW = fontPtr->getStringWidth(text.c_str()); int textH = fontPtr->getStringHeight(text.c_str()); parent->getSurface()->drawString(x + ((w-textW) >> 1), y + ((h-textH) >> 1), fontPtr, text); diff --git a/libgag/src/KeyPress.cpp b/libgag/src/KeyPress.cpp index 228891f0e..c780261d2 100644 --- a/libgag/src/KeyPress.cpp +++ b/libgag/src/KeyPress.cpp @@ -162,7 +162,7 @@ std::string KeyPress::format() const s+=""; if(shift) s+=""; - s+=FormatableString("<%0>").arg(key); + s+=FormattableString("<%0>").arg(key); return s; } @@ -248,13 +248,13 @@ std::string KeyPress::getTranslated() const } //Visual order, control always first. Rather than alt-control-a for example, its control-alt-a if(alt) - str=FormatableString(table->getString("[alt %0]")).arg(str); + str=FormattableString(table->getString("[alt %0]")).arg(str); if(meta) - str=FormatableString(table->getString("[meta %0]")).arg(str); + str=FormattableString(table->getString("[meta %0]")).arg(str); if(shift) - str=FormatableString(table->getString("[shift %0]")).arg(str); + str=FormattableString(table->getString("[shift %0]")).arg(str); if(control) - str=FormatableString(table->getString("[control %0]")).arg(str); + str=FormattableString(table->getString("[control %0]")).arg(str); return str; } diff --git a/libgag/src/StringTable.cpp b/libgag/src/StringTable.cpp index 48a735aeb..3a98d50c7 100644 --- a/libgag/src/StringTable.cpp +++ b/libgag/src/StringTable.cpp @@ -182,7 +182,7 @@ namespace GAGCore bool lcwp=false; int baseCount=0; const std::string &s = it->first; - // we check that we only have valid format (from a FormatableString point of view)... + // we check that we only have valid format (from a FormattableString point of view)... for (size_t j=0; j::iterator i=projects.begin(); i!=projects.end(); ++i) { @@ -436,7 +436,7 @@ boost::shared_ptrAICastor::getOrder() //computeWheatCareMap(); { size_t size=map->w*map->h; - Uint8 *wheatGradient=map->ressourcesGradient[team->teamNumber][CORN][canSwim]; + Uint8 *wheatGradient=map->resourcesGradient[team->teamNumber][CORN][canSwim]; for (int i=0; i<4; i++) memcpy(oldWheatGradient[i], wheatGradient, size); for (int i=0; i<2; i++) @@ -468,7 +468,7 @@ boost::shared_ptrAICastor::getOrder() for (int i=3; i>0; i--) oldWheatGradient[i]=oldWheatGradient[i-1]; oldWheatGradient[0]=temp; - Uint8 *wheatGradient=map->ressourcesGradient[team->teamNumber][CORN][canSwim]; + Uint8 *wheatGradient=map->resourcesGradient[team->teamNumber][CORN][canSwim]; memcpy(oldWheatGradient[0], wheatGradient, map->w*map->h); computeObstacleUnitMap(); computeWheatCareMap(); @@ -2005,14 +2005,14 @@ void AICastor::computeObstacleUnitMap() //int wMask=map->wMask; //int hMask=map->hMask; size_t size=w*h; - const auto& cases=map->cases; + const auto& tiles=map->tiles; Uint32 teamMask=team->me; for (size_t i=0; ihDec; //int wDec=map->wDec; size_t size=w*h; - const auto& cases=map->cases; + const auto& tiles=map->tiles; for (size_t i=0; i=16) // if (!isGrass) obstacleBuildingMap[i]=0; - else if (c.ressource.type!=NO_RES_TYPE) + else if (c.resource.type!=NO_RES_TYPE) obstacleBuildingMap[i]=0; else obstacleBuildingMap[i]=1; @@ -2104,7 +2104,7 @@ void AICastor::computeBuildingNeighbourMapOfBuilding(int bx, int by, int bw, int //size_t size=w*h; Uint8 *gradient=buildingNeighbourMap; - const auto& cases=map->cases; + const auto& tiles=map->tiles; //Uint8 *wheatGradient=map->ressourcesGradient[team->teamNumber][CORN][canSwim]; @@ -2120,12 +2120,12 @@ void AICastor::computeBuildingNeighbourMapOfBuilding(int bx, int by, int bw, int { int index; index=(xi&wMask)+(((by-1 )&hMask)<typeNum==WORKER && u->medical==0 && u->activity!=Unit::ACT_UPGRADING) { - int range=((u->hungry-u->trigHungry)>>1)/u->race->hungryness; + int range=((u->hungry-u->trigHungry)>>1)/u->race->hungriness; if (range<0) continue; //printf(" range=%d\n", range); @@ -2387,7 +2387,7 @@ void AICastor::computeWorkRangeMap() Unit *u=myUnits[i]; if (u && u->typeNum==WORKER && u->medical==0 && u->activity!=Unit::ACT_UPGRADING) { - int range=((u->hungry-u->trigHungry)>>1)/u->race->hungryness; + int range=((u->hungry-u->trigHungry)>>1)/u->race->hungriness; if (range<0) continue; //printf(" range=%d\n", range); @@ -2438,12 +2438,12 @@ fprintf(logFile, "computeHydratationMap()...\n"); Uint16 *gradient=(Uint16 *)malloc(2*size); memset(gradient, 0, 2*size); - const auto& cases=map->cases; + const auto& tiles=map->tiles; static const int range=16; for (int y=0; y=256)&&(t<256+16)) // if SAND for (int r=1; rcases; + const auto& tiles=map->tiles; for (size_t i=0; i16)// if !GRASS notGrassMap[i]=16; } @@ -2515,7 +2515,7 @@ void AICastor::computeWheatCareMap() size_t size=w*h; size_t sizeMask=(size-1); //Uint8 *wheatGradient=map->ressourcesGradient[team->teamNumber][CORN][canSwim]; - //Case *cases=map->cases; + //Tile *tiles=map->tiles; //Uint32 teamMask=team->me; Uint8 *temp=wheatCareMap[1]; @@ -2548,7 +2548,7 @@ void AICastor::computeWheatGrowthMap() //int hDec=map->hDec; //int wDec=map->wDec; size_t size=w*h; - Uint8 *wheatGradient=map->ressourcesGradient[team->teamNumber][CORN][canSwim]; + Uint8 *wheatGradient=map->resourcesGradient[team->teamNumber][CORN][canSwim]; memcpy(wheatGrowthMap, obstacleBuildingMap, size); @@ -2718,7 +2718,7 @@ void AICastor::computeEnemyWarriorsMap() { if ((map->fogOfWar[i]&team->me)==0) continue; - Uint16 guid=map->cases[i].groundUnit; + Uint16 guid=map->tiles[i].groundUnit; if (guid==NOGUID) continue; Uint32 teamMask=(1<<(guid>>10)); @@ -2793,7 +2793,7 @@ boost::shared_ptrAICastor::findGoodBuilding(Sint32 typeNum, bool food, bo //wheatLimit=(wheatLimit<<2); //printf(" (scaled) minWork=%d, wheatLimit=%d\n", minWork, wheatLimit); - Uint8 *wheatGradientMap=map->ressourcesGradient[team->teamNumber][CORN][canSwim]; + Uint8 *wheatGradientMap=map->resourcesGradient[team->teamNumber][CORN][canSwim]; memset(goodBuildingMap, 0, size); for (int y=0; yhMask; size_t size=w*h; - memset(ressourcesCluster, 0, size*2); + memset(resourcesCluster, 0, size*2); //int i=0; Uint8 old=0xFF; Uint16 id=0; - bool usedid[65536]; - memset(usedid, 0, 65536*sizeof(bool)); + bool usedId[65536]; + memset(usedId, 0, 65536*sizeof(bool)); for (int y=0; ycases[map->coordToIndex(x, y)]; // case - const auto& r=c.ressource; // ressource + const auto& c = map->tiles[map->coordToIndex(x, y)]; // case + const auto& r=c.resource; // resource Uint8 rt=r.type; // ressources type - int rci=x+y*w; // ressource cluster index - Uint16 *rcp=&ressourcesCluster[rci]; // ressource cluster pointer - Uint16 rc=*rcp; // ressource cluster + int rci=x+y*w; // resource cluster index + Uint16 *rcp=&resourcesCluster[rci]; // resource cluster pointer + Uint16 rc=*rcp; // resource cluster if (rt==0xFF) { @@ -2938,15 +2938,15 @@ void AICastor::computeRessourcesCluster() } else { - fprintf(logFile, "ressource rt=%d, at (%d, %d)\n", rt, x, y); + fprintf(logFile, "resource rt=%d, at (%d, %d)\n", rt, x, y); if (rt!=old) { fprintf(logFile, " rt!=old\n"); id=1; - while (usedid[id]) + while (usedId[id]) id++; if (id) - usedid[id]=true; + usedId[id]=true; old=rt; fprintf(logFile, " id=%d\n", id); } @@ -2960,10 +2960,10 @@ void AICastor::computeRessourcesCluster() else { Uint16 oldid=id; - usedid[oldid]=false; + usedId[oldid]=false; id=rc; // newid fprintf(logFile, " cleaning oldid=%d to id=%d.\n", oldid, id); - // We have to correct last ressourcesCluster values: + // We have to correct last resourcesCluster values: *rcp=id; while (*rcp==oldid) { @@ -2974,19 +2974,19 @@ void AICastor::computeRessourcesCluster() } } } - memcpy(ressourcesCluster+((y+1)&hMask)*w, ressourcesCluster+y*w, w*2); + memcpy(resourcesCluster+((y+1)&hMask)*w, resourcesCluster+y*w, w*2); } int used=0; for (int id=1; id<65536; id++) - if (usedid[id]) + if (usedId[id]) used++; fprintf(logFile, "computeRessourcesCluster(), used=%d\n", used); } void AICastor::updateGlobalGradientNoObstacle(Uint8 *gradient) { - //In this algotithm, "l" stands for one case at Left, "r" for one case at Right, "u" for Up, and "d" for Down. + //In this algorithm, "l" stands for one case at Left, "r" for one case at Right, "u" for Up, and "d" for Down. // Warning, this is *nearly* a copy-past, 4 times, once for each direction. int w=map->w; int h=map->h; @@ -3118,7 +3118,7 @@ void AICastor::updateGlobalGradientNoObstacle(Uint8 *gradient) void AICastor::updateGlobalGradient(Uint8 *gradient) { - //In this algotithm, "l" stands for one case at Left, "r" for one case at Right, "u" for Up, and "d" for Down. + //In this algorithm, "l" stands for one case at Left, "r" for one case at Right, "u" for Up, and "d" for Down. // Warning, this is *nearly* a copy-past, 4 times, once for each direction. int w=map->w; diff --git a/src/AICastor.h b/src/AICastor.h index bdef43399..7f9d43816 100644 --- a/src/AICastor.h +++ b/src/AICastor.h @@ -28,7 +28,7 @@ #include -struct Case; +struct Tile; class Game; class Map; class Order; @@ -250,7 +250,7 @@ class AICastor : public AIImplementation Uint8 *enemyRangeMap; Uint8 *enemyWarriorsMap; - Uint16 *ressourcesCluster; + Uint16 *resourcesCluster; private: FILE *logFile; diff --git a/src/AIEcho.cpp b/src/AIEcho.cpp index c9d5df579..7637add61 100644 --- a/src/AIEcho.cpp +++ b/src/AIEcho.cpp @@ -85,7 +85,7 @@ Entities::Entity* Entities::Entity::load_entity(GAGCore::InputStream *stream, Pl entity->load(stream, player, versionMinor); break; case Entities::ERessource: - entity = new Entities::Ressource; + entity = new Entities::Resource; entity->load(stream, player, versionMinor); break; case Entities::EAnyRessource: @@ -330,16 +330,16 @@ void Entities::AnyBuilding::save(GAGCore::OutputStream *stream) -Entities::Ressource::Ressource(int ressource_type) : ressource_type(ressource_type) +Entities::Resource::Resource(int ressource_type) : ressource_type(ressource_type) { } -bool Entities::Ressource::is_entity(Map* map, int posx, int posy) +bool Entities::Resource::is_entity(Map* map, int posx, int posy) { - if(map->isRessourceTakeable(posx, posy, ressource_type)) + if(map->isResourceTakeable(posx, posy, ressource_type)) { return true; } @@ -348,10 +348,10 @@ bool Entities::Ressource::is_entity(Map* map, int posx, int posy) -bool Entities::Ressource::operator==(const Entity& rhs) +bool Entities::Resource::operator==(const Entity& rhs) { - if(typeid(rhs)==typeid(Entities::Ressource) && - static_cast(rhs).ressource_type==ressource_type + if(typeid(rhs)==typeid(Entities::Resource) && + static_cast(rhs).ressource_type==ressource_type ) return true; return false; @@ -359,7 +359,7 @@ bool Entities::Ressource::operator==(const Entity& rhs) -bool Entities::Ressource::can_change() +bool Entities::Resource::can_change() { if(ressource_type==WOOD || ressource_type==CORN || ressource_type==ALGA) return true; @@ -368,16 +368,16 @@ bool Entities::Ressource::can_change() -Entities::EntityType Entities::Ressource::get_type() +Entities::EntityType Entities::Resource::get_type() { return Entities::ERessource; } -bool Entities::Ressource::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) +bool Entities::Resource::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { - stream->readEnterSection("Ressource"); + stream->readEnterSection("Resource"); ressource_type = stream->readSint32("ressource_type"); stream->readLeaveSection(); return true; @@ -385,9 +385,9 @@ bool Entities::Ressource::load(GAGCore::InputStream *stream, Player *player, Sin -void Entities::Ressource::save(GAGCore::OutputStream *stream) +void Entities::Resource::save(GAGCore::OutputStream *stream) { - stream->writeEnterSection("Ressource"); + stream->writeEnterSection("Resource"); stream->writeSint32(ressource_type, "ressource_type"); stream->writeLeaveSection(); } @@ -403,7 +403,7 @@ Entities::AnyRessource:: AnyRessource() bool Entities::AnyRessource:: is_entity(Map* map, int posx, int posy) { - if(map->isRessource(posx, posy)) + if(map->isResource(posx, posy)) { return true; } @@ -3230,7 +3230,7 @@ void DestroyBuilding::save(GAGCore::OutputStream *stream) -RessourceTracker::RessourceTracker(Echo& echo, int building_id, int length, int ressource) : record(length, 0), position(0), timer(0), length(length), echo(echo), building_id(building_id), ressource(ressource) +RessourceTracker::RessourceTracker(Echo& echo, int building_id, int length, int resource) : record(length, 0), position(0), timer(0), length(length), echo(echo), building_id(building_id), resource(resource) { } @@ -3243,7 +3243,7 @@ void RessourceTracker::tick() if((timer%10)==0) { Building* b = echo.get_building_register().get_building(building_id); - record[position]=b->ressources[ressource]; + record[position]=b->resources[resource]; position++; if(position>=record.size()) position=0; @@ -3280,7 +3280,7 @@ bool RessourceTracker::load(GAGCore::InputStream *stream, Player *player, Sint32 timer=stream->readUint32("timer"); building_id=stream->readUint32("building_id"); length=stream->readUint32("length"); - ressource=stream->readUint32("ressource"); + resource=stream->readUint32("resource"); stream->readLeaveSection(); return true; } @@ -3303,13 +3303,13 @@ void RessourceTracker::save(GAGCore::OutputStream *stream) stream->writeUint32(timer, "timer"); stream->writeUint32(building_id, "building_id"); stream->writeUint32(length, "length"); - stream->writeUint32(ressource, "ressource"); + stream->writeUint32(resource, "resource"); stream->writeLeaveSection(); } -AddRessourceTracker::AddRessourceTracker(int length, int ressource, int building_id) : length(length), building_id(building_id), ressource(ressource) +AddRessourceTracker::AddRessourceTracker(int length, int resource, int building_id) : length(length), building_id(building_id), resource(resource) { } @@ -3318,7 +3318,7 @@ AddRessourceTracker::AddRessourceTracker(int length, int ressource, int building void AddRessourceTracker::modify(Echo& echo) { - echo.add_ressource_tracker(new RessourceTracker(echo, building_id, length, ressource), building_id); + echo.add_ressource_tracker(new RessourceTracker(echo, building_id, length, resource), building_id); } @@ -3341,7 +3341,7 @@ bool AddRessourceTracker::load(GAGCore::InputStream *stream, Player *player, Sin ManagementOrder::load(stream, player, versionMinor); length=stream->readUint32("length"); building_id=stream->readUint32("building_id"); - ressource=stream->readUint32("ressource"); + resource=stream->readUint32("resource"); stream->readLeaveSection(); return true; } @@ -3354,7 +3354,7 @@ void AddRessourceTracker::save(GAGCore::OutputStream *stream) ManagementOrder::save(stream); stream->writeUint32(length, "length"); stream->writeUint32(building_id, "building_id"); - stream->writeUint32(ressource, "ressource"); + stream->writeUint32(resource, "resource"); stream->writeLeaveSection(); } @@ -4196,7 +4196,7 @@ void building_search_iterator::set_to_next() } if(position->first==-1 && positionSaved==position) { // This fixes an infinit loop. - is_end=true; // In some special cases the program Logic + is_end=true; // In some special tiles the program Logic return; // must have been wrong. } found_id=position->first; @@ -4497,14 +4497,14 @@ bool MapInfo::is_discovered(int x, int y) bool MapInfo::is_ressource(int x, int y, int type) { - return echo.player->map->isRessourceTakeable(x, y, type); + return echo.player->map->isResourceTakeable(x, y, type); } bool MapInfo::is_ressource(int x, int y) { - return echo.player->map->isRessource(x, y); + return echo.player->map->isResource(x, y); } @@ -4555,7 +4555,7 @@ bool MapInfo::backs_onto_sand(int x, int y) int MapInfo::get_ammount_ressource(int x, int y) { - return echo.player->map->getRessource(x, y).amount; + return echo.player->map->getResource(x, y).amount; } @@ -5159,7 +5159,7 @@ void ReachToInfinity::tick(Echo& echo) //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 4)); //You can't be farther than 10 units from wheat @@ -5180,9 +5180,9 @@ void ReachToInfinity::tick(Echo& echo) //Constraints arround the location of fruit AIEcho::Gradients::GradientInfo gi_fruit; - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(PRUNE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); //You want to be reasnobly close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); @@ -5287,7 +5287,7 @@ void ReachToInfinity::tick(Echo& echo) //Constraint arround the location of fruit AIEcho::Gradients::GradientInfo gi_cherry; - gi_cherry.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); + gi_cherry.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); //You want to be ontop of the cherry trees bo_cherry->add_constraint(new AIEcho::Construction::MaximumDistance(gi_cherry, 0)); @@ -5318,7 +5318,7 @@ void ReachToInfinity::tick(Echo& echo) //Constraints arround the location of fruit AIEcho::Gradients::GradientInfo gi_orange; - gi_orange.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); + gi_orange.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); //You want to be ontop of the orange trees bo_orange->add_constraint(new AIEcho::Construction::MaximumDistance(gi_orange, 0)); @@ -5347,7 +5347,7 @@ void ReachToInfinity::tick(Echo& echo) bo_prune->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); AIEcho::Gradients::GradientInfo gi_prune; - gi_prune.add_source(new AIEcho::Gradients::Entities::Ressource(PRUNE)); + gi_prune.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); //You want to be ontop of the prune trees bo_prune->add_constraint(new AIEcho::Construction::MaximumDistance(gi_prune, 0)); @@ -5430,7 +5430,7 @@ void ReachToInfinity::tick(Echo& echo) //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 4)); //You can't be farther than 10 units from wheat @@ -5453,9 +5453,9 @@ void ReachToInfinity::tick(Echo& echo) { //Constraints arround the location of fruit AIEcho::Gradients::GradientInfo gi_fruit; - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(PRUNE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); //You want to be reasnobly close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); } @@ -5490,7 +5490,7 @@ void ReachToInfinity::tick(Echo& echo) //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 4)); @@ -5543,13 +5543,13 @@ void ReachToInfinity::tick(Echo& echo) //Constraints arround the location of wood AIEcho::Gradients::GradientInfo gi_wood; - gi_wood.add_source(new AIEcho::Gradients::Entities::Ressource(WOOD)); + gi_wood.add_source(new AIEcho::Gradients::Entities::Resource(WOOD)); //You want to be close to wood bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wood, 4)); //Constraints arround the location of stone AIEcho::Gradients::GradientInfo gi_stone; - gi_stone.add_source(new AIEcho::Gradients::Entities::Ressource(STONE)); + gi_stone.add_source(new AIEcho::Gradients::Entities::Resource(STONE)); //You want to be close to stone bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_stone, 1)); //But not to close, so you have room to upgrade @@ -5586,19 +5586,19 @@ void ReachToInfinity::tick(Echo& echo) //Constraints arround the location of wood AIEcho::Gradients::GradientInfo gi_wood; - gi_wood.add_source(new AIEcho::Gradients::Entities::Ressource(WOOD)); + gi_wood.add_source(new AIEcho::Gradients::Entities::Resource(WOOD)); //You want to be close to wood bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wood, 4)); //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 1)); //Constraints arround the location of stone AIEcho::Gradients::GradientInfo gi_stone; - gi_stone.add_source(new AIEcho::Gradients::Entities::Ressource(STONE)); + gi_stone.add_source(new AIEcho::Gradients::Entities::Resource(STONE)); //You don't want to be too close, so you have room to upgrade bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_stone, 2)); @@ -5884,7 +5884,7 @@ void ReachToInfinity::handle_message(Echo& echo, const std::string& message) //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 4)); //You can't be farther than 10 units from wheat @@ -5907,9 +5907,9 @@ void ReachToInfinity::handle_message(Echo& echo, const std::string& message) if(echo.is_fruit_on_map()) { AIEcho::Gradients::GradientInfo gi_fruit; - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(PRUNE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); //You want to be reasnobly close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); } diff --git a/src/AIEcho.h b/src/AIEcho.h index e3a2054c3..018f1b909 100644 --- a/src/AIEcho.h +++ b/src/AIEcho.h @@ -49,7 +49,7 @@ namespace AIEcho class Building; class AnyTeamBuilding; class AnyBuilding; - class Ressource; + class Resource; class AnyRessource; class Water; }; @@ -242,13 +242,13 @@ namespace AIEcho bool under_construction; }; - ///Matches a particular ressource type - class Ressource : public Entity + ///Matches a particular resource type + class Resource : public Entity { public: - explicit Ressource(int ressource_type); + explicit Resource(int ressource_type); protected: - Ressource() : ressource_type(-1) {} + Resource() : ressource_type(-1) {} friend class Entity; bool is_entity(Map* map, int posx, int posy); bool operator==(const Entity& rhs); @@ -260,7 +260,7 @@ namespace AIEcho int ressource_type; }; - ///Matches any ressource type + ///Matches any resource type class AnyRessource : public Entity { public: @@ -395,7 +395,7 @@ namespace AIEcho ///The gradient manager is a very important part of the system, just like the gradient itself is. The gradient manager takes upon the task ///of managing and updating various gradients in the game. It returns a matching gradient when provided a GradientInfo. - ///This object is shared among all Echo AI's, which means gradients that aren't specific to a particular team (such as most Ressource + ///This object is shared among all Echo AI's, which means gradients that aren't specific to a particular team (such as most Resource ///gradients) don't have to be recalculated for every Echo AI seperately. This saves allot of cpu time when their are multiple Echo AI's. class GradientManager { @@ -1023,7 +1023,7 @@ namespace AIEcho void save(GAGCore::OutputStream *stream); }; - ///This class compares the total amount of ressources recorded by a ressource tracker. + ///This class compares the total amount of ressources recorded by a resource tracker. class RessourceTrackerAmount : public BuildingCondition { public: @@ -1045,7 +1045,7 @@ namespace AIEcho int tracker_method; }; - ///This class compares the age provided by a ressource tracker + ///This class compares the age provided by a resource tracker class RessourceTrackerAge : public BuildingCondition { public: @@ -1190,19 +1190,19 @@ namespace AIEcho }; - ///A ressource tracker is generally used for management, like most other things. A ressource trackers job is to keep + ///A resource tracker is generally used for management, like most other things. A resource trackers job is to keep ///track of the number of ressources in a particular building, and returning averages over a small period of time. - ///Its better to use a ressource tracker than getting the ressource amounts directly, because a ressource tracker + ///Its better to use a resource tracker than getting the resource amounts directly, because a resource tracker ///returns trends, and small anomalies like an Inn running out of food for only a second don't impact its result greatly. class RessourceTracker { public: RessourceTracker(Echo& echo, GAGCore::InputStream* stream, Player* player, Sint32 versionMinor) : echo(echo) { load(stream, player, versionMinor); } - RessourceTracker(Echo& echo, int building_id, int length, int ressource); + RessourceTracker(Echo& echo, int building_id, int length, int resource); ///Returns the total ressources the building possessed within the time frame int get_total_level(); - ///Returns the number of ticks the ressource tracker has been tracking. + ///Returns the number of ticks the resource tracker has been tracking. int get_age(); private: friend class AIEcho::Echo; @@ -1215,15 +1215,15 @@ namespace AIEcho int length; Echo& echo; int building_id; - int ressource; + int resource; }; - ///This adds a ressource tracker to a building + ///This adds a resource tracker to a building class AddRessourceTracker : public ManagementOrder { public: - AddRessourceTracker(int length, int ressource, int building_id); - AddRessourceTracker() : length(0), building_id(0), ressource(0) {} + AddRessourceTracker(int length, int resource, int building_id); + AddRessourceTracker() : length(0), building_id(0), resource(0) {} protected: void modify(Echo& echo); boost::logic::tribool wait(Echo& echo); @@ -1232,10 +1232,10 @@ namespace AIEcho void save(GAGCore::OutputStream *stream); int length; int building_id; - int ressource; + int resource; }; - ///This pauses a ressource tracker. This is mainly done when a building is about to be upgraded. + ///This pauses a resource tracker. This is mainly done when a building is about to be upgraded. class PauseRessourceTracker : public ManagementOrder { public: @@ -1250,7 +1250,7 @@ namespace AIEcho int building_id; }; - ///This unpauses a ressource tracker. This should be done when a building is done being upgraded. + ///This unpauses a resource tracker. This should be done when a building is done being upgraded. class UnPauseRessourceTracker : public ManagementOrder { public: diff --git a/src/AINicowar.cpp b/src/AINicowar.cpp index 65875c72f..e764eeb57 100644 --- a/src/AINicowar.cpp +++ b/src/AINicowar.cpp @@ -217,7 +217,7 @@ bool NewNicowar::load(GAGCore::InputStream *stream, Player *player, Sint32 versi buildings_under_construction=stream->readUint32("buildings_under_construction"); for(int n=0; nreadUint8(FormatableString("buildings_under_construction_per_type[%0]").arg(n).c_str()); + buildings_under_construction_per_type[n]=stream->readUint8(FormattableString("buildings_under_construction_per_type[%0]").arg(n).c_str()); } stream->readEnterSection("placement_queue"); @@ -307,7 +307,7 @@ void NewNicowar::save(GAGCore::OutputStream *stream) stream->writeUint32(buildings_under_construction, "buildings_under_construction"); for(int n=0; nwriteUint8(buildings_under_construction_per_type[n], FormatableString("buildings_under_construction_per_type[%0]").arg(n).c_str()); + stream->writeUint8(buildings_under_construction_per_type[n], FormattableString("buildings_under_construction_per_type[%0]").arg(n).c_str()); } stream->writeEnterSection("placement_queue"); @@ -1048,7 +1048,7 @@ int NewNicowar::order_regular_inn(Echo& echo) //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 8)); //You can't be farther than 10 units from wheat @@ -1089,9 +1089,9 @@ int NewNicowar::order_regular_inn(Echo& echo) { //Constraints arround the location of fruit AIEcho::Gradients::GradientInfo gi_fruit; - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); - gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(PRUNE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); + gi_fruit.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); //You want to be reasnobly close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); } @@ -1100,7 +1100,7 @@ int NewNicowar::order_regular_inn(Echo& echo) unsigned int id=echo.add_building_order(bo); //Change the number of workers assigned when the building is finished - ManagementOrder* mo_completion=new SendMessage(FormatableString("update inn %0").arg(id)); + ManagementOrder* mo_completion=new SendMessage(FormattableString("update inn %0").arg(id)); mo_completion->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_completion); @@ -1119,7 +1119,7 @@ int NewNicowar::order_regular_swarm(Echo& echo) //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 6)); @@ -1150,7 +1150,7 @@ int NewNicowar::order_regular_swarm(Echo& echo) unsigned int id=echo.add_building_order(bo); //Change the number of workers assigned when the building is finished - ManagementOrder* mo_completion=new SendMessage(FormatableString("update swarm %0").arg(id)); + ManagementOrder* mo_completion=new SendMessage(FormattableString("update swarm %0").arg(id)); mo_completion->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_completion); @@ -1169,7 +1169,7 @@ int NewNicowar::order_regular_racetrack(Echo& echo) //Constraints arround the location of wood AIEcho::Gradients::GradientInfo gi_wood; - gi_wood.add_source(new AIEcho::Gradients::Entities::Ressource(WOOD)); + gi_wood.add_source(new AIEcho::Gradients::Entities::Resource(WOOD)); //You want to be close to wood bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wood, 4)); @@ -1181,7 +1181,7 @@ int NewNicowar::order_regular_racetrack(Echo& echo) //Constraints arround the location of stone AIEcho::Gradients::GradientInfo gi_stone; - gi_stone.add_source(new AIEcho::Gradients::Entities::Ressource(STONE)); + gi_stone.add_source(new AIEcho::Gradients::Entities::Resource(STONE)); //You want to be close to stone bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_stone, 1)); //But not to close, so you have room to upgrade @@ -1223,7 +1223,7 @@ int NewNicowar::order_regular_swimmingpool(Echo& echo) //Constraints arround the location of wood AIEcho::Gradients::GradientInfo gi_wood; - gi_wood.add_source(new AIEcho::Gradients::Entities::Ressource(WOOD)); + gi_wood.add_source(new AIEcho::Gradients::Entities::Resource(WOOD)); //You want to be close to wood bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wood, 4)); @@ -1235,13 +1235,13 @@ int NewNicowar::order_regular_swimmingpool(Echo& echo) //Constraints arround the location of wheat AIEcho::Gradients::GradientInfo gi_wheat; - gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN)); + gi_wheat.add_source(new AIEcho::Gradients::Entities::Resource(CORN)); //You want to be close to wheat bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 1)); //Constraints arround the location of stone AIEcho::Gradients::GradientInfo gi_stone; - gi_stone.add_source(new AIEcho::Gradients::Entities::Ressource(STONE)); + gi_stone.add_source(new AIEcho::Gradients::Entities::Resource(STONE)); //You don't want to be too close, so you have room to upgrade bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_stone, 2)); @@ -1331,13 +1331,13 @@ int NewNicowar::order_regular_barracks(Echo& echo) //Constraints arround the location of stone AIEcho::Gradients::GradientInfo gi_stone; - gi_stone.add_source(new AIEcho::Gradients::Entities::Ressource(STONE)); + gi_stone.add_source(new AIEcho::Gradients::Entities::Resource(STONE)); //You want to be close to stone bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_stone, 5)); //Constraints arround the location of wood AIEcho::Gradients::GradientInfo gi_wood; - gi_wood.add_source(new AIEcho::Gradients::Entities::Ressource(WOOD)); + gi_wood.add_source(new AIEcho::Gradients::Entities::Resource(WOOD)); //You want to be close to wood bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wood, 2)); @@ -1372,7 +1372,7 @@ int NewNicowar::order_regular_hospital(Echo& echo) //Constraints arround the location of wood AIEcho::Gradients::GradientInfo gi_wood; - gi_wood.add_source(new AIEcho::Gradients::Entities::Ressource(WOOD)); + gi_wood.add_source(new AIEcho::Gradients::Entities::Resource(WOOD)); //You want to be close to wood bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wood, 2)); @@ -1485,7 +1485,7 @@ void NewNicowar::manage_swarm(Echo& echo, int id) to_assign=strategy.base_swarm_units_assigned; - ///Double units when ressource level is low + ///Double units when resource level is low if(total_ressource_level <= (strategy.base_swarm_low_wheat_trigger_ammount * 25)) to_assign*=2; @@ -1731,7 +1731,7 @@ void NewNicowar::upgrade_buildings(Echo& echo) //Cause the building to be updated after its completion. Not all buildings need //to be updated, in which case the order will simply be ignored - ManagementOrder* mo_completion=new SendMessage(FormatableString("update %0 %1").arg(type).arg(id)); + ManagementOrder* mo_completion=new SendMessage(FormattableString("update %0 %1").arg(type).arg(id)); mo_completion->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_completion); } @@ -1755,7 +1755,7 @@ void NewNicowar::upgrade_buildings(Echo& echo) //Cause the building to be updated after its completion. Not all buildings need //to be updated, in which case the order will simply be ignored - ManagementOrder* mo_completion=new SendMessage(FormatableString("update %0 %1").arg(type).arg(id)); + ManagementOrder* mo_completion=new SendMessage(FormattableString("update %0 %1").arg(type).arg(id)); mo_completion->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_completion); } @@ -1944,7 +1944,7 @@ bool NewNicowar::dig_out_enemy(Echo& echo) AIEcho::Gradients::GradientInfo gi_pathfind; gi_pathfind.add_source(new Entities::Position(bx, by)); - gi_pathfind.add_obstacle(new Entities::Ressource(STONE)); + gi_pathfind.add_obstacle(new Entities::Resource(STONE)); Gradient& gradient_pathfind=echo.get_gradient_manager().get_gradient(gi_pathfind); ///Next, find the closest point manhattan distance wise, to the building that is accessible @@ -2684,7 +2684,7 @@ void NewNicowar::update_fruit_flags(AIEcho::Echo& echo) bo_cherry->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); //Constraint arround the location of fruit AIEcho::Gradients::GradientInfo gi_cherry; - gi_cherry.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); + gi_cherry.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); //You want to be ontop of the cherry trees bo_cherry->add_constraint(new AIEcho::Construction::MaximumDistance(gi_cherry, 0)); //Add the building order to the list of orders @@ -2701,7 +2701,7 @@ void NewNicowar::update_fruit_flags(AIEcho::Echo& echo) bo_orange->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); //Constraints arround the location of fruit AIEcho::Gradients::GradientInfo gi_orange; - gi_orange.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); + gi_orange.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); //You want to be ontop of the orange trees bo_orange->add_constraint(new AIEcho::Construction::MaximumDistance(gi_orange, 0)); unsigned int id_orange=echo.add_building_order(bo_orange); @@ -2714,7 +2714,7 @@ void NewNicowar::update_fruit_flags(AIEcho::Echo& echo) //You want the closest fruit to your settlement possible bo_prune->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); AIEcho::Gradients::GradientInfo gi_prune; - gi_prune.add_source(new AIEcho::Gradients::Entities::Ressource(PRUNE)); + gi_prune.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); //You want to be ontop of the prune trees bo_prune->add_constraint(new AIEcho::Construction::MaximumDistance(gi_prune, 0)); //Add the building order to the list of orders diff --git a/src/AINumbi.cpp b/src/AINumbi.cpp index a14bf2c46..8465a02f6 100644 --- a/src/AINumbi.cpp +++ b/src/AINumbi.cpp @@ -264,13 +264,13 @@ int AINumbi::estimateFood(Building *building) { int rx, ry, dist; bool found; - if (map->ressourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX-1, building->posY-1, &rx, &ry, &dist)) + if (map->resourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX-1, building->posY-1, &rx, &ry, &dist)) found=true; - else if (map->ressourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX+building->type->width+1, building->posY-1, &rx, &ry, &dist)) + else if (map->resourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX+building->type->width+1, building->posY-1, &rx, &ry, &dist)) found=true; - else if (map->ressourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX+building->type->width+1, building->posY+building->type->height+1, &rx, &ry, &dist)) + else if (map->resourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX+building->type->width+1, building->posY+building->type->height+1, &rx, &ry, &dist)) found=true; - else if (map->ressourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX-1, building->posY+building->type->height+1, &rx, &ry, &dist)) + else if (map->resourceAvailableUpdate(team->teamNumber, CORN, 0, building->posX-1, building->posY+building->type->height+1, &rx, &ry, &dist)) found=true; else found=false; @@ -288,14 +288,14 @@ int AINumbi::estimateFood(Building *building) hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx+i, ry, CORN)||map->isRessourceTakeable(rx+i, ry-1, CORN)) + if (map->isResourceTakeable(rx+i, ry, CORN)||map->isResourceTakeable(rx+i, ry-1, CORN)) w++; else if (hole--<0) break; rxr=rx+i; hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx-i, ry, CORN)||map->isRessourceTakeable(rx-i, ry-1, CORN)) + if (map->isResourceTakeable(rx-i, ry, CORN)||map->isResourceTakeable(rx-i, ry-1, CORN)) w++; else if (hole--<0) break; @@ -305,14 +305,14 @@ int AINumbi::estimateFood(Building *building) hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx, ry+i, CORN)||map->isRessourceTakeable(rx-1, ry+i, CORN)) + if (map->isResourceTakeable(rx, ry+i, CORN)||map->isResourceTakeable(rx-1, ry+i, CORN)) h++; else if (hole--<0) break; ryb=ry+i; hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx, ry-i, CORN)||map->isRessourceTakeable(rx-1, ry-i, CORN)) + if (map->isResourceTakeable(rx, ry-i, CORN)||map->isResourceTakeable(rx-1, ry-i, CORN)) h++; else if (hole--<0) break; @@ -323,14 +323,14 @@ int AINumbi::estimateFood(Building *building) hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx, ry+i, CORN)||map->isRessourceTakeable(rx+1, ry+i, CORN)) + if (map->isResourceTakeable(rx, ry+i, CORN)||map->isResourceTakeable(rx+1, ry+i, CORN)) h++; else if (hole--<0) break; ryb=ry+i; hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx, ry-i, CORN)||map->isRessourceTakeable(rx+1, ry-i, CORN)) + if (map->isResourceTakeable(rx, ry-i, CORN)||map->isResourceTakeable(rx+1, ry-i, CORN)) h++; else if (hole--<0) break; @@ -340,13 +340,13 @@ int AINumbi::estimateFood(Building *building) w=0; hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx+i, ry, CORN)||map->isRessourceTakeable(rx+i, ry+1, CORN)) + if (map->isResourceTakeable(rx+i, ry, CORN)||map->isResourceTakeable(rx+i, ry+1, CORN)) w++; else if (hole--<0) break; hole=2; for (i=0; i<32; i++) - if (map->isRessourceTakeable(rx-i, ry, CORN)||map->isRessourceTakeable(rx-i, ry+1, CORN)) + if (map->isResourceTakeable(rx-i, ry, CORN)||map->isResourceTakeable(rx-i, ry+1, CORN)) w++; else if (hole--<0) break; @@ -730,7 +730,7 @@ bool AINumbi::findNewEmplacement(const int buildingType, int *posX, int *posY) if ((valid>299)&&(game->checkRoomForBuilding(px, py, bt, player->team->teamNumber))) { int rx, ry, dist; - bool nr=map->ressourceAvailableUpdate(team->teamNumber, CORN, 0, px, py, &rx, &ry, &dist); + bool nr=map->resourceAvailableUpdate(team->teamNumber, CORN, 0, px, py, &rx, &ry, &dist); if (nr) { //int dist=map->warpDistSquare(px+1, py+1, rx, ry); diff --git a/src/AIWarrush.cpp b/src/AIWarrush.cpp index 2445f5892..c668b610b 100644 --- a/src/AIWarrush.cpp +++ b/src/AIWarrush.cpp @@ -296,7 +296,7 @@ bool AIWarrush::percentageOfBuildingsAreFullyWorked(int percentage)const && b->constructionResultState == Building::NO_CONSTRUCTION && - (b->ressources[CORN]) > ((b->wishedResources[CORN]) * 2 / 3)) + (b->resources[CORN]) > ((b->wishedResources[CORN]) * 2 / 3)) {//heavily worked swarms and inns sometimes are full and have no workers ++num_worked_buildings; if(verbose)std::cout << "C"; @@ -551,7 +551,7 @@ boost::shared_ptr AIWarrush::farm() { for(int y=0;yh;y++) { - if((!map->isRessourceTakeable(x, y, WOOD) && !map->isRessourceTakeable(x, y, CORN))) + if((!map->isResourceTakeable(x, y, WOOD) && !map->isResourceTakeable(x, y, CORN))) { if(map->isForbidden(x, y, team->me)) { @@ -562,9 +562,9 @@ boost::shared_ptr AIWarrush::farm() && !map->isForbidden (x,y + 1,team->me) && !map->isForbidden (x,y - 1,team->me) //Or fruits'! - && !map->isRessourceTakeable(x, y, CHERRY) - && !map->isRessourceTakeable(x, y, ORANGE) - && !map->isRessourceTakeable(x, y, PRUNE) + && !map->isResourceTakeable(x, y, CHERRY) + && !map->isResourceTakeable(x, y, ORANGE) + && !map->isResourceTakeable(x, y, PRUNE) ) { del_acc.applyBrush(BrushApplication(x, y, 0), map); @@ -578,7 +578,7 @@ boost::shared_ptr AIWarrush::farm() } //we never clear anything but wood - if(!map->isRessourceTakeable(x, y, WOOD)) + if(!map->isResourceTakeable(x, y, WOOD)) { if(map->isClearArea(x, y, team->me)) { @@ -587,7 +587,7 @@ boost::shared_ptr AIWarrush::farm() } //we clear wood if it's next to nice stuff like wheat or buildings - if(map->isRessourceTakeable(x, y, WOOD)) + if(map->isResourceTakeable(x, y, WOOD)) { if(!map->isClearArea(x, y, team->me) && map->isMapDiscovered(x, y, team->me)) { @@ -595,7 +595,7 @@ boost::shared_ptr AIWarrush::farm() { for(int ymod=-1;ymod<=1;ymod++) { - if(map->isRessourceTakeable(x+xmod, y+ymod, CORN) + if(map->isResourceTakeable(x+xmod, y+ymod, CORN) || (map->getBuilding(x+xmod,y+ymod)!=NOGBID && (team->me & game->teams[Building::GIDtoTeam(map->getBuilding(x+xmod,y+ymod))]->me))) { @@ -612,7 +612,7 @@ boost::shared_ptr AIWarrush::farm() if(x%2==1 && ((y%2==1 && x%4==1) || (y%2==0 && x%4==3))) { - if(map->isRessourceTakeable(x, y, WOOD)) + if(map->isResourceTakeable(x, y, WOOD)) { if(!map->isForbidden(x, y, team->me) && !map->isClearArea(x, y, team->me) && map->isMapDiscovered(x, y, team->me) && water_gradient(x, y) > (255 - 15)) { @@ -623,7 +623,7 @@ boost::shared_ptr AIWarrush::farm() if(x%2==y%2) { - if(map->isRessourceTakeable(x, y, CORN)) + if(map->isResourceTakeable(x, y, CORN)) { if(!map->isForbidden(x, y, team->me) && map->isMapDiscovered(x, y, team->me) && water_gradient(x, y) > (255 - 15)) { @@ -634,9 +634,9 @@ boost::shared_ptr AIWarrush::farm() //FORBID FRUITS!!! They're horrible for our warriors and we hate converting. if( - ( map->isRessourceTakeable(x, y, CHERRY) - || map->isRessourceTakeable(x, y, ORANGE) - || map->isRessourceTakeable(x, y, PRUNE) ) + ( map->isResourceTakeable(x, y, CHERRY) + || map->isResourceTakeable(x, y, ORANGE) + || map->isResourceTakeable(x, y, PRUNE) ) && !map->isForbidden(x, y, team->me) && map->isMapDiscovered(x, y, team->me) ) @@ -722,12 +722,12 @@ void AIWarrush::initializeGradientWithResource(DynamicGradientMapArray &gradient { for(int y=0;yh;y++) { - Case c=map->getCase(x,y); - if (c.ressource.type==resource_type) + Tile c=map->getTile(x,y); + if (c.resource.type==resource_type) { gradient(x, y) = 255; } - else if (c.ressource.type!=NO_RES_TYPE) + else if (c.resource.type!=NO_RES_TYPE) { gradient(x, y) = 0; } @@ -782,8 +782,8 @@ boost::shared_ptr AIWarrush::buildBuildingOfType(Sint32 shortTypeNum) { for(int y=0;yh;y++) { - Case c=map->getCase(x,y); - if (c.ressource.type!=NO_RES_TYPE) + Tile c=map->getTile(x,y); + if (c.resource.type!=NO_RES_TYPE) { availability_gradient(x, y) = 0; } diff --git a/src/BasePlayer.h b/src/BasePlayer.h index f2eba7be2..ab961254f 100644 --- a/src/BasePlayer.h +++ b/src/BasePlayer.h @@ -39,7 +39,7 @@ class BasePlayer { ///A non existing player //NOTE : we don't need any more because null player are not created P_NONE=0, - ///Player will be dropped in any cases, but we still have to exchange orders + ///Player will be dropped in any tiles, but we still have to exchange orders P_LOST_DROPPING=1, ///Player is no longer taken into account, may be later changed to P_AI. All orders are NULLs. P_LOST_FINAL=2, diff --git a/src/Brush.cpp b/src/Brush.cpp index 757994fea..ca5716088 100644 --- a/src/Brush.cpp +++ b/src/Brush.cpp @@ -37,7 +37,7 @@ void BrushTool::draw(int x, int y) globalContainer->gfx->drawSprite(x+16, y, globalContainer->brush, 0); globalContainer->gfx->drawSprite(x+64+16, y, globalContainer->brush, 1); if (mode) - globalContainer->gfx->drawSprite(x+(static_cast(mode)-1)*64+16, y, globalContainer->gamegui, 22); + globalContainer->gfx->drawSprite(x+(static_cast(mode)-1)*64+16, y, globalContainer->gameGui, 22); } for (unsigned i=0; i<8; i++) { @@ -45,7 +45,7 @@ void BrushTool::draw(int x, int y) int decY = 32*(i/4)+36; globalContainer->gfx->drawSprite(x+decX, y+decY, globalContainer->brush, 2+i); if ((mode != MODE_NONE) && (figure == i)) - globalContainer->gfx->drawSprite(x+decX, y+decY, globalContainer->gamegui, 22); + globalContainer->gfx->drawSprite(x+decX, y+decY, globalContainer->gameGui, 22); } } diff --git a/src/Building.cpp b/src/Building.cpp index 7fb79178c..704c19b35 100644 --- a/src/Building.cpp +++ b/src/Building.cpp @@ -40,7 +40,7 @@ Building::Building(GAGCore::InputStream *stream, BuildingsTypes *types, Team *ow for (int i=0; i<2; i++) { globalGradient[i]=NULL; - localRessources[i]=NULL; + localResources[i]=NULL; } logFile = globalContainer->logFileManager->getFile("Building.log"); load(stream, types, owner, versionMinor); @@ -93,25 +93,25 @@ Building::Building(int x, int y, Uint16 gid, Sint32 typeNum, Team *team, Buildin underAttackTimer=0; canNotConvertUnitTimer=0; - // flag usefull : + // flag useful : unitStayRange=type->defaultUnitStayRange; unitStayRangeLocal=unitStayRange; for(int i=0; ihpInit; // (Uint16) - // prefered parameters + // preferred parameters productionTimeout=type->unitProductionTime; @@ -126,10 +126,10 @@ Building::Building(int x, int y, Uint16 gid, Sint32 typeNum, Team *team, Buildin percentUsed[i]=0; } - receiveRessourceMask=0; - sendRessourceMask=0; - receiveRessourceMaskLocal=0; - sendRessourceMaskLocal=0; + receiveResourceMask=0; + sendResourceMask=0; + receiveResourceMaskLocal=0; + sendResourceMaskLocal=0; shootingStep=0; shootingCooldown=SHOOTING_COOLDOWN_MAX; @@ -147,14 +147,14 @@ Building::Building(int x, int y, Uint16 gid, Sint32 typeNum, Team *team, Buildin for (int i=0; i<2; i++) { globalGradient[i]=NULL; - localRessources[i]=NULL; + localResources[i]=NULL; dirtyLocalGradient[i]=true; locked[i]=false; lastGlobalGradientUpdateStepCounter[i]=0; - localRessources[i]=0; - localRessourcesCleanTime[i]=0; - anyRessourceToClear[i]=0; + localResources[i]=0; + localResourcesCleanTime[i]=0; + anyResourceToClear[i]=0; } verbose=false; @@ -184,17 +184,17 @@ void Building::freeGradients() delete[] globalGradient[i]; globalGradient[i] = NULL; } - if (localRessources[i]) + if (localResources[i]) { - delete[] localRessources[i]; - localRessources[i] = NULL; + delete[] localResources[i]; + localResources[i] = NULL; } dirtyLocalGradient[i] = true; locked[i] = false; lastGlobalGradientUpdateStepCounter[i] = 0; - localRessourcesCleanTime[i] = 0; - anyRessourceToClear[i] = 0; + localResourcesCleanTime[i] = 0; + anyResourceToClear[i] = 0; } } @@ -247,27 +247,27 @@ void Building::load(GAGCore::InputStream *stream, BuildingsTypes *types, Team *o { std::ostringstream oss; oss << "clearingRessources[" << i << "]"; - clearingRessources[i] = (bool)stream->readSint32(oss.str().c_str()); + clearingResources[i] = (bool)stream->readSint32(oss.str().c_str()); } - assert(clearingRessources[STONE] == false); + assert(clearingResources[STONE] == false); - memcpy(clearingRessourcesLocal, clearingRessources, sizeof(bool)*BASIC_COUNT); + memcpy(clearingResourcesLocal, clearingResources, sizeof(bool)*BASIC_COUNT); minLevelToFlag = stream->readSint32("minLevelToFlag"); minLevelToFlagLocal = minLevelToFlag; // Building Specific - for (int i=0; ireadSint32(oss.str().c_str()); + localResource[i] = stream->readSint32(oss.str().c_str()); } // quality parameters hp = stream->readSint32("hp"); - // prefered parameters + // preferred parameters productionTimeout = stream->readSint32("productionTimeout"); totalRatio = stream->readSint32("totalRatio"); for (int i=0; ireadUint32("receiveRessourceMask"); - sendRessourceMask = stream->readUint32("sendRessourceMask"); - receiveRessourceMaskLocal = receiveRessourceMask; - sendRessourceMaskLocal = sendRessourceMask; + receiveResourceMask = stream->readUint32("receiveRessourceMask"); + sendResourceMask = stream->readUint32("sendRessourceMask"); + receiveResourceMaskLocal = receiveResourceMask; + sendResourceMaskLocal = sendResourceMask; shootingStep = stream->readUint32("shootingStep"); shootingCooldown = stream->readSint32("shootingCooldown"); @@ -298,7 +298,7 @@ void Building::load(GAGCore::InputStream *stream, BuildingsTypes *types, Team *o typeNum = stream->readSint32("typeNum"); type = types->get(typeNum); assert(type); - updateRessourcesPointer(); + updateResourcesPointer(); // reload data from type shortTypeNum = type->shortTypeNum; @@ -368,22 +368,22 @@ void Building::save(GAGCore::OutputStream *stream) { std::ostringstream oss; oss << "clearingRessources[" << i << "]"; - stream->writeSint32(clearingRessources[i], oss.str().c_str()); + stream->writeSint32(clearingResources[i], oss.str().c_str()); } stream->writeSint32(minLevelToFlag, "minLevelToFlag"); // Building Specific - for (int i=0; iwriteSint32(localRessource[i], oss.str().c_str()); + stream->writeSint32(localResource[i], oss.str().c_str()); } // quality parameters stream->writeSint32(hp, "hp"); - // prefered parameters + // preferred parameters stream->writeSint32(productionTimeout, "productionTimeout"); stream->writeSint32(totalRatio, "totalRatio"); for (int i=0; iwriteUint32(receiveRessourceMask, "receiveRessourceMask"); - stream->writeUint32(sendRessourceMask, "sendRessourceMask"); + stream->writeUint32(receiveResourceMask, "receiveRessourceMask"); + stream->writeUint32(sendResourceMask, "sendRessourceMask"); stream->writeUint32(shootingStep, "shootingStep"); stream->writeSint32(shootingCooldown, "shootingCooldown"); @@ -562,28 +562,28 @@ void Building::saveCrossRef(GAGCore::OutputStream *stream) stream->writeLeaveSection(); } -bool Building::isRessourceFull(void) +bool Building::isResourceFull(void) { - for (int i=0; imultiplierRessource[i]<=type->maxRessource[i]) + if (resources[i]+type->multiplierResource[i]<=type->maxResource[i]) return false; } return true; } -int Building::neededRessource(void) +int Building::neededResource(void) { Sint32 minProportion=0x7FFFFFFF; int minType=-1; - int deci=syncRand()%MAX_RESSOURCES; - for (int ib=0; ibmaxRessource[i]; - if (maxr) + int i=(ib+deci)%MAX_RESOURCES; + int maxR=type->maxResource[i]; + if (maxR) { - Sint32 proportion=(ressources[i]<<16)/maxr; + Sint32 proportion=(resources[i]<<16)/maxR; if (proportionmaxRessource[ri] - ressources[ri])) / (type->multiplierRessource[ri] * 3); + for (int ri = 0; ri < MAX_NB_RESOURCES; ri++) + needs[ri] = (4 * (type->maxResource[ri] - resources[ri])) / (type->multiplierResource[ri] * 3); for (std::list::iterator ui = unitsWorking.begin(); ui != unitsWorking.end(); ++ui) if ((*ui)->destinationPurpose >= 0) { - assert((*ui)->destinationPurpose < MAX_NB_RESSOURCES); + assert((*ui)->destinationPurpose < MAX_NB_RESOURCES); needs[(*ui)->destinationPurpose]--; } } -void Building::computeWishedRessources() +void Building::computeWishedResources() { // we balance the system with Units working on it: - for (int ri = 0; ri < MAX_NB_RESSOURCES; ri++) - wishedResources[ri] = (4 * (type->maxRessource[ri] - ressources[ri])) / (type->multiplierRessource[ri] * 3); + for (int ri = 0; ri < MAX_NB_RESOURCES; ri++) + wishedResources[ri] = (4 * (type->maxResource[ri] - resources[ri])) / (type->multiplierResource[ri] * 3); for (std::list::iterator ui = unitsWorking.begin(); ui != unitsWorking.end(); ++ui) if ((*ui)->destinationPurpose >= 0) { - assert((*ui)->destinationPurpose < MAX_NB_RESSOURCES); + assert((*ui)->destinationPurpose < MAX_NB_RESOURCES); wishedResources[(*ui)->destinationPurpose]--; } } -int Building::neededRessource(int r) +int Building::neededResource(int r) { assert(r >= 0); - int need = type->maxRessource[r] - ressources[r] + 1 - type->multiplierRessource[r]; + int need = type->maxResource[r] - resources[r] + 1 - type->multiplierResource[r]; return std::max(need,0); } -int Building::totalWishedRessource() +int Building::totalWishedResource() { int sum=0; - for (int ri = 0; ri < MAX_NB_RESSOURCES; ri++) + for (int ri = 0; ri < MAX_NB_RESOURCES; ri++) sum += wishedResources[ri]; return sum; } @@ -664,7 +664,7 @@ void Building::launchConstruction(Sint32 unitWorking, Sint32 unitWorkingFuture) owner->removeFromAbilitiesLists(this); // We remove all units who are going to the building: - // Notice that the algotithm is not fast but clean. + // Notice that the algorithm is not fast but clean. std::list unitsToRemove; for (std::list::iterator it=unitsInside.begin(); it!=unitsInside.end(); ++it) { @@ -760,8 +760,8 @@ void Building::cancelConstruction(Sint32 unitWorking) owner->prestige+=type->prestige; owner->addToStaticAbilitiesLists(this); - //Update the pointer ressources to the newly changed type - updateRessourcesPointer(); + //Update the pointer resources to the newly changed type + updateResourcesPointer(); posX=midPosX+type->decLeft; posY=midPosY+type->decTop; @@ -841,8 +841,8 @@ void Building::updateCallLists(void) if (buildingState==DEAD) return; desiredMaxUnitWorking = desiredNumberOfWorkers(); - bool ressourceFull=isRessourceFull(); - if (ressourceFull && !(type->canExchange && owner->openMarket())) + bool resourceFull=isResourceFull(); + if (resourceFull && !(type->canExchange && owner->openMarket())) { // Then we don't need anyone more to fill me, if I'm still in the call list for units, // remove me @@ -897,7 +897,7 @@ void Building::updateCallLists(void) // this is for food handling if (type->canFeedUnit) { - if (ressources[CORN]>(int)unitsInside.size()) + if (resources[CORN]>(int)unitsInside.size()) { if (inCanFeedUnit!=LS_IN) { @@ -982,11 +982,11 @@ void Building::updateBuildingSite(void) { assert(type->isBuildingSite); - if (isRessourceFull() && (buildingState!=WAITING_FOR_DESTRUCTION)) + if (isResourceFull() && (buildingState!=WAITING_FOR_DESTRUCTION)) { - // we really uses the resources of the buildingsite: - for(int i=0; imaxRessource[i]; + // we really uses the resources of the building site: + for(int i=0; imaxResource[i]; owner->prestige-=type->prestige; typeNum=type->nextLevel; @@ -995,8 +995,8 @@ void Building::updateBuildingSite(void) constructionResultState=NO_CONSTRUCTION; owner->prestige+=type->prestige; - //Update the pointer ressources to the newly changed type - updateRessourcesPointer(); + //Update the pointer resources to the newly changed type + updateResourcesPointer(); //now that building is complete clear the workers @@ -1062,13 +1062,13 @@ void Building::updateUnitsWorking(void) int maxDistSquare=0; Unit *fu=NULL; - std::list::iterator ittemp; + std::list::iterator itTemp; - // First choice: free an unit who has a not needed ressource.. + // First choice: free an unit who has a not needed resource.. for (std::list::iterator it=unitsWorking.begin(); it!=unitsWorking.end();) { - int r=(*it)->carriedRessource; - if (r>=0 && !neededRessource(r)) + int r=(*it)->carriedResource; + if (r>=0 && !neededResource(r)) { fu=(*it); fu->standardRandomActivity(); @@ -1079,13 +1079,13 @@ void Building::updateUnitsWorking(void) } } if(fu!=NULL) continue; - // Second choice: free an unit who has no ressource.. + // Second choice: free an unit who has no resource.. if (fu==NULL) { int minDistSquare=INT_MAX; for (std::list::iterator it=unitsWorking.begin(); it!=unitsWorking.end(); ++it) { - int r=(*it)->carriedRessource; + int r=(*it)->carriedResource; if (r<0) { int tx = posX; @@ -1100,7 +1100,7 @@ void Building::updateUnitsWorking(void) { minDistSquare=newDistSquare; fu=(*it); - ittemp=it; + itTemp=it; } } } @@ -1115,7 +1115,7 @@ void Building::updateUnitsWorking(void) { maxDistSquare=newDistSquare; fu=(*it); - ittemp=it; + itTemp=it; } } @@ -1125,7 +1125,7 @@ void Building::updateUnitsWorking(void) printf("bgid=%d, we free the unit gid=%d\n", gid, fu->gid); // We free the unit. fu->standardRandomActivity(); - unitsWorking.erase(ittemp); + unitsWorking.erase(itTemp); } else break; @@ -1154,7 +1154,7 @@ void Building::updateUnitsHarvesting(void) // TODO: replacing the remove by an erase should be a lot faster but // it causes the game to crash when a market gets destroyed. No idea // why. Actually there's no point bothering about this here as this - // method is not performance critical but still it's weired to me + // method is not performance critical but still it's weird to me // why it doesn't work the other way round. // unitsHarvesting.erase(tmpIt); } @@ -1163,7 +1163,7 @@ void Building::updateUnitsHarvesting(void) void Building::update(void) { - computeWishedRessources(); + computeWishedResources(); if (buildingState==DEAD) return; desiredMaxUnitWorking = desiredNumberOfWorkers(); @@ -1188,7 +1188,7 @@ void Building::setMapDiscovered(void) owner->map->setMapExploredByBuilding(posX-vr, posY-vr, type->width+vr*2, type->height+vr*2, owner->teamNumber); } -void Building::getRessourceCountToRepair(int ressources[BASIC_COUNT]) +void Building::getResourceCountToRepair(int resources[BASIC_COUNT]) { assert(!type->isBuildingSite); int repairLevelTypeNum=type->prevLevel; @@ -1198,7 +1198,7 @@ void Building::getRessourceCountToRepair(int ressources[BASIC_COUNT]) Sint32 fTotErr=0; for (int i=0; imaxRessource[i]; + int fVal=fDestructionRatio*repairBt->maxResource[i]; int iVal=(fVal>>16); fTotErr+=fVal&65535; if (fTotErr>=65536) @@ -1206,7 +1206,7 @@ void Building::getRessourceCountToRepair(int ressources[BASIC_COUNT]) fTotErr-=65536; iVal++; } - ressources[i]=repairBt->maxRessource[i]-iVal; + resources[i]=repairBt->maxResource[i]-iVal; } } @@ -1244,9 +1244,9 @@ bool Building::tryToBuildingSiteRoom(void) { Sint32 fDestructionRatio=(hp<<16)/type->hpMax; Sint32 fTotErr=0; - for (int i=0; imaxRessource[i]; + int fVal=fDestructionRatio*targetBt->maxResource[i]; int iVal=(fVal>>16); fTotErr+=fVal&65535; if (fTotErr>=65536) @@ -1254,7 +1254,7 @@ bool Building::tryToBuildingSiteRoom(void) fTotErr-=65536; iVal++; } - ressources[i]=iVal; + resources[i]=iVal; } } @@ -1270,24 +1270,24 @@ bool Building::tryToBuildingSiteRoom(void) type=targetBt; owner->prestige+=type->prestige; - //Update the pointer ressources to the newly changed type - updateRessourcesPointer(); + //Update the pointer resources to the newly changed type + updateResourcesPointer(); buildingState=ALIVE; owner->addToStaticAbilitiesLists(this); // towers may already have some stone! if (constructionResultState==UPGRADE) - for (int i=0; imaxRessource[i]; + int res=resources[i]; + int resMax=type->maxResource[i]; if (res>0 && resMax>0) { if (res>resMax) res=resMax; if (verbose) - printf("using %d ressources[%d] for fast constr (hp+=%d)\n", res, i, res*type->hpInc); + printf("using %d resources[%d] for fast constr (hp+=%d)\n", res, i, res*type->hpInc); hp+=res*type->hpInc; } } @@ -1308,14 +1308,14 @@ bool Building::tryToBuildingSiteRoom(void) posXLocal=posX; posYLocal=posY; - // flag usefull : + // flag useful : unitStayRange=type->defaultUnitStayRange; unitStayRangeLocal=unitStayRange; // quality parameters // hp=type->hpInit; // (Uint16) - // prefered parameters + // preferred parameters productionTimeout=type->unitProductionTime; totalRatio=0; @@ -1394,17 +1394,17 @@ bool Building::isHardSpaceForBuildingSite(void) bool Building::isHardSpaceForBuildingSite(ConstructionResultState constructionResultState) { - int tltn=-1; + int tlTn=-1; if (constructionResultState==UPGRADE) - tltn=type->nextLevel; + tlTn=type->nextLevel; else if (constructionResultState==REPAIR) - tltn=type->prevLevel; + tlTn=type->prevLevel; else assert(false); - if (tltn==-1) + if (tlTn==-1) return true; - BuildingType *bt=globalContainer->buildingsTypes.get(tltn); + BuildingType *bt=globalContainer->buildingsTypes.get(tlTn); int x=posX+bt->decLeft-type->decLeft; int y=posY+bt->decTop -type->decTop ; int w=bt->width; @@ -1417,7 +1417,7 @@ bool Building::isHardSpaceForBuildingSite(ConstructionResultState constructionRe bool Building::fullInside(void) { - if ((type->canFeedUnit) && (ressources[CORN]<=(int)unitsInside.size())) + if ((type->canFeedUnit) && (resources[CORN]<=(int)unitsInside.size())) return true; else return ((signed)unitsInside.size()>=maxUnitInside); @@ -1427,29 +1427,29 @@ bool Building::fullInside(void) int Building::desiredNumberOfWorkers(void) { //If its virtual, than this building is a flag and always gets - //full ressources + //full resources if(type->isVirtual) { return maxUnitWorking; } - //Otherwise, this building gets what the user desires, up to a limit of 2 units per 1 needed ressource, - //thus if no ressources are needed, then no units will be working here. - int neededRessourcesSum = 0; - for (size_t ri = 0; ri < MAX_RESSOURCES; ri++) + //Otherwise, this building gets what the user desires, up to a limit of 2 units per 1 needed resource, + //thus if no resources are needed, then no units will be working here. + int neededResourcesSum = 0; + for (size_t ri = 0; ri < MAX_RESOURCES; ri++) { - int neededRessources = (type->maxRessource[ri] - ressources[ri]) / type->multiplierRessource[ri]; - if (neededRessources > 0) - neededRessourcesSum += neededRessources; + int neededResources = (type->maxResource[ri] - resources[ri]) / type->multiplierResource[ri]; + if (neededResources > 0) + neededResourcesSum += neededResources; } int user_num = maxUnitWorking; - int max_considering_ressources = (4 * neededRessourcesSum) / 3; - return std::min(user_num, max_considering_ressources); + int max_considering_resources = (4 * neededResourcesSum) / 3; + return std::min(user_num, max_considering_resources); } void Building::step(void) { - computeWishedRessources(); + computeWishedResources(); updateCallLists(); if(underAttackTimer>0) @@ -1460,7 +1460,7 @@ void Building::step(void) } -bool Building::subscribeToBringRessourcesStep() +bool Building::subscribeToBringResourcesStep() { for(int i=0; i>2 - (d+dr))*500+100/harvest + score_to_max=(rightRes*100/d+noRes*80/(d+dr)+wrongRes*25/(d+dr))/walk+sign(timeLeft>>2 - (d+dr))*500+100/harvest */ /* int maxValue=-INT_MAX; @@ -1511,11 +1511,11 @@ bool Building::subscribeToBringRessourcesStep() } int distUnitRessource; int nr; - for (nr=0; nr0) { - if(map->ressourceAvailable(owner->teamNumber, nr, unit->performance[SWIM], unit->posX, unit->posY, &distUnitRessource)) //to fill distUnitRessource + if(map->resourceAvailable(owner->teamNumber, nr, unit->performance[SWIM], unit->posX, unit->posY, &distUnitRessource)) //to fill distUnitRessource break; else continue; @@ -1527,9 +1527,9 @@ bool Building::subscribeToBringRessourcesStep() continue; } int rightRes=(((r>=0) && neededRessource(r))?1:0); - if(rightRes==1 && (unit->hungry-unit->trigHungry)/unit->race->hungryness/2hungry-unit->trigHungry)/unit->race->hungriness/2hungry-unit->trigHungry)/unit->race->hungryness/2<(dist+distUnitRessource)) + else if(rightRes!=1 && (unit->hungry-unit->trigHungry)/unit->race->hungriness/2<(dist+distUnitRessource)) continue; int noRes=(r<0?1:0); int wrongRes=(((r>=0) && !neededRessource(r))?1:0); @@ -1583,7 +1583,7 @@ bool Building::subscribeToBringRessourcesStep() else { int distBuilding=0; - int timeLeft=(unit->hungry-unit->trigHungry)/unit->race->hungryness; + int timeLeft=(unit->hungry-unit->trigHungry)/unit->race->hungriness; bool canSwim=unit->performance[SWIM]; if(!map->buildingAvailable(this, canSwim, unit->posX, unit->posY, &distBuilding)) { @@ -1595,12 +1595,12 @@ bool Building::subscribeToBringRessourcesStep() } else { - int unitr = unit->carriedRessource; - if((unitr>=0) && neededRessource(unitr)) + int unitR = unit->carriedResource; + if((unitR>=0) && neededResource(unitR)) { possibleUnits[n] = unit; distances[n] = distBuilding; - resource[n] = unitr; + resource[n] = unitR; } else { @@ -1612,9 +1612,9 @@ bool Building::subscribeToBringRessourcesStep() bool fruitFoundTooFar=false; int x=unit->posX; int y=unit->posY; - for(int r=0; r0) { if(rressourceAvailable(teamNumber, r, canSwim, x, y, &distResource)) + if (map->resourceAvailable(teamNumber, r, canSwim, x, y, &distResource)) { if(distResourcecarriedRessource; - int timeLeft=(unit->hungry-unit->trigHungry)/unit->race->hungryness; - if ((r>=0) && neededRessource(r)) + int r=unit->carriedResource; + int timeLeft=(unit->hungry-unit->trigHungry)/unit->race->hungriness; + if ((r>=0) && neededResource(r)) { int dist = distances[n]; int value=dist-(timeLeft>>1); @@ -1699,7 +1699,7 @@ bool Building::subscribeToBringRessourcesStep() } } - //Second: we look for an unit who is not carying a ressource: + //Second: we look for an unit who is not carrying a resource: if (choosen==NULL) { for(int n=0; ncarriedRessource<0) + if (unit->carriedResource<0) { int r = resource[n]; int value=distances[n]; @@ -1733,8 +1733,8 @@ bool Building::subscribeToBringRessourcesStep() if(unit==NULL) continue; - int r2=unit->carriedRessource; - if ((r2>=0) && !neededRessource(r2)) + int r2=unit->carriedResource; + if ((r2>=0) && !neededResource(r2)) { int r = resource[n]; int value=distances[n]; @@ -1831,11 +1831,11 @@ bool Building::subscribeForFlagingStep() else { int distBuilding=0; - int timeLeft=(unit->hungry-unit->trigHungry)/unit->race->hungryness; + int timeLeft=(unit->hungry-unit->trigHungry)/unit->race->hungriness; timeLeft*=timeLeft; - int directdist=owner->map->warpDistSquare(unit->posX, unit->posY, posX, posY); + int directDist=owner->map->warpDistSquare(unit->posX, unit->posY, posX, posY); bool canSwim=unit->performance[SWIM]; - if(type->zonable[EXPLORER] && timeLeft < directdist) + if(type->zonable[EXPLORER] && timeLeft < directDist) { unitsFailingRequirements[UnitTooFarFromBuilding] += 1; } @@ -1847,14 +1847,14 @@ bool Building::subscribeForFlagingStep() { unitsFailingRequirements[UnitTooFarFromBuilding] += 1; } - else if(type->zonable[WORKER] && anyRessourceToClear[canSwim]==2) + else if(type->zonable[WORKER] && anyResourceToClear[canSwim]==2) { unitsFailingRequirements[UnitCantAccessResource] += 1; } else { if(type->zonable[EXPLORER]) - distances[n]=directdist; + distances[n]=directDist; else distances[n]=distBuilding; possibleUnits[n]=unit; @@ -1881,7 +1881,7 @@ bool Building::subscribeForFlagingStep() if(unit==NULL) continue; - int timeLeft=unit->hungry/unit->race->hungryness; + int timeLeft=unit->hungry/unit->race->hungriness; int hp=(unit->hp<<4)/unit->race->unitTypes[0][0].performance[HP]; timeLeft*=timeLeft; hp*=hp; @@ -1906,11 +1906,11 @@ bool Building::subscribeForFlagingStep() if(unit==NULL) continue; - int timeLeft=unit->hungry/unit->race->hungryness; + int timeLeft=unit->hungry/unit->race->hungriness; int hp=(unit->hp<<4)/unit->race->unitTypes[0][0].performance[HP]; int dist = distances[n]; int value=dist-2*timeLeft-2*hp; - //We want to maximize the attack level, use higher level soldeirs first + //We want to maximize the attack level, use higher level soldiers first int level=unit->performance[ATTACK_SPEED]*unit->getRealAttackStrength(); if ((level > maxLevel) || (level==maxLevel && valuehungry-unit->trigHungry)/unit->race->hungryness; + int timeLeft=(unit->hungry-unit->trigHungry)/unit->race->hungriness; int hp=(unit->hp<<4)/unit->race->unitTypes[0][0].performance[HP]; int dist = distances[n]; int value=dist-timeLeft-hp; @@ -1978,7 +1978,7 @@ void Building::swarmStep(void) if (hphpMax) hp++; assert(NB_UNIT_TYPE==3); - if ((ressources[CORN]>=type->ressourceForOneUnit)&&(ratio[0]|ratio[1]|ratio[2])) + if ((resources[CORN]>=type->resourceForOneUnit)&&(ratio[0]|ratio[1]|ratio[2])) productionTimeout--; if (productionTimeout<0) @@ -2020,7 +2020,7 @@ void Building::swarmStep(void) Unit * u=owner->game->addUnit(posX, posY, owner->teamNumber, minType, 0, 0, dx, dy); if (u) { - ressources[CORN]-=type->ressourceForOneUnit; + resources[CORN]-=type->resourceForOneUnit; updateCallLists(); u->activity=Unit::ACT_RANDOM; @@ -2052,9 +2052,9 @@ void Building::swarmStep(void) void Building::turretStep(Uint32 stepCounter) { // create bullet from stones in stock - if (ressources[STONE]>0 && (bullets<=(type->maxBullets-type->multiplierStoneToBullets))) + if (resources[STONE]>0 && (bullets<=(type->maxBullets-type->multiplierStoneToBullets))) { - ressources[STONE]--; + resources[STONE]--; bullets += type->multiplierStoneToBullets; // we need to be stone-feeded @@ -2064,7 +2064,7 @@ void Building::turretStep(Uint32 stepCounter) // compute cooldown if (shootingCooldown > 0) { - shootingCooldown -= type->shootRythme; + shootingCooldown -= type->shootRhythm; return; } @@ -2170,20 +2170,20 @@ void Building::turretStep(Uint32 stepCounter) if (testUnit->typeNum == WARRIOR) { int targetOffense = (testUnit->getRealAttackStrength() * testUnit->performance[ATTACK_SPEED]); // 88 to 1024 - int targetWeakeness = 0; // 0 to 512 + int targetWeakness = 0; // 0 to 512 if (testUnit->hp > 0) { if (testUnit->hp < type->shootDamage) // hahaha, how mean! - targetWeakeness = 512; + targetWeakness = 512; else - targetWeakeness = 256 / testUnit->hp; + targetWeakness = 256 / testUnit->hp; } int targetProximity = 0; // 0 to 512 if (i <= 0) targetProximity = 512; else targetProximity = (256 / i); - int targetScore = targetOffense + targetWeakeness + targetProximity; + int targetScore = targetOffense + targetWeakness + targetProximity; // lower scores are overriden if (targetScore > bestScore) { @@ -2304,7 +2304,7 @@ void Building::turretStep(Uint32 stepCounter) assert(dpx); assert(dpy); - if (abs(dpx)>abs(dpy)) //we avoid a square root, since all ditances are squares lengthed. + if (abs(dpx)>abs(dpy)) //we avoid a square root, since all distances are squares length. { mdp=abs(dpx); speedX=((dpx*type->shootSpeed)/(mdp<<8)); @@ -2341,9 +2341,9 @@ void Building::clearingFlagStep() { if (unitsWorking.size()<(unsigned)maxUnitWorking) for (int canSwim=0; canSwim<2; canSwim++) - if (localRessourcesCleanTime[canSwim]++>125) // Update every 5[s] + if (localResourcesCleanTime[canSwim]++>125) // Update every 5[s] { - if (!owner->map->updateLocalRessources(this, canSwim)) + if (!owner->map->updateLocalResources(this, canSwim)) { for (std::list::iterator it=unitsWorking.begin(); it!=unitsWorking.end(); ++it) (*it)->standardRandomActivity(); @@ -2409,7 +2409,7 @@ void Building::kill(void) { bool good=false; for (int r=0; r0) + if (resources[r]>0) { good=true; break; @@ -2494,25 +2494,25 @@ void Building::removeUnitFromInside(Unit* unit) -void Building::updateRessourcesPointer() +void Building::updateResourcesPointer() { - if(!type->useTeamRessources) + if(!type->useTeamResources) { - ressources=localRessource; + resources=localResource; } else { - ressources=owner->teamRessources; + resources=owner->teamResources; } } -void Building::addRessourceIntoBuilding(int ressourceType) +void Building::addResourceIntoBuilding(int resourceType) { - ressources[ressourceType]+=type->multiplierRessource[ressourceType]; + resources[resourceType]+=type->multiplierResource[resourceType]; //You can not exceed the maximum amount - ressources[ressourceType] = std::min(ressources[ressourceType], type->maxRessource[ressourceType]); + resources[resourceType] = std::min(resources[resourceType], type->maxResource[resourceType]); switch (constructionResultState) { case NO_CONSTRUCTION: @@ -2527,10 +2527,10 @@ void Building::addRessourceIntoBuilding(int ressourceType) case REPAIR: { - int totRessources=0; - for (unsigned i=0; imaxRessource[i]; - hp += type->hpMax/totRessources; + int totResources=0; + for (unsigned i=0; imaxResource[i]; + hp += type->hpMax/totResources; hp = std::min(hp, type->hpMax); } break; @@ -2543,10 +2543,10 @@ void Building::addRessourceIntoBuilding(int ressourceType) -void Building::removeRessourceFromBuilding(int ressourceType) +void Building::removeResourceFromBuilding(int resourceType) { - ressources[ressourceType]-=type->multiplierRessource[ressourceType]; - ressources[ressourceType]= std::max(ressources[ressourceType], 0); + resources[resourceType]-=type->multiplierResource[resourceType]; + resources[resourceType]= std::max(resources[resourceType], 0); updateCallLists(); } @@ -2628,7 +2628,7 @@ void Building::checkGroundExitQuality( { if (owner->map->isFreeForGroundUnit(extraTestX, extraTestY, canSwim, me)) oldQuality++; - if (owner->map->isRessource(testX, testY-1)) + if (owner->map->isResource(testX, testY-1)) { if (exitQuality<1+oldQuality) { @@ -2703,16 +2703,16 @@ void Building::computeFlagStatLocal(int *goingTo, int *onSpot) Uint32 Building::eatOnce(Uint32 *mask) { - ressources[CORN]--; - assert(ressources[CORN]>=0); + resources[CORN]--; + assert(resources[CORN]>=0); Uint32 fruitMask=0; Uint32 fruitCount=0; for (int i=0; iinside) + if (resources[i + HAPPYNESS_BASE] >inside) happyness++; return happyness; } @@ -2739,7 +2739,7 @@ bool Building::canConvertUnit(void) assert(type->canFeedUnit); return canNotConvertUnitTimer<=0 && - ((int)unitsInside.size() *checkSumsVector) if (checkSumsVector) checkSumsVector->push_back(cs);// [14] - for (int i=0; ipush_back(cs);// [15] cs=(cs<<31)|(cs>>1); diff --git a/src/Building.h b/src/Building.h index 022083024..9c1193dec 100644 --- a/src/Building.h +++ b/src/Building.h @@ -83,24 +83,24 @@ class Building : public BuildingUtils void loadCrossRef(GAGCore::InputStream *stream, BuildingsTypes *types, Team *owner, Sint32 versionMinor); void saveCrossRef(GAGCore::OutputStream *stream); - bool isRessourceFull(void); - int neededRessource(void); + bool isResourceFull(void); + int neededResource(void); /** - * calls neededRessource(int res) for all possible ressources. + * calls neededResource(int res) for all possible resources. * @param array of needs that will be filled by this function */ - void neededRessources(int needs[MAX_NB_RESSOURCES]); - void wishedRessources(int needs[MAX_NB_RESSOURCES]); + void neededResources(int needs[MAX_NB_RESOURCES]); + void computedNeededResources(int needs[MAX_NB_RESOURCES]); /** * @param res The resource type * @return count of resources needed of type res. In case of higher multiplicity * of the requested resource (fruits have 10) the value is reduced by (multiplicity-1) * and clipped to >= 0 */ - int neededRessource(int res); - ///Wished ressources are any ressources that are needed, and not being carried by a unit already. - void computeWishedRessources(); - int totalWishedRessource(); + int neededResource(int res); + ///Wished resources are any resources that are needed, and not being carried by a unit already. + void computeWishedResources(); + int totalWishedResource(); ///Launches construction. Provided with the number of units that should be working during the construction, ///and the number of units that should be working after the construction is finished. @@ -117,11 +117,11 @@ class Building : public BuildingUtils ///of buildings in Team that need units for work, or can have units "inside" void updateCallLists(void); ///When a building is waiting for room, this will make sure that the building is in the - ///Team::buildingsTryToBuildingSiteRoom list. It will also check for hardspace, etc if - ///ressources grow into the space or a building is placed, it becomes impossible + ///Team::buildingsTryToBuildingSiteRoom list. It will also check for hard space, etc if + ///resources grow into the space or a building is placed, it becomes impossible ///to upgrade and the construction is cancelled. void updateConstructionState(void); - ///Updates the construction state when undergoing construction. If the ressources are full, + ///Updates the construction state when undergoing construction. If the resources are full, ///construction has completed. void updateBuildingSite(void); ///This function updates the units working at this building. If there are too many units, it @@ -140,14 +140,14 @@ public:void update(void); ///Sets the area around the building to be discovered, and visible by the building void setMapDiscovered(void); - ///Gets the amount of ressources for each type of ressource that are needed to repair the building. -public:void getRessourceCountToRepair(int ressources[BASIC_COUNT]); + ///Gets the amount of resources for each type of resource that are needed to repair the building. +public:void getResourceCountToRepair(int resources[BASIC_COUNT]); ///Attempts to find room for a building site. If room is found, the building site is established, ///and it returns true. bool tryToBuildingSiteRoom(void); - ///This function puts hidden forbidden area around a new building site. This dispereses units so that + ///This function puts hidden forbidden area around a new building site. This disperses units so that ///the building isn't waiting for space when there are lots of units. private:void addForbiddenZoneToUpgradeArea(void); ///This function removes the hidden forbidden area placed by addForbiddenToUpgradeArea @@ -165,17 +165,17 @@ public:bool isHardSpaceForBuildingSite(ConstructionResultState constructionResul private:bool fullInside(void); ///This function tells the number of workers that should be working at this building. - ///If, for example, the building doesn't need any ressources, then this function will + ///If, for example, the building doesn't need any resources, then this function will ///return 0, because if its already full, it doesn't need any units. int desiredNumberOfWorkers(void); ///This is called every step. The building updates the desiredMaxUnitWorking variable using ///the function desiredNumberOfWorkers public:void step(void); - ///This function subscribes any building that needs ressources carried to it with units. + ///This function subscribes any building that needs resources carried to it with units. ///It is considered greedy, hiring as many units as it needs in order of its preference ///Returns true if a unit was hired - bool subscribeToBringRessourcesStep(void); + bool subscribeToBringResourcesStep(void); ///This function subscribes any flag that needs units for a with units. ///It is considered greedy, hiring as many units as it needs in order of its preference ///Returns true if a unit was hired @@ -186,8 +186,8 @@ public:void step(void); void swarmStep(void); /// This function searches for enemies, computes the best target, and fires a bullet void turretStep(Uint32 stepCounter); - /// This step updates clearing flag gradients. When there are no more ressources remaining, units are to - /// be fired. When ressources grow back, units have to be rehired.= + /// This step updates clearing flag gradients. When there are no more resources remaining, units are to + /// be fired. When resources grow back, units have to be rehired.= void clearingFlagStep(); /// Kills the building, removing all units that are working or inside the building, /// changing the state and adding it to the list of buildings to be deleted @@ -215,31 +215,31 @@ public:void removeUnitFromWorking(Unit* unit); /// it does not update the units state. void removeUnitFromInside(Unit* unit); - /// This function updates the ressources pointer. The variable ressources can either point to local ressources + /// This function updates the resources pointer. The variable resources can either point to local resources /// or team resources, depending on the BuildingType. -private:void updateRessourcesPointer(); +private:void updateResourcesPointer(); - /// This function is called when a Unit places a ressource into the building. -public:void addRessourceIntoBuilding(int ressourceType); + /// This function is called when a Unit places a resource into the building. +public:void addResourceIntoBuilding(int resourceType); - /// This function is called when a Unit takes a ressource from a building, such as a market - void removeRessourceFromBuilding(int ressourceType); + /// This function is called when a Unit takes a resource from a building, such as a market + void removeResourceFromBuilding(int resourceType); - ///Gets the middle x cordinate relative to posX + ///Gets the middle x coordinate relative to posX int getMidX(void); - ///Gets the middle y cordinate relative to posY + ///Gets the middle y coordinate relative to posY int getMidY(void); /// When a unit leaves a building, this function will find an open spot for that unit to leave, - /// and provides the x and y coordinates, along with the direction the unit should be travelling + /// and provides the x and y coordinates, along with the direction the unit should be traveling /// when it leaves. bool findGroundExit(int *posX, int *posY, int *dx, int *dy, bool canSwim); /// When a unit leaves a building, this function will find an open spot for that unit to leave, - /// and provides the x and y coordinates, along with the direction the unit should be travelling + /// and provides the x and y coordinates, along with the direction the unit should be traveling /// when it leaves. bool findAirExit(int *posX, int *posY, int *dx, int *dy); private: - /// checkstyle found this block of 26 lines being repeated 4 times. + /// check style found this block of 26 lines being repeated 4 times. void checkGroundExitQuality( const int testX, const int testY, @@ -298,7 +298,7 @@ private:Sint32 maxUnitWorkingPrevious; public:Sint32 desiredMaxUnitWorking; ///This is the list of units actively working on the building. std::list unitsWorking; - ///The subscribeToBringRessourcesStep and subscribeForFlagingStep operate every 32 ticks + ///The subscribeToBringResourcesStep and subscribeForFlagingStep operate every 32 ticks private:Sint32 subscriptionWorkingTimer; public:Sint32 maxUnitInside; ///This counts the number of units that failed the requirements for the building, but where free @@ -336,21 +336,21 @@ private:std::list unitsHarvesting; Uint8 underAttackTimer; - // Flag usefull : + // Flag useful : Sint32 unitStayRange; // (Uint8) Sint32 unitStayRangeLocal; - bool clearingRessources[BASIC_COUNT]; // true if the ressource has to be cleared. - bool clearingRessourcesLocal[BASIC_COUNT]; + bool clearingResources[BASIC_COUNT]; // true if the resource has to be cleared. + bool clearingResourcesLocal[BASIC_COUNT]; Sint32 minLevelToFlag; Sint32 minLevelToFlagLocal; // Building specific : - /// Amount stocked, or used for building building. Local ressources stores the ressources this particular building contains - /// in the event that the building type designates using global ressources instead of local ressources, the ressources pointer - /// will be changed to point to the global ressources Team::teamRessources instead of localRessources. - Sint32* ressources; - Sint32 wishedResources[MAX_NB_RESSOURCES]; -private:Sint32 localRessource[MAX_NB_RESSOURCES]; + /// Amount stocked, or used for building building. Local resources stores the resources this particular building contains + /// in the event that the building type designates using global resources instead of local resources, the resources pointer + /// will be changed to point to the global resources Team::teamResources instead of localResources. + Sint32* resources; + Sint32 wishedResources[MAX_NB_RESOURCES]; +private:Sint32 localResource[MAX_NB_RESOURCES]; // quality parameters public:Sint32 hp; // (Uint16) @@ -363,10 +363,10 @@ public:Sint32 ratio[NB_UNIT_TYPE]; private:Sint32 percentUsed[NB_UNIT_TYPE]; // exchange building parameters -public:Uint32 receiveRessourceMask; - Uint32 sendRessourceMask; - Uint32 receiveRessourceMaskLocal; - Uint32 sendRessourceMaskLocal; +public:Uint32 receiveResourceMask; + Uint32 sendResourceMask; + Uint32 receiveResourceMaskLocal; + Uint32 sendResourceMaskLocal; // turrets building parameters private:Uint32 shootingStep; @@ -382,9 +382,9 @@ public:Sint32 bullets; bool locked[2]; //True if the building is not reachable. Uint32 lastGlobalGradientUpdateStepCounter[2]; - Uint8 *localRessources[2]; - int localRessourcesCleanTime[2]; // The time since the localRessources[x] has not been updated. - int anyRessourceToClear[2]; // Which localRessources[x] gradient has any ressource. {0: unknow, 1:true, 2:false} + Uint8 *localResources[2]; + int localResourcesCleanTime[2]; // The time since the localResources[x] has not been updated. + int anyResourceToClear[2]; // Which localResources[x] gradient has any resource. {0: unknow, 1:true, 2:false} // shooting eye-candy data, not net synchronised Uint32 lastShootStep; diff --git a/src/BuildingType.cpp b/src/BuildingType.cpp index 13c8b68a6..14e952e5c 100644 --- a/src/BuildingType.cpp +++ b/src/BuildingType.cpp @@ -94,55 +94,55 @@ void BuildingType::loadFromConfigFile(const ConfigBlock *configBlock) configBlock->load(timeToHealUnit, "timeToHealUnit"); configBlock->load(insideSpeed, "insideSpeed"); configBlock->load(canExchange, "canExchange"); - configBlock->load(useTeamRessources, "useTeamRessources"); + configBlock->load(useTeamResources, "useTeamRessources"); configBlock->load(width, "width"); configBlock->load(height, "height"); configBlock->load(decLeft, "decLeft"); configBlock->load(decTop, "decTop"); configBlock->load(isVirtual, "isVirtual"); - configBlock->load(isCloacked, "isCloacked"); + configBlock->load(isCloaked, "isCloacked"); configBlock->load(shootingRange, "shootingRange"); configBlock->load(shootDamage, "shootDamage"); configBlock->load(shootSpeed, "shootSpeed"); - configBlock->load(shootRythme, "shootRythme"); + configBlock->load(shootRhythm, "shootRhythm"); configBlock->load(maxBullets, "maxBullets"); configBlock->load(multiplierStoneToBullets, "multiplierStoneToBullets"); configBlock->load(unitProductionTime, "unitProductionTime"); - configBlock->load(ressourceForOneUnit, "ressourceForOneUnit"); + configBlock->load(resourceForOneUnit, "ressourceForOneUnit"); - assert(MAX_NB_RESSOURCES == 15); - configBlock->load(maxRessource[0], "maxWood"); - configBlock->load(maxRessource[1], "maxCorn"); - configBlock->load(maxRessource[2], "maxPapyrus"); - configBlock->load(maxRessource[3], "maxStone"); - configBlock->load(maxRessource[4], "maxAlgue"); - configBlock->load(maxRessource[5], "maxFruit0"); - configBlock->load(maxRessource[6], "maxFruit1"); - configBlock->load(maxRessource[7], "maxFruit2"); - configBlock->load(maxRessource[8], "maxFruit3"); - configBlock->load(maxRessource[9], "maxFruit4"); - configBlock->load(maxRessource[10], "maxFruit5"); - configBlock->load(maxRessource[11], "maxFruit6"); - configBlock->load(maxRessource[12], "maxFruit7"); - configBlock->load(maxRessource[13], "maxFruit8"); - configBlock->load(maxRessource[14], "maxFruit9"); - configBlock->load(multiplierRessource[0], "multiplierWood"); - configBlock->load(multiplierRessource[1], "multiplierCorn"); - configBlock->load(multiplierRessource[2], "multiplierPapyrus"); - configBlock->load(multiplierRessource[3], "multiplierStone"); - configBlock->load(multiplierRessource[4], "multiplierAlgue"); - configBlock->load(multiplierRessource[5], "multiplierFruit0"); - configBlock->load(multiplierRessource[6], "multiplierFruit1"); - configBlock->load(multiplierRessource[7], "multiplierFruit2"); - configBlock->load(multiplierRessource[8], "multiplierFruit3"); - configBlock->load(multiplierRessource[9], "multiplierFruit4"); - configBlock->load(multiplierRessource[10], "multiplierFruit5"); - configBlock->load(multiplierRessource[11], "multiplierFruit6"); - configBlock->load(multiplierRessource[12], "multiplierFruit7"); - configBlock->load(multiplierRessource[13], "multiplierFruit8"); - configBlock->load(multiplierRessource[14], "multiplierFruit9"); + assert(MAX_NB_RESOURCES == 15); + configBlock->load(maxResource[0], "maxWood"); + configBlock->load(maxResource[1], "maxCorn"); + configBlock->load(maxResource[2], "maxPapyrus"); + configBlock->load(maxResource[3], "maxStone"); + configBlock->load(maxResource[4], "maxAlgue"); + configBlock->load(maxResource[5], "maxFruit0"); + configBlock->load(maxResource[6], "maxFruit1"); + configBlock->load(maxResource[7], "maxFruit2"); + configBlock->load(maxResource[8], "maxFruit3"); + configBlock->load(maxResource[9], "maxFruit4"); + configBlock->load(maxResource[10], "maxFruit5"); + configBlock->load(maxResource[11], "maxFruit6"); + configBlock->load(maxResource[12], "maxFruit7"); + configBlock->load(maxResource[13], "maxFruit8"); + configBlock->load(maxResource[14], "maxFruit9"); + configBlock->load(multiplierResource[0], "multiplierWood"); + configBlock->load(multiplierResource[1], "multiplierCorn"); + configBlock->load(multiplierResource[2], "multiplierPapyrus"); + configBlock->load(multiplierResource[3], "multiplierStone"); + configBlock->load(multiplierResource[4], "multiplierAlgue"); + configBlock->load(multiplierResource[5], "multiplierFruit0"); + configBlock->load(multiplierResource[6], "multiplierFruit1"); + configBlock->load(multiplierResource[7], "multiplierFruit2"); + configBlock->load(multiplierResource[8], "multiplierFruit3"); + configBlock->load(multiplierResource[9], "multiplierFruit4"); + configBlock->load(multiplierResource[10], "multiplierFruit5"); + configBlock->load(multiplierResource[11], "multiplierFruit6"); + configBlock->load(multiplierResource[12], "multiplierFruit7"); + configBlock->load(multiplierResource[13], "multiplierFruit8"); + configBlock->load(multiplierResource[14], "multiplierFruit9"); configBlock->load(maxUnitInside, "maxUnitInside"); configBlock->load(maxUnitWorking, "maxUnitWorking"); @@ -210,7 +210,7 @@ Uint32 BuildingType::checkSum(void) cs = (cs<<1) | (cs>>31); cs ^= canExchange; cs = (cs<<1) | (cs>>31); - cs ^= useTeamRessources; + cs ^= useTeamResources; cs = (cs<<1) | (cs>>31); cs ^= width; cs = (cs<<1) | (cs>>31); @@ -222,7 +222,7 @@ Uint32 BuildingType::checkSum(void) cs = (cs<<1) | (cs>>31); cs ^= isVirtual; cs = (cs<<1) | (cs>>31); - cs ^= isCloacked; + cs ^= isCloaked; cs = (cs<<1) | (cs>>31); cs ^= shootingRange; cs = (cs<<1) | (cs>>31); @@ -230,7 +230,7 @@ Uint32 BuildingType::checkSum(void) cs = (cs<<1) | (cs>>31); cs ^= shootSpeed; cs = (cs<<1) | (cs>>31); - cs ^= shootRythme; + cs ^= shootRhythm; cs = (cs<<1) | (cs>>31); cs ^= maxBullets; cs = (cs<<1) | (cs>>31); @@ -238,16 +238,16 @@ Uint32 BuildingType::checkSum(void) cs = (cs<<1) | (cs>>31); cs ^= unitProductionTime; cs = (cs<<1) | (cs>>31); - cs ^= ressourceForOneUnit; + cs ^= resourceForOneUnit; cs = (cs<<1) | (cs>>31); - for (size_t i = 0; i<(size_t)MAX_NB_RESSOURCES; i++) + for (size_t i = 0; i<(size_t)MAX_NB_RESOURCES; i++) { - cs ^= maxRessource[i]; + cs ^= maxResource[i]; cs = (cs<<1) | (cs>>31); } - for (size_t i = 0; i<(size_t)MAX_NB_RESSOURCES; i++) + for (size_t i = 0; i<(size_t)MAX_NB_RESOURCES; i++) { - cs ^= multiplierRessource[i]; + cs ^= multiplierResource[i]; cs = (cs<<1) | (cs>>31); } cs ^= maxUnitInside; diff --git a/src/BuildingType.h b/src/BuildingType.h index 0c701584d..92d22e4d4 100644 --- a/src/BuildingType.h +++ b/src/BuildingType.h @@ -43,11 +43,11 @@ class BuildingType: public LoadableFromConfigFile Sint32 flagImage; Sint32 crossConnectMultiImage; // If true, mean we have a wall-like building - // could be Uint8, if non 0 tell the number of maximum units locked by bulding for: + // could be Uint8, if non 0 tell the number of maximum units locked by building for: // by order of priority (top = max) Sint32 upgrade[NB_ABILITY]; // What kind on units can be upgraded here Sint32 upgradeTime[NB_ABILITY]; // Time to upgrade an unit, given the upgrade type needed. - Sint32 upgradeInParallel; // if true, can learn all upgardes with one learning time into the building + Sint32 upgradeInParallel; // if true, can learn all upgrades with one learning time into the building Sint32 foodable; Sint32 fillable; Sint32 zonable[NB_UNIT_TYPE]; // If an unit is required for a presence. @@ -59,27 +59,27 @@ class BuildingType: public LoadableFromConfigFile Sint32 timeToHealUnit; Sint32 insideSpeed; Sint32 canExchange; - Sint32 useTeamRessources; + Sint32 useTeamResources; Sint32 width, height; // Uint8, size in square Sint32 decLeft, decTop; Sint32 isVirtual; // bool, doesn't occupy ground occupation map, used for war-flag and exploration-flag. - Sint32 isCloacked; // bool, graphicaly invisible for enemy. - //Sint32 *walkOverMap; // should be allocated and deleted in a cleany way + Sint32 isCloaked; // bool, graphically invisible for enemy. + //Sint32 *walkOverMap; // should be allocated and deleted in a clean way //Sint32 walkableOver; // bool, can walk over Sint32 shootingRange; // Uint8, if 0 can't shoot Sint32 shootDamage; // Uint8 Sint32 shootSpeed; // Uint8, the actual speed at which the shots fly through the air. - Sint32 shootRythme; // Uint8, The frequency with which a tower fires. It fires once every - // SHOOTING_COOLDOWN_MAX/shootRythme ticks. + Sint32 shootRhythm; // Uint8, The frequency with which a tower fires. It fires once every + // SHOOTING_COOLDOWN_MAX/shootRhythm ticks. Sint32 maxBullets; Sint32 multiplierStoneToBullets; //The tower gets this many bullets every time a worker delivers stone to it. Sint32 unitProductionTime; // Uint8, nb tick to produce one unit - Sint32 ressourceForOneUnit; // The amount of wheat consumed in the production of a unit. + Sint32 resourceForOneUnit; // The amount of wheat consumed in the production of a unit. - Sint32 maxRessource[MAX_NB_RESSOURCES]; - Sint32 multiplierRessource[MAX_NB_RESSOURCES]; + Sint32 maxResource[MAX_NB_RESOURCES]; + Sint32 multiplierResource[MAX_NB_RESOURCES]; Sint32 maxUnitInside; Sint32 maxUnitWorking; @@ -95,7 +95,7 @@ class BuildingType: public LoadableFromConfigFile Sint32 shortTypeNum; // BuildingTypeShortNumber, Should not be used by the main engine, but only to choose the next level building. Sint32 isBuildingSite; - // Flag usefull + // Flag useful Sint32 defaultUnitStayRange; Sint32 maxUnitStayRange; diff --git a/src/BuildingsTypes.cpp b/src/BuildingsTypes.cpp index 81726ee63..eaa58a100 100644 --- a/src/BuildingsTypes.cpp +++ b/src/BuildingsTypes.cpp @@ -41,10 +41,10 @@ void BuildingsTypes::checkIntegrity(void) BuildingType *bt = entries[i]; assert(bt); - //Need ressource integrity: + //Need resource integrity: bool needRessource=false; - for (unsigned j=0; jmaxRessource[j]) + for (unsigned j=0; jmaxResource[j]) { needRessource=true; break; @@ -78,8 +78,8 @@ void BuildingsTypes::checkIntegrity(void) if (bt->isBuildingSite) { int resSum=0; - for (int i=0; imaxRessource[i]; + for (int i=0; imaxResource[i]; int hpSum = bt->hpInit+resSum*bt->hpInc; if (hpSum < bt->hpMax) { @@ -91,22 +91,22 @@ void BuildingsTypes::checkIntegrity(void) //flag integrity: if (bt->isVirtual) { - assert(bt->isCloacked); + assert(bt->isCloaked); assert(bt->defaultUnitStayRange); } - if (bt->isCloacked) + if (bt->isCloaked) { assert(bt->isVirtual); assert(bt->defaultUnitStayRange); } if (bt->defaultUnitStayRange) { - assert(bt->isCloacked); + assert(bt->isCloaked); assert(bt->isVirtual); } if (bt->zonableForbidden) { - assert(bt->isCloacked); + assert(bt->isCloaked); assert(bt->isVirtual); assert(bt->defaultUnitStayRange); } diff --git a/src/ChooseMapScreen.cpp b/src/ChooseMapScreen.cpp index e028d3c82..3c0a5ca0f 100644 --- a/src/ChooseMapScreen.cpp +++ b/src/ChooseMapScreen.cpp @@ -274,11 +274,11 @@ void ChooseMapScreen::updateMapInformation() // update map name & info mapName->setText(mapHeader.getMapName()); std::string textTemp; - textTemp = FormatableString("%0%1").arg(mapHeader.getNumberOfTeams()).arg(Toolkit::getStringTable()->getString("[teams]")); + textTemp = FormattableString("%0%1").arg(mapHeader.getNumberOfTeams()).arg(Toolkit::getStringTable()->getString("[teams]")); mapInfo->setText(textTemp); - textTemp = FormatableString("%0 %1.%2").arg(Toolkit::getStringTable()->getString("[Version]")).arg(mapHeader.getVersionMajor()).arg(mapHeader.getVersionMinor()); + textTemp = FormattableString("%0 %1.%2").arg(Toolkit::getStringTable()->getString("[Version]")).arg(mapHeader.getVersionMajor()).arg(mapHeader.getVersionMinor()); mapVersion->setText(textTemp); - textTemp = FormatableString("%0 x %1").arg(mapPreview->getLastWidth()).arg(mapPreview->getLastHeight()); + textTemp = FormattableString("%0 x %1").arg(mapPreview->getLastWidth()).arg(mapPreview->getLastHeight()); mapSize->setText(textTemp); // call subclass handler diff --git a/src/CustomGameScreen.cpp b/src/CustomGameScreen.cpp index a1db372cc..2a9d92889 100644 --- a/src/CustomGameScreen.cpp +++ b/src/CustomGameScreen.cpp @@ -214,7 +214,7 @@ void CustomGameScreen::updatePlayers() else { AI::ImplementitionID iid=getAiImplementation(i); - FormatableString name("%0 %1"); + FormattableString name("%0 %1"); name.arg(AINames::getAIText(iid)).arg(i-1); gameHeader.getBasePlayer(count) = BasePlayer(i, name.c_str(), teamColor, Player::playerTypeFromImplementitionID(iid)); if(teamColor != humanColor) diff --git a/src/EndGameScreen.cpp b/src/EndGameScreen.cpp index cbde4b3ad..932f7bc9f 100644 --- a/src/EndGameScreen.cpp +++ b/src/EndGameScreen.cpp @@ -354,7 +354,7 @@ EndGameScreen::EndGameScreen(GameGUI *gui) } else { - FormatableString strText; + FormattableString strText; if ((t->allies) & (gui->getLocalTeam()->me)) strText = Toolkit::getStringTable()->getString("[Won : your ally %0 has the most prestige]"); else diff --git a/src/Engine.cpp b/src/Engine.cpp index ed1835370..3bb761263 100644 --- a/src/Engine.cpp +++ b/src/Engine.cpp @@ -270,7 +270,7 @@ int Engine::run(void) std::vector musicDirs; while (!(filename = globalContainer->fileManager->getNextDirectoryEntry()).empty()) { - if (globalContainer->fileManager->isDir(FormatableString("%0/%1").arg("data/zik/").arg(filename))) + if (globalContainer->fileManager->isDir(FormattableString("%0/%1").arg("data/zik/").arg(filename))) { std::cerr << "music dir found: " << filename << std::endl; musicDirs.push_back(filename); @@ -284,9 +284,9 @@ int Engine::run(void) size_t musicIndex(rand() % musicDirs.size()); const std::string& musicDir(musicDirs[musicIndex]); std::cerr << "selecting music dir " << musicDir << std::endl; - globalContainer->mix->loadTrack(FormatableString("data/zik/%0/a1.ogg").arg(musicDir), 2); - globalContainer->mix->loadTrack(FormatableString("data/zik/%0/a2.ogg").arg(musicDir), 3); - globalContainer->mix->loadTrack(FormatableString("data/zik/%0/a3.ogg").arg(musicDir), 4); + globalContainer->mix->loadTrack(FormattableString("data/zik/%0/a1.ogg").arg(musicDir), 2); + globalContainer->mix->loadTrack(FormattableString("data/zik/%0/a2.ogg").arg(musicDir), 3); + globalContainer->mix->loadTrack(FormattableString("data/zik/%0/a3.ogg").arg(musicDir), 4); } else { @@ -516,7 +516,7 @@ int Engine::run(void) !(globalContainer->gfx->getOptionFlags() & GraphicContext::USEGPU) ) { - FormatableString fileName = FormatableString("videoshots/%0.%1.bmp").arg(globalContainer->videoshotName).arg(frameNumber++, 10, 10, '0'); + FormattableString fileName = FormattableString("videoshots/%0.%1.bmp").arg(globalContainer->videoshotName).arg(frameNumber++, 10, 10, '0'); printf("printing video shot %s\n", fileName.c_str()); globalContainer->gfx->printScreen(fileName.c_str()); } @@ -787,13 +787,13 @@ GameHeader Engine::prepareCampaign(MapHeader& mapHeader, int& localPlayer, int& { localPlayer = playerNumber; localTeam = i; - std::string name = FormatableString("Player %0").arg(playerNumber); + std::string name = FormattableString("Player %0").arg(playerNumber); gameHeader.getBasePlayer(i) = BasePlayer(playerNumber, name.c_str(), i, BasePlayer::P_LOCAL); wasHuman=true; } else if (mapHeader.getBaseTeam(i).type==BaseTeam::T_AI || wasHuman) { - std::string name = FormatableString("AI Player %0").arg(playerNumber); + std::string name = FormattableString("AI Player %0").arg(playerNumber); gameHeader.getBasePlayer(i) = BasePlayer(playerNumber, name.c_str(), i, BasePlayer::P_AI); } playerNumber+=1; @@ -876,7 +876,7 @@ GameHeader Engine::createRandomGame(int numberOfTeams) else { AI::ImplementitionID iid=static_cast(syncRand() % 5 + 1); - FormatableString name("%0 %1"); + FormattableString name("%0 %1"); name.arg(AINames::getAIText(iid)).arg(i-1); gameHeader.getBasePlayer(count) = BasePlayer(i, name.c_str(), teamColor, Player::playerTypeFromImplementitionID(iid)); } diff --git a/src/FertilityCalculatorThread.cpp b/src/FertilityCalculatorThread.cpp index 5e62cc4d0..b44b34734 100644 --- a/src/FertilityCalculatorThread.cpp +++ b/src/FertilityCalculatorThread.cpp @@ -68,7 +68,7 @@ void FertilityCalculatorThread::operator()() { for(int y=0; y order, int localPlayer) for (int x=posX; xteamNumber == players[localPlayer]->teamNumber) map.localForbiddenMap.set(index, true); } @@ -318,12 +318,12 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) if ((b) && (b->buildingState==Building::ALIVE)) { fprintf(logFile, "ORDER_MODIFY_EXCHANGE"); - b->receiveRessourceMask=ome->receiveRessourceMask; - b->sendRessourceMask=ome->sendRessourceMask; + b->receiveResourceMask=ome->receiveRessourceMask; + b->sendResourceMask=ome->sendRessourceMask; if (order->sender!=localPlayer) { - b->receiveRessourceMaskLocal=b->receiveRessourceMask; - b->sendRessourceMaskLocal=b->sendRessourceMask; + b->receiveResourceMaskLocal=b->receiveResourceMask; + b->sendResourceMaskLocal=b->sendResourceMask; } b->update(); } @@ -366,10 +366,10 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) delete b->globalGradient[i]; b->globalGradient[i]=NULL; } - if (b->localRessources[i]) + if (b->localResources[i]) { - delete b->localRessources[i]; - b->localRessources[i]=NULL; + delete b->localResources[i]; + b->localResources[i]=NULL; } } } @@ -391,9 +391,9 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) && b->type->zonable[WORKER]) { fprintf(logFile, "ORDER_MODIFY_CLEARING_FLAG"); - memcpy(b->clearingRessources, omcf->clearingRessources, sizeof(bool)*BASIC_COUNT); + memcpy(b->clearingResources, omcf->clearingRessources, sizeof(bool)*BASIC_COUNT); if (order->sender!=localPlayer) - memcpy(b->clearingRessourcesLocal, omcf->clearingRessources, sizeof(bool)*BASIC_COUNT); + memcpy(b->clearingResourcesLocal, omcf->clearingRessources, sizeof(bool)*BASIC_COUNT); } } break; @@ -463,10 +463,10 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) delete[] b->globalGradient[i]; b->globalGradient[i]=NULL; } - if (b->localRessources[i]) + if (b->localResources[i]) { - delete b->localRessources[i]; - b->localRessources[i]=NULL; + delete b->localResources[i]; + b->localResources[i]=NULL; } } } @@ -494,7 +494,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { size_t index = (x&map.wMask)+(((y&map.hMask)<teamNumber == players[localPlayer]->teamNumber) map.localForbiddenMap.set(index, true); @@ -513,7 +513,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { size_t index = (x&map.wMask)+(((y&map.hMask)<teamNumber == players[localPlayer]->teamNumber) map.localForbiddenMap.set(index, false); @@ -547,7 +547,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { size_t index = (x&map.wMask)+(((y&map.hMask)<teamNumber == players[localPlayer]->teamNumber) map.localGuardAreaMap.set(index, true); @@ -566,7 +566,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { size_t index = (x&map.wMask)+(((y&map.hMask)<teamNumber == players[localPlayer]->teamNumber) map.localGuardAreaMap.set(index, false); @@ -594,7 +594,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { size_t index = (x&map.wMask)+(((y&map.hMask)<teamNumber == players[localPlayer]->teamNumber) map.localClearAreaMap.set(index, true); @@ -613,7 +613,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { size_t index = (x&map.wMask)+(((y&map.hMask)<teamNumber == players[localPlayer]->teamNumber) map.localClearAreaMap.set(index, false); @@ -952,7 +952,7 @@ bool Game::load(GAGCore::InputStream *stream) stream->readText("campaignText"); // default prestige calculation - prestigeToReach = std::max(MIN_MAX_PRESIGE, mapHeader.getNumberOfTeams()*TEAM_MAX_PRESTIGE); + prestigeToReach = std::max(MIN_MAX_PRESTIGE, mapHeader.getNumberOfTeams()*TEAM_MAX_PRESTIGE); if(mapHeader.getVersionMinor() >= 75) { @@ -998,7 +998,7 @@ void Game::integrity(void) for (int y=0; ysetCorrectColor( ((float)i*360.0f) /(float)pos ); - prestigeToReach = std::max(MIN_MAX_PRESIGE, pos*TEAM_MAX_PRESTIGE); + prestigeToReach = std::max(MIN_MAX_PRESTIGE, pos*TEAM_MAX_PRESTIGE); map.addTeam(); @@ -1816,20 +1816,20 @@ void Game::drawUnit(int x, int y, Uint16 gid, int viewportX, int viewportY, int { if (globalContainer->settings.optionFlags & GlobalContainer::OPTION_LOW_SPEED_GFX) { - globalContainer->gfx->drawSprite(px+16-(globalContainer->magiceffect->getW(0)>>1), py+16-(globalContainer->magiceffect->getH(0)>>1), globalContainer->magiceffect, 0); + globalContainer->gfx->drawSprite(px+16-(globalContainer->magicEffect->getW(0)>>1), py+16-(globalContainer->magicEffect->getH(0)>>1), globalContainer->magicEffect, 0); } else { unsigned alpha = (unit->magicActionAnimation * 255) / MAGIC_ACTION_ANIMATION_FRAME_COUNT; if (globalContainer->gfx->canDrawStretchedSprite()) { - int stretchW = ((MAGIC_ACTION_ANIMATION_FRAME_COUNT - unit->magicActionAnimation) * globalContainer->magiceffect->getW(0)) / (MAGIC_ACTION_ANIMATION_FRAME_COUNT * 2); - int stretchH = ((MAGIC_ACTION_ANIMATION_FRAME_COUNT - unit->magicActionAnimation) * globalContainer->magiceffect->getH(0)) / (MAGIC_ACTION_ANIMATION_FRAME_COUNT * 2); - globalContainer->gfx->drawSprite(px+16-stretchW, py+16-stretchH, stretchW*2, stretchH*2, globalContainer->magiceffect, 0, alpha); + int stretchW = ((MAGIC_ACTION_ANIMATION_FRAME_COUNT - unit->magicActionAnimation) * globalContainer->magicEffect->getW(0)) / (MAGIC_ACTION_ANIMATION_FRAME_COUNT * 2); + int stretchH = ((MAGIC_ACTION_ANIMATION_FRAME_COUNT - unit->magicActionAnimation) * globalContainer->magicEffect->getH(0)) / (MAGIC_ACTION_ANIMATION_FRAME_COUNT * 2); + globalContainer->gfx->drawSprite(px+16-stretchW, py+16-stretchH, stretchW*2, stretchH*2, globalContainer->magicEffect, 0, alpha); } else { - globalContainer->gfx->drawSprite(px+16-(globalContainer->magiceffect->getW(0)>>1), py+16-(globalContainer->magiceffect->getH(0)>>1), globalContainer->magiceffect, 0, alpha); + globalContainer->gfx->drawSprite(px+16-(globalContainer->magicEffect->getW(0)>>1), py+16-(globalContainer->magicEffect->getH(0)>>1), globalContainer->magicEffect, 0, alpha); } } } @@ -1849,8 +1849,8 @@ void Game::drawUnit(int x, int y, Uint16 gid, int viewportX, int viewportY, int else drawPointBar(px+1, py+25+3, LEFT_TO_RIGHT, 10, 1+(int)(9*hpRatio), 255, 0, 0); - if ((unit->performance[HARVEST]) && (unit->carriedRessource>=0)) - globalContainer->gfx->drawSprite(px+24, py, globalContainer->ressourceMini, unit->carriedRessource); + if ((unit->performance[HARVEST]) && (unit->carriedResource>=0)) + globalContainer->gfx->drawSprite(px+24, py, globalContainer->resourceMini, unit->carriedResource); } if (drawOptions & DRAW_ACCESSIBILITY) @@ -1867,7 +1867,7 @@ void Game::drawUnit(int x, int y, Uint16 gid, int viewportX, int viewportY, int } if(highlightUnitType & (1<typeNum)) { - globalContainer->gfx->drawSprite(px, py-decY-32, globalContainer->gamegui, 36); + globalContainer->gfx->drawSprite(px, py-decY-32, globalContainer->gameGui, 36); } } @@ -1918,7 +1918,7 @@ inline void Game::drawMapTerrain(int left, int top, int right, int bot, int view else { assert(false); // Now there shouldn't be any more ressources on "terrain". - sprite=globalContainer->ressources; + sprite=globalContainer->resources; id-=272; } if ((id < 256) || (id >= 256+16)) @@ -1942,21 +1942,21 @@ inline void Game::drawMapRessources(int left, int top, int right, int bot, int v visibleTeams) || ((drawOptions & DRAW_WHOLE_MAP) != 0)) { - const auto& r = map.getRessource(x+viewportX, y+viewportY); + const auto& r = map.getResource(x+viewportX, y+viewportY); if (r.type!=NO_RES_TYPE) { - Sprite *sprite=globalContainer->ressources; + Sprite *sprite=globalContainer->resources; int type=r.type; int amount=r.amount; int variety=r.variety; - const RessourceType *rt=globalContainer->ressourcesTypes.get(type); + const ResourceType *rt=globalContainer->resourcesTypes.get(type); int imgid=rt->gfxId+(variety*rt->sizesCount)+amount; if (!rt->eternal) imgid--; int dx=(sprite->getW(imgid)-32)>>1; int dy=(sprite->getH(imgid)-32)>>1; assert(type>=0); - assert(type<(int)globalContainer->ressourcesTypes.size()); + assert(type<(int)globalContainer->resourcesTypes.size()); assert(amount>=0); assert(amount<=rt->sizesCount); assert(variety>=0); @@ -2041,14 +2041,14 @@ inline void Game::drawMapDebugAreas(int left, int top, int right, int bot, int s //b=teams[0]->myBuildings[21]; //if (teams[0]->virtualBuildings.size()) // b=*teams[0]->virtualBuildings.begin(); - if (b && b->localRessources[1]) + if (b && b->localResources[1]) for (int y=top-1; y<=bot; y++) for (int x=left-1; x<=right; x++) if (map.warpDistMax(b->posX, b->posY, x+viewportX, y+viewportY)<16) { int lx=(x+viewportX-b->posX+15)&31; int ly=(y+viewportY-b->posY+15)&31; - globalContainer->gfx->drawString((x<<5), (y<<5), globalContainer->littleFont, b->localRessources[1][lx+ly*32]); + globalContainer->gfx->drawString((x<<5), (y<<5), globalContainer->littleFont, b->localResources[1][lx+ly*32]); } } @@ -2228,9 +2228,9 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view // compute bar size, prevent oversize int bDiv=1; assert(type->height!=0); - while ( ((type->maxRessource[CORN]*3+1)/bDiv)>((type->height*32)-10)) + while ( ((type->maxResource[CORN]*3+1)/bDiv)>((type->height*32)-10)) bDiv++; - drawPointBar(x+1, y+1, BOTTOM_TO_TOP, type->maxRessource[CORN]/bDiv, building->ressources[CORN]/bDiv, 255, 255, 120, 1+bDiv); + drawPointBar(x+1, y+1, BOTTOM_TO_TOP, type->maxResource[CORN]/bDiv, building->resources[CORN]/bDiv, 255, 255, 120, 1+bDiv); } // bullets (for defence towers) @@ -2260,7 +2260,7 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view if(highlightBuildingType & (1<shortTypeNum)) { - globalContainer->gfx->drawSprite(x + buildingSprite->getW(imgid)/2 - 16, y-36, globalContainer->gamegui, 36); + globalContainer->gfx->drawSprite(x + buildingSprite->getW(imgid)/2 - 16, y-36, globalContainer->gameGui, 36); } } @@ -2320,21 +2320,21 @@ inline void Game::drawMapAreas(int left, int top, int right, int bot, int sw, in { if((drawOptions & DRAW_NO_RESSOURCE_GROWTH_AREAS) != 0) { - if(!map.canRessourcesGrow(x+viewportX, y+viewportY)) + if(!map.canResourcesGrow(x+viewportX, y+viewportY)) { globalContainer->gfx->drawLine((x<<5), 8+(y<<5), 32+(x<<5), 8+(y<<5), 128, 64, 0); globalContainer->gfx->drawLine((x<<5), 16+(y<<5), 32+(x<<5), 16+(y<<5), 128, 64, 0); globalContainer->gfx->drawLine((x<<5), 24+(y<<5), 32+(x<<5), 24+(y<<5), 128, 64, 0); // globalContainer->gfx->drawLine((x<<5), 32+(y<<5), 32+(x<<5), 32+(y<<5), 128, 64, 0); - if (map.canRessourcesGrow(x+viewportX, y+viewportY-1)) + if (map.canResourcesGrow(x+viewportX, y+viewportY-1)) globalContainer->gfx->drawHorzLine((x<<5), (y<<5), 32, 255, 128, 0); - if (map.canRessourcesGrow(x+viewportX, y+viewportY+1)) + if (map.canResourcesGrow(x+viewportX, y+viewportY+1)) globalContainer->gfx->drawHorzLine((x<<5), 32+(y<<5), 32, 255, 128, 0); - if (map.canRessourcesGrow(x+viewportX-1, y+viewportY)) + if (map.canResourcesGrow(x+viewportX-1, y+viewportY)) globalContainer->gfx->drawVertLine((x<<5), (y<<5), 32, 255, 128, 0); - if (map.canRessourcesGrow(x+viewportX+1, y+viewportY)) + if (map.canResourcesGrow(x+viewportX+1, y+viewportY)) globalContainer->gfx->drawVertLine(32+(x<<5), (y<<5), 32, 255, 128, 0); } } @@ -2937,9 +2937,9 @@ void Game::drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargi // compute bar size, prevent oversize int bDiv=1; assert(type->height!=0); - while ( ((type->maxRessource[CORN]*3+1)/bDiv)>((type->height*32)-10)) + while ( ((type->maxResource[CORN]*3+1)/bDiv)>((type->height*32)-10)) bDiv++; - drawPointBar(x+1, y+1, BOTTOM_TO_TOP, type->maxRessource[CORN]/bDiv, building->ressources[CORN]/bDiv, 255, 255, 120, 1+bDiv); + drawPointBar(x+1, y+1, BOTTOM_TO_TOP, type->maxResource[CORN]/bDiv, building->resources[CORN]/bDiv, 255, 255, 120, 1+bDiv); } } } diff --git a/src/GameEvent.cpp b/src/GameEvent.cpp index 752d001f6..718c64ab3 100644 --- a/src/GameEvent.cpp +++ b/src/GameEvent.cpp @@ -75,7 +75,7 @@ UnitUnderAttackEvent::UnitUnderAttackEvent(Uint32 step, Sint16 x, Sint16 y, Uint std::string UnitUnderAttackEvent::formatMessage() { std::string message; - message+=FormatableString(Toolkit::getStringTable()->getString("[Your %0 are under attack]")) + message+=FormattableString(Toolkit::getStringTable()->getString("[Your %0 are under attack]")) .arg(getUnitName(type)); return message; } @@ -108,7 +108,7 @@ UnitLostConversionEvent::UnitLostConversionEvent(Uint32 step, Sint16 x, Sint16 y std::string UnitLostConversionEvent::formatMessage() { std::string message; - message += FormatableString(Toolkit::getStringTable()->getString("[Your unit got converted to %0's team]")).arg(teamName); + message += FormattableString(Toolkit::getStringTable()->getString("[Your unit got converted to %0's team]")).arg(teamName); return message; } @@ -140,7 +140,7 @@ UnitGainedConversionEvent::UnitGainedConversionEvent(Uint32 step, Sint16 x, Sint std::string UnitGainedConversionEvent::formatMessage() { std::string message; - message += FormatableString(Toolkit::getStringTable()->getString("[%0's team unit got converted to your team]")).arg(teamName); + message += FormattableString(Toolkit::getStringTable()->getString("[%0's team unit got converted to your team]")).arg(teamName); return message; } diff --git a/src/GameGUI.cpp b/src/GameGUI.cpp index 7909a2e56..eeec59c8a 100644 --- a/src/GameGUI.cpp +++ b/src/GameGUI.cpp @@ -61,18 +61,18 @@ #define TYPING_INPUT_BASE_INC 7 #define TYPING_INPUT_MAX_POS 46 -// these values are manually layouted for cuteste perception +// these values are manually layouted for cutest perception #define YPOS_BASE_DEFAULT 180 #define YPOS_BASE_CONSTRUCTION (YPOS_BASE_DEFAULT + 5) #define YPOS_BASE_FLAG (YPOS_BASE_DEFAULT + 5) #define YPOS_BASE_STAT YPOS_BASE_DEFAULT #define YPOS_BASE_BUILDING (YPOS_BASE_DEFAULT + 10) #define YPOS_BASE_UNIT (YPOS_BASE_DEFAULT + 10) -#define YPOS_BASE_RESSOURCE YPOS_BASE_DEFAULT +#define YPOS_BASE_RESOURCE YPOS_BASE_DEFAULT #define YOFFSET_NAME 28 #define YOFFSET_ICON 52 -#define YOFFSET_CARYING 34 +#define YOFFSET_CARRYING 34 #define YOFFSET_BAR 32 #define YOFFSET_INFOS 12 #define YOFFSET_TOWER 22 @@ -195,7 +195,7 @@ GameGUI::~GameGUI() void GameGUI::init() { - notmenu = false; + notMenu = false; isRunning=true; gamePaused=false; hardPause=false; @@ -274,7 +274,7 @@ void GameGUI::init() scrollWheelChanges=0; - hilights.clear(); + highlights.clear(); } void GameGUI::adjustLocalTeam() @@ -387,7 +387,7 @@ void GameGUI::step(void) bool wasMouseMotion=false; bool wasWindowEvent=false; int oldMouseMapX = -1, oldMouseMapY = -1; // hopefully the values here will never matter - // we get all pending events but for mousemotion we only keep the last one + // we get all pending events but for mouse motion we only keep the last one while (SDL_PollEvent(&event)) { if (event.type==SDL_MOUSEMOTION) @@ -500,22 +500,22 @@ void GameGUI::step(void) } assert(localTeam); - boost::shared_ptr gevent = localTeam->getEvent(); - while(gevent) + boost::shared_ptr gEvent = localTeam->getEvent(); + while(gEvent) { - Color c = gevent->formatColor(); - addMessage(c, gevent->formatMessage(), false); - eventGoPosX = gevent->getX(); - eventGoPosY = gevent->getY(); - eventGoType = gevent->getEventType(); - gevent = localTeam->getEvent(); + Color c = gEvent->formatColor(); + addMessage(c, gEvent->formatMessage(), false); + eventGoPosX = gEvent->getX(); + eventGoPosY = gEvent->getY(); + eventGoType = gEvent->getEventType(); + gEvent = localTeam->getEvent(); } // voice step boost::shared_ptr orderVoiceData; while ((orderVoiceData = globalContainer->voiceRecorder->getNextOrder()) != NULL) { - orderVoiceData->recepientsMask = chatMask ^ (chatMask & (1<recipientsMask = chatMask ^ (chatMask & (1< messages; setMultiLine(game.sgslScript.textShown, &messages, " "); - ///Add each line as a seperate message to the message manager. + ///Add each line as a separate message to the message manager. ///Must be done backwards to appear in the right order for (int i=messages.size()-1; i>=0; i--) { @@ -544,7 +544,7 @@ void GameGUI::step(void) std::vector messages; setMultiLine(scriptText, &messages, " "); - // Add each line as a seperate message to the message manager. + // Add each line as a separate message to the message manager. // Must be done backwards to appear in the right order for (int i=messages.size()-1; i>=0; i--) { @@ -673,9 +673,9 @@ bool GameGUI::processGameMenu(SDL_Event *event) delete gameMenuScreen; inGameMenu=IGM_LOAD; if (globalContainer->replaying) - gameMenuScreen = new LoadSaveScreen("replays", "replay", true, std::string(Toolkit::getStringTable()->getString("[load replay]")), defualtGameSaveName.c_str(), glob2FilenameToName, glob2NameToFilename); + gameMenuScreen = new LoadSaveScreen("replays", "replay", true, std::string(Toolkit::getStringTable()->getString("[load replay]")), defaultGameSaveName.c_str(), glob2FilenameToName, glob2NameToFilename); else - gameMenuScreen = new LoadSaveScreen("games", "game", true, false, defualtGameSaveName.c_str(), glob2FilenameToName, glob2NameToFilename); + gameMenuScreen = new LoadSaveScreen("games", "game", true, false, defaultGameSaveName.c_str(), glob2FilenameToName, glob2NameToFilename); return true; } break; @@ -683,7 +683,7 @@ bool GameGUI::processGameMenu(SDL_Event *event) { delete gameMenuScreen; inGameMenu=IGM_SAVE; - gameMenuScreen = new LoadSaveScreen("games", "game", false, false, defualtGameSaveName.c_str(), glob2FilenameToName, glob2NameToFilename); + gameMenuScreen = new LoadSaveScreen("games", "game", false, false, defaultGameSaveName.c_str(), glob2FilenameToName, glob2NameToFilename); return true; } break; @@ -747,7 +747,7 @@ bool GameGUI::processGameMenu(SDL_Event *event) } } - // we have a special cases for uncontroled Teams: + // we have a special tiles for uncontroled Teams: // FIXME : remove this for (int ti=0; tiplayersMask==0) @@ -813,7 +813,7 @@ bool GameGUI::processGameMenu(SDL_Event *event) } else { - defualtGameSaveName=((LoadSaveScreen *)gameMenuScreen)->getName(); + defaultGameSaveName=((LoadSaveScreen *)gameMenuScreen)->getName(); OutputStream *stream = new BinaryOutputStream(Toolkit::getFileManager()->openOutputStreamBackend(locationName)); if (stream->isEndOfStream()) { @@ -1004,12 +1004,12 @@ void GameGUI::processEvent(SDL_Event *event) // if there is a menu he get events first if (inGameMenu) { - notmenu=true; + notMenu=true; processGameMenu(event); } else { - notmenu=false; + notMenu=false; if (scrollableText) { processScrollableWidget(event); @@ -1751,7 +1751,7 @@ void GameGUI::handleKeyAlways(void) { SDL_PumpEvents(); const Uint8 *keystate = SDL_GetKeyboardState(NULL); - if (notmenu == false) + if (notMenu == false) { SDL_Keymod modState = SDL_GetModState(); int xMotion = 1; @@ -1989,15 +1989,15 @@ void GameGUI::handleMapClick(int mx, int my, int button) } else { - // and ressource - if (game.map.isRessource(mapX, mapY) && game.map.isMapDiscovered(mapX, mapY, localTeam->me)) + // and resource + if (game.map.isResource(mapX, mapY) && game.map.isMapDiscovered(mapX, mapY, localTeam->me)) { - setSelection(RESSOURCE_SELECTION, mapY*game.map.getW()+mapX); + setSelection(RESOURCE_SELECTION, mapY*game.map.getW()+mapX); selectionPushed=true; } else { - if (selectionMode == RESSOURCE_SELECTION) + if (selectionMode == RESOURCE_SELECTION) clearSelection(); } } @@ -2061,7 +2061,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) assert (selBuild); if (selBuild->owner->teamNumber!=localTeamNo) return; - int ypos = YPOS_BASE_BUILDING + YOFFSET_NAME + YOFFSET_ICON + YOFFSET_B_SEP; + int yPos = YPOS_BASE_BUILDING + YOFFSET_NAME + YOFFSET_ICON + YOFFSET_B_SEP; BuildingType *buildingType = selBuild->type; int lmx = mx - RIGHT_MENU_OFFSET; // local mx @@ -2069,8 +2069,8 @@ void GameGUI::handleMenuClick(int mx, int my, int button) if (selBuild->type->maxUnitWorking) { if (((selBuild->owner->allies)&(1<ypos+YOFFSET_TEXT_BAR - && myyPos+YOFFSET_TEXT_BAR + && mybuildingState==Building::ALIVE && lmx < 128) { @@ -2100,16 +2100,16 @@ void GameGUI::handleMenuClick(int mx, int my, int button) } } } - ypos += YOFFSET_BAR + YOFFSET_B_SEP; + yPos += YOFFSET_BAR + YOFFSET_B_SEP; } // priorities if(selBuild->type->maxUnitWorking) { - ypos += YOFFSET_B_SEP; + yPos += YOFFSET_B_SEP; if (((selBuild->owner->allies)&(1<ypos+16 - && myyPos+16 + && mybuildingState==Building::ALIVE) { int width = (128 - 8)/3; @@ -2130,15 +2130,15 @@ void GameGUI::handleMenuClick(int mx, int my, int button) selBuild->priorityLocal = 1; } } - ypos += YOFFSET_BAR+YOFFSET_B_SEP; + yPos += YOFFSET_BAR+YOFFSET_B_SEP; } // flag range bar if (buildingType->defaultUnitStayRange) { if (((selBuild->owner->allies)&(1<ypos+YOFFSET_TEXT_BAR) - && (myyPos+YOFFSET_TEXT_BAR) + && (mytype == "clearingflag") { - ypos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; + yPos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; int j=0; for (int i=0; iypos && myyPos && myclearingRessourcesLocal[i]=!selBuild->clearingRessourcesLocal[i]; - orderQueue.push_back(shared_ptr(new OrderModifyClearingFlag(selBuild->gid, selBuild->clearingRessourcesLocal))); + selBuild->clearingResourcesLocal[i]=!selBuild->clearingResourcesLocal[i]; + orderQueue.push_back(shared_ptr(new OrderModifyClearingFlag(selBuild->gid, selBuild->clearingResourcesLocal))); } - ypos+=YOFFSET_TEXT_PARA; + yPos+=YOFFSET_TEXT_PARA; j++; } } if (buildingType->type == "warflag") { - ypos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; + yPos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; for (int i=0; i<4; i++) { - if (my>ypos && myyPos && myminLevelToFlagLocal=i; orderQueue.push_back(shared_ptr(new OrderModifyMinLevelToFlag(selBuild->gid, selBuild->minLevelToFlagLocal))); } - ypos+=YOFFSET_TEXT_PARA; + yPos+=YOFFSET_TEXT_PARA; } } @@ -2215,29 +2215,29 @@ void GameGUI::handleMenuClick(int mx, int my, int button) // must be able to do to be accepted at this flag // 0 == any explorer // 1 == must be able to attack ground - ypos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; + yPos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; for (int i=0; i<2; i++) { - if (my>ypos && myyPos && myminLevelToFlagLocal=i; orderQueue.push_back(shared_ptr(new OrderModifyMinLevelToFlag(selBuild->gid, selBuild->minLevelToFlagLocal))); } - ypos+=YOFFSET_TEXT_PARA; + yPos+=YOFFSET_TEXT_PARA; } } } if (buildingType->armor) - ypos+=YOFFSET_TEXT_LINE; + yPos+=YOFFSET_TEXT_LINE; if (buildingType->maxUnitInside) - ypos += YOFFSET_INFOS; + yPos += YOFFSET_INFOS; if (buildingType->shootDamage) - ypos += YOFFSET_TOWER; - ypos += YOFFSET_B_SEP; + yPos += YOFFSET_TOWER; + yPos += YOFFSET_B_SEP; - //Exchannge building + //Exchange building //Exchanging as a feature is broken /* if (selBuild->type->canExchange && ((selBuild->owner->allies)&(1<92) && (lmx<104)) { - if (selBuild->receiveRessourceMask & (1<receiveResourceMask & (1<receiveRessourceMaskLocal &= ~(1<receiveResourceMaskLocal &= ~(1<receiveRessourceMaskLocal |= (1<sendRessourceMaskLocal &= ~(1<receiveResourceMaskLocal |= (1<sendResourceMaskLocal &= ~(1<(new OrderModifyExchange(selBuild->gid, selBuild->receiveRessourceMaskLocal, selBuild->sendRessourceMaskLocal))); + orderQueue.push_back(shared_ptr(new OrderModifyExchange(selBuild->gid, selBuild->receiveResourceMaskLocal, selBuild->sendResourceMaskLocal))); } if ((lmx>110) && (lmx<122)) { - if (selBuild->sendRessourceMask & (1<sendResourceMask & (1<sendRessourceMaskLocal &= ~(1<sendResourceMaskLocal &= ~(1<receiveRessourceMaskLocal &= ~(1<sendRessourceMaskLocal |= (1<receiveResourceMaskLocal &= ~(1<sendResourceMaskLocal |= (1<(new OrderModifyExchange(selBuild->gid, selBuild->receiveRessourceMaskLocal, selBuild->sendRessourceMaskLocal))); + orderQueue.push_back(shared_ptr(new OrderModifyExchange(selBuild->gid, selBuild->receiveResourceMaskLocal, selBuild->sendResourceMaskLocal))); } } } */ - // ressources in + // resources in unsigned j = 0; - for (unsigned i=0; iressourcesTypes.size(); i++) + for (unsigned i=0; iresourcesTypes.size(); i++) { - if (buildingType->maxRessource[i]) + if (buildingType->maxResource[i]) { j++; - ypos += 11; + yPos += 11; } } if (buildingType->maxBullets) { j++; - ypos += 11; + yPos += 11; } - ypos+=5; + yPos+=5; if (selBuild->type->unitProductionTime) { - ypos+=15; + yPos+=15; for (int i=0; iypos+(i*20))&&(myyPos+(i*20))&&(mydestinationPurpose); - printf(" carriedRessource=%d\n", selUnit->carriedRessource); + printf(" carriedResource=%d\n", selUnit->carriedResource); } else if ((displayMode==CONSTRUCTION_VIEW && !globalContainer->replaying)) { @@ -2685,7 +2685,7 @@ void GameGUI::drawPanelButtons(int y) drawPanelButton(y, 2, RDM_NB_VIEWS, 4); } - if(hilights.find(HilightUnderMinimapIcon) != hilights.end()) + if(highlights.find(HilightUnderMinimapIcon) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, y, 38)); } @@ -2695,7 +2695,7 @@ void GameGUI::drawPanelButton(int y, int pos, int numButtons, int sprite) { int dec = (RIGHT_MENU_WIDTH - numButtons*32)/2; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH + dec + pos*32, y, globalContainer->gamegui, sprite); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH + dec + pos*32, y, globalContainer->gameGui, sprite); } void GameGUI::drawChoice(int pos, std::vector &types, std::vector &states, unsigned numberPerLine) @@ -2742,7 +2742,7 @@ void GameGUI::drawChoice(int pos, std::vector &types, std::vectorgfx->drawSprite(x+decX, y+decY, buildingSprite, imgid); globalContainer->gfx->setClipRect(); - if(hilights.find(HilightBuildingOnPanel+IntBuildingType::shortNumberFromType(type)) != hilights.end()) + if(highlights.find(HilightBuildingOnPanel+IntBuildingType::shortNumberFromType(type)) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(x+decX-36, y-6+decX, 38)); } @@ -2757,9 +2757,9 @@ void GameGUI::drawChoice(int pos, std::vector &types, std::vectorgamegui->getW(8); + sw = globalContainer->gameGui->getW(8); else - sw = globalContainer->gamegui->getW(23); + sw = globalContainer->gameGui->getW(23); assert(sel>=0); @@ -2769,9 +2769,9 @@ void GameGUI::drawChoice(int pos, std::vector &types, std::vectorgfx->drawSprite(x+decX, y+1, globalContainer->gamegui, 8); + globalContainer->gfx->drawSprite(x+decX, y+1, globalContainer->gameGui, 8); else - globalContainer->gfx->drawSprite(x+decX, y+4, globalContainer->gamegui, 23); + globalContainer->gfx->drawSprite(x+decX, y+4, globalContainer->gameGui, 23); } int toDrawInfoFor = -1; @@ -2823,17 +2823,17 @@ void GameGUI::drawChoice(int pos, std::vector &types, std::vectorgfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+4+(RIGHT_MENU_WIDTH-128)/2, buildingInfoStart+6, globalContainer->littleFont, - FormatableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Wood]")).arg(bt->maxRessource[0]).c_str()); + FormattableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Wood]")).arg(bt->maxResource[0]).c_str()); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+4+(RIGHT_MENU_WIDTH-128)/2, buildingInfoStart+17, globalContainer->littleFont, - FormatableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Stone]")).arg(bt->maxRessource[3]).c_str()); + FormattableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Stone]")).arg(bt->maxResource[3]).c_str()); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+4+64+(RIGHT_MENU_WIDTH-128)/2, buildingInfoStart+6, globalContainer->littleFont, - FormatableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Alga]")).arg(bt->maxRessource[4]).c_str()); + FormattableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Alga]")).arg(bt->maxResource[4]).c_str()); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+4+64+(RIGHT_MENU_WIDTH-128)/2, buildingInfoStart+17, globalContainer->littleFont, - FormatableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Corn]")).arg(bt->maxRessource[1]).c_str()); + FormattableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Corn]")).arg(bt->maxResource[1]).c_str()); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+4+(RIGHT_MENU_WIDTH-128)/2, buildingInfoStart+28, globalContainer->littleFont, - FormatableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Papyrus]")).arg(bt->maxRessource[2]).c_str()); + FormattableString("%0: %1").arg(Toolkit::getStringTable()->getString("[Papyrus]")).arg(bt->maxResource[2]).c_str()); } } } @@ -2904,10 +2904,10 @@ void GameGUI::drawUnitInfos(void) int ddx = (RIGHT_MENU_HALF_WIDTH - 56) / 2 + 2; globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+ddx+12+decX, ypos+7+4+decY, unitSprite, imgid); - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+ddx, ypos+4, globalContainer->gamegui, 18); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+ddx, ypos+4, globalContainer->gameGui, 18); // draw HP - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos, globalContainer->littleFont, FormatableString("%0:").arg(Toolkit::getStringTable()->getString("[hp]")).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos, globalContainer->littleFont, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[hp]")).c_str()); if (selUnit->hp<=selUnit->trigHP) { r=255; g=0; b=0; } @@ -2915,10 +2915,10 @@ void GameGUI::drawUnitInfos(void) { r=0; g=255; b=0; } globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, r, g, b)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE, globalContainer->littleFont, FormatableString("%0/%1").arg(selUnit->hp).arg(selUnit->performance[HP]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0/%1").arg(selUnit->hp).arg(selUnit->performance[HP]).c_str()); globalContainer->littleFont->popStyle(); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE+YOFFSET_TEXT_PARA, globalContainer->littleFont, FormatableString("%0:").arg(Toolkit::getStringTable()->getString("[food]")).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE+YOFFSET_TEXT_PARA, globalContainer->littleFont, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[food]")).c_str()); // draw food if (selUnit->isUnitHungry()) @@ -2927,7 +2927,7 @@ void GameGUI::drawUnitInfos(void) { r=0; g=255; b=0; } globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, r, g, b)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+2*YOFFSET_TEXT_LINE+YOFFSET_TEXT_PARA, globalContainer->littleFont, FormatableString("%0 % (%1)").arg(((float)selUnit->hungry*100.0f)/(float)Unit::HUNGRY_MAX, 0, 0).arg(selUnit->fruitCount).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+2*YOFFSET_TEXT_LINE+YOFFSET_TEXT_PARA, globalContainer->littleFont, FormattableString("%0 % (%1)").arg(((float)selUnit->hungry*100.0f)/(float)Unit::HUNGRY_MAX, 0, 0).arg(selUnit->fruitCount).c_str()); globalContainer->littleFont->popStyle(); ypos += YOFFSET_ICON+10; @@ -2936,21 +2936,21 @@ void GameGUI::drawUnitInfos(void) if (selUnit->performance[HARVEST]) { - if (selUnit->carriedRessource>=0) + if (selUnit->carriedResource>=0) { - const RessourceType* r = globalContainer->ressourcesTypes.get(selUnit->carriedRessource); + const ResourceType* r = globalContainer->resourcesTypes.get(selUnit->carriedResource); unsigned resImg = r->gfxId + r->sizesCount - 1; globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos+8, globalContainer->littleFont, Toolkit::getStringTable()->getString("[carry]")); - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-32-8-rdec, ypos, globalContainer->ressources, resImg); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-32-8-rdec, ypos, globalContainer->resources, resImg); } else { globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos+8, globalContainer->littleFont, Toolkit::getStringTable()->getString("[don't carry anything]")); } } - ypos += YOFFSET_CARYING+10; + ypos += YOFFSET_CARRYING+10; - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 : %1").arg(Toolkit::getStringTable()->getString("[current speed]")).arg(selUnit->speed).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 : %1").arg(Toolkit::getStringTable()->getString("[current speed]")).arg(selUnit->speed).c_str()); ypos += YOFFSET_TEXT_PARA+10; if (selUnit->performance[ARMOR]) @@ -2959,53 +2959,53 @@ void GameGUI::drawUnitInfos(void) int realArmor = selUnit->performance[ARMOR] - selUnit->fruitCount * armorReductionPerHappyness; if (realArmor < 0) globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 255, 0, 0)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 : %1 = %2 - %3 * %4").arg(Toolkit::getStringTable()->getString("[armor]")).arg(realArmor).arg(selUnit->performance[ARMOR]).arg(selUnit->fruitCount).arg(armorReductionPerHappyness).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 : %1 = %2 - %3 * %4").arg(Toolkit::getStringTable()->getString("[armor]")).arg(realArmor).arg(selUnit->performance[ARMOR]).arg(selUnit->fruitCount).arg(armorReductionPerHappyness).c_str()); if (realArmor < 0) globalContainer->littleFont->popStyle(); } ypos += YOFFSET_TEXT_PARA; if (selUnit->typeNum!=EXPLORER) - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0:").arg(Toolkit::getStringTable()->getString("[levels]")).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[levels]")).c_str()); ypos += YOFFSET_TEXT_PARA; if (selUnit->performance[WALK]) - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Walk]")).arg((1+selUnit->level[WALK])).arg(selUnit->performance[WALK]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Walk]")).arg((1+selUnit->level[WALK])).arg(selUnit->performance[WALK]).c_str()); ypos += YOFFSET_TEXT_LINE; if (selUnit->performance[SWIM]) - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Swim]")).arg(selUnit->level[SWIM]).arg(selUnit->performance[SWIM]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Swim]")).arg(selUnit->level[SWIM]).arg(selUnit->performance[SWIM]).c_str()); ypos += YOFFSET_TEXT_LINE; if (selUnit->performance[BUILD]) - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Build]")).arg(1+selUnit->level[BUILD]).arg(selUnit->performance[BUILD]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Build]")).arg(1+selUnit->level[BUILD]).arg(selUnit->performance[BUILD]).c_str()); ypos += YOFFSET_TEXT_LINE; if (selUnit->performance[HARVEST]) - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Harvest]")).arg(1+selUnit->level[HARVEST]).arg(selUnit->performance[HARVEST]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[Harvest]")).arg(1+selUnit->level[HARVEST]).arg(selUnit->performance[HARVEST]).c_str()); ypos += YOFFSET_TEXT_LINE; if (selUnit->performance[ATTACK_SPEED]) - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[At. speed]")).arg(1+selUnit->level[ATTACK_SPEED]).arg(selUnit->performance[ATTACK_SPEED]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1) : %2").arg(Toolkit::getStringTable()->getString("[At. speed]")).arg(1+selUnit->level[ATTACK_SPEED]).arg(selUnit->performance[ATTACK_SPEED]).c_str()); ypos += YOFFSET_TEXT_LINE; if (selUnit->performance[ATTACK_STRENGTH]) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1+%2) : %3+%4").arg(Toolkit::getStringTable()->getString("[At. strength]")).arg(1+selUnit->level[ATTACK_STRENGTH]).arg(selUnit->experienceLevel).arg(selUnit->performance[ATTACK_STRENGTH]).arg(selUnit->experienceLevel).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1+%2) : %3+%4").arg(Toolkit::getStringTable()->getString("[At. strength]")).arg(1+selUnit->level[ATTACK_STRENGTH]).arg(selUnit->experienceLevel).arg(selUnit->performance[ATTACK_STRENGTH]).arg(selUnit->experienceLevel).c_str()); ypos += YOFFSET_TEXT_PARA + 2; } if (selUnit->performance[MAGIC_ATTACK_AIR]) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1+%2) : %3+%4").arg(Toolkit::getStringTable()->getString("[Magic At. Air]")).arg(1+selUnit->level[MAGIC_ATTACK_AIR]).arg(selUnit->experienceLevel).arg(selUnit->performance[MAGIC_ATTACK_AIR]).arg(selUnit->experienceLevel).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1+%2) : %3+%4").arg(Toolkit::getStringTable()->getString("[Magic At. Air]")).arg(1+selUnit->level[MAGIC_ATTACK_AIR]).arg(selUnit->experienceLevel).arg(selUnit->performance[MAGIC_ATTACK_AIR]).arg(selUnit->experienceLevel).c_str()); ypos += YOFFSET_TEXT_PARA + 2; } if (selUnit->performance[MAGIC_ATTACK_GROUND]) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1+%2) : %3+%4").arg(Toolkit::getStringTable()->getString("[Magic At. Ground]")).arg(1+selUnit->level[MAGIC_ATTACK_GROUND]).arg(selUnit->experienceLevel).arg(selUnit->performance[MAGIC_ATTACK_GROUND]).arg(selUnit->experienceLevel).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1+%2) : %3+%4").arg(Toolkit::getStringTable()->getString("[Magic At. Ground]")).arg(1+selUnit->level[MAGIC_ATTACK_GROUND]).arg(selUnit->experienceLevel).arg(selUnit->performance[MAGIC_ATTACK_GROUND]).arg(selUnit->experienceLevel).c_str()); ypos += YOFFSET_TEXT_PARA + 2; } @@ -3016,7 +3016,7 @@ void GameGUI::drawUnitInfos(void) void GameGUI::drawValueAlignedRight(int y, int v) { - FormatableString s("%0"); + FormattableString s("%0"); s.arg(v); int len = globalContainer->littleFont->getStringWidth(s.c_str()); globalContainer->gfx->drawString(globalContainer->gfx->getW()-len-2, y, globalContainer->littleFont, s.c_str()); @@ -3029,7 +3029,7 @@ void GameGUI::drawCosts(int ressources[BASIC_COUNT], Font *font) int y = i>>1; globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+4+(i&0x1)*64, 256+172-42+y*12, font, - FormatableString("%0: %1").arg(getRessourceName(i)).arg(ressources[i]).c_str()); + FormattableString("%0: %1").arg(getResourceName(i)).arg(ressources[i]).c_str()); } } @@ -3049,11 +3049,11 @@ void GameGUI::drawRadioButton(int x, int y, bool isSet) { if(isSet) { - globalContainer->gfx->drawSprite(x, y, globalContainer->gamegui, 20); + globalContainer->gfx->drawSprite(x, y, globalContainer->gameGui, 20); } else { - globalContainer->gfx->drawSprite(x, y, globalContainer->gamegui, 19); + globalContainer->gfx->drawSprite(x, y, globalContainer->gameGui, 19); } } @@ -3097,7 +3097,7 @@ void GameGUI::drawBuildingInfos(void) if ((buildingType->nextLevel>=0) || (buildingType->prevLevel>=0)) { const std::string textT = Toolkit::getStringTable()->getString("[level]"); - title += FormatableString("%0 %1").arg(textT).arg(buildingType->level+1); + title += FormattableString("%0 %1").arg(textT).arg(buildingType->level+1); } if (buildingType->isBuildingSite) { @@ -3138,7 +3138,7 @@ void GameGUI::drawBuildingInfos(void) int ddx = (RIGHT_MENU_HALF_WIDTH - 56) / 2 + 2; miniSprite->setBaseColor(selBuild->owner->color); globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+ddx+dx, ypos+4+dy, miniSprite, imgid); - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+ddx, ypos+4, globalContainer->gamegui, 18); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+ddx, ypos+4, globalContainer->gameGui, 18); // draw HP if (buildingType->hpMax) @@ -3153,7 +3153,7 @@ void GameGUI::drawBuildingInfos(void) { r=0; g=255; b=0; } globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, r, g, b)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE, globalContainer->littleFont, FormatableString("%0/%1").arg(selBuild->hp).arg(buildingType->hpMax).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0/%1").arg(selBuild->hp).arg(buildingType->hpMax).c_str()); globalContainer->littleFont->popStyle(); } @@ -3165,13 +3165,13 @@ void GameGUI::drawBuildingInfos(void) globalContainer->littleFont->popStyle(); if (selBuild->buildingState==Building::ALIVE) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, globalContainer->littleFont, FormatableString("%0/%1").arg(selBuild->unitsInside.size()).arg(selBuild->maxUnitInside).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0/%1").arg(selBuild->unitsInside.size()).arg(selBuild->maxUnitInside).c_str()); } else { if (selBuild->unitsInside.size()>1) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, globalContainer->littleFont, FormatableString("%0%1").arg(Toolkit::getStringTable()->getString("[Still (i)]")).arg(selBuild->unitsInside.size()).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0%1").arg(Toolkit::getStringTable()->getString("[Still (i)]")).arg(selBuild->unitsInside.size()).c_str()); } else if (selBuild->unitsInside.size()==1) { @@ -3189,14 +3189,14 @@ void GameGUI::drawBuildingInfos(void) selBuild->computeFlagStatLocal(&goingTo, &onSpot); // display flag stat globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 185, 195, 21)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos, globalContainer->littleFont, FormatableString("%0").arg(Toolkit::getStringTable()->getString("[In way]")).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos, globalContainer->littleFont, FormattableString("%0").arg(Toolkit::getStringTable()->getString("[In way]")).c_str()); globalContainer->littleFont->popStyle(); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE, globalContainer->littleFont, FormatableString("%0").arg(goingTo).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0").arg(goingTo).c_str()); globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 185, 195, 21)); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+YOFFSET_TEXT_LINE, - globalContainer->littleFont, FormatableString(Toolkit::getStringTable()->getString("[On the spot]")).c_str()); + globalContainer->littleFont, FormattableString(Toolkit::getStringTable()->getString("[On the spot]")).c_str()); globalContainer->littleFont->popStyle(); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-+RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, globalContainer->littleFont, FormatableString("%0").arg(onSpot).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-+RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0").arg(onSpot).c_str()); } ypos += YOFFSET_ICON+YOFFSET_B_SEP; @@ -3216,14 +3216,14 @@ void GameGUI::drawBuildingInfos(void) globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 185, 195, 21)); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, working); globalContainer->littleFont->popStyle(); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4+len, ypos, globalContainer->littleFont, FormatableString("%0/%1").arg((int)selBuild->unitsWorking.size()).arg(maxUnitsWorking).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4+len, ypos, globalContainer->littleFont, FormattableString("%0/%1").arg((int)selBuild->unitsWorking.size()).arg(maxUnitsWorking).c_str()); drawScrollBox(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos+YOFFSET_TEXT_BAR, maxUnitsWorking, maxUnitsWorking, selBuild->unitsWorking.size(), MAX_UNIT_WORKING); } else { if (selBuild->unitsWorking.size()>1) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0%1%2").arg(Toolkit::getStringTable()->getString("[still (w)]")).arg(selBuild->unitsWorking.size()).arg(Toolkit::getStringTable()->getString("[units working]")).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0%1%2").arg(Toolkit::getStringTable()->getString("[still (w)]")).arg(selBuild->unitsWorking.size()).arg(Toolkit::getStringTable()->getString("[units working]")).c_str()); } else if (selBuild->unitsWorking.size()==1) { @@ -3232,7 +3232,7 @@ void GameGUI::drawBuildingInfos(void) } } } - if(hilights.find(HilightUnitsAssignedBar) != hilights.end()) + if(highlights.find(HilightUnitsAssignedBar) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, ypos+6, 38)); } @@ -3286,7 +3286,7 @@ void GameGUI::drawBuildingInfos(void) globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 185, 195, 21)); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, range); globalContainer->littleFont->popStyle(); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4+len, ypos, globalContainer->littleFont, FormatableString("%0").arg(selBuild->unitStayRange).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4+len, ypos, globalContainer->littleFont, FormattableString("%0").arg(selBuild->unitStayRange).c_str()); drawScrollBox(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos+YOFFSET_TEXT_BAR, selBuild->unitStayRange, unitStayRange, 0, selBuild->type->maxUnitStayRange); } ypos += YOFFSET_BAR+YOFFSET_B_SEP; @@ -3307,13 +3307,13 @@ void GameGUI::drawBuildingInfos(void) if (i!=STONE) { globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, ypos, globalContainer->littleFont, - getRessourceName(i)); + getResourceName(i)); int spriteId; - if (globalContainer->replaying?selBuild->clearingRessources[i]:selBuild->clearingRessourcesLocal[i]) + if (globalContainer->replaying?selBuild->clearingResources[i]:selBuild->clearingResourcesLocal[i]) spriteId=20; else spriteId=19; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gamegui, spriteId); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gameGui, spriteId); ypos+=YOFFSET_TEXT_PARA; j++; @@ -3334,7 +3334,7 @@ void GameGUI::drawBuildingInfos(void) spriteId=20; else spriteId=19; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gamegui, spriteId); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gameGui, spriteId); ypos+=YOFFSET_TEXT_PARA; } @@ -3357,7 +3357,7 @@ void GameGUI::drawBuildingInfos(void) spriteId = 20; else spriteId = 19; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gamegui, spriteId); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gameGui, spriteId); ypos += YOFFSET_TEXT_PARA; globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, ypos, globalContainer->littleFont,Toolkit::getStringTable()->getString("[ground attack]")); @@ -3365,7 +3365,7 @@ void GameGUI::drawBuildingInfos(void) spriteId = 20; else spriteId = 19; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gamegui, spriteId); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gameGui, spriteId); ypos += YOFFSET_TEXT_PARA; } } @@ -3373,15 +3373,15 @@ void GameGUI::drawBuildingInfos(void) // other infos if (buildingType->armor) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0: %1").arg(Toolkit::getStringTable()->getString("[armor]")).arg(buildingType->armor).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0: %1").arg(Toolkit::getStringTable()->getString("[armor]")).arg(buildingType->armor).c_str()); ypos+=YOFFSET_TEXT_LINE; } if (buildingType->maxUnitInside) ypos += YOFFSET_INFOS; if (buildingType->shootDamage) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos+1, globalContainer->littleFont, FormatableString("%0 : %1").arg(Toolkit::getStringTable()->getString("[damage]")).arg(buildingType->shootDamage).c_str()); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos+12, globalContainer->littleFont, FormatableString("%0 : %1").arg(Toolkit::getStringTable()->getString("[range]")).arg(buildingType->shootingRange).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos+1, globalContainer->littleFont, FormattableString("%0 : %1").arg(Toolkit::getStringTable()->getString("[damage]")).arg(buildingType->shootDamage).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos+12, globalContainer->littleFont, FormattableString("%0 : %1").arg(Toolkit::getStringTable()->getString("[range]")).arg(buildingType->shootingRange).c_str()); ypos += YOFFSET_TOWER; } @@ -3447,11 +3447,11 @@ void GameGUI::drawBuildingInfos(void) globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 185, 195, 21)); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, Toolkit::getStringTable()->getString("[market]")); globalContainer->littleFont->popStyle(); - //globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-36-3, ypos+1, globalContainer->gamegui, EXCHANGE_BUILDING_ICONS); + //globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-36-3, ypos+1, globalContainer->gameGui, EXCHANGE_BUILDING_ICONS); ypos += YOFFSET_TEXT_PARA; for (unsigned i=0; igfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 (%1/%2)").arg(getRessourceName(i+HAPPYNESS_BASE)).arg(selBuild->ressources[i+HAPPYNESS_BASE]).arg(buildingType->maxRessource[i+HAPPYNESS_BASE]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 (%1/%2)").arg(getResourceName(i+HAPPYNESS_BASE)).arg(selBuild->resources[i+HAPPYNESS_BASE]).arg(buildingType->maxResource[i+HAPPYNESS_BASE]).c_str()); /* int inId, outId; @@ -3463,8 +3463,8 @@ void GameGUI::drawBuildingInfos(void) outId = 20; else outId = 19; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-36, ypos+2, globalContainer->gamegui, inId); - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-18, ypos+2, globalContainer->gamegui, outId); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-36, ypos+2, globalContainer->gameGui, inId); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-18, ypos+2, globalContainer->gameGui, outId); */ ypos += YOFFSET_TEXT_PARA; @@ -3479,18 +3479,18 @@ void GameGUI::drawBuildingInfos(void) // ressources in unsigned j = 0; - for (unsigned i=0; iressourcesTypes.size(); i++) + for (unsigned i=0; iresourcesTypes.size(); i++) { - if (buildingType->maxRessource[i]) + if (buildingType->maxResource[i]) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 : %1/%2").arg(getRessourceName(i)).arg(selBuild->ressources[i]).arg(buildingType->maxRessource[i]).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 : %1/%2").arg(getResourceName(i)).arg(selBuild->resources[i]).arg(buildingType->maxResource[i]).c_str()); j++; ypos += 11; } } if (buildingType->maxBullets) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormatableString("%0 : %1/%2").arg(Toolkit::getStringTable()->getString("[Bullets]")).arg(selBuild->bullets).arg(buildingType->maxBullets).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, FormattableString("%0 : %1/%2").arg(Toolkit::getStringTable()->getString("[Bullets]")).arg(selBuild->bullets).arg(buildingType->maxBullets).c_str()); j++; ypos += 11; } @@ -3513,7 +3513,7 @@ void GameGUI::drawBuildingInfos(void) drawScrollBox(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos, selBuild->ratio[i], ratio, 0, MAX_RATIO_RANGE); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+24, ypos, globalContainer->littleFont, getUnitName(i)); - if(i==1 && hilights.find(HilightRatioBar) != hilights.end()) + if(i==1 && highlights.find(HilightRatioBar) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET-36, ypos-8, 38)); } @@ -3540,31 +3540,31 @@ void GameGUI::drawBuildingInfos(void) { std::string s; if(j == Building::UnitNotAvailable) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units not available]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units not available]")).arg(n); if(j == Building::UnitTooLowLevel) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units too low level]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units too low level]")).arg(n); else if(j == Building::UnitCantAccessBuilding) { if (buildingType->isVirtual) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units can't access flag]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units can't access flag]")).arg(n); else - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units can't access building]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units can't access building]")).arg(n); } else if(j == Building::UnitTooFarFromBuilding) { if (buildingType->isVirtual) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units too far from flag]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units too far from flag]")).arg(n); else - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units too far from building]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units too far from building]")).arg(n); } else if(j == Building::UnitCantAccessResource) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units can't access resource]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units can't access resource]")).arg(n); else if(j == Building::UnitCantAccessFruit) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units too far from resource]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units too far from resource]")).arg(n); else if(j == Building::UnitTooFarFromResource) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units can't access fruit]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units can't access fruit]")).arg(n); else if(j == Building::UnitTooFarFromFruit) - s = FormatableString(Toolkit::getStringTable()->getString("[%0 units too far from fruit]")).arg(n); + s = FormattableString(Toolkit::getStringTable()->getString("[%0 units too far from fruit]")).arg(n); globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+10, ypos, globalContainer->littleFont, s.c_str()); ypos+=11; } @@ -3600,7 +3600,7 @@ void GameGUI::drawBuildingInfos(void) { globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 200, 200, 255)); int ressources[BASIC_COUNT]; - selBuild->getRessourceCountToRepair(ressources); + selBuild->getResourceCountToRepair(ressources); drawCosts(ressources, globalContainer->littleFont); globalContainer->littleFont->popStyle(); } @@ -3620,7 +3620,7 @@ void GameGUI::drawBuildingInfos(void) // We draw the ressources cost. int typeNum=buildingType->nextLevel; BuildingType *bt=globalContainer->buildingsTypes.get(typeNum); - drawCosts(bt->maxRessource, globalContainer->littleFont); + drawCosts(bt->maxResource, globalContainer->littleFont); // We draw the new abilities: int blueYpos = YPOS_BASE_BUILDING + YOFFSET_NAME; @@ -3655,11 +3655,11 @@ void GameGUI::drawBuildingInfos(void) blueYpos += YOFFSET_B_SEP; unsigned j = 0; - for (unsigned i=0; iressourcesTypes.size(); i++) + for (unsigned i=0; iresourcesTypes.size(); i++) { - if (buildingType->maxRessource[i]) + if (buildingType->maxResource[i]) { - drawValueAlignedRight(blueYpos+(j*11), bt->maxRessource[i]); + drawValueAlignedRight(blueYpos+(j*11), bt->maxResource[i]); j++; } } @@ -3689,32 +3689,32 @@ void GameGUI::drawBuildingInfos(void) } } -void GameGUI::drawRessourceInfos(void) +void GameGUI::drawResourceInfos(void) { - const Ressource &r = game.map.getRessource(selection.ressource); - int ypos = YPOS_BASE_RESSOURCE; + const Resource &r = game.map.getResource(selection.resource); + int ypos = YPOS_BASE_RESOURCE; if (r.type!=NO_RES_TYPE) { - // Draw ressource name - const std::string &ressourceName = getRessourceName(r.type); + // Draw resource name + const std::string &ressourceName = getResourceName(r.type); int titleLen = globalContainer->littleFont->getStringWidth(ressourceName.c_str()); int titlePos = globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+((RIGHT_MENU_WIDTH-titleLen)>>1); globalContainer->gfx->drawString(titlePos, ypos+(YOFFSET_TEXT_PARA>>1), globalContainer->littleFont, ressourceName.c_str()); ypos += 2*YOFFSET_TEXT_PARA; - // Draw ressource image - const RessourceType* rt = globalContainer->ressourcesTypes.get(r.type); + // Draw resource image + const ResourceType* rt = globalContainer->resourcesTypes.get(r.type); unsigned resImg = rt->gfxId + r.variety*rt->sizesCount + r.amount; if (!rt->eternal) resImg--; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+16, ypos, globalContainer->ressources, resImg); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+16, ypos, globalContainer->resources, resImg); - // Draw ressource count + // Draw resource count if (rt->granular) { int sizesCount=rt->sizesCount; int amount=r.amount; - const std::string amountS = FormatableString("%0/%1").arg(amount).arg(sizesCount); + const std::string amountS = FormattableString("%0/%1").arg(amount).arg(sizesCount); int amountSH = globalContainer->littleFont->getStringHeight(amountS.c_str()); globalContainer->gfx->drawString(globalContainer->gfx->getW()-64, ypos+((32-amountSH)>>1), globalContainer->littleFont, amountS.c_str()); } @@ -3733,14 +3733,14 @@ void GameGUI::drawReplayPanel(void) int y = REPLAY_PANEL_YOFFSET; int inc = REPLAY_PANEL_SPACE_BETWEEN_OPTIONS; - globalContainer->gfx->drawString(x, y, font, FormatableString("%0:").arg(Toolkit::getStringTable()->getString("[Options]"))); + globalContainer->gfx->drawString(x, y, font, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[Options]"))); drawCheckButton(x, y + 1*inc, Toolkit::getStringTable()->getString("[fog of war]"), globalContainer->replayShowFog); drawCheckButton(x, y + 2*inc, Toolkit::getStringTable()->getString("[combined vision]"), (globalContainer->replayVisibleTeams == 0xFFFFFFFF)); drawCheckButton(x, y + 3*inc, Toolkit::getStringTable()->getString("[show areas]"), (globalContainer->replayShowAreas)); drawCheckButton(x, y + 4*inc, Toolkit::getStringTable()->getString("[show flags]"), (globalContainer->replayShowFlags)); - globalContainer->gfx->drawString(x, y + REPLAY_PANEL_PLAYERLIST_YOFFSET, font, FormatableString("%0:").arg(Toolkit::getStringTable()->getString("[players]"))); + globalContainer->gfx->drawString(x, y + REPLAY_PANEL_PLAYERLIST_YOFFSET, font, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[players]"))); for (int i = 0; i < game.teamsCount(); i++) { @@ -3782,20 +3782,20 @@ void GameGUI::drawReplayProgressBar(bool drawBackground) // Draw the round caps globalContainer->gfx->drawSprite( REPLAY_PROGRESS_BAR_X_OFFSET, y, - globalContainer->gamegui, + globalContainer->gameGui, REPLAY_BAR_LEFT_CAP_SPRITE); globalContainer->gfx->drawSprite( REPLAY_BAR_WIDTH - REPLAY_PROGRESS_BAR_X_OFFSET - REPLAY_PROGRESS_BAR_CAP_WIDTH, y, - globalContainer->gamegui, + globalContainer->gameGui, REPLAY_BAR_RIGHT_CAP_SPRITE); // Draw the buttons for play, pause and fast-forward int x = REPLAY_BAR_WIDTH - REPLAY_PROGRESS_BAR_X_OFFSET - REPLAY_PROGRESS_BAR_CAP_WIDTH; int inc = REPLAY_PROGRESS_BAR_BUTTON_WIDTH; - globalContainer->gfx->drawSprite( x - inc*3, y, globalContainer->gamegui, (!gamePaused && !globalContainer->replayFastForward ? REPLAY_BAR_PLAY_BUTTON_ACTIVE_SPRITE : REPLAY_BAR_PLAY_BUTTON_SPRITE)); - globalContainer->gfx->drawSprite( x - inc*2, y, globalContainer->gamegui, (gamePaused ? REPLAY_BAR_PAUSE_BUTTON_ACTIVE_SPRITE : REPLAY_BAR_PAUSE_BUTTON_SPRITE)); - globalContainer->gfx->drawSprite( x - inc*1, y, globalContainer->gamegui, (!gamePaused && globalContainer->replayFastForward ? REPLAY_BAR_FAST_FORWARD_BUTTON_ACTIVE_SPRITE : REPLAY_BAR_FAST_FORWARD_BUTTON_SPRITE)); + globalContainer->gfx->drawSprite( x - inc*3, y, globalContainer->gameGui, (!gamePaused && !globalContainer->replayFastForward ? REPLAY_BAR_PLAY_BUTTON_ACTIVE_SPRITE : REPLAY_BAR_PLAY_BUTTON_SPRITE)); + globalContainer->gfx->drawSprite( x - inc*2, y, globalContainer->gameGui, (gamePaused ? REPLAY_BAR_PAUSE_BUTTON_ACTIVE_SPRITE : REPLAY_BAR_PAUSE_BUTTON_SPRITE)); + globalContainer->gfx->drawSprite( x - inc*1, y, globalContainer->gameGui, (!gamePaused && globalContainer->replayFastForward ? REPLAY_BAR_FAST_FORWARD_BUTTON_ACTIVE_SPRITE : REPLAY_BAR_FAST_FORWARD_BUTTON_SPRITE)); // Calculate the time // This is based on default speed 25 fps, not the actual Engine's speed @@ -3812,7 +3812,7 @@ void GameGUI::drawReplayProgressBar(bool drawBackground) if (time2_hour <= 99) { globalContainer->gfx->drawString(REPLAY_BAR_TIMER_X, y+3, globalContainer->littleFont, - FormatableString("%0:%1:%2 / %3:%4:%5") + FormattableString("%0:%1:%2 / %3:%4:%5") .arg(time1_hour) .arg(time1_min,2,10,'0') .arg(time1_sec,2,10,'0') @@ -3825,7 +3825,7 @@ void GameGUI::drawReplayProgressBar(bool drawBackground) { // Time did not get saved properly, don't show it globalContainer->gfx->drawString(REPLAY_BAR_TIMER_X, y+3, globalContainer->littleFont, - FormatableString("%0:%1:%2") + FormattableString("%0:%1:%2") .arg(time1_hour) .arg(time1_min,2,10,'0') .arg(time1_sec,2,10,'0') @@ -3843,7 +3843,7 @@ void GameGUI::drawReplayProgressBar(bool drawBackground) { for (int i = 0; i < REPLAY_BAR_WIDTH; i += 32) { - globalContainer->gfx->drawSprite(i, REPLAY_BAR_Y-4, globalContainer->gamegui, 16); + globalContainer->gfx->drawSprite(i, REPLAY_BAR_Y-4, globalContainer->gameGui, 16); } } } @@ -3862,7 +3862,7 @@ void GameGUI::drawPanel(void) else globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH, 133, RIGHT_MENU_WIDTH, globalContainer->gfx->getH()-128, 0, 0, 40, 180); - if(hilights.find(HilightRightSidePanel) != hilights.end()) + if(highlights.find(HilightRightSidePanel) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, globalContainer->gfx->getH()/2, 38)); } @@ -3878,8 +3878,8 @@ void GameGUI::drawPanel(void) case UNIT_SELECTION: drawUnitInfos(); break; - case RESSOURCE_SELECTION: - drawRessourceInfos(); + case RESOURCE_SELECTION: + drawResourceInfos(); break; default: if (!globalContainer->replaying) @@ -3915,11 +3915,11 @@ void GameGUI::drawPanel(void) drawReplayPanel(); break; case RDM_STAT_TEXT_VIEW: - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+15, YPOS_BASE_STAT+5, globalContainer->littleFont, FormatableString("%0 %1").arg(Toolkit::getStringTable()->getString("[watching:]")).arg(localTeam->getFirstPlayerName()).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+15, YPOS_BASE_STAT+5, globalContainer->littleFont, FormattableString("%0 %1").arg(Toolkit::getStringTable()->getString("[watching:]")).arg(localTeam->getFirstPlayerName()).c_str()); teamStats->drawText(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+RIGHT_MENU_OFFSET, YPOS_BASE_STAT+15); break; case RDM_STAT_GRAPH_VIEW: - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+15, YPOS_BASE_STAT+5, globalContainer->littleFont, FormatableString("%0 %1").arg(Toolkit::getStringTable()->getString("[watching:]")).arg(localTeam->getFirstPlayerName()).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+15, YPOS_BASE_STAT+5, globalContainer->littleFont, FormattableString("%0 %1").arg(Toolkit::getStringTable()->getString("[watching:]")).arg(localTeam->getFirstPlayerName()).c_str()); teamStats->drawStat(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+RIGHT_MENU_OFFSET, YPOS_BASE_STAT+15); drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+155+64, Toolkit::getStringTable()->getString("[Starving Map]"), showStarvingMap); drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+155+88, Toolkit::getStringTable()->getString("[Damaged Map]"), showDamagedMap); @@ -3941,23 +3941,23 @@ void GameGUI::drawFlagView(void) drawChoice(YPOS_BASE_FLAG, flagsChoiceName, flagsChoiceState, 3); // draw choice of area - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gamegui, 13); - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+48+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gamegui, 14); - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+88+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gamegui, 25); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gameGui, 13); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+48+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gameGui, 14); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+88+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gameGui, 25); if (brush.getType() != BrushTool::MODE_NONE) { int decX = 8 + ((int)toolManager.getZoneType()) * 40 + dec; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+decX, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gamegui, 22); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+decX, YPOS_BASE_FLAG+YOFFSET_BRUSH, globalContainer->gameGui, 22); } - if(hilights.find(HilightForbiddenZoneOnPanel) != hilights.end()) + if(highlights.find(HilightForbiddenZoneOnPanel) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+8+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, 38)); } - if(hilights.find(HilightGuardZoneOnPanel) != hilights.end()) + if(highlights.find(HilightGuardZoneOnPanel) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+48+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, 38)); } - if(hilights.find(HilightClearingZoneOnPanel) != hilights.end()) + if(highlights.find(HilightClearingZoneOnPanel) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+88+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, 38)); } @@ -3965,7 +3965,7 @@ void GameGUI::drawFlagView(void) // draw brush brush.draw(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH+40); - if(hilights.find(HilightBrushSelector) != hilights.end()) + if(highlights.find(HilightBrushSelector) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH+40+30, 38)); } @@ -4017,7 +4017,7 @@ void GameGUI::drawTopScreenBar(void) int dec = (globalContainer->gfx->getW()-640)>>2; dec += 10; - globalContainer->unitmini->setBaseColor(localTeam->color); + globalContainer->unitMini->setBaseColor(localTeam->color); for (int i=0; i<3; i++) { free = teamStats->getFreeUnits(i); @@ -4032,22 +4032,22 @@ void GameGUI::drawTopScreenBar(void) else memcpy(actC, whiteC, sizeof(whiteC)); - globalContainer->gfx->drawSprite(dec+2, -1, globalContainer->unitmini, i); + globalContainer->gfx->drawSprite(dec+2, -1, globalContainer->unitMini, i); globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, actC[0], actC[1], actC[2])); - globalContainer->gfx->drawString(dec+22, 0, globalContainer->littleFont, FormatableString("%0 / %1").arg(free).arg(tot).c_str()); + globalContainer->gfx->drawString(dec+22, 0, globalContainer->littleFont, FormattableString("%0 / %1").arg(free).arg(tot).c_str()); globalContainer->littleFont->popStyle(); - if(i==WORKER && hilights.find(HilightWorkersWorkingFreeStat) != hilights.end()) + if(i==WORKER && highlights.find(HilightWorkersWorkingFreeStat) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(dec+22, 32, 39)); } - else if(i==WARRIOR && hilights.find(HilightExplorersWorkingFreeStat) != hilights.end()) + else if(i==WARRIOR && highlights.find(HilightExplorersWorkingFreeStat) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(dec+22, 32, 39)); } - else if(i==EXPLORER && hilights.find(HilightWarriorsWorkingFreeStat) != hilights.end()) + else if(i==EXPLORER && highlights.find(HilightWarriorsWorkingFreeStat) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(dec+22, 32, 39)); } @@ -4056,12 +4056,12 @@ void GameGUI::drawTopScreenBar(void) } // draw prestige stats - globalContainer->gfx->drawString(dec+0, 0, globalContainer->littleFont, FormatableString("%0 / %1 / %2").arg(localTeam->prestige).arg(game.totalPrestige).arg(game.prestigeToReach).c_str()); + globalContainer->gfx->drawString(dec+0, 0, globalContainer->littleFont, FormattableString("%0 / %1 / %2").arg(localTeam->prestige).arg(game.totalPrestige).arg(game.prestigeToReach).c_str()); dec += 90; // draw unit conversion stats - globalContainer->gfx->drawString(dec, 0, globalContainer->littleFont, FormatableString("+%0 / -%1").arg(localTeam->unitConversionGained).arg(localTeam->unitConversionLost).c_str()); + globalContainer->gfx->drawString(dec, 0, globalContainer->littleFont, FormattableString("+%0 / -%1").arg(localTeam->unitConversionGained).arg(localTeam->unitConversionLost).c_str()); // draw CPU load dec += 70; @@ -4088,11 +4088,11 @@ void GameGUI::drawTopScreenBar(void) int pos=globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-16; for (int i=0; igfx->drawSprite(i, 16, globalContainer->gamegui, 16); + globalContainer->gfx->drawSprite(i, 16, globalContainer->gameGui, 16); } for (int i=16; igfx->getH(); i+=32) { - globalContainer->gfx->drawSprite(pos+12, i, globalContainer->gamegui, 17); + globalContainer->gfx->drawSprite(pos+12, i, globalContainer->gameGui, 17); } @@ -4102,7 +4102,7 @@ void GameGUI::drawTopScreenBar(void) index = 7; else index = 6; - globalContainer->gfx->drawSprite(pos, IGM_MAIN_MENU_ICON_Y, globalContainer->gamegui, index); + globalContainer->gfx->drawSprite(pos, IGM_MAIN_MENU_ICON_Y, globalContainer->gameGui, index); // draw alliance button if ( !(hiddenGUIElements & HIDABLE_ALLIANCE) ) @@ -4111,7 +4111,7 @@ void GameGUI::drawTopScreenBar(void) index = 44; else index = 45; - globalContainer->gfx->drawSprite(pos, IGM_ALLIANCE_ICON_Y, globalContainer->gamegui, index); + globalContainer->gfx->drawSprite(pos, IGM_ALLIANCE_ICON_Y, globalContainer->gameGui, index); } // draw objectives button @@ -4119,9 +4119,9 @@ void GameGUI::drawTopScreenBar(void) index = 46; else index = 47; - globalContainer->gfx->drawSprite(pos, IGM_OBJECTIVES_ICON_Y, globalContainer->gamegui, index); + globalContainer->gfx->drawSprite(pos, IGM_OBJECTIVES_ICON_Y, globalContainer->gameGui, index); - if(hilights.find(HilightMainMenuIcon) != hilights.end()) + if(highlights.find(HilightMainMenuIcon) != highlights.end()) { arrowPositions.push_back(HilightArrowPosition(pos-32, 32, 43)); } @@ -4171,10 +4171,10 @@ void GameGUI::drawOverlayInfos(void) } } } - else if (selectionMode==RESSOURCE_SELECTION) + else if (selectionMode==RESOURCE_SELECTION) { - int rx = selection.ressource & game.map.getMaskW(); - int ry = selection.ressource >> game.map.getShiftW(); + int rx = selection.resource & game.map.getMaskW(); + int ry = selection.resource >> game.map.getShiftW(); int px, py; game.map.mapCaseToDisplayable(rx, ry, &px, &py, viewportX, viewportY); globalContainer->gfx->drawCircle(px+16, py+16, 16, 0, 0, 190); @@ -4201,7 +4201,7 @@ void GameGUI::drawOverlayInfos(void) { if (pm&apm) { - globalContainer->gfx->drawString(44, 44+pnb*20, globalContainer->standardFont, FormatableString(Toolkit::getStringTable()->getString("[waiting for %0]")).arg(game.players[pi2]->name).c_str()); + globalContainer->gfx->drawString(44, 44+pnb*20, globalContainer->standardFont, FormattableString(Toolkit::getStringTable()->getString("[waiting for %0]")).arg(game.players[pi2]->name).c_str()); pnb++; } pm=pm<<1; @@ -4250,7 +4250,7 @@ void GameGUI::drawOverlayInfos(void) // show script counter if (game.sgslScript.getMainTimer()) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-165, ymesg, globalContainer->standardFont, FormatableString("%0").arg(game.sgslScript.getMainTimer()).c_str()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-165, ymesg, globalContainer->standardFont, FormattableString("%0").arg(game.sgslScript.getMainTimer()).c_str()); yinc = std::max(yinc, 32); } @@ -4274,7 +4274,7 @@ void GameGUI::drawOverlayInfos(void) // Draw icon if trasmitting if (globalContainer->voiceRecorder->recordingNow) - globalContainer->gfx->drawSprite(5, globalContainer->gfx->getH()-50, globalContainer->gamegui, 24); + globalContainer->gfx->drawSprite(5, globalContainer->gfx->getH()-50, globalContainer->gameGui, 24); // Draw which players are transmitting voice int xinc = 42; @@ -4284,8 +4284,8 @@ void GameGUI::drawOverlayInfos(void) { if(xinc==42) { - globalContainer->gamegui->setBaseColor(game.teams[game.players[p]->teamNumber]->color); - globalContainer->gfx->drawSprite(42, globalContainer->gfx->getH()-55, globalContainer->gamegui, 30); + globalContainer->gameGui->setBaseColor(game.teams[game.players[p]->teamNumber]->color); + globalContainer->gfx->drawSprite(42, globalContainer->gfx->getH()-55, globalContainer->gameGui, 30); xinc += 47; } int height = globalContainer->standardFont->getStringHeight(game.players[p]->name.c_str()); @@ -4464,7 +4464,7 @@ void GameGUI::drawAll(int team) // draw the hilight arrows for(int i=0; i<(int)arrowPositions.size(); ++i) { - globalContainer->gfx->drawSprite(arrowPositions[i].x, arrowPositions[i].y, globalContainer->gamegui, arrowPositions[i].sprite); + globalContainer->gfx->drawSprite(arrowPositions[i].x, arrowPositions[i].y, globalContainer->gameGui, arrowPositions[i].sprite); } } @@ -4537,12 +4537,12 @@ void GameGUI::executeOrder(boost::shared_ptr order) if (messageOrderType==MessageOrder::NORMAL_MESSAGE_TYPE) { if (mo->recepientsMask &(1<name).arg(mo->getText()), true); + addMessage(Color(230, 230, 230), FormattableString("%0 : %1").arg(game.players[sp]->name).arg(mo->getText()), true); } else if (messageOrderType==MessageOrder::PRIVATE_MESSAGE_TYPE) { if (mo->recepientsMask &(1< %2").arg(Toolkit::getStringTable()->getString("[from:]")).arg(game.players[sp]->name).arg(mo->getText()), true); + addMessage(Color(99, 255, 242), FormattableString("<%0%1> %2").arg(Toolkit::getStringTable()->getString("[from:]")).arg(game.players[sp]->name).arg(mo->getText()), true); else if (sp==localPlayer) { Uint32 rm=mo->recepientsMask; @@ -4550,7 +4550,7 @@ void GameGUI::executeOrder(boost::shared_ptr order) for (k=0; k %2").arg(Toolkit::getStringTable()->getString("[to:]")).arg(game.players[k]->name).arg(mo->getText()), true); + addMessage(Color(99, 255, 242), FormattableString("<%0%1> %2").arg(Toolkit::getStringTable()->getString("[to:]")).arg(game.players[k]->name).arg(mo->getText()), true); break; } else @@ -4567,7 +4567,7 @@ void GameGUI::executeOrder(boost::shared_ptr order) case ORDER_VOICE_DATA: { boost::shared_ptr ov = static_pointer_cast(order); - if (ov->recepientsMask & (1<recipientsMask & (1<mix->addVoiceData(ov); game.executeOrder(order, localPlayer); } @@ -4577,7 +4577,7 @@ void GameGUI::executeOrder(boost::shared_ptr order) int qp=order->sender; if (qp==localPlayer) isRunning=false; - addMessage(Color(200, 200, 200), FormatableString(Toolkit::getStringTable()->getString("[%0 has left the game]")).arg(game.players[qp]->name), true); + addMessage(Color(200, 200, 200), FormattableString(Toolkit::getStringTable()->getString("[%0 has left the game]")).arg(game.players[qp]->name), true); game.executeOrder(order, localPlayer); } break; @@ -4658,7 +4658,7 @@ bool GameGUI::load(GAGCore::InputStream *stream, bool ignoreGUIData) std::cerr << "GameGUI::load : can't load game" << std::endl; return false; } - defualtGameSaveName = game.mapHeader.getMapName(); + defaultGameSaveName = game.mapHeader.getMapName(); if (game.mapHeader.getIsSavedGame()) { // load gui's specific infos @@ -4752,7 +4752,7 @@ void GameGUI::save(GAGCore::OutputStream *stream, const std::string name) void GameGUI::drawButton(int x, int y, std::string caption, int r, int g, int b, bool doLanguageLookup) { - globalContainer->gfx->drawSprite(x+8, y, globalContainer->gamegui, 12); + globalContainer->gfx->drawSprite(x+8, y, globalContainer->gameGui, 12); globalContainer->gfx->drawFilledRect(x+17, y+3, 94, 10, r, g, b); std::string textToDraw; @@ -4788,17 +4788,17 @@ void GameGUI::drawScrollBox(int x, int y, int value, int valueLocal, int act, in { //scrollbar borders globalContainer->gfx->setClipRect(x+8, y, 112, 16); - globalContainer->gfx->drawSprite(x+8, y, globalContainer->gamegui, 9); + globalContainer->gfx->drawSprite(x+8, y, globalContainer->gameGui, 9); //localBar int size=(valueLocal*92)/max; globalContainer->gfx->setClipRect(x+18, y, size, 16); - globalContainer->gfx->drawSprite(x+18, y+3, globalContainer->gamegui, 10); + globalContainer->gfx->drawSprite(x+18, y+3, globalContainer->gameGui, 10); //actualBar size=(act*92)/max; globalContainer->gfx->setClipRect(x+18, y, size, 16); - globalContainer->gfx->drawSprite(x+18, y+4, globalContainer->gamegui, 11); + globalContainer->gfx->drawSprite(x+18, y+4, globalContainer->gameGui, 11); globalContainer->gfx->setClipRect(); } @@ -4808,10 +4808,10 @@ void GameGUI::drawXPProgressBar(int x, int y, int act, int max) globalContainer->gfx->setClipRect(x+8, y, 112, 16); globalContainer->gfx->setClipRect(x+18, y, 92, 16); - globalContainer->gfx->drawSprite(x+18, y+3, globalContainer->gamegui, 10); + globalContainer->gfx->drawSprite(x+18, y+3, globalContainer->gameGui, 10); globalContainer->gfx->setClipRect(x+18, y, (act*92)/max, 16); - globalContainer->gfx->drawSprite(x+18, y+4, globalContainer->gamegui, 11); + globalContainer->gfx->drawSprite(x+18, y+4, globalContainer->gameGui, 11); globalContainer->gfx->setClipRect(); } @@ -4858,9 +4858,9 @@ void GameGUI::setSelection(SelectionMode newSelMode, unsigned newSelection) selection.unit=game.teams[team]->myUnits[id]; game.selectedUnit=selection.unit; } - else if (selectionMode==RESSOURCE_SELECTION) + else if (selectionMode==RESOURCE_SELECTION) { - selection.ressource=newSelection; + selection.resource=newSelection; } } @@ -5136,15 +5136,15 @@ void GameGUI::setCampaignGame(Campaign& campaign, const std::string& missionName void GameGUI::updateHilightInGame() { game.highlightUnitType = 0; - if(hilights.find(HilightWorkers) != hilights.end()) + if(highlights.find(HilightWorkers) != highlights.end()) { game.highlightUnitType |= 1< hilights; + std::set highlights; struct HilightArrowPosition { @@ -190,7 +190,7 @@ class GameGUI ///proccess, and they are drawn last std::vector arrowPositions; - ///This sends the hilight values to the Game class, setting Game::highlightBuildingType and Game::highlightUnitType + ///This sends the highlight values to the Game class, setting Game::highlightBuildingType and Game::highlightUnitType void updateHilightInGame(); KeyboardManager keyboardManager; @@ -200,7 +200,7 @@ class GameGUI bool gamePaused; bool hardPause; bool isRunning; - bool notmenu; + bool notMenu; //! true if user close the glob2 window. bool exitGlobCompletely; //! true if the game needs to flush all outgoing orders and exit @@ -238,7 +238,7 @@ class GameGUI void drawRedButton(int x, int y, std::string caption, bool doLanguageLookup=true); void drawTextCenter(int x, int y, std::string caption); void drawValueAlignedRight(int y, int v); - void drawCosts(int ressources[BASIC_COUNT], Font *font); + void drawCosts(int resources[BASIC_COUNT], Font *font); void drawCheckButton(int x, int y, std::string caption, bool isSet); void drawRadioButton(int x, int y, bool isSet); @@ -265,8 +265,8 @@ class GameGUI void drawUnitInfos(void); //! Draw the infos and actions from a building void drawBuildingInfos(void); - //! Draw the infos about a ressource on map (type and number left) - void drawRessourceInfos(void); + //! Draw the infos about a resource on map (type and number left) + void drawResourceInfos(void); //! Draw the replay panel void drawReplayPanel(void); //! Draw the bottom bar with the replay's time bar @@ -315,7 +315,7 @@ class GameGUI NO_SELECTION=0, BUILDING_SELECTION, UNIT_SELECTION, - RESSOURCE_SELECTION, + RESOURCE_SELECTION, TOOL_SELECTION, BRUSH_SELECTION } selectionMode; @@ -323,7 +323,7 @@ class GameGUI { Building* building; Unit* unit; - int ressource; + int resource; } selection; // Brushes @@ -368,11 +368,11 @@ class GameGUI //! whether script text was updated in last step, required because of our translation override common text mechanism bool scriptTextUpdated; - //! True if the mouse's button way never relased since selection. + //! True if the mouse's button way never released since selection. bool selectionPushed; //! The position of the flag when it was pushed. Sint32 selectionPushedPosX, selectionPushedPosY; - //! True if the mouse's button way never relased since click im minimap. + //! True if the mouse's button way never released since click im minimap. bool miniMapPushed; //! True if we try to put a mark in the minimap bool putMark; @@ -420,7 +420,7 @@ class GameGUI ///Denotes the name of the game save for saving, ///set on loading the map - std::string defualtGameSaveName; + std::string defaultGameSaveName; bool hasEndOfGameDialogBeenShown; @@ -479,7 +479,7 @@ class GameGUI int lifeSpan; //!< maximum age of the particle int startImg; //!< image of the particle at birth - int endImg; //!< image of the partile at death + int endImg; //!< image of the particle at death Color color; //!< color (team) of this particle }; diff --git a/src/GameGUIToolManager.cpp b/src/GameGUIToolManager.cpp index 4074a709d..d090f35f8 100644 --- a/src/GameGUIToolManager.cpp +++ b/src/GameGUIToolManager.cpp @@ -139,7 +139,7 @@ void GameGUIToolManager::drawTool(int mouseX, int mouseY, int localteam, int vie lines. (The intensities used below are 2/3 as bright for the case of removing areas.) */ /* This reasoning should be abstracted out and reused - in MapEdit.cpp to choose a color for those cases + in MapEdit.cpp to choose a color for those tiles where areas are being drawn. */ unsigned mode = brush.getType(); switch(mode) @@ -453,7 +453,7 @@ void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int v globalContainer->gfx->drawLine(batX+batW-1, batY, batX, batY+batH-1, 255, 0, 0, 127); globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 255, 0, 0, 127)); - globalContainer->gfx->drawString(batX, batY-12, globalContainer->littleFont, FormatableString("%0.%1").arg(game.teams[localteam]->noMoreBuildingSitesCountdown/40).arg((game.teams[localteam]->noMoreBuildingSitesCountdown%40)/4).c_str()); + globalContainer->gfx->drawString(batX, batY-12, globalContainer->littleFont, FormattableString("%0.%1").arg(game.teams[localteam]->noMoreBuildingSitesCountdown/40).arg((game.teams[localteam]->noMoreBuildingSitesCountdown%40)/4).c_str()); globalContainer->littleFont->popStyle(); } else diff --git a/src/GlobalContainer.cpp b/src/GlobalContainer.cpp index 4e0ad1b0a..f10647a17 100644 --- a/src/GlobalContainer.cpp +++ b/src/GlobalContainer.cpp @@ -106,7 +106,7 @@ GlobalContainer::GlobalContainer(void) terrain = NULL; terrainShader = NULL; terrainBlack = NULL; - ressources = NULL; + resources = NULL; units = NULL; unitsSkins = NULL; @@ -588,8 +588,8 @@ void GlobalContainer::loadClient(void) updateLoadProgressScreen(60); // load resources - ressources = Toolkit::getSprite("data/gfx/ressource"); - ressourceMini = Toolkit::getSprite("data/gfx/ressourcemini"); + resources = Toolkit::getSprite("data/gfx/ressource"); + resourceMini = Toolkit::getSprite("data/gfx/ressourcemini"); areaClearing = Toolkit::getSprite("data/gfx/area-clearing"); areaForbidden = Toolkit::getSprite("data/gfx/area-forbidden"); areaGuard = Toolkit::getSprite("data/gfx/area-guard"); @@ -604,10 +604,10 @@ void GlobalContainer::loadClient(void) updateLoadProgressScreen(90); // load graphics for gui - unitmini = Toolkit::getSprite("data/gfx/unitmini"); - gamegui = Toolkit::getSprite("data/gfx/gamegui"); + unitMini = Toolkit::getSprite("data/gfx/unitmini"); + gameGui = Toolkit::getSprite("data/gfx/gamegui"); brush = Toolkit::getSprite("data/gfx/brush"); - magiceffect = Toolkit::getSprite("data/gfx/magiceffect"); + magicEffect = Toolkit::getSprite("data/gfx/magiceffect"); particles = Toolkit::getSprite("data/gfx/particle"); // use custom style @@ -639,7 +639,7 @@ void GlobalContainer::load(void) // load default unit types Race::loadDefault(); // load resources types - ressourcesTypes.load("data/ressources.txt"); ///TODO: coding in english or french? english is resources, french is ressources + resourcesTypes.load("data/ressources.txt"); ///TODO: coding in english or french? english is resources, french is ressources #ifndef YOG_SERVER_ONLY loadClient(); @@ -658,7 +658,7 @@ void GlobalContainer::load(void) Uint32 GlobalContainer::getConfigCheckSum() { // TODO: add the units config - return buildingsTypes.checkSum() + ressourcesTypes.checkSum() + Race::checkSumDefault(); + return buildingsTypes.checkSum() + resourcesTypes.checkSum() + Race::checkSumDefault(); } #endif // !YOG_SERVER_ONLY diff --git a/src/GlobalContainer.h b/src/GlobalContainer.h index cd0ed9de4..86a300296 100644 --- a/src/GlobalContainer.h +++ b/src/GlobalContainer.h @@ -83,8 +83,8 @@ class GlobalContainer Sprite *terrainCloud; Sprite *terrainBlack; Sprite *terrainShader; - Sprite *ressources; - Sprite *ressourceMini; + Sprite *resources; + Sprite *resourceMini; Sprite *areaClearing; Sprite *areaForbidden; Sprite *areaGuard; @@ -92,10 +92,10 @@ class GlobalContainer Sprite *bulletExplosion; Sprite *deathAnimation; Sprite *units; - Sprite *unitmini; - Sprite *gamegui; + Sprite *unitMini; + Sprite *gameGui; Sprite *brush; - Sprite *magiceffect; + Sprite *magicEffect; Sprite *particles; UnitsSkins *unitsSkins; @@ -109,7 +109,7 @@ class GlobalContainer #ifndef YOG_SERVER_ONLY BuildingsTypes buildingsTypes; #endif // !YOG_SERVER_ONLY - RessourcesTypes ressourcesTypes; + ResourcesTypes resourcesTypes; std::string videoshotName; //!< the name of videoshot to record. If empty, do not record videoshot bool runNoX; diff --git a/src/Gradient.h b/src/Gradient.h index 493bd8ee3..8478cd230 100644 --- a/src/Gradient.h +++ b/src/Gradient.h @@ -122,7 +122,7 @@ template Uint8 BuildingGradientMethodowner->me; Uint16 bgid=building->gid; - Case& c=map->cases[square]; + Tile& c=map->tiles[square]; bool isWarFlag=false; bool isWarFlagSquare=false; @@ -146,7 +146,7 @@ template Uint8 BuildingGradientMethodclearingRessources[c.ressource.type]) + if(c.resource.type != NO_RES_TYPE && building->clearingResources[c.resource.type]) { isClearingFlagSquare=true; } @@ -160,7 +160,7 @@ template Uint8 BuildingGradientMethodimmobileUnits[square] != 255) return 0; - else if (c.ressource.type!=NO_RES_TYPE && !isClearingFlagSquare) + else if (c.resource.type!=NO_RES_TYPE && !isClearingFlagSquare) return 0; else if (!canSwim && map->isWater(square)) return 0; diff --git a/src/LANMenuScreen.cpp b/src/LANMenuScreen.cpp index 598e49354..0c0bc80db 100644 --- a/src/LANMenuScreen.cpp +++ b/src/LANMenuScreen.cpp @@ -72,7 +72,7 @@ void LANMenuScreen::onAction(Widget *source, Action action, int par1, int par2) shared_ptr server(new YOGServer(YOGAnonymousLogin, YOGSingleGame)); if(!server->isListening()) { - MessageBox(globalContainer->gfx, "standard", MB_ONEBUTTON, FormatableString(Toolkit::getStringTable()->getString("[Can't host game, port %0 in use]")).arg(YOG_SERVER_PORT).c_str(), Toolkit::getStringTable()->getString("[ok]")); + MessageBox(globalContainer->gfx, "standard", MB_ONEBUTTON, FormattableString(Toolkit::getStringTable()->getString("[Can't host game, port %0 in use]")).arg(YOG_SERVER_PORT).c_str(), Toolkit::getStringTable()->getString("[ok]")); endExecute(QuitMenu); } else @@ -88,7 +88,7 @@ void LANMenuScreen::onAction(Widget *source, Action action, int par1, int par2) boost::shared_ptr game(new MultiplayerGame(client)); client->setMultiplayerGame(game); - std::string name = FormatableString(Toolkit::getStringTable()->getString("[%0's game]")).arg(globalContainer->settings.getUsername()); + std::string name = FormattableString(Toolkit::getStringTable()->getString("[%0's game]")).arg(globalContainer->settings.getUsername()); game->createNewGame(name); game->setMapHeader(cms.getMapHeader()); diff --git a/src/MainMenuScreen.cpp b/src/MainMenuScreen.cpp index 75ebde618..7facf8907 100644 --- a/src/MainMenuScreen.cpp +++ b/src/MainMenuScreen.cpp @@ -60,7 +60,7 @@ MainMenuScreen::MainMenuScreen() addWidget(new TextButton(10, 420, 300, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[credits]"), CREDITS)); addWidget(new TextButton(330, 420, 300, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[quit]"), QUIT, 27)); - addWidget(new Text(3, 0, ALIGN_RIGHT, ALIGN_BOTTOM, "standard", FormatableString("V %0.%1.%2").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(NET_PROTOCOL_VERSION).c_str())); + addWidget(new Text(3, 0, ALIGN_RIGHT, ALIGN_BOTTOM, "standard", FormattableString("V %0.%1.%2").arg(VERSION_MAJOR).arg(VERSION_MINOR).arg(NET_PROTOCOL_VERSION).c_str())); addWidget(new Text(3, 0, ALIGN_LEFT, ALIGN_BOTTOM, "standard", PACKAGE_VERSION)); diff --git a/src/Map.cpp b/src/Map.cpp index 41cc44a0f..221a1300b 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -92,10 +92,10 @@ Map::Map() aStarPoints = NULL; for (int t=0; tlogFileManager->getFile("Map.log"); - std::fill(incRessourceLog, incRessourceLog + 16, 0); + std::fill(incResourceLog, incResourceLog + 16, 0); areaNames.resize(9); @@ -225,9 +225,9 @@ Map::Map() Map::~Map(void) { - FILE *resLogFile = globalContainer->logFileManager->getFile("IncRessourceLog.log"); + FILE *resLogFile = globalContainer->logFileManager->getFile("IncResourceLog.log"); for (int i=0; i<=11; i++) - fprintf(resLogFile, "incRessourceLog[%2d] =%8d\n", i, incRessourceLog[i]); + fprintf(resLogFile, "incResourceLog[%2d] =%8d\n", i, incResourceLog[i]); fprintf(resLogFile, "\n"); fflush(resLogFile); clear(); @@ -239,13 +239,13 @@ void Map::clear() if (arraysBuilt) { for (int t=0; treadEnterSection(i); mapDiscovered[i] = stream->readUint32("mapDiscovered"); - cases[i].terrain = stream->readUint16("terrain"); - cases[i].building = stream->readUint16("building"); + tiles[i].terrain = stream->readUint16("terrain"); + tiles[i].building = stream->readUint16("building"); - stream->read(&(cases[i].ressource), 4, "ressource"); - cases[i].groundUnit = stream->readUint16("groundUnit"); - cases[i].airUnit = stream->readUint16("airUnit"); - cases[i].forbidden = stream->readUint32("forbidden"); + stream->read(&(tiles[i].resource), 4, "ressource"); + tiles[i].groundUnit = stream->readUint16("groundUnit"); + tiles[i].airUnit = stream->readUint16("airUnit"); + tiles[i].forbidden = stream->readUint32("forbidden"); if(versionMinor < 62) stream->readUint32("hiddenForbidden"); - cases[i].guardArea = stream->readUint32("guardArea"); - cases[i].clearArea = stream->readUint32("clearArea"); - cases[i].scriptAreas = stream->readUint16("scriptAreas"); - cases[i].canRessourcesGrow = stream->readUint8("canRessourcesGrow"); + tiles[i].guardArea = stream->readUint32("guardArea"); + tiles[i].clearArea = stream->readUint32("clearArea"); + tiles[i].scriptAreas = stream->readUint16("scriptAreas"); + tiles[i].canResourcesGrow = stream->readUint8("canRessourcesGrow"); if(versionMinor >= 63) - cases[i].fertility = stream->readUint16("fertility"); - fertilityMaximum = std::max(fertilityMaximum, cases[i].fertility); + tiles[i].fertility = stream->readUint16("fertility"); + fertilityMaximum = std::max(fertilityMaximum, tiles[i].fertility); stream->readLeaveSection(); } @@ -1106,15 +1106,15 @@ bool Map::load(GAGCore::InputStream *stream, MapHeader& header, Game *game) // This is a game, so we do compute gradients for (int t=0; twriteEnterSection(i); stream->writeUint32(mapDiscovered[i], "mapDiscovered"); - stream->writeUint16(cases[i].terrain, "terrain"); - stream->writeUint16(cases[i].building, "building"); + stream->writeUint16(tiles[i].terrain, "terrain"); + stream->writeUint16(tiles[i].building, "building"); - stream->write(&(cases[i].ressource), 4, "ressource"); + stream->write(&(tiles[i].resource), 4, "ressource"); - stream->writeUint16(cases[i].groundUnit, "groundUnit"); - stream->writeUint16(cases[i].airUnit, "airUnit"); - stream->writeUint32(cases[i].forbidden, "forbidden"); - stream->writeUint32(cases[i].guardArea, "guardArea"); - stream->writeUint32(cases[i].clearArea, "clearArea"); - stream->writeUint16(cases[i].scriptAreas, "scriptAreas"); - stream->writeUint8(cases[i].canRessourcesGrow, "canRessourcesGrow"); - stream->writeUint16(cases[i].fertility, "fertility"); + stream->writeUint16(tiles[i].groundUnit, "groundUnit"); + stream->writeUint16(tiles[i].airUnit, "airUnit"); + stream->writeUint32(tiles[i].forbidden, "forbidden"); + stream->writeUint32(tiles[i].guardArea, "guardArea"); + stream->writeUint32(tiles[i].clearArea, "clearArea"); + stream->writeUint16(tiles[i].scriptAreas, "scriptAreas"); + stream->writeUint8(tiles[i].canResourcesGrow, "canRessourcesGrow"); + stream->writeUint16(tiles[i].fertility, "fertility"); stream->writeLeaveSection(); } stream->writeLeaveSection(); @@ -1247,21 +1247,21 @@ void Map::addTeam(void) assert(numberOfTeam>0); for (int t=0; tressourcesTypes.get(r.type)->expendable) + else if (globalContainer->resourcesTypes.get(r.type)->expendable) { - // we extand ressource: + // we extend resource: int dx, dy; Unit::dxDyFromDirection((syncRand()&7), &dx, &dy); int nx=x+dx; int ny=y+dy; - if(canRessourcesGrow(nx, ny)) - incRessource(nx, ny, r.type, r.variety); + if(canResourcesGrow(nx, ny)) + incResource(nx, ny, r.type, r.variety); } } } @@ -1404,7 +1404,7 @@ void Map::growRessources(void) #ifndef YOG_SERVER_ONLY void Map::syncStep(Uint32 stepCounter) { - growRessources(); + growResources(); for (int i=0; imapHeader.getNumberOfTeams(); for (int t=0; tressourcesTypes.get(r.type); + const ResourceType *fullType = globalContainer->resourcesTypes.get(r.type); - if (!fulltype->shrinkable) + if (!fullType->shrinkable) return; - if (fulltype->eternal) + if (fullType->eternal) { if (r.amount > 0) r.amount--; } else { - if (!fulltype->granular || r.amount<=1) + if (!fullType->granular || r.amount<=1) r.clear(); else r.amount--; } } -void Map::decRessource(int x, int y, int ressourceType) +void Map::decResource(int x, int y, int resourceType) { - if (isRessourceTakeable(x, y, ressourceType)) - decRessource(x, y); + if (isResourceTakeable(x, y, resourceType)) + decResource(x, y); } -bool Map::incRessource(int x, int y, int ressourceType, int variety) +bool Map::incResource(int x, int y, int resourceType, int variety) { - Ressource &r = getCase(x, y).ressource; - const RessourceType *fulltype; - incRessourceLog[0]++; + Resource &r = getTile(x, y).resource; + const ResourceType *fullType; + incResourceLog[0]++; if (r.type == NO_RES_TYPE) { - incRessourceLog[1]++; + incResourceLog[1]++; if (getBuilding(x, y) != NOGBID) return false; - incRessourceLog[2]++; + incResourceLog[2]++; if (getGroundUnit(x, y) != NOGUID) return false; - incRessourceLog[3]++; + incResourceLog[3]++; - fulltype = globalContainer->ressourcesTypes.get(ressourceType); - if (getTerrainType(x, y) == fulltype->terrain) + fullType = globalContainer->resourcesTypes.get(resourceType); + if (getTerrainType(x, y) == fullType->terrain) { - r.type = ressourceType; + r.type = resourceType; r.variety = variety; r.amount = 1; r.animation = 0; - incRessourceLog[4]++; + incResourceLog[4]++; return true; } else { - incRessourceLog[5]++; + incResourceLog[5]++; return false; } } else { - fulltype = globalContainer->ressourcesTypes.get(r.type); - incRessourceLog[6]++; + fullType = globalContainer->resourcesTypes.get(r.type); + incResourceLog[6]++; } - incRessourceLog[7]++; - if (r.type != ressourceType) + incResourceLog[7]++; + if (r.type != resourceType) return false; - incRessourceLog[8]++; - if (!fulltype->shrinkable) + incResourceLog[8]++; + if (!fullType->shrinkable) return false; - incRessourceLog[9]++; - if (r.amount < fulltype->sizesCount) + incResourceLog[9]++; + if (r.amount < fullType->sizesCount) { - incRessourceLog[10]++; + incResourceLog[10]++; r.amount++; return true; } else { - incRessourceLog[11]++; + incResourceLog[11]++; r.amount--; } return false; @@ -1669,7 +1669,7 @@ bool Map::incRessource(int x, int y, int ressourceType, int variety) bool Map::isFreeForGroundUnit(int x, int y, bool canSwim, Uint32 teamMask) const { - if (isRessource(x, y)) + if (isResource(x, y)) return false; if (getBuilding(x, y)!=NOGBID) return false; @@ -1684,7 +1684,7 @@ bool Map::isFreeForGroundUnit(int x, int y, bool canSwim, Uint32 teamMask) const bool Map::isFreeForGroundUnitNoForbidden(int x, int y, bool canSwim) const { - if (isRessource(x, y)) + if (isResource(x, y)) return false; if (getBuilding(x, y)!=NOGBID) return false; @@ -1697,7 +1697,7 @@ bool Map::isFreeForGroundUnitNoForbidden(int x, int y, bool canSwim) const bool Map::isFreeForBuilding(int x, int y) const { - if (isRessource(x, y)) + if (isResource(x, y)) return false; if (getBuilding(x, y)!=NOGBID) return false; @@ -1724,7 +1724,7 @@ bool Map::isFreeForBuilding(int x, int y, int w, int h, Uint16 gid) const for (int xi=x; xiposX; int y=unit->posY; Uint32 me=unit->owner->me; for (int tdx=-1; tdx<=1; tdx++) for (int tdy=-1; tdy<=1; tdy++) - if (isRessource(x+tdx, y+tdy) && ((getForbidden(x+tdx, y+tdy)&me)==0)) + if (isResource(x+tdx, y+tdy) && ((getForbidden(x+tdx, y+tdy)&me)==0)) { *dx=tdx; *dy=tdy; @@ -1841,14 +1841,14 @@ bool Map::doesUnitTouchRessource(Unit *unit, int *dx, int *dy) const return false; } -bool Map::doesUnitTouchRessource(Unit *unit, int ressourceType, int *dx, int *dy) const +bool Map::doesUnitTouchResource(Unit *unit, int resourceType, int *dx, int *dy) const { int x=unit->posX; int y=unit->posY; Uint32 me=unit->owner->me; for (int tdx=-1; tdx<=1; tdx++) for (int tdy=-1; tdy<=1; tdy++) - if (isRessourceTakeable(x+tdx, y+tdy, ressourceType) && ((getForbidden(x+tdx, y+tdy)&me)==0)) + if (isResourceTakeable(x+tdx, y+tdy, resourceType) && ((getForbidden(x+tdx, y+tdy)&me)==0)) { *dx=tdx; *dy=tdy; @@ -1857,11 +1857,11 @@ bool Map::doesUnitTouchRessource(Unit *unit, int ressourceType, int *dx, int *dy return false; } -bool Map::doesPosTouchRessource(int x, int y, int ressourceType, int *dx, int *dy) const +bool Map::doesPosTouchResource(int x, int y, int resourceType, int *dx, int *dy) const { for (int tdx=-1; tdx<=1; tdx++) for (int tdy=-1; tdy<=1; tdy++) - if (isRessourceTakeable(x+tdx, y+tdy,ressourceType)) + if (isResourceTakeable(x+tdx, y+tdy,resourceType)) { *dx=tdx; *dy=tdy; @@ -2005,45 +2005,45 @@ void Map::setUMatPos(int x, int y, TerrainType t, int l) { if (getUMTerrain(dx,dy-1)==WATER) { -// setNoRessource(dx, dy-1, 1); +// setNoResource(dx, dy-1, 1); setUMTerrain(dx,dy-1,SAND); } if (getUMTerrain(dx,dy+1)==WATER) { -// setNoRessource(dx, dy+1, 1); +// setNoResource(dx, dy+1, 1); setUMTerrain(dx,dy+1,SAND); } if (getUMTerrain(dx-1,dy)==WATER) { -// setNoRessource(dx-1, dy, 1); +// setNoResource(dx-1, dy, 1); setUMTerrain(dx-1,dy,SAND); } if (getUMTerrain(dx+1,dy)==WATER) { -// setNoRessource(dx+1, dy, 1); +// setNoResource(dx+1, dy, 1); setUMTerrain(dx+1,dy,SAND); } if (getUMTerrain(dx-1,dy-1)==WATER) { -// setNoRessource(dx-1, dy-1, 1); +// setNoResource(dx-1, dy-1, 1); setUMTerrain(dx-1,dy-1,SAND); } if (getUMTerrain(dx+1,dy-1)==WATER) { -// setNoRessource(dx+1, dy-1, 1); +// setNoResource(dx+1, dy-1, 1); setUMTerrain(dx+1,dy-1,SAND); } if (getUMTerrain(dx+1,dy+1)==WATER) { -// setNoRessource(dx+1, dy+1, 1); +// setNoResource(dx+1, dy+1, 1); setUMTerrain(dx+1,dy+1,SAND); } if (getUMTerrain(dx-1,dy+1)==WATER) { -// setNoRessource(dx-1, dy+1, 1); +// setNoResource(dx-1, dy+1, 1); setUMTerrain(dx-1,dy+1,SAND); } } @@ -2051,45 +2051,45 @@ void Map::setUMatPos(int x, int y, TerrainType t, int l) { if (getUMTerrain(dx,dy-1)==GRASS) { -// setNoRessource(dx, dy-1, 1); +// setNoResource(dx, dy-1, 1); setUMTerrain(dx,dy-1,SAND); } if (getUMTerrain(dx,dy+1)==GRASS) { -// setNoRessource(dx, dy+1, 1); +// setNoResource(dx, dy+1, 1); setUMTerrain(dx,dy+1,SAND); } if (getUMTerrain(dx-1,dy)==GRASS) { -// setNoRessource(dx-1, dy, 1); +// setNoResource(dx-1, dy, 1); setUMTerrain(dx-1,dy,SAND); } if (getUMTerrain(dx+1,dy)==GRASS) { -// setNoRessource(dx+1, dy, 1); +// setNoResource(dx+1, dy, 1); setUMTerrain(dx+1,dy,SAND); } if (getUMTerrain(dx-1,dy-1)==GRASS) { -// setNoRessource(dx-1, dy-1, 1); +// setNoResource(dx-1, dy-1, 1); setUMTerrain(dx-1,dy-1,SAND); } if (getUMTerrain(dx+1,dy-1)==GRASS) { -// setNoRessource(dx+1, dy-1, 1); +// setNoResource(dx+1, dy-1, 1); setUMTerrain(dx+1,dy-1,SAND); } if (getUMTerrain(dx+1,dy+1)==GRASS) { -// setNoRessource(dx+1, dy+1, 1); +// setNoResource(dx+1, dy+1, 1); setUMTerrain(dx+1,dy+1,SAND); } if (getUMTerrain(dx-1,dy+1)==GRASS) { -// setNoRessource(dx-1, dy+1, 1); +// setNoResource(dx-1, dy+1, 1); setUMTerrain(dx-1,dy+1,SAND); } } @@ -2101,28 +2101,28 @@ void Map::setUMatPos(int x, int y, TerrainType t, int l) regenerateMap(x-(l>>1)-2,y-(l>>1)-2,l+3,l+3); } -void Map::setNoRessource(int x, int y, int l) +void Map::setNoResource(int x, int y, int l) { assert(l>=0); assert(l>1); dx>1)+1; dx++) for (int dy=y-(l>>1); dy>1)+1; dy++) - cases[coordToIndex(dx, dy)].ressource.clear(); + tiles[coordToIndex(dx, dy)].resource.clear(); } -void Map::setRessource(int x, int y, int type, int l) +void Map::setResource(int x, int y, int type, int l) { assert(l>=0); assert(l>1); dx>1)+1; dx++) for (int dy=y-(l>>1); dy>1)+1; dy++) - if (isRessourceAllowed(dx, dy, type)) + if (isResourceAllowed(dx, dy, type)) { - Ressource& rp=cases[coordToIndex(dx, dy)].ressource; + Resource& rp=tiles[coordToIndex(dx, dy)].resource; rp.type=type; - const RessourceType *rt=globalContainer->ressourcesTypes.get(type); + const ResourceType *rt=globalContainer->resourcesTypes.get(type); rp.variety=syncRand()%rt->varietiesCount; assert(rt->sizesCount>1); rp.amount=1+syncRand()%(rt->sizesCount-1); @@ -2130,24 +2130,24 @@ void Map::setRessource(int x, int y, int type, int l) } } -bool Map::isRessourceAllowed(int x, int y, int type) +bool Map::isResourceAllowed(int x, int y, int type) { - return (getBuilding(x, y) == NOGBID) && (getGroundUnit(x, y) == NOGUID) && (getTerrainType(x, y)==globalContainer->ressourcesTypes.get(type)->terrain); + return (getBuilding(x, y) == NOGBID) && (getGroundUnit(x, y) == NOGUID) && (getTerrainType(x, y)==globalContainer->resourcesTypes.get(type)->terrain); } bool Map::isPointSet(int n, int x, int y) const { - return getCase(x, y).scriptAreas & 1<1; //Because 0==obstacle, 1==no obstacle, but you don't know if there is anything around. } -bool Map::ressourceAvailable(int teamNumber, int ressourceType, bool canSwim, int x, int y, int *dist) const +bool Map::resourceAvailable(int teamNumber, int resourceType, bool canSwim, int x, int y, int *dist) const { - Uint8 g = getGradient(teamNumber, ressourceType, canSwim, x, y); + Uint8 g = getGradient(teamNumber, resourceType, canSwim, x, y); if (g>1) { *dist = 255-g; @@ -2238,22 +2238,22 @@ bool Map::ressourceAvailable(int teamNumber, int ressourceType, bool canSwim, in return false; } -bool Map::ressourceAvailableUpdate(int teamNumber, int ressourceType, bool canSwim, int x, int y, Sint32 *targetX, Sint32 *targetY, int *dist) +bool Map::resourceAvailableUpdate(int teamNumber, int resourceType, bool canSwim, int x, int y, Sint32 *targetX, Sint32 *targetY, int *dist) { // distance and availability bool result; if (dist) - result = ressourceAvailable(teamNumber, ressourceType, canSwim, x, y, dist); + result = resourceAvailable(teamNumber, resourceType, canSwim, x, y, dist); else - result = ressourceAvailable(teamNumber, ressourceType, canSwim, x, y); + result = resourceAvailable(teamNumber, resourceType, canSwim, x, y); // target position - Uint8 *gradient = ressourcesGradient[teamNumber][ressourceType][canSwim]; - ressourceAvailableCount[teamNumber][ressourceType]++; + Uint8 *gradient = resourcesGradient[teamNumber][resourceType][canSwim]; + resourceAvailableCount[teamNumber][resourceType]++; if (getGlobalGradientDestination(gradient, x, y, targetX, targetY)) - ressourceAvailableCountSuccess[teamNumber][ressourceType]++; + resourceAvailableCountSuccess[teamNumber][resourceType]++; else - ressourceAvailableCountFailure[teamNumber][ressourceType]++; + resourceAvailableCountFailure[teamNumber][resourceType]++; return result; } @@ -2313,7 +2313,7 @@ bool Map::getGlobalGradientDestination(Uint8 *gradient, int x, int y, Sint32 *ta /* This was the old way. I was much more complex but reliable with partially broken gradients. Let's keep it for now in case of such type of gradient reappears -bool Map::ressourceAvailable(int teamNumber, int ressourceType, bool canSwim, int x, int y, Sint32 *targetX, Sint32 *targetY, int *dist) +bool Map::resourceAvailable(int teamNumber, int resourceType, bool canSwim, int x, int y, Sint32 *targetX, Sint32 *targetY, int *dist) commented out version last seen in revision 0ea2652945a0 @@ -2343,7 +2343,7 @@ template void Map::updateGlobalGradientSlow(Uint8 *gradient) wrong. Given the results of the tests, this will never happen. The easiest way to provide a listedAddr[] which guarantee a correct result, is to put only references to gradient heights that are all the same. Currently this is the case of all gradient computation but - the AI ones (GT_UNDEFINED). For further undestanding you have to dig into the code and + the AI ones (GT_UNDEFINED). For further understanding you have to dig into the code and try #define check_disorderable_gradient_error_probability */ template void Map::updateGlobalGradientVersionSimple( Uint8 *gradient, Tint *listedAddr, size_t listCountWrite, GradientType gradientType) @@ -2416,7 +2416,7 @@ template void Map::updateGlobalGradientVersionSimon(Uint8 *gradie /* This algorithm uses the fact that all fields which are adjacent to the field directly below the current one, are also adjacent to either the field to its left or right. Thus this field only needs to become a source if its left or right - is not accessable. The same with the other 3 directions. + is not accessible. The same with the other 3 directions. | | | | ------+-------+------ @@ -2458,7 +2458,7 @@ template void Map::updateGlobalGradientVersionSimon(Uint8 *gradie Uint8 side; { // In this scope we care only about the diagonal neighbours. /* We will use flags to mark if at least one of the 2 fields - next to a adjacent nondiagonal field is not accessable. + next to a adjacent non-diagonal field is not accessible. Binary representation: 9 = 1001 3 = 0011 @@ -2488,11 +2488,11 @@ template void Map::updateGlobalGradientVersionSimon(Uint8 *gradie *addr = g; listedAddr[(listCountWrite++)&(size-1)] = deltaAddrC[ci]; } - else if (side == 0) // If field is inaccessable, + else if (side == 0) // If field is inaccessible, flag |= diagFlags[ci]; // mark the corresponding bit } } - { // Now we take a look at our nondiagonal neighbours + { // Now we take a look at our non-diagonal neighbours size_t deltaAddrC[4]; deltaAddrC[0] = (yu << wDec) | x ; // _|0|_ @@ -2509,7 +2509,7 @@ template void Map::updateGlobalGradientVersionSimon(Uint8 *gradie { *addr = g; // Only mark this as a new source, - // if its left or right was inaccessable. + // if its left or right was inaccessible. if (flag & 1) // Information is in the first bit listedAddr[(listCountWrite++)&(size-1)] = deltaAddrC[ci]; #if defined(LOG_SIMON_GRADIENT) @@ -2546,7 +2546,7 @@ template void Map::updateGlobalGradientVersionKai(Uint8 *gradient size_t listCountRead = 0; // Index of first untreated field in listedAddr. #if defined(LOG_GRADIENT_LINE_GRADIENT) - std::map dcount; + std::map dCount; #endif #if defined(LOG_SIMON_GRADIENT) size_t spared=0; @@ -2580,24 +2580,24 @@ template void Map::updateGlobalGradientVersionKai(Uint8 *gradient // Get the length of the segment. size_t d; // Length of the line segment. - size_t ylineDec = y << wDec; // Line the field is in. + size_t yLineDec = y << wDec; // Line the field is in. // remember: && and || only compute second argument if they have to. for (d=1; (++listCountRead < listCountWrite); d++) // While not empty. { pos = listedAddr[listCountRead&sizeMask]; // Next untreated field. - // We can tollerate gaps of length 1. + // We can tolerate gaps of length 1. // Break if this field has not the same g as I, or is not the one // to my right or the one behind this. if (gradient[pos] != myg) // Need same g for all fields in line. break; - if (pos == (ylineDec | ( (d + x) & wMask ) ) ) + if (pos == (yLineDec | ( (d + x) & wMask ) ) ) continue; // If the next field is beside to the right. #define ALLOW_SMALL_GAPS #if defined( ALLOW_SMALL_GAPS ) - if (pos == (ylineDec | ( (d + 1 + x) & wMask ) ) ) + if (pos == (yLineDec | ( (d + 1 + x) & wMask ) ) ) { // If it is behind it. We overleap one field. - addr = &gradient[(ylineDec | ( (x+d++) & wMask ) )]; + addr = &gradient[(yLineDec | ( (x+d++) & wMask ) )]; side = *addr; if ( side>0 && side void Map::updateGlobalGradientVersionKai(Uint8 *gradient // d is the size of the segment. listCountRead is in correct position. #if defined( LOG_GRADIENT_LINE_GRADIENT ) - ++dcount[d]; + ++dCount[d]; #endif - bool leftflag=false; // True if we might need to put the field left - bool rightflag=false; // resp. right of the segment to listedAddr. + bool leftFlag=false; // True if we might need to put the field left + bool rightFlag=false; // resp. right of the segment to listedAddr. // Handle the upper line first then the lower line. - ylineDec = yu << wDec; + yLineDec = yu << wDec; for (int upperOrLower=0;upperOrLower<=1;upperOrLower++) { // The left of the first field is special, // since we have to test its left. - pos = ylineDec | ( (x-1) & wMask ); + pos = yLineDec | ( (x-1) & wMask ); addr = &gradient[pos]; side = *addr; if ( side>0 && side0 && side void Map::updateGlobalGradientVersionKai(Uint8 *gradient // The right of the last field is special, // since we have to test its right. - pos = ylineDec | ( (x+d) & wMask ); + pos = yLineDec | ( (x+d) & wMask ); addr = &gradient[pos]; side = *addr; if ( side>0 && side void Map::updateGlobalGradientVersionKai(Uint8 *gradient *addr = g; listedAddr[(listCountWrite++)&sizeMask] = pos; } else if (side == 0) - rightflag=true; + rightFlag=true; - ylineDec = yd << wDec; // Change attention to the lower line. + yLineDec = yd << wDec; // Change attention to the lower line. } // The segment is processed. // Now handle leftmost and rightmost field. @@ -2669,7 +2669,7 @@ template void Map::updateGlobalGradientVersionKai(Uint8 *gradient if ( side>0 && side void Map::updateGlobalGradientVersionKai(Uint8 *gradient if ( side>0 && side void Map::updateGlobalGradientVersionKai(Uint8 *gradient #if defined( LOG_GRADIENT_LINE_GRADIENT ) FILE *dlog = globalContainer->logFileManager->getFile("GradientLineLength.log"); - for (std::map::iterator it=dcount.begin();it!=dcount.end();it++) + for (std::map::iterator it=dCount.begin();it!=dCount.end();it++) fprintf(dlog,"line length: %3d count: %4d\n",it->first,it->second); #endif } @@ -2800,17 +2800,17 @@ template void Map::updateGlobalGradient( #endif } -void Map::updateRessourcesGradient(int teamNumber, Uint8 ressourceType, bool canSwim) +void Map::updateResourcesGradient(int teamNumber, Uint8 resourceType, bool canSwim) { if (size <= 65536) - updateRessourcesGradient(teamNumber, ressourceType, canSwim); + updateResourcesGradient(teamNumber, resourceType, canSwim); else - updateRessourcesGradient(teamNumber, ressourceType, canSwim); + updateResourcesGradient(teamNumber, resourceType, canSwim); } -template void Map::updateRessourcesGradient(int teamNumber, Uint8 ressourceType, bool canSwim) +template void Map::updateResourcesGradient(int teamNumber, Uint8 resourceType, bool canSwim) { - Uint8 *gradient=ressourcesGradient[teamNumber][ressourceType][canSwim]; + Uint8 *gradient=resourcesGradient[teamNumber][resourceType][canSwim]; assert(gradient); Tint *listedAddr = new Tint[size]; size_t listCountWrite = 0; @@ -2819,12 +2819,12 @@ template void Map::updateRessourcesGradient(int teamNumber, Uint8 assert(globalContainer); for (size_t i=0; i void Map::updateRessourcesGradient(int teamNumber, Uint8 else gradient[i]=1; } - else if (c.ressource.type==ressourceType) + else if (c.resource.type==resourceType) { - if (globalContainer->ressourcesTypes.get(ressourceType)->visibleToBeCollected && !(fogOfWar[i]&teamMask)) + if (globalContainer->resourcesTypes.get(resourceType)->visibleToBeCollected && !(fogOfWar[i]&teamMask)) gradient[i]=0; else { @@ -2851,11 +2851,11 @@ template void Map::updateRessourcesGradient(int teamNumber, Uint8 delete[] listedAddr; } -bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool strict, bool verbose) const +bool Map::directionFromMiniGrad(Uint8 miniGrad[25], int *dx, int *dy, const bool strict, bool verbose) const { Uint8 max; Uint8 mxd; // max in direction - Uint32 maxs[8]; + Uint32 maxS[8]; max=mxd=miniGrad[1+1*5]; if (max && max!=255) @@ -2867,7 +2867,7 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[1+0*5]); UPDATE_MAX(max,miniGrad[2+0*5]); } - maxs[0]=(max<<8)|mxd; + maxS[0]=(max<<8)|mxd; max=mxd=miniGrad[3+1*5]; if (max && max!=255) { @@ -2878,7 +2878,7 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[4+1*5]); UPDATE_MAX(max,miniGrad[4+2*5]); } - maxs[1]=(max<<8)|mxd; + maxS[1]=(max<<8)|mxd; max=mxd=miniGrad[3+3*5]; if (max && max!=255) { @@ -2889,7 +2889,7 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[3+4*5]); UPDATE_MAX(max,miniGrad[2+4*5]); } - maxs[2]=(max<<8)|mxd; + maxS[2]=(max<<8)|mxd; max=mxd=miniGrad[1+3*5]; if (max && max!=255) { @@ -2900,7 +2900,7 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[0+3*5]); UPDATE_MAX(max,miniGrad[0+2*5]); } - maxs[3]=(max<<8)|mxd; + maxS[3]=(max<<8)|mxd; max=mxd=miniGrad[2+1*5]; @@ -2911,7 +2911,7 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[2+0*5]); UPDATE_MAX(max,miniGrad[3+0*5]); } - maxs[4]=(max<<8)|mxd; + maxS[4]=(max<<8)|mxd; max=mxd=miniGrad[3+2*5]; if (max && max!=255) { @@ -2920,7 +2920,7 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[4+2*5]); UPDATE_MAX(max,miniGrad[4+3*5]); } - maxs[5]=(max<<8)|mxd; + maxS[5]=(max<<8)|mxd; max=mxd=miniGrad[2+3*5]; if (max && max!=255) { @@ -2929,7 +2929,7 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[2+4*5]); UPDATE_MAX(max,miniGrad[3+4*5]); } - maxs[6]=(max<<8)|mxd; + maxS[6]=(max<<8)|mxd; max=mxd=miniGrad[1+2*5]; if (max && max!=255) { @@ -2938,24 +2938,24 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool UPDATE_MAX(max,miniGrad[0+2*5]); UPDATE_MAX(max,miniGrad[0+3*5]); } - maxs[7]=(max<<8)|mxd; + maxS[7]=(max<<8)|mxd; - int centerg=miniGrad[2+2*5]; - centerg=(centerg<<8)|centerg; - int maxg=0; - int maxd=8; + int centerG=miniGrad[2+2*5]; + centerG=(centerG<<8)|centerG; + int maxG=0; + int maxD=8; bool good=false; if (strict) { for (int d=0; d<8; d++) { - int g=maxs[d]; - if (g>centerg) + int g=maxS[d]; + if (g>centerG) good=true; - if (maxg<=g) + if (maxG<=g) { - maxg=g; - maxd=d; + maxG=g; + maxD=d; } } } @@ -2963,13 +2963,13 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool { for (int d=0; d<8; d++) { - int g=maxs[d]; - if (g && g!=centerg) + int g=maxS[d]; + if (g && g!=centerG) good=true; - if (maxg<=g) + if (maxG<=g) { - maxg=g; - maxd=d; + maxG=g; + maxD=d; } } } @@ -2988,10 +2988,10 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool } if (verbose) { - printf("maxs:\n"); + printf("maxS:\n"); for (int d=0; d<8; d++) - printf("%4d.%4d (%d)\n", maxs[d]>>8, maxs[d]&0xFF, maxs[d]); - printf("max=%4d.%4d (%d), d=%d, good=%d\n", maxs[maxd]>>8, maxs[maxd]&0xFF, maxs[maxd], maxd, good); + printf("%4d.%4d (%d)\n", maxS[d]>>8, maxS[d]&0xFF, maxS[d]); + printf("max=%4d.%4d (%d), d=%d, good=%d\n", maxS[maxD]>>8, maxS[maxD]&0xFF, maxS[maxD], maxD, good); }; } @@ -2999,20 +2999,20 @@ bool Map::directionFromMinigrad(Uint8 miniGrad[25], int *dx, int *dy, const bool return false; int stdd; - if (maxd<4) - stdd=(maxd<<1); - else if (maxd!=8) - stdd=1+((maxd-4)<<1); + if (maxD<4) + stdd=(maxD<<1); + else if (maxD!=8) + stdd=1+((maxD-4)<<1); else stdd=8; - //printf("stdd=%4d\n", maxd); + //printf("stdd=%4d\n", maxD); Unit::dxDyFromDirection(stdd, dx, dy); return true; } -bool Map::directionByMinigrad(Uint32 teamMask, bool canSwim, int x, int y, int *dx, int *dy, const Uint8 *gradient, bool strict, bool verbose) const +bool Map::directionByMiniGrad(Uint32 teamMask, bool canSwim, int x, int y, int *dx, int *dy, const Uint8 *gradient, bool strict, bool verbose) const { Uint8 miniGrad[25]; miniGrad[2+2*5]=gradient[x+y*w]; @@ -3041,11 +3041,11 @@ bool Map::directionByMinigrad(Uint32 teamMask, bool canSwim, int x, int y, int * miniGrad[rx+ry*5+12]=0; } if (verbose) - printf("directionByMinigrad global %d\n", canSwim); - return directionFromMinigrad(miniGrad, dx, dy, strict, verbose); + printf("directionByMiniGrad global %d\n", canSwim); + return directionFromMiniGrad(miniGrad, dx, dy, strict, verbose); } -bool Map::directionByMinigrad(Uint32 teamMask, bool canSwim, int x, int y, int bx, int by, int *dx, int *dy, Uint8 localGradient[1024], bool strict, bool verbose) const +bool Map::directionByMiniGrad(Uint32 teamMask, bool canSwim, int x, int y, int bx, int by, int *dx, int *dy, Uint8 localGradient[1024], bool strict, bool verbose) const { Uint8 miniGrad[25]; for (int ry=0; ry<5; ry++) @@ -3097,51 +3097,51 @@ bool Map::directionByMinigrad(Uint32 teamMask, bool canSwim, int x, int y, int b miniGrad[rx+ry*5]=0; } if (verbose) - printf("directionByMinigrad local %d\n", canSwim); - return directionFromMinigrad(miniGrad, dx, dy, strict, verbose); + printf("directionByMiniGrad local %d\n", canSwim); + return directionFromMiniGrad(miniGrad, dx, dy, strict, verbose); } -bool Map::pathfindRessource(int teamNumber, Uint8 ressourceType, bool canSwim, int x, int y, int *dx, int *dy, bool *stopWork, bool verbose) +bool Map::pathfindResource(int teamNumber, Uint8 resourceType, bool canSwim, int x, int y, int *dx, int *dy, bool *stopWork, bool verbose) { - pathToRessourceCountTot++; + pathToResourceCountTot++; if (verbose) - printf("pathfindingRessource...\n"); - assert(ressourceTypeposX; int y=unit->posY; - if ((cases[x+(y<owner->me) + if ((tiles[x+(y<owner->me) { if (verbose) printf(" forbidden\n"); @@ -3273,7 +3273,7 @@ void Map::updateLocalGradient(Building *building, bool canSwim) Uint8 gradient[1024]; // 1. INITIALIZATION of gradient[]: - // 1a. Set all values to 1 (meaning 'far away, but not inaccessable'). + // 1a. Set all values to 1 (meaning 'far away, but not inaccessible'). memset(gradient, 1, 1024); bool isWarFlag=false; @@ -3317,7 +3317,7 @@ void Map::updateLocalGradient(Building *building, bool canSwim) if (yi2+(xi*xi)<=r2) { size_t addr = coordToIndex(posX+w+xi, posY+h+yi); - if(cases[addr].ressource.type != NO_RES_TYPE && building->clearingRessources[cases[addr].ressource.type]) + if(tiles[addr].resource.type != NO_RES_TYPE && building->clearingResources[tiles[addr].resource.type]) { int xxi=clip_0_31(15+xi); gradient[xxi+(yyi<<5)]=255; @@ -3340,14 +3340,14 @@ void Map::updateLocalGradient(Building *building, bool canSwim) for (int xl=0; xl<32; xl++) { int xg=(xl+posX-15)&wMask; - const Case& c=cases[wyg+xg]; + const Tile& c=tiles[wyg+xg]; int wyx=wyl+xl; if (c.building==NOGBID) { if (c.forbidden&teamMask) gradient[wyx] = 0; - else if (c.ressource.type!=NO_RES_TYPE && !(isClearingFlag && gradient[wyx]==255)) + else if (c.resource.type!=NO_RES_TYPE && !(isClearingFlag && gradient[wyx]==255)) gradient[wyx] = 0; else if(immobileUnits[wyx] != 255) gradient[wyx] = 0; @@ -3360,7 +3360,7 @@ void Map::updateLocalGradient(Building *building, bool canSwim) { gradient[wyx] = 255; } - //Warflags don't consider enemy buildings an obstacle + // War flags don't consider enemy buildings an obstacle else if(!isWarFlag || (1<owner->allies)) gradient[wyx] = 0; else if(gradient[wyx]!=255) @@ -3445,7 +3445,7 @@ void Map::updateLocalGradient(Building *building, bool canSwim) // 4. PROPAGATION of gradient values. propagateLocalGradients(gradient); - // 5. WRITEBACK (because of the 'any change'-computation). + // 5. WRITE BACK (because of the 'any change'-computation). memcpy(tgtGradient, gradient, 1024); } @@ -3493,15 +3493,15 @@ void propagateLocalGradients(Uint8* gradient) { if (max && max!=255) { for (int dy=-32; dy<=32; dy+=32) { - int ypart = wy+dy; - if (ypart & (32*32)) continue; // Over- or underflow + int yPart = wy+dy; + if (yPart & (32*32)) continue; // Over- or underflow for (int dx=-1; dx<=1; dx++) { - int xpart = x+dx; - if (xpart & 32) continue; // Over- or underflow - UPDATE_MAX(max,gradient[ypart+xpart]); + int xPart = x+dx; + if (xPart & 32) continue; // Over- or underflow + UPDATE_MAX(max,gradient[yPart+xPart]); } } - // TODO: checkstyle found very long code duplicaitons here + // TODO: check style found very long code duplications here // src/Map.cpp:3463: warning: Found duplicate of 59 lines in src/Map.cpp, starting from line 3,858 assert(max); if (max==1) @@ -3634,7 +3634,7 @@ template void Map::updateGlobalGradient(Building *building, bool if (yi2+(xi*xi)<=r2) { size_t addr = coordToIndex(posX+w+xi, posY+h+yi); - if(cases[addr].ressource.type!=NO_RES_TYPE && building->clearingRessources[cases[addr].ressource.type]) + if(tiles[addr].resource.type!=NO_RES_TYPE && building->clearingResources[tiles[addr].resource.type]) { if(gradient[addr] == 1) { @@ -3652,12 +3652,12 @@ template void Map::updateGlobalGradient(Building *building, bool for (int x=0; x void Map::updateGlobalGradient(Building *building, bool gradient[wyx] = 255; listedAddr[listCountWrite++] = wyx; } - //Warflags don't consider enemy buildings an obstacle + //War flags don't consider enemy buildings an obstacle else if(!isWarFlag || (1<owner->allies)) gradient[wyx] = 0; else if(gradient[wyx]!=255) @@ -3736,28 +3736,28 @@ template void Map::updateGlobalGradient(Building *building, bool delete[] listedAddr; } -bool Map::updateLocalRessources(Building *building, bool canSwim) +bool Map::updateLocalResources(Building *building, bool canSwim) { - localRessourcesUpdateCount++; + localResourcesUpdateCount++; assert(building); assert(building->type); assert(building->type->isVirtual); - fprintf(logFile, "updatingLocalRessources[%d] (gbid=%d)...\n", canSwim, building->gid); + fprintf(logFile, "updatingLocalResources[%d] (gbid=%d)...\n", canSwim, building->gid); int posX=building->posX; int posY=building->posY; Uint32 teamMask=building->owner->me; - Uint8 *gradient=building->localRessources[canSwim]; + Uint8 *gradient=building->localResources[canSwim]; if (gradient==NULL) { gradient=new Uint8[1024]; - building->localRessources[canSwim]=gradient; + building->localResources[canSwim]=gradient; } assert(gradient); - bool *clearingRessources=building->clearingRessources; - bool anyRessourceToClear=false; + bool *clearingResources=building->clearingResources; + bool anyResourceToClear=false; memset(gradient, 1, 1024); int range=building->unitStayRange; @@ -3773,41 +3773,41 @@ bool Map::updateLocalRessources(Building *building, bool canSwim) for (int xl=0; xl<32; xl++) { int xg=(xl+posX-15)&wMask; - const Case& c=cases[wyg+xg]; - int addrl=wyl+xl; + const Tile& c=tiles[wyg+xg]; + int addrL=wyl+xl; int dist2=(xl-15)*(xl-15)+dyl2; if (dist2<=range2) { if (c.forbidden&teamMask) - gradient[addrl]=0; - else if (c.ressource.type!=NO_RES_TYPE) + gradient[addrL]=0; + else if (c.resource.type!=NO_RES_TYPE) { - Sint8 t=c.ressource.type; - if (tlocalRessourcesCleanTime[canSwim]=0; - if (anyRessourceToClear) - building->anyRessourceToClear[canSwim]=1; + building->localResourcesCleanTime[canSwim]=0; + if (anyResourceToClear) + building->anyResourceToClear[canSwim]=1; else { - building->anyRessourceToClear[canSwim]=2; + building->anyResourceToClear[canSwim]=2; return false; } expandLocalGradient(gradient); @@ -3979,11 +3979,11 @@ bool Map::buildingAvailable(Building *building, bool canSwim, int x, int y, int int ly=(y-by+15+32)&31; if (!building->dirtyLocalGradient[canSwim]) { - Uint8 currentg=gradient[lx+(ly<<5)]; - if (currentg>1) + Uint8 currentG=gradient[lx+(ly<<5)]; + if (currentG>1) { buildingAvailableCountCloseSuccessFast++; - *dist=255-currentg; + *dist=255-currentG; return true; } else @@ -3992,9 +3992,9 @@ bool Map::buildingAvailable(Building *building, bool canSwim, int x, int y, int { int ddx, ddy; Unit::dxDyFromDirection(d, &ddx, &ddy); - int lxddx=clip_0_31(lx+ddx); - int lyddy=clip_0_31(ly+ddy); - Uint8 g=gradient[lxddx+(lyddy<<5)]; + int lxDdx=clip_0_31(lx+ddx); + int lyDdy=clip_0_31(ly+ddy); + Uint8 g=gradient[lxDdx+(lyDdy<<5)]; if (g>1) { buildingAvailableCountCloseSuccessAround++; @@ -4015,12 +4015,12 @@ bool Map::buildingAvailable(Building *building, bool canSwim, int x, int y, int return false; } - Uint8 currentg=gradient[lx+ly*32]; + Uint8 currentG=gradient[lx+ly*32]; - if (currentg>1) + if (currentG>1) { buildingAvailableCountCloseSuccessUpdate++; - *dist=255-currentg; + *dist=255-currentG; return true; } else @@ -4029,9 +4029,9 @@ bool Map::buildingAvailable(Building *building, bool canSwim, int x, int y, int { int ddx, ddy; Unit::dxDyFromDirection(d, &ddx, &ddy); - int lxddx=clip_0_31(lx+ddx); - int lyddy=clip_0_31(ly+ddy); - Uint8 g=gradient[lxddx+(lyddy<<5)]; + int lxDdx=clip_0_31(lx+ddx); + int lyDdy=clip_0_31(ly+ddy); + Uint8 g=gradient[lxDdx+(lyDdy<<5)]; if (g>1) { buildingAvailableCountCloseSuccessUpdateAround++; @@ -4066,11 +4066,11 @@ bool Map::buildingAvailable(Building *building, bool canSwim, int x, int y, int //fprintf(logFile, "ba-b- global gradient to building bgid=%d@(%d, %d) failed, locked. p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); return false; } - Uint8 currentg=gradient[coordToIndex(x, y)]; - if (currentg>1) + Uint8 currentG=gradient[coordToIndex(x, y)]; + if (currentG>1) { buildingAvailableCountFarOldSuccessFast++; - *dist=255-currentg; + *dist=255-currentG; return true; } else @@ -4103,11 +4103,11 @@ bool Map::buildingAvailable(Building *building, bool canSwim, int x, int y, int return false; } - Uint8 currentg=gradient[coordToIndex(x, y)]; - if (currentg>1) + Uint8 currentG=gradient[coordToIndex(x, y)]; + if (currentG>1) { buildingAvailableCountFarNewSuccessFast++; - *dist=255-currentg; + *dist=255-currentG; return true; } else @@ -4152,7 +4152,7 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * assert(x>=0); assert(y>=0); Uint32 teamMask=building->owner->me; - if (((cases[x+y*w].forbidden) & teamMask)!=0) + if (((tiles[x+y*w].forbidden) & teamMask)!=0) { int teamNumber=building->owner->teamNumber; if (verbose) @@ -4166,11 +4166,11 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * int lx=(x-bx+15+32)&31; int ly=(y-by+15+32)&31; int max=0; - Uint8 currentg=gradient[lx+(ly<<5)]; + Uint8 currentG=gradient[lx+(ly<<5)]; bool found=false; bool gradientUsable=false; - if (!building->dirtyLocalGradient[canSwim] && currentg==255) + if (!building->dirtyLocalGradient[canSwim] && currentG==255) { *dx=0; *dy=0; @@ -4180,9 +4180,9 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * return true; } - if (!building->dirtyLocalGradient[canSwim] && currentg>1) + if (!building->dirtyLocalGradient[canSwim] && currentG>1) { - if (directionByMinigrad(teamMask, canSwim, x, y, bx, by, dx, dy, gradient, true, verbose)) + if (directionByMiniGrad(teamMask, canSwim, x, y, bx, by, dx, dy, gradient, true, verbose)) { pathToBuildingCountCloseSuccessBase++; if (verbose) @@ -4202,12 +4202,12 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * } max=0; - currentg=gradient[lx+ly*32]; + currentG=gradient[lx+ly*32]; found=false; gradientUsable=false; - if (currentg>1) + if (currentG>1) { - if (directionByMinigrad(teamMask, canSwim, x, y, bx, by, dx, dy, gradient, true, verbose)) + if (directionByMiniGrad(teamMask, canSwim, x, y, bx, by, dx, dy, gradient, true, verbose)) { pathToBuildingCountCloseSuccessUpdated++; if (verbose) @@ -4220,7 +4220,7 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * else pathToBuildingCountIsFar++; pathToBuildingCountFar++; - //Here the "local-32*32-cases-gradient-pathfinding-system" has failed, then we look for a full size gradient. + //Here the "local-32*32-tiles-gradient-pathfinding-system" has failed, then we look for a full size gradient. gradient=building->globalGradient[canSwim]; if (gradient==NULL) @@ -4235,7 +4235,7 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * else { bool found=false; - Uint8 currentg=gradient[coordToIndex(x, y)]; + Uint8 currentG=gradient[coordToIndex(x, y)]; if (building->locked[canSwim]) { pathToBuildingCountFarOldFailureLocked++; @@ -4244,7 +4244,7 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * fprintf(logFile, "b- global gradient to building bgid=%d@(%d, %d) failed, locked. p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); return false; } - else if (currentg==1) + else if (currentG==1) { pathToBuildingCountFarOldFailureBad++; if (verbose) @@ -4253,7 +4253,7 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * return false; } else - found=directionByMinigrad(teamMask, canSwim, x, y, dx, dy, gradient, true, verbose); + found=directionByMiniGrad(teamMask, canSwim, x, y, dx, dy, gradient, true, verbose); //printf("found=%d, d=(%d, %d)\n", found, *dx, *dy); if (found) @@ -4268,7 +4268,7 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * pathToBuildingCountFarOldFailureRepeat++; if (verbose) printf("d- global gradient to building bgid=%d@(%d, %d) failed, repeat.\n", building->gid, building->posX, building->posY); - return directionByMinigrad(teamMask, canSwim, x, y, dx, dy, gradient, false, verbose); + return directionByMiniGrad(teamMask, canSwim, x, y, dx, dy, gradient, false, verbose); } else { @@ -4288,10 +4288,10 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * return false; } - Uint8 currentg=gradient[coordToIndex(x, y)]; - if (currentg>1) + Uint8 currentG=gradient[coordToIndex(x, y)]; + if (currentG>1) { - if (directionByMinigrad(teamMask, canSwim, x, y, dx, dy, gradient, true, verbose)) + if (directionByMiniGrad(teamMask, canSwim, x, y, dx, dy, gradient, true, verbose)) { pathToBuildingCountFarUpdateSuccess++; if (verbose) @@ -4310,7 +4310,7 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * else { pathToBuildingCountFarUpdateFailureBad++; - // TODO: find why this happend so often + // TODO: find why this happened so often if (verbose) printf("g- global gradient to building bgid=%d@(%d, %d) failed! p=(%d, %d), canSwim=%d\n", building->gid, building->posX, building->posY, x, y, canSwim); fprintf(logFile, "g- global gradient to building bgid=%d@(%d, %d) failed! p=(%d, %d), canSwim=%d\n", building->gid, building->posX, building->posY, x, y, canSwim); @@ -4318,24 +4318,24 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * return false; } -bool Map::pathfindLocalRessource(Building *building, bool canSwim, int x, int y, int *dx, int *dy) +bool Map::pathfindLocalResource(Building *building, bool canSwim, int x, int y, int *dx, int *dy) { - pathfindLocalRessourceCount++; + pathfindLocalResourceCount++; assert(building); assert(building->type); assert(building->type->isVirtual); - //printf("pathfindingLocalRessource[%d] (gbid=%d)...\n", canSwim, building->gid); + //printf("pathfindingLocalResource[%d] (gbid=%d)...\n", canSwim, building->gid); int bx=building->posX; int by=building->posY; Uint32 teamMask=building->owner->me; - Uint8 *gradient=building->localRessources[canSwim]; + Uint8 *gradient=building->localResources[canSwim]; if (gradient==NULL) { - if (!updateLocalRessources(building, canSwim)) + if (!updateLocalResources(building, canSwim)) return false; - gradient=building->localRessources[canSwim]; + gradient=building->localResources[canSwim]; } assert(gradient); //HACK: I have no idea what is going on or why isInLocalGradient(x, y, bx, by) was asserted and why isInLocalGradient(x, y, bx, by) checks for the rectangle it is checking for, but this fixes a rare crash. @@ -4346,31 +4346,31 @@ bool Map::pathfindLocalRessource(Building *building, bool canSwim, int x, int y, int lx=(x-bx+15+32)&31; int ly=(y-by+15+32)&31; int max=0; - Uint8 currentg=gradient[lx+(ly<<5)]; + Uint8 currentG=gradient[lx+(ly<<5)]; bool found=false; bool gradientUsable=false; - if (currentg==1 && (building->localRessourcesCleanTime[canSwim]+=16)<128) + if (currentG==1 && (building->localResourcesCleanTime[canSwim]+=16)<128) { - // This mean there are still ressources, but they are unreachable. + // This mean there are still resources, but they are unreachable. // We wait 5[s] before recomputing anything. if (verbose) - printf("...pathfindedLocalRessource v0 failure waiting\n"); - pathfindLocalRessourceCountWait++; + printf("...pathfindedLocalResource v0 failure waiting\n"); + pathfindLocalResourceCountWait++; return false; } - if (currentg>1 && currentg!=255) + if (currentG>1 && currentG!=255) { for (int sd=0; sd<=1; sd++) for (int d=sd; d<8; d+=2) { int ddx, ddy; Unit::dxDyFromDirection(d, &ddx, &ddy); - int lxddx=clip_0_31(lx+ddx); - int lyddy=clip_0_31(ly+ddy); - Uint8 g=gradient[lxddx+(lyddy<<5)]; - if (!gradientUsable && g>currentg && isHardSpaceForGroundUnit(x+ddx, y+ddy, canSwim, teamMask)) + int lxDdx=clip_0_31(lx+ddx); + int lyDdy=clip_0_31(ly+ddy); + Uint8 g=gradient[lxDdx+(lyDdy<<5)]; + if (!gradientUsable && g>currentG && isHardSpaceForGroundUnit(x+ddx, y+ddy, canSwim, teamMask)) gradientUsable=true; if (g>=max && isFreeForGroundUnit(x+ddx, y+ddy, canSwim, teamMask)) { @@ -4385,46 +4385,46 @@ bool Map::pathfindLocalRessource(Building *building, bool canSwim, int x, int y, { if (found) { - pathfindLocalRessourceCountSuccessBase++; - //printf("...pathfindedLocalRessource v1\n"); + pathfindLocalResourceCountSuccessBase++; + //printf("...pathfindedLocalResource v1\n"); return true; } else { *dx=0; *dy=0; - pathfindLocalRessourceCountSuccessLocked++; + pathfindLocalResourceCountSuccessLocked++; if (verbose) - printf("...pathfindedLocalRessource v2 locked\n"); + printf("...pathfindedLocalResource v2 locked\n"); return true; } } } - updateLocalRessources(building, canSwim); + updateLocalResources(building, canSwim); max=0; - currentg=gradient[lx+(ly<<5)]; + currentG=gradient[lx+(ly<<5)]; found=false; gradientUsable=false; - if (currentg==1) + if (currentG==1) { - pathfindLocalRessourceCountFailureNone++; - //printf("...pathfindedLocalRessource v3 No ressource\n"); + pathfindLocalResourceCountFailureNone++; + //printf("...pathfindedLocalResource v3 No resource\n"); return false; } - else if ((currentg!=0) && (currentg!=255)) + else if ((currentG!=0) && (currentG!=255)) { for (int sd=0; sd<=1; sd++) for (int d=sd; d<8; d+=2) { int ddx, ddy; Unit::dxDyFromDirection(d, &ddx, &ddy); - int lxddx=clip_0_31(lx+ddx); - int lyddy=clip_0_31(ly+ddy); - Uint8 g=gradient[lxddx+(lyddy<<5)]; - if (!gradientUsable && g>currentg && isHardSpaceForGroundUnit(x+ddx, y+ddy, canSwim, teamMask)) + int lxDdx=clip_0_31(lx+ddx); + int lyDdy=clip_0_31(ly+ddy); + Uint8 g=gradient[lxDdx+(lyDdy<<5)]; + if (!gradientUsable && g>currentG && isHardSpaceForGroundUnit(x+ddx, y+ddy, canSwim, teamMask)) gradientUsable=true; if (g>=max && isFreeForGroundUnit(x+ddx, y+ddy, canSwim, teamMask)) { @@ -4439,35 +4439,35 @@ bool Map::pathfindLocalRessource(Building *building, bool canSwim, int x, int y, { if (found) { - pathfindLocalRessourceCountSuccessUpdate++; - //printf("...pathfindedLocalRessource v3\n"); + pathfindLocalResourceCountSuccessUpdate++; + //printf("...pathfindedLocalResource v3\n"); return true; } else { *dx=0; *dy=0; - pathfindLocalRessourceCountSuccessUpdateLocked++; + pathfindLocalResourceCountSuccessUpdateLocked++; if (verbose) - printf("...pathfindedLocalRessource v4 locked\n"); + printf("...pathfindedLocalResource v4 locked\n"); return true; } } else { - pathfindLocalRessourceCountFailureUnusable++; - fprintf(logFile, "lr-a- failed to pathfind localRessource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); + pathfindLocalResourceCountFailureUnusable++; + fprintf(logFile, "lr-a- failed to pathfind localResource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); if (verbose) - printf("lr-a- failed to pathfind localRessource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); + printf("lr-a- failed to pathfind localResource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); return false; } } else { - pathfindLocalRessourceCountFailureBad++; - fprintf(logFile, "lr-b- failed to pathfind localRessource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); + pathfindLocalResourceCountFailureBad++; + fprintf(logFile, "lr-b- failed to pathfind localResource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); if (verbose) - printf("lr-b- failed to pathfind localRessource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); + printf("lr-b- failed to pathfind localResource bgid=%d@(%d, %d) p=(%d, %d)\n", building->gid, building->posX, building->posY, x, y); return false; } } @@ -4481,7 +4481,7 @@ void Map::dirtyLocalGradient(int x, int y, int wl, int hl, int teamNumber) { for (int wi=0; widirtyLocalGradient[canSwim]=true; b->locked[canSwim]=false; - if (b->localRessources[canSwim]) + if (b->localResources[canSwim]) { - delete b->localRessources[canSwim]; - b->localRessources[canSwim]=NULL; + delete b->localResources[canSwim]; + b->localResources[canSwim]=NULL; } } } @@ -4513,7 +4513,7 @@ bool Map::pathfindForbidden(const Uint8 *optionGradient, int teamNumber, bool ca assert(gradient); Uint32 maxValue=0; - int maxd=0; + int maxD=0; for (int di=0; di<8; di++) { int rx=tabClose[di][0]; @@ -4543,13 +4543,13 @@ bool Map::pathfindForbidden(const Uint8 *optionGradient, int teamNumber, bool ca maxValue=value; if (verbose) printf("new maxValue=%d \n", maxValue); - maxd=di; + maxD=di; } } if (maxValue>=(2<<8)) { - *dx=tabClose[maxd][0]; - *dy=tabClose[maxd][1]; + *dx=tabClose[maxD][0]; + *dy=tabClose[maxD][1]; if (verbose) printf(" Success (%d:%d) (%d, %d)\n", (maxValue>>8), (maxValue&0xFF), *dx, *dy); pathfindForbiddenCountSuccess++; @@ -4575,7 +4575,7 @@ bool Map::pathfindGuardArea(int teamNumber, bool canSwim, int x, int y, int *dx, bool found = false; // we look around us, searching for a usable position with a bigger gradient value - if (directionByMinigrad(1< void Map::updateForbiddenGradient(int teamNumber, bool c assert(gradient); for (size_t i = 0; i < size; i++) { - const Case& c = cases[i]; - if ((c.ressource.type != NO_RES_TYPE) || (c.building!=NOGBID) || (!canSwim && isWater(i))) + const Tile& c = tiles[i]; + if ((c.resource.type != NO_RES_TYPE) || (c.building!=NOGBID) || (!canSwim && isWater(i))) { gradient[i] = 0; } @@ -4658,22 +4658,22 @@ template void Map::updateForbiddenGradient(int teamNumber, bool c size_t adl = (i - 1 + w) & (size - 1); size_t aml = (i - 1 ) & (size - 1); - if( ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[aul].forbidden) &teamMask) - || (cases[aul].building!=NOGBID) || (!canSwim && isWater(aul))) && - ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[aum].forbidden) &teamMask) - || (cases[aum].building!=NOGBID) || (!canSwim && isWater(aum))) && - ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[aur].forbidden) &teamMask) - || (cases[aur].building!=NOGBID) || (!canSwim && isWater(aur))) && - ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[amr].forbidden) &teamMask) - || (cases[amr].building!=NOGBID) || (!canSwim && isWater(amr))) && - ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[adr].forbidden) &teamMask) - || (cases[adr].building!=NOGBID) || (!canSwim && isWater(adr))) && - ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[adm].forbidden) &teamMask) - || (cases[adm].building!=NOGBID) || (!canSwim && isWater(adm))) && - ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[adl].forbidden) &teamMask) - || (cases[adl].building!=NOGBID) || (!canSwim && isWater(adl))) && - ((cases[aul].ressource.type != NO_RES_TYPE) || ((cases[aml].forbidden) &teamMask) - || (cases[aml].building!=NOGBID) || (!canSwim && isWater(aml))) ) + if( ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[aul].forbidden) &teamMask) + || (tiles[aul].building!=NOGBID) || (!canSwim && isWater(aul))) && + ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[aum].forbidden) &teamMask) + || (tiles[aum].building!=NOGBID) || (!canSwim && isWater(aum))) && + ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[aur].forbidden) &teamMask) + || (tiles[aur].building!=NOGBID) || (!canSwim && isWater(aur))) && + ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[amr].forbidden) &teamMask) + || (tiles[amr].building!=NOGBID) || (!canSwim && isWater(amr))) && + ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[adr].forbidden) &teamMask) + || (tiles[adr].building!=NOGBID) || (!canSwim && isWater(adr))) && + ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[adm].forbidden) &teamMask) + || (tiles[adm].building!=NOGBID) || (!canSwim && isWater(adm))) && + ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[adl].forbidden) &teamMask) + || (tiles[adl].building!=NOGBID) || (!canSwim && isWater(adl))) && + ((tiles[aul].resource.type != NO_RES_TYPE) || ((tiles[aml].forbidden) &teamMask) + || (tiles[aml].building!=NOGBID) || (!canSwim && isWater(aml))) ) { gradient[i]= 1; } @@ -4693,29 +4693,29 @@ template void Map::updateForbiddenGradient(int teamNumber, bool c #endif #if defined(SIMONS_FORBIDDEN_GRADIENT_INIT) - Uint8 *testgradient = forbiddenGradient[teamNumber][canSwim]; - assert(testgradient); + Uint8 *testGradient = forbiddenGradient[teamNumber][canSwim]; + assert(testGradient); size_t listCountWriteInit = 0; // We set the obstacle and free places for (size_t i=0; i void Map::updateForbiddenGradient(int teamNumber, bool c deltaAddrC[7] = (y << wDec) | xl; for( int ci=0; ci<8; ci++) { - if( testgradient[ deltaAddrC[ci] ] == 255 ) + if( testGradient[ deltaAddrC[ci] ] == 255 ) { - testgradient[i] = 254; + testGradient[i] = 254; listedAddr[listCountWrite++] = i; break; } @@ -4753,7 +4753,7 @@ template void Map::updateForbiddenGradient(int teamNumber, bool c } // Then we propagate the gradient - updateGlobalGradient(testgradient, listedAddr, listCountWrite, GT_FORBIDDEN, canSwim); + updateGlobalGradient(testGradient, listedAddr, listCountWrite, GT_FORBIDDEN, canSwim); #endif #if defined(SIMPLE_FORBIDDEN_GRADIENT_INIT) @@ -4767,8 +4767,8 @@ template void Map::updateForbiddenGradient(int teamNumber, bool c for (size_t i=0; i void Map::updateForbiddenGradient(int teamNumber, bool c #endif delete[] listedAddr; #if defined(TEST_FORBIDDEN_GRADIENT_INIT) - assert (memcmp (testgradient, gradient, size) == 0); + assert (memcmp (testGradient, gradient, size) == 0); #endif } @@ -4824,12 +4824,12 @@ template void Map::updateGuardAreasGradient(int teamNumber, bool Uint32 teamMask = Team::teamNumberToMask(teamNumber); for (size_t i=0; iteams[teamNumber]->allies)) gradient[i] = 0; @@ -4880,17 +4880,17 @@ template void Map::updateClearAreasGradient(int teamNumber, bool Uint32 teamMask = Team::teamNumberToMask(teamNumber); for (size_t i=0; i