From aa831dbb616627f982098ae44bd94ac6e64cccbd Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 17 Apr 2012 15:25:31 +0000 Subject: [PATCH] - inlined a few more functions --- source/glest_game/graphics/renderer.h | 52 ++++----- source/glest_game/type_instances/faction.h | 44 +++---- source/glest_game/type_instances/unit.h | 128 ++++++++++----------- source/glest_game/types/unit_type.h | 76 ++++++------ source/glest_game/world/map.h | 48 ++++---- source/glest_game/world/surface_atlas.h | 18 +-- source/glest_game/world/time_flow.h | 10 +- source/glest_game/world/unit_updater.h | 2 +- source/glest_game/world/world.h | 56 ++++----- 9 files changed, 217 insertions(+), 217 deletions(-) diff --git a/source/glest_game/graphics/renderer.h b/source/glest_game/graphics/renderer.h index f31680fbb..235f9a201 100644 --- a/source/glest_game/graphics/renderer.h +++ b/source/glest_game/graphics/renderer.h @@ -91,7 +91,7 @@ public: class VisibleQuadContainerCache { protected: - void CopyAll(const VisibleQuadContainerCache &obj) { + inline void CopyAll(const VisibleQuadContainerCache &obj) { cacheFrame = obj.cacheFrame; visibleObjectList = obj.visibleObjectList; visibleUnitList = obj.visibleUnitList; @@ -106,24 +106,24 @@ protected: public: - VisibleQuadContainerCache() { + inline VisibleQuadContainerCache() { cacheFrame = 0; clearFrustrumData(); clearCacheData(); } - VisibleQuadContainerCache(const VisibleQuadContainerCache &obj) { + inline VisibleQuadContainerCache(const VisibleQuadContainerCache &obj) { CopyAll(obj); } - VisibleQuadContainerCache & operator=(const VisibleQuadContainerCache &obj) { + inline VisibleQuadContainerCache & operator=(const VisibleQuadContainerCache &obj) { CopyAll(obj); return *this; } - void clearCacheData() { + inline void clearCacheData() { clearVolatileCacheData(); clearNonVolatileCacheData(); } - void clearVolatileCacheData() { + inline void clearVolatileCacheData() { visibleUnitList.clear(); visibleQuadUnitList.clear(); //inVisibleUnitList.clear(); @@ -131,14 +131,14 @@ public: visibleUnitList.reserve(500); visibleQuadUnitList.reserve(500); } - void clearNonVolatileCacheData() { + inline void clearNonVolatileCacheData() { visibleObjectList.clear(); visibleScaledCellList.clear(); visibleObjectList.reserve(500); visibleScaledCellList.reserve(500); } - void clearFrustrumData() { + inline void clearFrustrumData() { frustumData = vector >(6,vector(4,0)); proj = vector(16,0); modl = vector(16,0); @@ -313,7 +313,7 @@ private: class SurfaceData { public: - SurfaceData() { + inline SurfaceData() { uniqueId=0; bufferCount=0; textureHandle=0; @@ -335,8 +335,8 @@ private: class MapRenderer { public: - MapRenderer(): map(NULL) {} - ~MapRenderer() { destroy(); } + inline MapRenderer(): map(NULL) {} + inline ~MapRenderer() { destroy(); } void render(const Map* map,float coordStep,VisibleQuadContainerCache &qCache); void renderVisibleLayers(const Map* map,float coordStep,VisibleQuadContainerCache &qCache); void destroy(); @@ -346,7 +346,7 @@ private: const Map* map; struct Layer { - Layer(int th): + inline Layer(int th): vbo_vertices(0), vbo_normals(0), vbo_fowTexCoords(0), vbo_surfTexCoords(0), vbo_indices(0), indexCount(0), @@ -409,8 +409,8 @@ public: void endGame(bool isFinalEnd); //get - int getTriangleCount() const {return triangleCount;} - int getPointCount() const {return pointCount;} + inline int getTriangleCount() const {return triangleCount;} + inline int getPointCount() const {return pointCount;} //misc void reloadResources(); @@ -431,8 +431,8 @@ public: void endFont(Font *font, ResourceScope rs, bool mustExistInList=false); void resetFontManager(ResourceScope rs); - TextRenderer2D *getTextRenderer() const {return textRenderer;} - TextRenderer3D *getTextRenderer3D() const {return textRenderer3D;} + inline TextRenderer2D *getTextRenderer() const {return textRenderer;} + inline TextRenderer3D *getTextRenderer3D() const {return textRenderer3D;} void manageParticleSystem(ParticleSystem *particleSystem, ResourceScope rs); void cleanupParticleSystems(vector &particleSystems,ResourceScope rs); @@ -532,8 +532,8 @@ public: //misc void loadConfig(); void saveScreen(const string &path,int w=0, int h=0); - Quad2i getVisibleQuad() const {return visibleQuad;} - Quad2i getVisibleQuadFromCamera() const {return visibleQuadFromCamera;} + inline Quad2i getVisibleQuad() const {return visibleQuad;} + inline Quad2i getVisibleQuadFromCamera() const {return visibleQuadFromCamera;} void renderTeamColorPlane(); void renderTeamColorCircle(); @@ -541,28 +541,28 @@ public: static Shadows strToShadows(const string &s); static string shadowsToStr(Shadows shadows); - const Game * getGame() { return game; } + inline const Game * getGame() { return game; } void setAllowRenderUnitTitles(bool value); - bool getAllowRenderUnitTitles() { return allowRenderUnitTitles; } + inline bool getAllowRenderUnitTitles() { return allowRenderUnitTitles; } void renderUnitTitles(Font2D *font, Vec3f color); void renderUnitTitles3D(Font3D *font, Vec3f color); Vec3f computeScreenPosition(const Vec3f &worldPos); void setPhotoMode(bool value) { photoMode = value; } - bool getNo2DMouseRendering() const { return no2DMouseRendering; } + inline bool getNo2DMouseRendering() const { return no2DMouseRendering; } void setNo2DMouseRendering(bool value) { no2DMouseRendering = value; } - bool getShowDebugUI() const { return showDebugUI; } + inline bool getShowDebugUI() const { return showDebugUI; } void setShowDebugUI(bool value) { showDebugUI = value; } - int getShowDebugUILevel() const { return showDebugUILevel; } + inline int getShowDebugUILevel() const { return showDebugUILevel; } void setShowDebugUILevel(int value) { showDebugUILevel=value; } void cycleShowDebugUILevel(); void setLastRenderFps(int value); - int getLastRenderFps() const { return lastRenderFps;} + inline int getLastRenderFps() const { return lastRenderFps;} VisibleQuadContainerCache & getQuadCache(bool updateOnDirtyFrame=true,bool forceNew=false); void removeObjectFromQuadCache(const Object *o); @@ -577,10 +577,10 @@ public: static Texture2D * findFactionLogoTexture(string logoFilename); static Texture2D * preloadTexture(string logoFilename); - int getCachedSurfaceDataSize() const { return mapSurfaceData.size(); } + inline int getCachedSurfaceDataSize() const { return mapSurfaceData.size(); } void setCustom3dMenuList(GLuint *customlist3dMenu) { this->customlist3dMenu = customlist3dMenu; } - GLuint * getCustom3dMenuList() const { return this->customlist3dMenu; } + inline GLuint * getCustom3dMenuList() const { return this->customlist3dMenu; } void init3dListMenu(const MainMenu *mm); diff --git a/source/glest_game/type_instances/faction.h b/source/glest_game/type_instances/faction.h index 44dad7324..d1f4833bf 100644 --- a/source/glest_game/type_instances/faction.h +++ b/source/glest_game/type_instances/faction.h @@ -151,12 +151,12 @@ public: Faction(); ~Faction(); - void addLivingUnits(int id) { livingUnits.insert(id); } - void addLivingUnitsp(Unit *unit) { livingUnitsp.insert(unit); } + inline void addLivingUnits(int id) { livingUnits.insert(id); } + inline void addLivingUnitsp(Unit *unit) { livingUnitsp.insert(unit); } - bool isUnitInLivingUnitsp(Unit *unit) { return (livingUnitsp.find(unit) != livingUnitsp.end()); } - void deleteLivingUnits(int id) { livingUnits.erase(id); } - void deleteLivingUnitsp(Unit *unit) { livingUnitsp.erase(unit); } + inline bool isUnitInLivingUnitsp(Unit *unit) { return (livingUnitsp.find(unit) != livingUnitsp.end()); } + inline void deleteLivingUnits(int id) { livingUnits.erase(id); } + inline void deleteLivingUnitsp(Unit *unit) { livingUnitsp.erase(unit); } //std::map unitsMovingList; void addUnitToMovingList(int unitId); @@ -175,32 +175,32 @@ public: bool giveResources, const XmlNode *loadWorldNode=NULL); void end(); - bool getFactionDisconnectHandled() const { return factionDisconnectHandled;} + inline bool getFactionDisconnectHandled() const { return factionDisconnectHandled;} void setFactionDisconnectHandled(bool value) { factionDisconnectHandled=value;} //get const Resource *getResource(const ResourceType *rt) const; - const Resource *getResource(int i) const {return &resources[i];} + inline const Resource *getResource(int i) const {return &resources[i];} int getStoreAmount(const ResourceType *rt) const; - const FactionType *getType() const {return factionType;} - int getIndex() const {return index;} + inline const FactionType *getType() const {return factionType;} + inline int getIndex() const {return index;} - int getTeam() const {return teamIndex;} + inline int getTeam() const {return teamIndex;} void setTeam(int team) {teamIndex=team;} - TechTree * getTechTree() const { return techTree; } + inline TechTree * getTechTree() const { return techTree; } const SwitchTeamVote * getFirstSwitchTeamVote() const; SwitchTeamVote * getSwitchTeamVote(int factionIndex); void setSwitchTeamVote(SwitchTeamVote &vote); - int getCurrentSwitchTeamVoteFactionIndex() const { return currentSwitchTeamVoteFactionIndex; } + inline int getCurrentSwitchTeamVoteFactionIndex() const { return currentSwitchTeamVoteFactionIndex; } void setCurrentSwitchTeamVoteFactionIndex(int index) { currentSwitchTeamVoteFactionIndex = index; } bool getCpuControl(bool enableServerControlledAI, bool isNetworkGame, NetworkRole role) const; bool getCpuControl() const; - bool getCpuEasyControl() const {return control==ctCpuEasy;} - bool getCpuUltraControl() const {return control==ctCpuUltra;} - bool getCpuMegaControl() const {return control==ctCpuMega;} - ControlType getControlType() const {return control;} + inline bool getCpuEasyControl() const {return control==ctCpuEasy;} + inline bool getCpuUltraControl() const {return control==ctCpuUltra;} + inline bool getCpuMegaControl() const {return control==ctCpuMega;} + inline ControlType getControlType() const {return control;} FactionPersonalityType getPersonalityType() const; void setPersonalityType(FactionPersonalityType pType) { overridePersonalityType=pType; } @@ -210,10 +210,10 @@ public: int getUnitCount() const; Mutex * getUnitMutex() {return unitsMutex;} - const UpgradeManager *getUpgradeManager() const {return &upgradeManager;} - const Texture2D *getTexture() const {return texture;} - int getStartLocationIndex() const {return startLocationIndex;} - bool getThisFaction() const {return thisFaction;} + inline const UpgradeManager *getUpgradeManager() const {return &upgradeManager;} + inline const Texture2D *getTexture() const {return texture;} + inline int getStartLocationIndex() const {return startLocationIndex;} + inline bool getThisFaction() const {return thisFaction;} //upgrades void startUpgrade(const UpgradeType *ut); @@ -259,7 +259,7 @@ public: Vec2i getClosestResourceTypeTargetFromCache(Unit *unit, const ResourceType *type); Vec2i getClosestResourceTypeTargetFromCache(const Vec2i &pos, const ResourceType *type); void cleanupResourceTypeTargetCache(std::vector *deleteListPtr); - int getCacheResourceTargetListSize() const { return cacheResourceTargetList.size(); } + inline int getCacheResourceTargetListSize() const { return cacheResourceTargetList.size(); } Unit * findClosestUnitWithSkillClass(const Vec2i &pos,const CommandClass &cmdClass, const std::vector &skillClassList, @@ -267,7 +267,7 @@ public: void deletePixels(); - World * getWorld() { return world; } + inline World * getWorld() { return world; } int getFrameCount(); void signalWorkerThread(int frameIndex); bool isWorkerThreadSignalCompleted(int frameIndex); diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 6df7988d6..11f5462cf 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -445,67 +445,67 @@ public: //queries Command *getCurrrentCommandThreadSafe(); void setIgnoreCheckCommand(bool value) { ignoreCheckCommand=value;} - bool getIgnoreCheckCommand() const {return ignoreCheckCommand;} - int getId() const {return id;} - Field getCurrField() const {return currField;} - int getLoadCount() const {return loadCount;} - float getLastAnimProgress() const {return lastAnimProgress;} + inline bool getIgnoreCheckCommand() const {return ignoreCheckCommand;} + inline int getId() const {return id;} + inline Field getCurrField() const {return currField;} + inline int getLoadCount() const {return loadCount;} + inline float getLastAnimProgress() const {return lastAnimProgress;} //float getProgress() const {return progress;} - float getAnimProgress() const {return animProgress;} - float getHightlight() const {return highlight;} - int getProgress2() const {return progress2;} + inline float getAnimProgress() const {return animProgress;} + inline float getHightlight() const {return highlight;} + inline int getProgress2() const {return progress2;} int getFactionIndex() const; int getTeam() const; - int getHp() const {return hp;} - int getEp() const {return ep;} + inline int getHp() const {return hp;} + inline int getEp() const {return ep;} int getProductionPercent() const; float getProgressRatio() const; float getHpRatio() const; float getEpRatio() const; - bool getToBeUndertaken() const {return toBeUndertaken;} - Vec2i getTargetPos() const {return targetPos;} - Vec3f getTargetVec() const {return targetVec;} - Field getTargetField() const {return targetField;} - Vec2i getMeetingPos() const {return meetingPos;} - Faction *getFaction() const {return faction;} - const ResourceType *getLoadType() const {return loadType;} - const UnitType *getType() const {return type;} - const SkillType *getCurrSkill() const {return currSkill;} - const TotalUpgrade *getTotalUpgrade() const {return &totalUpgrade;} - float getRotation() const {return rotation;} + inline bool getToBeUndertaken() const {return toBeUndertaken;} + inline Vec2i getTargetPos() const {return targetPos;} + inline Vec3f getTargetVec() const {return targetVec;} + inline Field getTargetField() const {return targetField;} + inline Vec2i getMeetingPos() const {return meetingPos;} + inline Faction *getFaction() const {return faction;} + inline const ResourceType *getLoadType() const {return loadType;} + inline const UnitType *getType() const {return type;} + inline const SkillType *getCurrSkill() const {return currSkill;} + inline const TotalUpgrade *getTotalUpgrade() const {return &totalUpgrade;} + inline float getRotation() const {return rotation;} float getRotationX() const; float getRotationZ() const; - ParticleSystem *getFire() const {return fire;} - int getKills() const {return kills;} - int getEnemyKills() const {return enemyKills;} - const Level *getLevel() const {return level;} + inline ParticleSystem *getFire() const {return fire;} + inline int getKills() const {return kills;} + inline int getEnemyKills() const {return enemyKills;} + inline const Level *getLevel() const {return level;} const Level *getNextLevel() const; string getFullName() const; - const UnitPathInterface *getPath() const {return unitPath;} - UnitPathInterface *getPath() {return unitPath;} - WaypointPath *getWaypointPath() {return &waypointPath;} + inline const UnitPathInterface *getPath() const {return unitPath;} + inline UnitPathInterface *getPath() {return unitPath;} + inline WaypointPath *getWaypointPath() {return &waypointPath;} - int getLastAttackerUnitId() const { return lastAttackerUnitId; } - void setLastAttackerUnitId(int unitId) { lastAttackerUnitId = unitId; } + inline int getLastAttackerUnitId() const { return lastAttackerUnitId; } + inline void setLastAttackerUnitId(int unitId) { lastAttackerUnitId = unitId; } - int getLastAttackedUnitId() const { return lastAttackedUnitId; } - void setLastAttackedUnitId(int unitId) { lastAttackedUnitId = unitId; } + inline int getLastAttackedUnitId() const { return lastAttackedUnitId; } + inline void setLastAttackedUnitId(int unitId) { lastAttackedUnitId = unitId; } - CauseOfDeathType getCauseOfDeath() const { return causeOfDeath; } - void setCauseOfDeath(CauseOfDeathType cause) { causeOfDeath = cause; } + inline CauseOfDeathType getCauseOfDeath() const { return causeOfDeath; } + inline void setCauseOfDeath(CauseOfDeathType cause) { causeOfDeath = cause; } //pos - Vec2i getPos() const {return pos;} + inline Vec2i getPos() const {return pos;} Vec2i getPosWithCellMapSet() const; - Vec2i getLastPos() const {return lastPos;} + inline Vec2i getLastPos() const {return lastPos;} Vec2i getCenteredPos() const; Vec2f getFloatCenteredPos() const; Vec2i getCellPos() const; //is - bool isHighlighted() const {return highlight>0.f;} - bool isDead() const {return !alive;} - bool isAlive() const {return alive;} + inline bool isHighlighted() const {return highlight>0.f;} + inline bool isDead() const {return !alive;} + inline bool isAlive() const {return alive;} bool isOperative() const; bool isBeingBuilt() const; bool isBuilt() const; @@ -516,19 +516,19 @@ public: bool isInteresting(InterestingUnitType iut) const; //set - void setCurrField(Field currField) {this->currField= currField;} + inline void setCurrField(Field currField) {this->currField= currField;} void setCurrSkill(const SkillType *currSkill); void setCurrSkill(SkillClass sc); - void setLoadCount(int loadCount) {this->loadCount= loadCount;} - void setLoadType(const ResourceType *loadType) {this->loadType= loadType;} - void setProgress2(int progress2) {this->progress2= progress2;} + inline void setLoadCount(int loadCount) {this->loadCount= loadCount;} + inline void setLoadType(const ResourceType *loadType) {this->loadType= loadType;} + inline void setProgress2(int progress2) {this->progress2= progress2;} void setPos(const Vec2i &pos,bool clearPathFinder=false); void setTargetPos(const Vec2i &targetPos); void setTarget(const Unit *unit); void setTargetVec(const Vec3f &targetVec); void setMeetingPos(const Vec2i &meetingPos); void setVisible(const bool visible); - bool getVisible() const { return visible; } + inline bool getVisible() const { return visible; } //render related const Model *getCurrentModel(); @@ -582,26 +582,26 @@ public: void applyCommand(Command *command); void setModelFacing(CardinalDir value); - CardinalDir getModelFacing() const { return modelFacing; } + inline CardinalDir getModelFacing() const { return modelFacing; } bool isMeetingPointSettable() const; - int getLastRenderFrame() const { return lastRenderFrame; } - void setLastRenderFrame(int value) { lastRenderFrame = value; } + inline int getLastRenderFrame() const { return lastRenderFrame; } + inline void setLastRenderFrame(int value) { lastRenderFrame = value; } - int getRetryCurrCommandCount() const { return retryCurrCommandCount; } - void setRetryCurrCommandCount(int value) { retryCurrCommandCount = value; } + inline int getRetryCurrCommandCount() const { return retryCurrCommandCount; } + inline void setRetryCurrCommandCount(int value) { retryCurrCommandCount = value; } - Vec3f getScreenPos() const { return screenPos; } + inline Vec3f getScreenPos() const { return screenPos; } void setScreenPos(Vec3f value) { screenPos = value; } - string getCurrentUnitTitle() const {return currentUnitTitle;} + inline string getCurrentUnitTitle() const {return currentUnitTitle;} void setCurrentUnitTitle(string value) { currentUnitTitle = value;} void exploreCells(); - bool getInBailOutAttempt() const { return inBailOutAttempt; } - void setInBailOutAttempt(bool value) { inBailOutAttempt = value; } + inline bool getInBailOutAttempt() const { return inBailOutAttempt; } + inline void setInBailOutAttempt(bool value) { inBailOutAttempt = value; } //std::vector > getBadHarvestPosList() const { return badHarvestPosList; } //void setBadHarvestPosList(std::vector > value) { badHarvestPosList = value; } @@ -611,7 +611,7 @@ public: void cleanupOldBadHarvestPos(); void setLastHarvestResourceTarget(const Vec2i *pos); - std::pair getLastHarvestResourceTarget() const { return lastHarvestResourceTarget;} + inline std::pair getLastHarvestResourceTarget() const { return lastHarvestResourceTarget;} //std::pair > getCurrentTargetPathTaken() const { return currentTargetPathTaken; } //void addCurrentTargetPathTakenCell(const Vec2i &target,const Vec2i &cell); @@ -621,23 +621,23 @@ public: bool needToUpdate(); bool isLastStuckFrameWithinCurrentFrameTolerance() const; - uint32 getLastStuckFrame() const { return lastStuckFrame; } - void setLastStuckFrame(uint32 value) { lastStuckFrame = value; } + inline uint32 getLastStuckFrame() const { return lastStuckFrame; } + inline void setLastStuckFrame(uint32 value) { lastStuckFrame = value; } void setLastStuckFrameToCurrentFrame(); - Vec2i getLastStuckPos() const { return lastStuckPos; } - void setLastStuckPos(Vec2i pos) { lastStuckPos = pos; } + inline Vec2i getLastStuckPos() const { return lastStuckPos; } + inline void setLastStuckPos(Vec2i pos) { lastStuckPos = pos; } bool isLastPathfindFailedFrameWithinCurrentFrameTolerance() const; - uint32 getLastPathfindFailedFrame() const { return lastPathfindFailedFrame; } - void setLastPathfindFailedFrame(uint32 value) { lastPathfindFailedFrame = value; } + inline uint32 getLastPathfindFailedFrame() const { return lastPathfindFailedFrame; } + inline void setLastPathfindFailedFrame(uint32 value) { lastPathfindFailedFrame = value; } void setLastPathfindFailedFrameToCurrentFrame(); - Vec2i getLastPathfindFailedPos() const { return lastPathfindFailedPos; } - void setLastPathfindFailedPos(Vec2i pos) { lastPathfindFailedPos = pos; } + inline Vec2i getLastPathfindFailedPos() const { return lastPathfindFailedPos; } + inline void setLastPathfindFailedPos(Vec2i pos) { lastPathfindFailedPos = pos; } - bool getUsePathfinderExtendedMaxNodes() const { return usePathfinderExtendedMaxNodes; } - void setUsePathfinderExtendedMaxNodes(bool value) { usePathfinderExtendedMaxNodes = value; } + inline bool getUsePathfinderExtendedMaxNodes() const { return usePathfinderExtendedMaxNodes; } + inline void setUsePathfinderExtendedMaxNodes(bool value) { usePathfinderExtendedMaxNodes = value; } void updateTimedParticles(); diff --git a/source/glest_game/types/unit_type.h b/source/glest_game/types/unit_type.h index d94e7f4a9..c42e08b2d 100644 --- a/source/glest_game/types/unit_type.h +++ b/source/glest_game/types/unit_type.h @@ -153,46 +153,46 @@ public: Checksum* techtreeChecksum, std::map > > &loadedFileList); //get - int getId() const {return id;} - int getMaxHp() const {return maxHp;} - int getHpRegeneration() const {return hpRegeneration;} - int getMaxEp() const {return maxEp;} - int getEpRegeneration() const {return epRegeneration;} - int getMaxUnitCount() const {return maxUnitCount;} - bool getField(Field field) const {return fields[field];} - Field getField() const {return field;} - bool getProperty(Property property) const {return properties[property];} - int getArmor() const {return armor;} - const ArmorType *getArmorType() const {return armorType;} - const SkillType *getSkillType(int i) const {return skillTypes[i];} + inline int getId() const {return id;} + inline int getMaxHp() const {return maxHp;} + inline int getHpRegeneration() const {return hpRegeneration;} + inline int getMaxEp() const {return maxEp;} + inline int getEpRegeneration() const {return epRegeneration;} + inline int getMaxUnitCount() const {return maxUnitCount;} + inline bool getField(Field field) const {return fields[field];} + inline Field getField() const {return field;} + inline bool getProperty(Property property) const {return properties[property];} + inline int getArmor() const {return armor;} + inline const ArmorType *getArmorType() const {return armorType;} + inline const SkillType *getSkillType(int i) const {return skillTypes[i];} const CommandType *getCommandType(int i) const; - const Level *getLevel(int i) const {return &levels[i];} + inline const Level *getLevel(int i) const {return &levels[i];} const Level *getLevel(string name) const; - int getSkillTypeCount() const {return skillTypes.size();} - int getCommandTypeCount() const {return commandTypes.size();} - int getLevelCount() const {return levels.size();} - bool getLight() const {return light;} - bool getRotationAllowed() const {return rotationAllowed;} - Vec3f getLightColor() const {return lightColor;} - bool getMultiSelect() const {return multiSelect;} - int getSight() const {return sight;} - int getSize() const {return size;} + inline int getSkillTypeCount() const {return skillTypes.size();} + inline int getCommandTypeCount() const {return commandTypes.size();} + inline int getLevelCount() const {return levels.size();} + inline bool getLight() const {return light;} + inline bool getRotationAllowed() const {return rotationAllowed;} + inline Vec3f getLightColor() const {return lightColor;} + inline bool getMultiSelect() const {return multiSelect;} + inline int getSight() const {return sight;} + inline int getSize() const {return size;} int getHeight() const {return height;} int getStoredResourceCount() const {return storedResources.size();} - const Resource *getStoredResource(int i) const {return &storedResources[i];} + inline const Resource *getStoredResource(int i) const {return &storedResources[i];} bool getCellMapCell(int x, int y, CardinalDir facing) const; - bool getMeetingPoint() const {return meetingPoint;} - bool getCountUnitDeathInStats() const {return countUnitDeathInStats;} - bool getCountUnitProductionInStats() const {return countUnitProductionInStats;} - bool getCountUnitKillInStats() const {return countUnitKillInStats;} - bool getCountKillForUnitUpgrade() const {return countKillForUnitUpgrade;} - bool isMobile() const {return (firstSkillTypeOfClass[scMove] != NULL);} - Texture2D *getMeetingPointImage() const {return meetingPointImage;} - StaticSound *getSelectionSound() const {return selectionSounds.getRandSound();} - StaticSound *getCommandSound() const {return commandSounds.getRandSound();} + inline bool getMeetingPoint() const {return meetingPoint;} + inline bool getCountUnitDeathInStats() const {return countUnitDeathInStats;} + inline bool getCountUnitProductionInStats() const {return countUnitProductionInStats;} + inline bool getCountUnitKillInStats() const {return countUnitKillInStats;} + inline bool getCountKillForUnitUpgrade() const {return countKillForUnitUpgrade;} + inline bool isMobile() const {return (firstSkillTypeOfClass[scMove] != NULL);} + inline Texture2D *getMeetingPointImage() const {return meetingPointImage;} + inline StaticSound *getSelectionSound() const {return selectionSounds.getRandSound();} + inline StaticSound *getCommandSound() const {return commandSounds.getRandSound();} - const SoundContainer & getSelectionSounds() const { return selectionSounds; } - const SoundContainer & getCommandSounds() const { return commandSounds; } + inline const SoundContainer & getSelectionSounds() const { return selectionSounds; } + inline const SoundContainer & getCommandSounds() const { return commandSounds; } int getStore(const ResourceType *rt) const; const SkillType *getSkillType(const string &skillName, SkillClass skillClass) const; @@ -216,8 +216,8 @@ public: bool hasCommandClass(CommandClass commandClass) const; bool hasSkillType(const SkillType *skillType) const; bool hasSkillClass(SkillClass skillClass) const; - bool hasCellMap() const {return cellMap!=NULL;} - bool getAllowEmptyCellMap() const {return allowEmptyCellMap;} + inline bool hasCellMap() const {return cellMap!=NULL;} + inline bool getAllowEmptyCellMap() const {return allowEmptyCellMap;} bool hasEmptyCellMap() const; Vec2i getFirstOccupiedCellInCellMap(Vec2i currentPos) const; @@ -228,8 +228,8 @@ public: const CommandType* findCommandTypeById(int id) const; string getCommandTypeListDesc() const; - float getRotatedBuildPos() { return rotatedBuildPos; } - void setRotatedBuildPos(float value) { rotatedBuildPos = value; } + inline float getRotatedBuildPos() { return rotatedBuildPos; } + inline void setRotatedBuildPos(float value) { rotatedBuildPos = value; } //other virtual string getReqDesc() const; diff --git a/source/glest_game/world/map.h b/source/glest_game/world/map.h index 69d5df223..9083c899c 100644 --- a/source/glest_game/world/map.h +++ b/source/glest_game/world/map.h @@ -64,9 +64,9 @@ public: inline Unit *getUnitWithEmptyCellMap(int field) const { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} return unitsWithEmptyCellMap[field];} inline float getHeight() const {return height;} - void setUnit(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} units[field]= unit;} - void setUnitWithEmptyCellMap(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} unitsWithEmptyCellMap[field]= unit;} - void setHeight(float height) {this->height= height;} + inline void setUnit(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} units[field]= unit;} + inline void setUnitWithEmptyCellMap(int field, Unit *unit) { if(field >= fieldCount) { throw megaglest_runtime_error("Invalid field value" + intToStr(field));} unitsWithEmptyCellMap[field]= unit;} + inline void setHeight(float height) {this->height= height;} inline bool isFree(Field field) const { bool result = getUnit(field) == NULL || getUnit(field)->isPutrefacting(); @@ -134,34 +134,34 @@ public: void end(); //to kill particles //get - const Vec3f &getVertex() const {return vertex;} - float getHeight() const {return vertex.y;} - const Vec3f &getColor() const {return color;} - const Vec3f &getNormal() const {return normal;} - int getSurfaceType() const {return surfaceType;} - const Texture2D *getSurfaceTexture() const {return surfaceTexture;} - Object *getObject() const {return object;} - Resource *getResource() const {return object==NULL? NULL: object->getResource();} - const Vec2f &getFowTexCoord() const {return fowTexCoord;} - const Vec2f &getSurfTexCoord() const {return surfTexCoord;} - bool getNearSubmerged() const {return nearSubmerged;} + inline const Vec3f &getVertex() const {return vertex;} + inline float getHeight() const {return vertex.y;} + inline const Vec3f &getColor() const {return color;} + inline const Vec3f &getNormal() const {return normal;} + inline int getSurfaceType() const {return surfaceType;} + inline const Texture2D *getSurfaceTexture() const {return surfaceTexture;} + inline Object *getObject() const {return object;} + inline Resource *getResource() const {return object==NULL? NULL: object->getResource();} + inline const Vec2f &getFowTexCoord() const {return fowTexCoord;} + inline const Vec2f &getSurfTexCoord() const {return surfTexCoord;} + inline bool getNearSubmerged() const {return nearSubmerged;} inline bool isVisible(int teamIndex) const {return visible[teamIndex];} inline bool isExplored(int teamIndex) const {return explored[teamIndex];} //set - void setVertex(const Vec3f &vertex) {this->vertex= vertex;} - void setHeight(float height, bool cellChangedFromOriginalMapLoadValue=false); - void setNormal(const Vec3f &normal) {this->normal= normal;} - void setColor(const Vec3f &color) {this->color= color;} - void setSurfaceType(int surfaceType) {this->surfaceType= surfaceType;} - void setSurfaceTexture(const Texture2D *st) {this->surfaceTexture= st;} - void setObject(Object *object) {this->object= object;} - void setFowTexCoord(const Vec2f &ftc) {this->fowTexCoord= ftc;} - void setSurfTexCoord(const Vec2f &stc) {this->surfTexCoord= stc;} + inline void setVertex(const Vec3f &vertex) {this->vertex= vertex;} + inline void setHeight(float height, bool cellChangedFromOriginalMapLoadValue=false); + inline void setNormal(const Vec3f &normal) {this->normal= normal;} + inline void setColor(const Vec3f &color) {this->color= color;} + inline void setSurfaceType(int surfaceType) {this->surfaceType= surfaceType;} + inline void setSurfaceTexture(const Texture2D *st) {this->surfaceTexture= st;} + inline void setObject(Object *object) {this->object= object;} + inline void setFowTexCoord(const Vec2f &ftc) {this->fowTexCoord= ftc;} + inline void setSurfTexCoord(const Vec2f &stc) {this->surfTexCoord= stc;} void setExplored(int teamIndex, bool explored); void setVisible(int teamIndex, bool visible); - void setNearSubmerged(bool nearSubmerged) {this->nearSubmerged= nearSubmerged;} + inline void setNearSubmerged(bool nearSubmerged) {this->nearSubmerged= nearSubmerged;} //misc void deleteResource(); diff --git a/source/glest_game/world/surface_atlas.h b/source/glest_game/world/surface_atlas.h index 7720c98f8..b80a83182 100644 --- a/source/glest_game/world/surface_atlas.h +++ b/source/glest_game/world/surface_atlas.h @@ -46,16 +46,16 @@ public: SurfaceInfo(const Pixmap2D *lu, const Pixmap2D *ru, const Pixmap2D *ld, const Pixmap2D *rd); bool operator==(const SurfaceInfo &si) const; - const Pixmap2D *getCenter() const {return center;} - const Pixmap2D *getLeftUp() const {return leftUp;} - const Pixmap2D *getRightUp() const {return rightUp;} - const Pixmap2D *getLeftDown() const {return leftDown;} - const Pixmap2D *getRightDown() const {return rightDown;} - const Vec2f &getCoord() const {return coord;} - const Texture2D *getTexture() const {return texture;} + inline const Pixmap2D *getCenter() const {return center;} + inline const Pixmap2D *getLeftUp() const {return leftUp;} + inline const Pixmap2D *getRightUp() const {return rightUp;} + inline const Pixmap2D *getLeftDown() const {return leftDown;} + inline const Pixmap2D *getRightDown() const {return rightDown;} + inline const Vec2f &getCoord() const {return coord;} + inline const Texture2D *getTexture() const {return texture;} - void setCoord(const Vec2f &coord) {this->coord= coord;} - void setTexture(const Texture2D *texture) {this->texture= texture;} + inline void setCoord(const Vec2f &coord) {this->coord= coord;} + inline void setTexture(const Texture2D *texture) {this->texture= texture;} }; // ===================================================== diff --git a/source/glest_game/world/time_flow.h b/source/glest_game/world/time_flow.h index 8d166daa0..0373690ec 100644 --- a/source/glest_game/world/time_flow.h +++ b/source/glest_game/world/time_flow.h @@ -51,11 +51,11 @@ public: } void init(Tileset *tileset); - float getTime() const {return time;} - bool isDay() const {return time>dawn && timedusk-1.f;} - float getTimeInc() const {return timeInc;} + inline float getTime() const {return time;} + inline bool isDay() const {return time>dawn && timedusk-1.f;} + inline float getTimeInc() const {return timeInc;} Vec3f computeLightColor() const; void update(); diff --git a/source/glest_game/world/unit_updater.h b/source/glest_game/world/unit_updater.h index e7e625621..7a5f2ae1e 100644 --- a/source/glest_game/world/unit_updater.h +++ b/source/glest_game/world/unit_updater.h @@ -117,7 +117,7 @@ public: void clearUnitPrecache(Unit *unit); void removeUnitPrecache(Unit *unit); - unsigned int getAttackWarningCount() const { return attackWarnings.size(); } + inline unsigned int getAttackWarningCount() const { return attackWarnings.size(); } std::pair unitBeingAttacked(const Unit *unit); void unitBeingAttacked(std::pair &result, const Unit *unit, const AttackSkillType *ast,float *currentDistToUnit=NULL); vector enemyUnitsOnRange(const Unit *unit,const AttackSkillType *ast); diff --git a/source/glest_game/world/world.h b/source/glest_game/world/world.h index 06a130018..f51970b4b 100644 --- a/source/glest_game/world/world.h +++ b/source/glest_game/world/world.h @@ -156,38 +156,38 @@ public: void endScenario(); //to die before selection does //get - int getMaxPlayers() const {return map.getMaxPlayers();} - int getThisFactionIndex() const {return thisFactionIndex;} + inline int getMaxPlayers() const {return map.getMaxPlayers();} + inline int getThisFactionIndex() const {return thisFactionIndex;} - int getThisTeamIndex() const {return thisTeamIndex;} - void setThisTeamIndex(int team) { thisTeamIndex=team;} + inline int getThisTeamIndex() const {return thisTeamIndex;} + inline void setThisTeamIndex(int team) { thisTeamIndex=team;} - const Faction *getThisFaction() const {return factions[thisFactionIndex];} - Faction *getThisFactionPtr() {return factions[thisFactionIndex];} + inline const Faction *getThisFaction() const {return factions[thisFactionIndex];} + inline Faction *getThisFactionPtr() {return factions[thisFactionIndex];} - int getFactionCount() const {return factions.size();} - const Map *getMap() const {return ↦} - Map *getMapPtr() {return ↦} + inline int getFactionCount() const {return factions.size();} + inline const Map *getMap() const {return ↦} + inline Map *getMapPtr() {return ↦} - const Tileset *getTileset() const {return &tileset;} - const TechTree *getTechTree() const {return techTree;} - const Scenario *getScenario() const {return &scenario;} - const TimeFlow *getTimeFlow() const {return &timeFlow;} - Tileset *getTileset() {return &tileset;} - Map *getMap() {return ↦} + inline const Tileset *getTileset() const {return &tileset;} + inline const TechTree *getTechTree() const {return techTree;} + inline const Scenario *getScenario() const {return &scenario;} + inline const TimeFlow *getTimeFlow() const {return &timeFlow;} + inline Tileset *getTileset() {return &tileset;} + inline Map *getMap() {return ↦} Cartographer* getCartographer() {return cartographer;} RoutePlanner* getRoutePlanner() {return routePlanner;} - const Faction *getFaction(int i) const {return factions[i];} - Faction *getFaction(int i) {return factions[i];} - const Minimap *getMinimap() const {return &minimap;} - Minimap *getMiniMapObject() {return &minimap;} - const Stats *getStats() const {return &stats;}; - Stats *getStats() {return &stats;}; - const WaterEffects *getWaterEffects() const {return &waterEffects;} - const WaterEffects *getAttackEffects() const {return &attackEffects;} + inline const Faction *getFaction(int i) const {return factions[i];} + inline Faction *getFaction(int i) {return factions[i];} + inline const Minimap *getMinimap() const {return &minimap;} + inline Minimap *getMiniMapObject() {return &minimap;} + inline const Stats *getStats() const {return &stats;}; + inline Stats *getStats() {return &stats;}; + inline const WaterEffects *getWaterEffects() const {return &waterEffects;} + inline const WaterEffects *getAttackEffects() const {return &attackEffects;} int getNextUnitId(Faction *faction); int getNextCommandGroupId(); - int getFrameCount() const {return frameCount;} + inline int getFrameCount() const {return frameCount;} //init & load void init(Game *game, bool createUnits, bool initFactions=true); @@ -201,8 +201,8 @@ public: Checksum loadMap(const string &path, Checksum* checksum); Checksum loadScenario(const string &path, Checksum* checksum,bool resetCurrentScenario=false,const XmlNode *rootNode=NULL); void setQueuedScenario(string scenarioName,bool keepFactions); - string getQueuedScenario() const { return queuedScenarioName; } - bool getQueuedScenarioKeepFactions() const { return queuedScenarioKeepFactions; } + inline string getQueuedScenario() const { return queuedScenarioName; } + inline bool getQueuedScenarioKeepFactions() const { return queuedScenarioKeepFactions; } void initUnitsForScenario(); //misc @@ -249,7 +249,7 @@ public: const string getSystemMacroValue(const string key); const string getPlayerName(int factionIndex); - Game * getGame() { return game; } + inline Game * getGame() { return game; } const GameSettings * getGameSettings() const; GameSettings * getGameSettingsPtr(); @@ -266,7 +266,7 @@ public: void exploreCells(const Vec2i &newPos, int sightRange, int teamIndex); bool showWorldForPlayer(int factionIndex) const; - UnitUpdater * getUnitUpdater() { return &unitUpdater; } + inline UnitUpdater * getUnitUpdater() { return &unitUpdater; } void removeResourceTargetFromCache(const Vec2i &pos);