diff --git a/libgag/include/BinaryStream.h b/libgag/include/BinaryStream.h index c8b9764b..466cc1ab 100644 --- a/libgag/include/BinaryStream.h +++ b/libgag/include/BinaryStream.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __BINARYSTREAM_H -#define __BINARYSTREAM_H +#ifndef __BINARY_STREAM_H +#define __BINARY_STREAM_H #include #include @@ -41,16 +41,16 @@ namespace GAGCore virtual void write(const void *data, const size_t size, const std::string name); - virtual void writeEndianIndependant(const void *v, const size_t size, const std::string name); + virtual void writeEndianIndependent(const void *v, const size_t size, const std::string name); virtual void writeSint8(const Sint8 v, const std::string name) { this->write(&v, 1, name); } virtual void writeUint8(const Uint8 v, const std::string name) { this->write(&v, 1, name); } - virtual void writeSint16(const Sint16 v, const std::string name) { this->writeEndianIndependant(&v, 2, name); } - virtual void writeUint16(const Uint16 v, const std::string name) { this->writeEndianIndependant(&v, 2, name); } - virtual void writeSint32(const Sint32 v, const std::string name) { this->writeEndianIndependant(&v, 4, name); } - virtual void writeUint32(const Uint32 v, const std::string name) { this->writeEndianIndependant(&v, 4, name); } - virtual void writeFloat(const float v, const std::string name) { this->writeEndianIndependant(&v, 4, name); } - virtual void writeDouble(const double v, const std::string name) { this->writeEndianIndependant(&v, 8, name); } + virtual void writeSint16(const Sint16 v, const std::string name) { this->writeEndianIndependent(&v, 2, name); } + virtual void writeUint16(const Uint16 v, const std::string name) { this->writeEndianIndependent(&v, 2, name); } + virtual void writeSint32(const Sint32 v, const std::string name) { this->writeEndianIndependent(&v, 4, name); } + virtual void writeUint32(const Uint32 v, const std::string name) { this->writeEndianIndependent(&v, 4, name); } + virtual void writeFloat(const float v, const std::string name) { this->writeEndianIndependent(&v, 4, name); } + virtual void writeDouble(const double v, const std::string name) { this->writeEndianIndependent(&v, 8, name); } virtual void writeText(const std::string &v, const std::string name); virtual void flush(void) { backend->flush(); } @@ -85,16 +85,16 @@ namespace GAGCore virtual void read(void *data, size_t size, const std::string name) { backend->read(data, size); } - virtual void readEndianIndependant(void *v, size_t size, const std::string name); + virtual void readEndianIndependent(void *v, size_t size, const std::string name); virtual Sint8 readSint8(const std::string name) { Sint8 i; this->read(&i, 1, name); return i; } virtual Uint8 readUint8(const std::string name) { Uint8 i; this->read(&i, 1, name); return i; } - virtual Sint16 readSint16(const std::string name) { Sint16 i; this->readEndianIndependant(&i, 2, name); return i; } - virtual Uint16 readUint16(const std::string name) { Uint16 i; this->readEndianIndependant(&i, 2, name); return i; } - virtual Sint32 readSint32(const std::string name) { Sint32 i; this->readEndianIndependant(&i, 4, name); return i; } - virtual Uint32 readUint32(const std::string name) { Uint32 i; this->readEndianIndependant(&i, 4, name); return i; } - virtual float readFloat(const std::string name) { float f; this->readEndianIndependant(&f, 4, name); return f; } - virtual double readDouble(const std::string name) { double d; this->readEndianIndependant(&d, 8, name); return d; } + virtual Sint16 readSint16(const std::string name) { Sint16 i; this->readEndianIndependent(&i, 2, name); return i; } + virtual Uint16 readUint16(const std::string name) { Uint16 i; this->readEndianIndependent(&i, 2, name); return i; } + virtual Sint32 readSint32(const std::string name) { Sint32 i; this->readEndianIndependent(&i, 4, name); return i; } + virtual Uint32 readUint32(const std::string name) { Uint32 i; this->readEndianIndependent(&i, 4, name); return i; } + virtual float readFloat(const std::string name) { float f; this->readEndianIndependent(&f, 4, name); return f; } + virtual double readDouble(const std::string name) { double d; this->readEndianIndependent(&d, 8, name); return d; } virtual std::string readText(const std::string name); virtual void readEnterSection(const std::string name) { } diff --git a/libgag/include/FileManager.h b/libgag/include/FileManager.h index 5c267e37..6e3c45fe 100644 --- a/libgag/include/FileManager.h +++ b/libgag/include/FileManager.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __FILEMANAGER_H -#define __FILEMANAGER_H +#ifndef __FILE_MANAGER_H +#define __FILE_MANAGER_H #include "GAGSys.h" #include @@ -66,11 +66,11 @@ namespace GAGCore //! internal function that does the real listing job bool addListingForDir(const std::string realDir, const std::string extension="", const bool dirs=false); //! open a file, if it is in writing, do a backup - SDL_RWops *openWithbackup(const std::string filename, const std::string mode); + SDL_RWops *openWithBackup(const std::string filename, const std::string mode); //! open a file, if it is in writing, do a backup, fopen version - FILE *openWithbackupFP(const std::string filename, const std::string mode); + FILE *openWithBackupFP(const std::string filename, const std::string mode); //! open a file, if it is in writing, do a backup, std::ofstream version - std::ofstream *openWithbackupOFS(const std::string filename, std::ofstream::openmode mode); + std::ofstream *openWithBackupOFS(const std::string filename, std::ofstream::openmode mode); public: //! FileManager constructor @@ -92,9 +92,9 @@ namespace GAGCore //! Returns true if filename is a directory bool isDir(const std::string filename); - //! Compress source to dest uzing gzip, returns true on success + //! Compress source to dest using gzip, returns true on success bool gzip(const std::string &source, const std::string &dest); - //! Uncompress source to dest uzing gzip, returns true on success + //! Uncompress source to dest using gzip, returns true on success bool gunzip(const std::string &source, const std::string &dest); //! Open an output stream backend, use it to construct specific output streams diff --git a/libgag/include/FormatableString.h b/libgag/include/FormatableString.h index 38653b24..b76d56fd 100644 --- a/libgag/include/FormatableString.h +++ b/libgag/include/FormatableString.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef FORMATABLESTRING_H -#define FORMATABLESTRING_H +#ifndef FORMATABLE_STRING_H +#define FORMATABLE_STRING_H #include #include @@ -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/GAGSys.h b/libgag/include/GAGSys.h index 99a15cf8..a917471c 100644 --- a/libgag/include/GAGSys.h +++ b/libgag/include/GAGSys.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GAGSYS_H -#define __GAGSYS_H +#ifndef __GAG_SYS_H +#define __GAG_SYS_H #ifndef MAX_SINT32 #define MAX_SINT32 0x7FFFFFFF diff --git a/libgag/include/GUIAnimation.h b/libgag/include/GUIAnimation.h index 3e5b3465..a8570a8a 100644 --- a/libgag/include/GUIAnimation.h +++ b/libgag/include/GUIAnimation.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIANIMATION_H -#define __GUIANIMATION_H +#ifndef __GUI_ANIMATION_H +#define __GUI_ANIMATION_H #include "GUIBase.h" #include diff --git a/libgag/include/GUIBase.h b/libgag/include/GUIBase.h index fb2d2ccf..a6aa8124 100644 --- a/libgag/include/GUIBase.h +++ b/libgag/include/GUIBase.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIBASE_H -#define __GUIBASE_H +#ifndef __GUI_BASE_H +#define __GUI_BASE_H #include "GAGSys.h" #include "GraphicContext.h" diff --git a/libgag/include/GUIButton.h b/libgag/include/GUIButton.h index d9b89ec5..486bdc4e 100644 --- a/libgag/include/GUIButton.h +++ b/libgag/include/GUIButton.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIBUTTON_H -#define __GUIBUTTON_H +#ifndef __GUI_BUTTON_H +#define __GUI_BUTTON_H #include "GUIBase.h" #include @@ -163,8 +163,8 @@ namespace GAGGUI public: MultiTextButton() { textIndex=0; returnCode=0; } - MultiTextButton(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, const std::string text, int retuxrnCode, Uint16 unicodeShortcut=0); - MultiTextButton(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, const std::string text, int retuxrnCode, const std::string& tooltip, const std::string &tooltipFont, Uint16 unicodeShortcut=0); + MultiTextButton(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, const std::string text, int returnCode, Uint16 unicodeShortcut=0); + MultiTextButton(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, const std::string text, int returnCode, const std::string& tooltip, const std::string &tooltipFont, Uint16 unicodeShortcut=0); virtual ~MultiTextButton() { } diff --git a/libgag/include/GUICheckList.h b/libgag/include/GUICheckList.h index cbd935c3..5eb1fe5a 100644 --- a/libgag/include/GUICheckList.h +++ b/libgag/include/GUICheckList.h @@ -21,7 +21,7 @@ #include "GUIList.h" -///A CheckList is bassically like a list, except that each item is either checked off or it isn't +///A CheckList is basically like a list, except that each item is either checked off or it isn't namespace GAGGUI { diff --git a/libgag/include/GUIFileList.h b/libgag/include/GUIFileList.h index 58c2e882..ff8d0c2f 100644 --- a/libgag/include/GUIFileList.h +++ b/libgag/include/GUIFileList.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIFILELIST_H -#define __GUIFILELIST_H +#ifndef __GUI_FILELIST_H +#define __GUI_FILELIST_H #include "FileManager.h" #include "GUIList.h" diff --git a/libgag/include/GUIImage.h b/libgag/include/GUIImage.h index 603c18e8..62b65a88 100644 --- a/libgag/include/GUIImage.h +++ b/libgag/include/GUIImage.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIIMAGE_H -#define __GUIIMAGE_H +#ifndef __GUI_IMAGE_H +#define __GUI_IMAGE_H #include "GUIBase.h" #include "GraphicContext.h" diff --git a/libgag/include/GUIKeySelector.h b/libgag/include/GUIKeySelector.h index d89e63f2..071a2c25 100644 --- a/libgag/include/GUIKeySelector.h +++ b/libgag/include/GUIKeySelector.h @@ -33,7 +33,7 @@ namespace GAGGUI class KeySelector: public HighlightableWidget { public: - //Construct with given cordinates + //Construct with given coordinates KeySelector(int x, int y, Uint32 hAlign, Uint32 vAlign, const std::string font, int w=0, int h=0); //Construct with tooltip KeySelector(int x, int y, Uint32 hAlign, Uint32 vAlign, const std::string font, const std::string& tooltip, const std::string &tooltipFont, int w=0, int h=0); diff --git a/libgag/include/GUIList.h b/libgag/include/GUIList.h index 8d8e3752..6dff12b6 100644 --- a/libgag/include/GUIList.h +++ b/libgag/include/GUIList.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUILIST_H -#define __GUILIST_H +#ifndef __GUI_LIST_H +#define __GUI_LIST_H #include "GUIBase.h" #include diff --git a/libgag/include/GUIMessageBox.h b/libgag/include/GUIMessageBox.h index a13ef88a..c995413b 100644 --- a/libgag/include/GUIMessageBox.h +++ b/libgag/include/GUIMessageBox.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIMESSAGEBOX_H -#define __GUIMESSAGEBOX_H +#ifndef __GUI_MESSAGE_BOX_H +#define __GUI_MESSAGE_BOX_H #include "GUIBase.h" @@ -28,15 +28,15 @@ namespace GAGGUI enum MessageBoxType { //! One button (like OK) - MB_ONEBUTTON, + MB_ONE_BUTTON, //! Two buttons (like Ok, Cancel) - MB_TWOBUTTONS, + MB_TWO_BUTTONS, //! three buttons, (like Yes, No, Cancel) - MB_THREEBUTTONS + MB_THREE_BUTTONS }; //! The display a modal message box, with a title and some buttons - //! \retval the nummer of the clicked button, -1 on unexpected early-out (CTRL-C, ...) + //! \retval the number of the clicked button, -1 on unexpected early-out (CTRL-C, ...) int MessageBox(GAGCore::GraphicContext *parentCtx, const std::string font, MessageBoxType type, std::string title, std::string caption1, std::string caption2 = "", std::string caption3 = ""); } diff --git a/libgag/include/GUIProgressBar.h b/libgag/include/GUIProgressBar.h index 3f003f99..116a3733 100644 --- a/libgag/include/GUIProgressBar.h +++ b/libgag/include/GUIProgressBar.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIPROGRESS_BAR_H -#define __GUIPROGRESS_BAR_H +#ifndef __GUI_PROGRESS_BAR_H +#define __GUI_PROGRESS_BAR_H #include "GUIBase.h" #include "GraphicContext.h" diff --git a/libgag/include/GUISelector.h b/libgag/include/GUISelector.h index 04377882..4f586bcd 100644 --- a/libgag/include/GUISelector.h +++ b/libgag/include/GUISelector.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUISELECTOR_H -#define __GUISELECTOR_H +#ifndef __GUI_SELECTOR_H +#define __GUI_SELECTOR_H #include "GUIBase.h" #include diff --git a/libgag/include/GUIStyle.h b/libgag/include/GUIStyle.h index 3752259a..8a513d4f 100644 --- a/libgag/include/GUIStyle.h +++ b/libgag/include/GUIStyle.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUISTYLE_H -#define __GUISTYLE_H +#ifndef __GUI_STYLE_H +#define __GUI_STYLE_H #include "GraphicContext.h" diff --git a/libgag/include/GUITabScreen.h b/libgag/include/GUITabScreen.h index 6e0a2b51..e95135cd 100644 --- a/libgag/include/GUITabScreen.h +++ b/libgag/include/GUITabScreen.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef GUITabScreen_h -#define GUITabScreen_h +#ifndef __GUI_TAB_SCREEN_H +#define __GUI_TAB_SCREEN_H #include "GUIBase.h" #include @@ -45,7 +45,7 @@ namespace GAGGUI ///This removes a widget from a particular group. This calls remove widget automatically void removeWidgetFromGroup(Widget* widget, int group_n); - ///This sets a particular TabScreenWindow to a group_n. TabScreenWindows recieve events from the widgets + ///This sets a particular TabScreenWindow to a group_n. TabScreenWindows receive events from the widgets ///in their group. void setTabScreenWindowToGroup(TabScreenWindow* window, int group_n); @@ -64,7 +64,7 @@ namespace GAGGUI ///This removes a title for a group, removing the group and any widgets in it void removeGroup(int group_n); - ///Recieves the action. Child classes should call this one first + ///Receives the action. Child classes should call this one first void onAction(Widget *source, Action action, int par1, int par2); ///This is called when a group has been activated diff --git a/libgag/include/GUITabScreenWindow.h b/libgag/include/GUITabScreenWindow.h index a4c89ea6..eba3e755 100644 --- a/libgag/include/GUITabScreenWindow.h +++ b/libgag/include/GUITabScreenWindow.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef GUITabScreenWindow_h -#define GUITabScreenWindow_h +#ifndef __GUI_TAB_SCREEN_WINDOW_H +#define __GUI_TAB_SCREEN_WINDOW_H #include "GUIBase.h" @@ -32,8 +32,8 @@ namespace GAGGUI namespace GAGGUI { ///A TabScreenWindow is like a Screen, except that its meant to operate as a tab - ///in a TabScreen, rather than a whole screen by itself. A TabScreenWindow bassically - ///recieves events from the widgets in its TabScreen group, and has a return code + ///in a TabScreen, rather than a whole screen by itself. A TabScreenWindow basically + ///receives events from the widgets in its TabScreen group, and has a return code class TabScreenWindow { public: @@ -75,7 +75,7 @@ namespace GAGGUI ///Ends the execution of the TabScreenWindow with the given end value void endExecute(int returnCode); - ///Sets whether this window is acticated or not + ///Sets whether this window is activated or not void setActivated(bool activated); ///This is the parent of this tab screen window diff --git a/libgag/include/GUIText.h b/libgag/include/GUIText.h index c098cece..ab24f9bb 100644 --- a/libgag/include/GUIText.h +++ b/libgag/include/GUIText.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUITEXT_H -#define __GUITEXT_H +#ifndef __GUI_TEXT_H +#define __GUI_TEXT_H #include "GUIBase.h" #include "GraphicContext.h" diff --git a/libgag/include/GUITextArea.h b/libgag/include/GUITextArea.h index 3f4d8ca6..9faebe12 100644 --- a/libgag/include/GUITextArea.h +++ b/libgag/include/GUITextArea.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUITEXTAREA_H -#define __GUITEXTAREA_H +#ifndef __GUI_TEXT_AREA_H +#define __GUI_TEXT_AREA_H #include "GUIBase.h" #include @@ -37,7 +37,7 @@ namespace GAGGUI { protected: bool readOnly; - std::string spritelocation; + std::string spriteLocation; int spriteWidth; GAGCore::Font *font; size_t areaHeight; @@ -72,7 +72,7 @@ namespace GAGGUI const std::string font, bool readOnly=true, const std::string text="", - const std::string spritelocation=""); + const std::string spriteLocation=""); TextArea(int x, int y, int w, @@ -84,7 +84,7 @@ namespace GAGGUI const std::string &tooltipFont, bool readOnly=true, const std::string text="", - const std::string spritelocation=""); + const std::string spriteLocation=""); virtual ~TextArea(); virtual void internalInit(void); diff --git a/libgag/include/GUITextInput.h b/libgag/include/GUITextInput.h index bcd45a13..19cd7f38 100644 --- a/libgag/include/GUITextInput.h +++ b/libgag/include/GUITextInput.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUITEXTINPUT_H -#define __GUITEXTINPUT_H +#ifndef __GUI_TEXT_INPUT_H +#define __GUI_TEXT_INPUT_H #include "GUIBase.h" #include @@ -42,7 +42,7 @@ namespace GAGGUI size_t cursPos; size_t maxLength; bool password; - std::vector autocompletableWord; + std::vector autoCompletableWord; // cache, recomputed at least on paint GAGCore::Font *fontPtr; @@ -93,7 +93,7 @@ namespace GAGGUI // autocompletion void addAutoCompletableWord(const std::string &word); void removeAutoCompletableWord(const std::string &word); - bool getAutoCompleteSuggestion(const std::string & word, std::vector & wordlist); + bool getAutoCompleteSuggestion(const std::string & word, std::vector & wordList); std::string getAutoComplete(const std::string & word, int n); bool isActivated(void) { return activated; } diff --git a/libgag/include/GraphicContext.h b/libgag/include/GraphicContext.h index 17745cd3..82e1260f 100644 --- a/libgag/include/GraphicContext.h +++ b/libgag/include/GraphicContext.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GRAPHICCONTEXT_H -#define __GRAPHICCONTEXT_H +#ifndef __GRAPHIC_CONTEXT_H +#define __GRAPHIC_CONTEXT_H #include "SDLGraphicContext.h" diff --git a/libgag/include/KeyPress.h b/libgag/include/KeyPress.h index c410784a..50ad26be 100644 --- a/libgag/include/KeyPress.h +++ b/libgag/include/KeyPress.h @@ -16,8 +16,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef KeyPress_h -#define KeyPress_h +#ifndef __KEY_PRESS_H +#define __KEY_PRESS_H #include "SDL.h" #include @@ -66,7 +66,7 @@ class KeyPress ///Returns whether control must be held with the key bool needControl() const; - ///Returns whether the meta must be helt with the key + ///Returns whether the meta must be held with the key bool needMeta() const; ///Returns whether shift must be held with the key diff --git a/libgag/include/SDLGraphicContext.h b/libgag/include/SDLGraphicContext.h index fc364c5c..de4bcc52 100644 --- a/libgag/include/SDLGraphicContext.h +++ b/libgag/include/SDLGraphicContext.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef INCLUDED_SDL_GRAPHICCONTEXT_H -#define INCLUDED_SDL_GRAPHICCONTEXT_H +#ifndef INCLUDED_SDL_GRAPHIC_CONTEXT_H +#define INCLUDED_SDL_GRAPHIC_CONTEXT_H #include "GAGSys.h" #include "CursorManager.h" @@ -39,7 +39,7 @@ namespace GAGCore //! Color is 4 bytes big but provides easy access to components struct Color { - //! Typical usefull alpha values pre-defined + //! Typical useful alpha values pre-defined enum Alpha { ALPHA_TRANSPARENT = 0, //!< constant for transparent alpha @@ -55,7 +55,7 @@ namespace GAGCore //! Return HSV values in pointers void getHSV(float *hue, float *sat, float *lum); - //! Set color from HLS, alpha unctouched + //! Set color from HLS, alpha untouched void setHSV(float hue, float sat, float lum); //! pack components in a 32 bits int given SDL screen values @@ -82,7 +82,7 @@ namespace GAGCore class Sprite; - //! Font with a given foundery, shape and color + //! Font with a given foundry, shape and color class Font { public: @@ -159,7 +159,7 @@ namespace GAGCore friend struct Color; friend class GraphicContext; //! the underlying software SDL surface - SDL_Surface *sdlsurface; + SDL_Surface *sdlSurface; //! The clipping rect, we do not draw outside it SDL_Rect clipRect; //! this surface has been modified since latest blit @@ -176,9 +176,9 @@ namespace GAGCore void _drawHorzLine(int x, int y, int l, const Color& color); protected: - //! Protectedconstructor, only called by GraphicContext - DrawableSurface() { sdlsurface = NULL; } - //! allocate textre in GPU for this surface + //! Protected constructor, only called by GraphicContext + DrawableSurface() { sdlSurface = NULL; } + //! allocate texture in GPU for this surface void allocateTexture(void); //! reset the texture size upon changes void initTextureSize(void); @@ -209,8 +209,8 @@ namespace GAGCore virtual void shiftHSV(float hue, float sat, float lum); // accessors - virtual int getW(void) { return sdlsurface->w; } - virtual int getH(void) { return sdlsurface->h; } + virtual int getW(void) { return sdlSurface->w; } + virtual int getH(void) { return sdlSurface->h; } // capability querying virtual bool canDrawStretchedSprite(void) { return false; } @@ -253,7 +253,7 @@ namespace GAGCore void drawString(float x, float y, Font *font, const std::string &msg, float w = 0, Uint8 alpha = Color::ALPHA_OPAQUE); - //! Draw an alpha map of size mapW, mapH using a specific color at coordinantes x, y using cells of size cellW, cellH + //! Draw an alpha map of size mapW, mapH using a specific color at coordinates x, y using cells of size cellW, cellH virtual void drawAlphaMap(const std::valarray &map, int mapW, int mapH, int x, int y, int cellW, int cellH, const Color &color); virtual void drawAlphaMap(const std::valarray &map, int mapW, int mapH, int x, int y, int cellW, int cellH, const Color &color); @@ -269,7 +269,7 @@ namespace GAGCore virtual void drawCircle(int x, int y, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a = Color::ALPHA_OPAQUE); virtual void drawString(int x, int y, Font *font, int i); - // This is for translation textshot code, it works by trapping calls to the getString function in the translation StringTables, + // This is for translation text shot code, it works by trapping calls to the getString function in the translation StringTables, // then later in drawString, if we are drawing one of the found strings returned by StringTable, it will add it to the list of // rectangles that represent found texts. Just before the next frame begins to draw, all of the rectangle pictures are flushed // into bmp's. This is done because we want the translation pictures to be done when *all* of the screen is already drawn (when @@ -310,11 +310,11 @@ namespace GAGCore enum OptionFlags { DEFAULT = 0, - USEGPU = 1, - FULLSCREEN = 2, + USE_GPU = 1, + FULL_SCREEN = 2, //TODO: either implement "resizable" as a resizable gui or explain what this does RESIZABLE = 8, - CUSTOMCURSOR = 16, + CUSTOM_CURSOR = 16, }; protected: @@ -328,7 +328,7 @@ namespace GAGCore std::string appIcon; public: - //! Constructor. Create a new window of size (w,h). If useGPU is true, use GPU for accelerated 2D (OpenGL or DX) + //! Constructor. Create a new window of size (w,h). If useGpu is true, use GPU for accelerated 2D (OpenGL or DX) GraphicContext(int w, int h, Uint32 flags, const std::string title = "", const std::string icon = ""); //! Destructor virtual ~GraphicContext(void); @@ -347,7 +347,7 @@ namespace GAGCore virtual void shiftHSV(float hue, float sat, float lum) { } // reimplemented drawing commands for HW (GPU / GL) accelerated version - virtual bool canDrawStretchedSprite(void) { return (optionFlags & USEGPU) != 0; } + virtual bool canDrawStretchedSprite(void) { return (optionFlags & USE_GPU) != 0; } virtual void drawPixel(int x, int y, const Color& color); virtual void drawPixel(float x, float y, const Color& color); diff --git a/libgag/include/Stream.h b/libgag/include/Stream.h index 84c4fa9e..196e27fc 100644 --- a/libgag/include/Stream.h +++ b/libgag/include/Stream.h @@ -26,7 +26,7 @@ namespace GAGCore { - //! A stream is a high-level serialization structure, used to read/write structured datas + //! A stream is a high-level serialization structure, used to read/write structured data class Stream { public: diff --git a/libgag/include/StreamBackend.h b/libgag/include/StreamBackend.h index 7ae90ca7..cb5e2bf0 100644 --- a/libgag/include/StreamBackend.h +++ b/libgag/include/StreamBackend.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __STREAMBACKEND_H -#define __STREAMBACKEND_H +#ifndef __STREAM_BACKEND_H +#define __STREAM_BACKEND_H #include #include @@ -107,7 +107,7 @@ namespace GAGCore class MemoryStreamBackend : public StreamBackend { private: - std::string datas; + std::string data; size_t index; public: @@ -126,7 +126,7 @@ namespace GAGCore virtual size_t getPosition(void); virtual bool isEndOfStream(void); virtual bool isValid(void) { return true; } - virtual const char* getBuffer() { return datas.c_str(); } + virtual const char* getBuffer() { return data.c_str(); } }; //! A stream that doesn't save data, it just produces a hash. Don't try to read from it! diff --git a/libgag/include/StreamFilter.h b/libgag/include/StreamFilter.h index aa3f9011..78389269 100644 --- a/libgag/include/StreamFilter.h +++ b/libgag/include/StreamFilter.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __STREAMFILTER_H -#define __STREAMFILTER_H +#ifndef __STREAM_FILTER_H +#define __STREAM_FILTER_H #include "StreamBackend.h" @@ -33,7 +33,7 @@ namespace GAGCore { public: //! Use backend as the source - CompressedInputStreamBackendFilter(StreamBackend *backen); + CompressedInputStreamBackendFilter(StreamBackend *backend); }; //! Uncompress from a StreamBackend @@ -44,7 +44,7 @@ namespace GAGCore public: //! Use backend as the destination - CompressedOutputStreamBackendFilter(StreamBackend *backen); + CompressedOutputStreamBackendFilter(StreamBackend *backend); //! Delete also the associated backend virtual ~CompressedOutputStreamBackendFilter(); //! We are writing in memory, never out of stream diff --git a/libgag/include/StringTable.h b/libgag/include/StringTable.h index 510a11dc..ca7f9a28 100644 --- a/libgag/include/StringTable.h +++ b/libgag/include/StringTable.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __STRINGTABLE_H -#define __STRINGTABLE_H +#ifndef __STRING_TABLE_H +#define __STRING_TABLE_H #include #include @@ -46,9 +46,9 @@ namespace GAGCore int getNumberOfLanguage(void) { return languageCount; } bool loadIncompleteList(const std::string filename); bool load(const std::string filename); - const std::string getString(const std::string stringname) const; - bool doesStringExist(const std::string stringname) const; - const std::string getStringInLang(const std::string stringname, int lang) const; + const std::string getString(const std::string stringName) const; + bool doesStringExist(const std::string stringName) const; + const std::string getStringInLang(const std::string stringName, int lang) const; void print(); private: diff --git a/libgag/include/TextSort.h b/libgag/include/TextSort.h index 49374cbd..f753ee05 100644 --- a/libgag/include/TextSort.h +++ b/libgag/include/TextSort.h @@ -16,8 +16,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef TextSort_h -#define TextSort_h +#ifndef __TEXT_SORT_H +#define __TEXT_SORT_H #include diff --git a/libgag/include/TextStream.h b/libgag/include/TextStream.h index 644bac2f..d314852c 100644 --- a/libgag/include/TextStream.h +++ b/libgag/include/TextStream.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __TEXTSTREAM_H -#define __TEXTSTREAM_H +#ifndef __TEXT_STREAM_H +#define __TEXT_STREAM_H #include #include diff --git a/libgag/include/Toolkit.h b/libgag/include/Toolkit.h index 93d50799..4150e5ee 100644 --- a/libgag/include/Toolkit.h +++ b/libgag/include/Toolkit.h @@ -31,11 +31,11 @@ namespace GAGCore class StringTable; class GraphicContext; - //! Toolkit is a ressource server + //! Toolkit is a resource server class Toolkit { private: - // Private constructor, we do not want the user to create a Tookit, it is a static thing + // Private constructor, we do not want the user to create a Toolkit, it is a static thing Toolkit() { } public: diff --git a/libgag/src/BinaryStream.cpp b/libgag/src/BinaryStream.cpp index 0d1ababd..4e41f6e6 100644 --- a/libgag/src/BinaryStream.cpp +++ b/libgag/src/BinaryStream.cpp @@ -37,7 +37,7 @@ namespace GAGCore backend->write(data, size); } - void BinaryOutputStream::writeEndianIndependant(const void *v, const size_t size, const std::string name) + void BinaryOutputStream::writeEndianIndependent(const void *v, const size_t size, const std::string name) { if (size==2) { @@ -78,7 +78,7 @@ namespace GAGCore SHA1Final(sha1, &sha1Context); } - void BinaryInputStream::readEndianIndependant(void *v, size_t size, const std::string name) + void BinaryInputStream::readEndianIndependent(void *v, size_t size, const std::string name) { backend->read(v, size); if (size==2) diff --git a/libgag/src/FileManager.cpp b/libgag/src/FileManager.cpp index cbcfba00..d45559e9 100644 --- a/libgag/src/FileManager.cpp +++ b/libgag/src/FileManager.cpp @@ -95,15 +95,15 @@ namespace GAGCore #endif char * pch; - int linksize = readlink(proc, link, sizeof(link)); - if (linksize < 0) + int linkSize = readlink(proc, link, sizeof(link)); + if (linkSize < 0) { perror("readlink() error"); } else { - assert ((int)sizeof(link) > linksize); - link[linksize] = '\0'; + assert ((int)sizeof(link) > linkSize); + link[linkSize] = '\0'; pch = strrchr(link,'/'); if ( (pch-link) > 0) @@ -115,7 +115,7 @@ namespace GAGCore if ( (pch-link) > 0) link[pch-link] = '\0'; - if ((linksize + 13) <= (int)sizeof(link)) + if ((linkSize + 13) <= (int)sizeof(link)) { strcat(link, "/share/glob2"); addDir(link); @@ -166,7 +166,7 @@ namespace GAGCore } } - SDL_RWops *FileManager::openWithbackup(const std::string filename, const std::string mode) + SDL_RWops *FileManager::openWithBackup(const std::string filename, const std::string mode) { if (mode.find('w') != std::string::npos) { @@ -177,7 +177,7 @@ namespace GAGCore return SDL_RWFromFile(filename.c_str(), mode.c_str()); } - FILE *FileManager::openWithbackupFP(const std::string filename, const std::string mode) + FILE *FileManager::openWithBackupFP(const std::string filename, const std::string mode) { if (mode.find('w') != std::string::npos) { @@ -188,7 +188,7 @@ namespace GAGCore return fopen(filename.c_str(), mode.c_str()); } - std::ofstream *FileManager::openWithbackupOFS(const std::string filename, std::ofstream::openmode mode) + std::ofstream *FileManager::openWithBackupOFS(const std::string filename, std::ofstream::openmode mode) { if (mode & std::ios_base::out) { @@ -285,7 +285,7 @@ namespace GAGCore path += filename; //std::cerr << "FileManager::open trying to open " << path << " corresponding to source [" << dirList[i] << "] and filename [" << filename << "] with mode " << mode << "\n" << std::endl; - SDL_RWops *fp = openWithbackup(path.c_str(), mode.c_str()); + SDL_RWops *fp = openWithBackup(path.c_str(), mode.c_str()); if (fp) return fp; } @@ -301,7 +301,7 @@ namespace GAGCore path += DIR_SEPARATOR; path += filename; - FILE *fp = openWithbackupFP(path.c_str(), mode.c_str()); + FILE *fp = openWithBackupFP(path.c_str(), mode.c_str()); if (fp) return fp; } @@ -417,7 +417,7 @@ namespace GAGCore return false; } - // Preapare source + // Prepare source srcStream->seekFromEnd(0); size_t fileLength = srcStream->getPosition(); srcStream->seekFromStart(0); @@ -448,7 +448,7 @@ namespace GAGCore return false; } - // Preapare source + // Prepare source gzFile gzStream = gzdopen(fileno(srcStream), "rb"); #define BLOCK_SIZE 1024*1024 std::string buffer; diff --git a/libgag/src/FormatableString.cpp b/libgag/src/FormatableString.cpp index bc5c358e..b251d2d0 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/GUIBase.cpp b/libgag/src/GUIBase.cpp index 36277e6b..74e46a77 100644 --- a/libgag/src/GUIBase.cpp +++ b/libgag/src/GUIBase.cpp @@ -243,8 +243,8 @@ namespace GAGGUI assert(parent); assert(parent->getSurface()); - int screenw = parent->getSurface()->getW(); - int screenh = parent->getSurface()->getH(); + int screenW = parent->getSurface()->getW(); + int screenH = parent->getSurface()->getH(); switch (hAlignFlag) { @@ -254,22 +254,22 @@ namespace GAGGUI break; case ALIGN_RIGHT: - *sx=screenw-w-x; + *sx=screenW-w-x; *sw=w; break; case ALIGN_FILL: *sx=x; - *sw=screenw-w-x; + *sw=screenW-w-x; break; case ALIGN_SCREEN_CENTERED: - *sx=x+((screenw-640)>>1); + *sx=x+((screenW-640)>>1); *sw=w; break; case ALIGN_CENTERED: - *sx = (screenw - w) >> 1; + *sx = (screenW - w) >> 1; *sw = w; break; @@ -285,22 +285,22 @@ namespace GAGGUI break; case ALIGN_RIGHT: - *sy=screenh-h-y; + *sy=screenH-h-y; *sh=h; break; case ALIGN_FILL: *sy=y; - *sh=screenh-h-y; + *sh=screenH-h-y; break; case ALIGN_SCREEN_CENTERED: - *sy=y+((screenh-480)>>1); + *sy=y+((screenH-480)>>1); *sh=h; break; case ALIGN_CENTERED: - *sy = (screenh - h) >> 1; + *sy = (screenH - h) >> 1; *sh = h; break; @@ -563,7 +563,7 @@ namespace GAGGUI // a switch in each specific onSDLEvent method // we never receive neither SDL_QUIT nor // SDL_VIDEORESIZE (not dispatched) - // For the moment, we do not take the following event in accout : + // For the moment, we do not take the following event in account : // SDL_SYSWMEVENT, SDL_JOY*****, switch(event->type) { diff --git a/libgag/src/GUIFileList.cpp b/libgag/src/GUIFileList.cpp index 8b41c0b5..081141fa 100644 --- a/libgag/src/GUIFileList.cpp +++ b/libgag/src/GUIFileList.cpp @@ -172,7 +172,7 @@ namespace GAGGUI return fullName; } - struct strfilecmp_functor + struct strFileCmpFunctor { bool operator()(const std::string &x, const std::string &y) { @@ -184,6 +184,6 @@ namespace GAGGUI void FileList::sort(void) { - std::sort(strings.begin(), strings.end(), strfilecmp_functor()); + std::sort(strings.begin(), strings.end(), strFileCmpFunctor()); } } diff --git a/libgag/src/GUIKeySelector.cpp b/libgag/src/GUIKeySelector.cpp index 30e36193..e02f4c17 100644 --- a/libgag/src/GUIKeySelector.cpp +++ b/libgag/src/GUIKeySelector.cpp @@ -83,10 +83,10 @@ namespace GAGGUI - void KeySelector::setKey(const KeyPress& nkey) + void KeySelector::setKey(const KeyPress& nKey) { - key = nkey; - this->text = nkey.getTranslated(); + key = nKey; + this->text = nKey.getTranslated(); } diff --git a/libgag/src/GUIProgressBar.cpp b/libgag/src/GUIProgressBar.cpp index 416ca9f4..73a3e091 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/GUITabScreenWindow.cpp b/libgag/src/GUITabScreenWindow.cpp index 45490e57..76d2a11f 100644 --- a/libgag/src/GUITabScreenWindow.cpp +++ b/libgag/src/GUITabScreenWindow.cpp @@ -88,15 +88,15 @@ namespace GAGGUI } - void TabScreenWindow::endExecute(int nreturnCode) + void TabScreenWindow::endExecute(int nReturnCode) { isExecuting = false; - returnCode = nreturnCode; + returnCode = nReturnCode; } - void TabScreenWindow::setActivated(bool nactivated) + void TabScreenWindow::setActivated(bool nActivated) { - activated=nactivated; + activated=nActivated; } }; diff --git a/libgag/src/GUITextArea.cpp b/libgag/src/GUITextArea.cpp index 5ee8c898..32428bc4 100644 --- a/libgag/src/GUITextArea.cpp +++ b/libgag/src/GUITextArea.cpp @@ -32,7 +32,7 @@ using namespace GAGCore; namespace GAGGUI { - TextArea::TextArea(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, bool readOnly, const std::string text, const std::string spritelocation) + TextArea::TextArea(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, bool readOnly, const std::string text, const std::string spriteLocation) { this->x = x; this->y = y; @@ -61,13 +61,13 @@ namespace GAGGUI this->text = text; - if (!spritelocation.empty()) - sprite = Toolkit::getSprite(spritelocation); + if (!spriteLocation.empty()) + sprite = Toolkit::getSprite(spriteLocation); if (sprite) spriteWidth = sprite->getW(0); } - TextArea::TextArea(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, const std::string &tooltip, const std::string &tooltipFont, bool readOnly, const std::string text, const std::string spritelocation) + TextArea::TextArea(int x, int y, int w, int h, Uint32 hAlign, Uint32 vAlign, const std::string font, const std::string &tooltip, const std::string &tooltipFont, bool readOnly, const std::string text, const std::string spriteLocation) : HighlightableWidget(tooltip, tooltipFont) { this->x = x; @@ -97,8 +97,8 @@ namespace GAGGUI this->text = text; - if (!spritelocation.empty()) - sprite = Toolkit::getSprite(spritelocation); + if (!spriteLocation.empty()) + sprite = Toolkit::getSprite(spriteLocation); if (sprite) spriteWidth = sprite->getW(0); } diff --git a/libgag/src/GUITextInput.cpp b/libgag/src/GUITextInput.cpp index afa4f577..a7d18ce2 100644 --- a/libgag/src/GUITextInput.cpp +++ b/libgag/src/GUITextInput.cpp @@ -103,11 +103,11 @@ namespace GAGGUI char* c = event->text.text; if (c) { - size_t lutf8=strlen(c); - if ((maxLength==0) || (text.length()+lutf8getStringWidth(text.c_str()+textDep, cursPos-textDep); } - while ((textDep>0) && (cursorScreenPos0) && (cursorScreenPosw-TEXTBOXSIDEPAD-4) ) + while ( (textDepw-TEXT_BOX_SIDE_PAD-4) ) { textDep++; cursorScreenPos=fontPtr->getStringWidth(text.c_str()+textDep, cursPos-textDep); @@ -360,7 +360,7 @@ namespace GAGGUI /// adds word for autocompletion via void TextInput::addAutoCompletableWord(const std::string &word) { - autocompletableWord.push_back(word); + autoCompletableWord.push_back(word); }; /// removes word from autocompletion via @@ -369,7 +369,7 @@ namespace GAGGUI std::vector::iterator> toDelete; std::vector::iterator it; - for (it = autocompletableWord.begin(); it != autocompletableWord.end(); ++it) + for (it = autoCompletableWord.begin(); it != autoCompletableWord.end(); ++it) { if (*it==word) toDelete.push_back(it); @@ -378,7 +378,7 @@ namespace GAGGUI std::vector::iterator>::iterator it2; for (it2 = toDelete.begin(); it2 != toDelete.end(); ++it2) { - autocompletableWord.erase(*it2); + autoCompletableWord.erase(*it2); } } @@ -387,7 +387,7 @@ namespace GAGGUI { int count = 0; std::vector::iterator it; - for (it = autocompletableWord.begin(); it != autocompletableWord.end(); ++it) + for (it = autoCompletableWord.begin(); it != autoCompletableWord.end(); ++it) { if(*it==word) { diff --git a/libgag/src/GraphicContext.cpp b/libgag/src/GraphicContext.cpp index 1033c073..047e7fae 100644 --- a/libgag/src/GraphicContext.cpp +++ b/libgag/src/GraphicContext.cpp @@ -60,7 +60,7 @@ namespace GAGCore // static local pointer to the actual graphic context static GraphicContext *_gc = NULL; static SDL_PixelFormat _glFormat; - //EXPERIMENTAL is a bit buggy and "not EXPERIMENTAL" is bugfree but slow + //EXPERIMENTAL is a bit buggy and "not EXPERIMENTAL" is bug free but slow //when rendering clouds or other density layers (GraphicContext::drawAlphaMap). static const bool EXPERIMENTAL=false; @@ -115,17 +115,17 @@ namespace GAGCore bool _doTexture; bool _doScissor; GLint _texture; - GLenum _sfactor, _dfactor; + GLenum _sFactor, _dFactor; bool isTextureSRectangle; bool useATIWorkaround; - unsigned alocatedTextureCount; + unsigned allocatedTextureCount; GLState(void) { resetCache(); isTextureSRectangle = false; useATIWorkaround = false; - alocatedTextureCount = 0; + allocatedTextureCount = 0; } void resetCache(void) @@ -134,8 +134,8 @@ namespace GAGCore _doTexture = false; _doScissor = false; _texture = -1; - _sfactor = 0xffffffff; - _dfactor = 0xffffffff; + _sFactor = 0xffffffff; + _dFactor = 0xffffffff; } void checkExtensions(void) @@ -209,7 +209,7 @@ namespace GAGCore bool doScissor(bool on) { // The glIsEnabled is function is quite expensive. That's why we have a _doScissor variable. - // I'm quite sure that this assert should never fail, so I've outcommented it, partially + // I'm quite sure that this assert should never fail, so I've out-commented it, partially // because we don't do #define NDEBUG in most of our releases (so far). //assert(_doScissor == glIsEnabled(GL_SCISSOR_TEST)); @@ -225,15 +225,15 @@ namespace GAGCore return !on; } - void blendFunc(GLenum sfactor, GLenum dfactor) + void blendFunc(GLenum sFactor, GLenum dFactor) { - if ((sfactor == _sfactor) && (dfactor == _dfactor)) + if ((sFactor == _sFactor) && (dFactor == _dFactor)) return; - glBlendFunc(sfactor, dfactor); + glBlendFunc(sFactor, dFactor); - _sfactor = sfactor; - _dfactor = dfactor; + _sFactor = sFactor; + _dFactor = dFactor; } } glState; #endif @@ -241,7 +241,7 @@ namespace GAGCore SDL_Surface *DrawableSurface::convertForUpload(SDL_Surface *source) { SDL_Surface *dest; - if (_gc->sdlsurface->format->BitsPerPixel == 32) + if (_gc->sdlSurface->format->BitsPerPixel == 32) { dest = SDL_ConvertSurfaceFormat(source, SDL_PIXELFORMAT_BGRA32, 0); } @@ -256,7 +256,7 @@ namespace GAGCore // Drawable surface DrawableSurface::DrawableSurface(const std::string &imageFileName) { - sdlsurface = NULL; + sdlSurface = NULL; if (!loadImage(imageFileName)) setRes(0, 0); allocateTexture(); @@ -264,7 +264,7 @@ namespace GAGCore DrawableSurface::DrawableSurface(int w, int h) { - sdlsurface = NULL; + sdlSurface = NULL; setRes(w, h); allocateTexture(); } @@ -272,9 +272,9 @@ namespace GAGCore DrawableSurface::DrawableSurface(const SDL_Surface *sourceSurface) { assert(sourceSurface); - // beurk, const cast here becasue SDL API sucks - sdlsurface = convertForUpload(const_cast(sourceSurface)); - assert(sdlsurface); + // beurk, const cast here because SDL API sucks + sdlSurface = convertForUpload(const_cast(sourceSurface)); + assert(sdlSurface); setClipRect(); allocateTexture(); dirty = true; @@ -282,12 +282,12 @@ namespace GAGCore DrawableSurface *DrawableSurface::clone(void) { - return new DrawableSurface(sdlsurface); + return new DrawableSurface(sdlSurface); } DrawableSurface::~DrawableSurface(void) { - SDL_FreeSurface(sdlsurface); + SDL_FreeSurface(sdlSurface); freeGPUTexture(); } @@ -303,10 +303,10 @@ namespace GAGCore void DrawableSurface::allocateTexture(void) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { glGenTextures(1, reinterpret_cast(&texture)); - glState.alocatedTextureCount++; + glState.allocatedTextureCount++; initTextureSize(); } #endif @@ -315,7 +315,7 @@ namespace GAGCore void DrawableSurface::initTextureSize(void) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { // only power of two textures are supported if (!glState.isTextureSRectangle) @@ -325,8 +325,8 @@ namespace GAGCore glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); - int w = getMinPowerOfTwo(sdlsurface->w); - int h = getMinPowerOfTwo(sdlsurface->h); + int w = getMinPowerOfTwo(sdlSurface->w); + int h = getMinPowerOfTwo(sdlSurface->h); std::valarray zeroBuffer((char)0, w * h * 4); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, &zeroBuffer[0]); @@ -345,15 +345,15 @@ namespace GAGCore void DrawableSurface::uploadToTexture(void) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { glState.setTexture(texture); void *pixelsPtr; GLenum pixelFormat; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - std::valarray tempPixels(sdlsurface->w * sdlsurface->h); - Uint32 *sourcePtr = static_cast(sdlsurface->pixels); + std::valarray tempPixels(sdlSurface->w * sdlSurface->h); + Uint32 *sourcePtr = static_cast(sdlSurface->pixels); for (size_t i=0; i> 24); @@ -362,16 +362,16 @@ namespace GAGCore pixelsPtr = &tempPixels[0]; pixelFormat = GL_RGBA; #else - pixelsPtr = sdlsurface->pixels; + pixelsPtr = sdlSurface->pixels; pixelFormat = GL_BGRA; #endif if (glState.isTextureSRectangle) { - glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, sdlsurface->w, sdlsurface->h, 0, pixelFormat, GL_UNSIGNED_BYTE, pixelsPtr); + glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, sdlSurface->w, sdlSurface->h, 0, pixelFormat, GL_UNSIGNED_BYTE, pixelsPtr); } else { - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, sdlsurface->w, sdlsurface->h, pixelFormat, GL_UNSIGNED_BYTE, pixelsPtr); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, sdlSurface->w, sdlSurface->h, pixelFormat, GL_UNSIGNED_BYTE, pixelsPtr); } } #endif @@ -381,14 +381,14 @@ namespace GAGCore void DrawableSurface::freeGPUTexture(void) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { glDeleteTextures(1, reinterpret_cast(&texture)); - glState.alocatedTextureCount--; + glState.allocatedTextureCount--; // The next line causes a desynchronization between _doScissors and glIsEnabled(GL_SCISSOR_TEST), // which causes the setClipRect() functions to not reset the clipping the way it should, so many - // things don't get drawn properly and the game appears to "blink". Outcommenting it didn't cause + // things don't get drawn properly and the game appears to "blink". Out-commenting it didn't cause // any other problems. If you think glState should be reset, feel free to do so, but also call // functions like glDisable() as required. @@ -399,11 +399,11 @@ namespace GAGCore void DrawableSurface::setRes(int w, int h) { - if (sdlsurface) - SDL_FreeSurface(sdlsurface); + if (sdlSurface) + SDL_FreeSurface(sdlSurface); - sdlsurface = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, _glFormat.Rmask, _glFormat.Gmask, _glFormat.Bmask, _glFormat.Amask); - assert(sdlsurface); + sdlSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, _glFormat.Rmask, _glFormat.Gmask, _glFormat.Bmask, _glFormat.Amask); + assert(sdlSurface); setClipRect(); initTextureSize(); dirty = true; @@ -424,26 +424,26 @@ namespace GAGCore void DrawableSurface::setClipRect(int x, int y, int w, int h) { - assert(sdlsurface); + assert(sdlSurface); clipRect.x = static_cast(x); clipRect.y = static_cast(y); clipRect.w = static_cast(w); clipRect.h = static_cast(h); - SDL_SetClipRect(sdlsurface, &clipRect); + SDL_SetClipRect(sdlSurface, &clipRect); } void DrawableSurface::setClipRect(void) { - assert(sdlsurface); + assert(sdlSurface); clipRect.x = 0; clipRect.y = 0; - clipRect.w = static_cast(sdlsurface->w); - clipRect.h = static_cast(sdlsurface->h); + clipRect.w = static_cast(sdlSurface->w); + clipRect.h = static_cast(sdlSurface->h); - SDL_SetClipRect(sdlsurface, &clipRect); + SDL_SetClipRect(sdlSurface, &clipRect); } bool DrawableSurface::loadImage(const std::string name) @@ -458,9 +458,9 @@ namespace GAGCore SDL_RWclose(imageStream); if (loadedSurface) { - if (sdlsurface) - SDL_FreeSurface(sdlsurface); - sdlsurface = convertForUpload(loadedSurface); + if (sdlSurface) + SDL_FreeSurface(sdlSurface); + sdlSurface = convertForUpload(loadedSurface); SDL_FreeSurface(loadedSurface); setClipRect(); dirty = true; @@ -473,8 +473,8 @@ namespace GAGCore void DrawableSurface::shiftHSV(float hue, float sat, float lum) { - Uint32 *mem = (Uint32 *)sdlsurface->pixels; - for (size_t i = 0; i < static_cast(sdlsurface->w * sdlsurface->h); i++) + Uint32 *mem = (Uint32 *)sdlSurface->pixels; + for (size_t i = 0; i < static_cast(sdlSurface->w * sdlSurface->h); i++) { // get values float h, s, v; @@ -514,7 +514,7 @@ namespace GAGCore // draw if (color.a == Color::ALPHA_OPAQUE) { - *(((Uint32 *)sdlsurface->pixels) + y*(sdlsurface->pitch>>2) + x) = color.pack(); + *(((Uint32 *)sdlSurface->pixels) + y*(sdlSurface->pitch>>2) + x) = color.pack(); } else { @@ -524,7 +524,7 @@ namespace GAGCore Uint32 colorPreMult0 = (colorValue & 0x00FF00FF) * a; Uint32 colorPreMult1 = ((colorValue >> 8) & 0x00FF00FF) * a; - Uint32 *mem = ((Uint32 *)sdlsurface->pixels) + y*(sdlsurface->pitch>>2) + x; + Uint32 *mem = ((Uint32 *)sdlSurface->pixels) + y*(sdlSurface->pitch>>2) + x; Uint32 surfaceValue = *mem; Uint32 surfacePreMult0 = (surfaceValue & 0x00FF00FF) * na; @@ -598,7 +598,7 @@ namespace GAGCore Uint32 colorValue = color.pack(); for (int dy = y; dy < y + h; dy++) { - Uint32 *mem = ((Uint32 *)sdlsurface->pixels) + dy*(sdlsurface->pitch>>2) + x; + Uint32 *mem = ((Uint32 *)sdlSurface->pixels) + dy*(sdlSurface->pitch>>2) + x; int dw = w; do { @@ -617,7 +617,7 @@ namespace GAGCore for (int dy = y; dy < y + h; dy++) { - Uint32 *mem = ((Uint32 *)sdlsurface->pixels) + dy*(sdlsurface->pitch>>2) + x; + Uint32 *mem = ((Uint32 *)sdlSurface->pixels) + dy*(sdlSurface->pitch>>2) + x; int dw = w; do { @@ -651,7 +651,7 @@ namespace GAGCore if ((x < clipRect.x) || (x >= clipRect.x + clipRect.w)) return; - // set l positiv + // set l positive if (l < 0) { y += l; @@ -676,8 +676,8 @@ namespace GAGCore return; // draw - int increment = sdlsurface->pitch >> 2; - Uint32 *mem = ((Uint32 *)sdlsurface->pixels) + y*increment + x; + int increment = sdlSurface->pitch >> 2; + Uint32 *mem = ((Uint32 *)sdlSurface->pixels) + y*increment + x; if (color.a == Color::ALPHA_OPAQUE) { Uint32 colorValue = color.pack(); @@ -719,7 +719,7 @@ namespace GAGCore if ((y < clipRect.y) || (y >= clipRect.y + clipRect.h)) return; - // set l positiv + // set l positive if (l < 0) { x += l; @@ -744,7 +744,7 @@ namespace GAGCore return; // draw - Uint32 *mem = ((Uint32 *)sdlsurface->pixels) + y*(sdlsurface->pitch >> 2) + x; + Uint32 *mem = ((Uint32 *)sdlSurface->pixels) + y*(sdlSurface->pitch >> 2) + x; if (color.a == Color::ALPHA_OPAQUE) { Uint32 colorValue = color.pack(); @@ -874,42 +874,42 @@ namespace GAGCore // setup variable to draw alpha in the right direction #define Sgn(x) (x>0 ? (x == 0 ? 0 : 1) : (x==0 ? 0 : -1)) - Sint32 littleincx; - Sint32 littleincy; - Sint32 bigincx; - Sint32 bigincy; - Sint32 alphadecx; - Sint32 alphadecy; + Sint32 littleIncX; + Sint32 littleIncY; + Sint32 bigIncX; + Sint32 bigIncY; + Sint32 alphaDecX; + Sint32 alphaDecY; if (abs(dx) > abs(dy)) { - littleincx = 1; - littleincy = 0; - bigincx = 1; - bigincy = Sgn(dy); - alphadecx = 0; - alphadecy = Sgn(dy); + littleIncX = 1; + littleIncY = 0; + bigIncX = 1; + bigIncY = Sgn(dy); + alphaDecX = 0; + alphaDecY = Sgn(dy); } else { // we swap x and y meaning test = -test; std::swap(dx, dy); - littleincx = 0; - littleincy = 1; - bigincx = Sgn(dx); - bigincy = 1; - alphadecx = 1; - alphadecy = 0; + littleIncX = 0; + littleIncY = 1; + bigIncX = Sgn(dx); + bigIncY = 1; + alphaDecX = 1; + alphaDecY = 0; } if (dx < 0) { dx = -dx; - littleincx = 0; - littleincy = -littleincy; - bigincx = -bigincx; - bigincy = -bigincy; - alphadecy = -alphadecy; + littleIncX = 0; + littleIncY = -littleIncY; + bigIncX = -bigIncX; + bigIncY = -bigIncY; + alphaDecY = -alphaDecY; } // compute initial position @@ -917,15 +917,15 @@ namespace GAGCore px = x1; py = y1; - // variable initialisation for bresenham algo + // variable initialisation for Bresenham algo if (dx == 0) return; if (dy == 0) return; const int FIXED = 8; const int I = 255; // number of degree of alpha - const int Ibits = 8; - int m = (abs(dy) << (Ibits+FIXED)) / abs(dx); + const int IBits = 8; + int m = (abs(dy) << (IBits+FIXED)) / abs(dx); int w = (I << FIXED) - m; int e = 1 << (FIXED-1); @@ -941,20 +941,20 @@ namespace GAGCore { if (e < w) { - px+=littleincx; - py+=littleincy; + px+=littleIncX; + py+=littleIncY; e+= m; } else { - px+=bigincx; - py+=bigincy; + px+=bigIncX; + py+=bigIncY; e-= w; } color.a = I - (e >> FIXED); drawPixel(px, py, color); color.a = e >> FIXED; - drawPixel(px + alphadecx, py + alphadecy, color); + drawPixel(px + alphaDecX, py + alphaDecY, color); } } @@ -1072,20 +1072,20 @@ namespace GAGCore if (alpha == Color::ALPHA_OPAQUE) { #ifdef HAVE_OPENGL - if ((surface == _gc) && (_gc->getOptionFlags() & GraphicContext::USEGPU)) + if ((surface == _gc) && (_gc->getOptionFlags() & GraphicContext::USE_GPU)) { - if ((x == 0) && (y == 0) && (sdlsurface->w == sw) && (sdlsurface->h == sh)) + if ((x == 0) && (y == 0) && (sdlSurface->w == sw) && (sdlSurface->h == sh)) { std::valarray tempPixels(sw*sh); #if SDL_BYTEORDER == SDL_BIG_ENDIAN - glReadPixels(sx, sy, sdlsurface->w, sdlsurface->h, GL_RGBA, GL_UNSIGNED_BYTE, &tempPixels[0]); + glReadPixels(sx, sy, sdlSurface->w, sdlSurface->h, GL_RGBA, GL_UNSIGNED_BYTE, &tempPixels[0]); #else - glReadPixels(sx, sy, sdlsurface->w, sdlsurface->h, GL_BGRA, GL_UNSIGNED_BYTE, &tempPixels[0]); + glReadPixels(sx, sy, sdlSurface->w, sdlSurface->h, GL_BGRA, GL_UNSIGNED_BYTE, &tempPixels[0]); #endif for (int y = 0; ypixels)[(sh-y-1)*sw]); + unsigned *destPtr = &(((unsigned *)sdlSurface->pixels)[(sh-y-1)*sw]); for (int x = 0; x(y); dr.w = static_cast(sw); dr.h = static_cast(sh); - SDL_BlitSurface(surface->sdlsurface, &sr, sdlsurface, &dr); + SDL_BlitSurface(surface->sdlSurface, &sr, sdlSurface, &dr); #ifdef HAVE_OPENGL } #endif // HAVE_OPENGL } else { - if ((surface == _gc) && (_gc->getOptionFlags() & GraphicContext::USEGPU)) + if ((surface == _gc) && (_gc->getOptionFlags() & GraphicContext::USE_GPU)) { - std::cerr << "Blitting with alphablending from framebuffer in GL is forbidden" << std::endl; + std::cerr << "Blitting with alpha blending from framebuffer in GL is forbidden" << std::endl; assert(false); } @@ -1170,8 +1170,8 @@ namespace GAGCore #endif for (int dy = 0; dy < sh; dy++) { - Uint32 *memSrc = ((Uint32 *)surface->sdlsurface->pixels) + (sy + dy)*(surface->sdlsurface->pitch>>2) + sx; - Uint32 *memDest = ((Uint32 *)sdlsurface->pixels) + (y + dy)*(sdlsurface->pitch>>2) + x; + Uint32 *memSrc = ((Uint32 *)surface->sdlSurface->pixels) + (sy + dy)*(surface->sdlSurface->pitch>>2) + sx; + Uint32 *memDest = ((Uint32 *)sdlSurface->pixels) + (y + dy)*(sdlSurface->pitch>>2) + x; int dw = sw; do { @@ -1288,7 +1288,7 @@ namespace GAGCore font->drawString(this, x, y, w, output, alpha); - ///////////// The following code is for translation textshots //////////// + ///////////// The following code is for translation text shots //////////// if(!translationPicturesDirectory.empty()) { for(std::map::iterator i=texts.begin(); i!=texts.end(); ++i) @@ -1297,8 +1297,8 @@ namespace GAGCore { int width=font->getStringWidth(i->first.c_str()); int height=font->getStringHeight(i->first.c_str()); - int startx=font->getStringWidth(output.substr(0, output.find(i->first)).c_str()); - drawSquares.push_back(boost::make_tuple(SRectangle(x+startx, y, width, height), i->second, this)); + int startX=font->getStringWidth(output.substr(0, output.find(i->first)).c_str()); + drawSquares.push_back(boost::make_tuple(SRectangle(x+startX, y, width, height), i->second, this)); wroteTexts.insert(i->second); texts.erase(i); break; @@ -1318,7 +1318,7 @@ namespace GAGCore if(pos != std::string::npos) output = output.substr(0, pos); - ///////////// The following code is for translation textshots //////////// + ///////////// The following code is for translation text shots //////////// if(!translationPicturesDirectory.empty()) { for(std::map::iterator i=texts.begin(); i!=texts.end(); ++i) @@ -1327,8 +1327,8 @@ namespace GAGCore { int width=font->getStringWidth(i->first.c_str()); int height=font->getStringHeight(i->first.c_str()); - int startx=font->getStringWidth(output.substr(0, output.find(i->first)).c_str()); - drawSquares.push_back(boost::make_tuple(SRectangle(int(x+startx), int(y), width, height), i->second, this)); + int startX=font->getStringWidth(output.substr(0, output.find(i->first)).c_str()); + drawSquares.push_back(boost::make_tuple(SRectangle(int(x+startX), int(y), width, height), i->second, this)); wroteTexts.insert(i->second); texts.erase(i); break; @@ -1365,7 +1365,7 @@ namespace GAGCore this->drawString(x, y, font, str.str()); } - //This code is for the textshot code + //This code is for the text shot code std::map DrawableSurface::texts; std::set DrawableSurface::wroteTexts; std::vector > DrawableSurface::drawSquares; @@ -1393,7 +1393,7 @@ namespace GAGCore for (size_t i2 = 0; i2 < Toolkit::getFileManager()->getDirCount(); i2++) { std::string fullFileName = translationPicturesDirectory + DIR_SEPARATOR_S + "text-" + i->get<1>(); - if (SDL_SaveBMP(toPrint.sdlsurface, (fullFileName+".bmp").c_str()) == 0) + if (SDL_SaveBMP(toPrint.sdlSurface, (fullFileName+".bmp").c_str()) == 0) { break; } @@ -1417,7 +1417,7 @@ namespace GAGCore { DrawableSurface::setClipRect(x, y, w, h); #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { glState.doScissor(true); glScissor(clipRect.x, getH() - clipRect.y - clipRect.h, clipRect.w, clipRect.h); @@ -1429,17 +1429,17 @@ namespace GAGCore { DrawableSurface::setClipRect(); #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) glState.doScissor(false); #endif } - // drawing, reimplementation for GL + // drawing, re-implementation for GL void GraphicContext::drawPixel(int x, int y, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) GraphicContext::drawPixel(static_cast(x), static_cast(y), color); else #endif @@ -1449,7 +1449,7 @@ namespace GAGCore void GraphicContext::drawPixel(float x, float y, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) drawFilledRect(x, y, 1.0f, 1.0f, color); else #endif @@ -1460,7 +1460,7 @@ namespace GAGCore void GraphicContext::drawRect(int x, int y, int w, int h, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) GraphicContext::drawRect(static_cast(x), static_cast(y), static_cast(w), static_cast(h), color); else #endif @@ -1470,7 +1470,7 @@ namespace GAGCore void GraphicContext::drawRect(float x, float y, float w, float h, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) { // state change glState.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1498,7 +1498,7 @@ namespace GAGCore void GraphicContext::drawFilledRect(int x, int y, int w, int h, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) GraphicContext::drawFilledRect(static_cast(x), static_cast(y), static_cast(w), static_cast(h), color); else #endif @@ -1508,7 +1508,7 @@ namespace GAGCore void GraphicContext::drawFilledRect(float x, float y, float w, float h, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) { // state change if (color.a < 255) @@ -1538,7 +1538,7 @@ namespace GAGCore void GraphicContext::drawLine(int x1, int y1, int x2, int y2, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) GraphicContext::drawLine(static_cast(x1), static_cast(y1), static_cast(x2), static_cast(y2), color); else #endif @@ -1548,7 +1548,7 @@ namespace GAGCore void GraphicContext::drawLine(float x1, float y1, float x2, float y2, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) { // state change glState.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1574,7 +1574,7 @@ namespace GAGCore void GraphicContext::drawCircle(int x, int y, int radius, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) drawCircle(static_cast(x), static_cast(y), static_cast(radius), color); else #endif @@ -1584,7 +1584,7 @@ namespace GAGCore void GraphicContext::drawCircle(float x, float y, float radius, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) { glState.doBlend(true); glState.doTexture(false); @@ -1638,7 +1638,7 @@ namespace GAGCore void GraphicContext::drawSurface(int x, int y, DrawableSurface *surface, int sx, int sy, int sw, int sh, Uint8 alpha) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) drawSurface(x, y, sw, sh, surface, sx, sy, sw, sh, alpha); else #endif @@ -1648,7 +1648,7 @@ namespace GAGCore void GraphicContext::drawSurface(float x, float y, DrawableSurface *surface, int sx, int sy, int sw, int sh, Uint8 alpha) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) drawSurface(x, y, static_cast(sw), static_cast(sh), surface, sx, sy, sw, sh, alpha); else #endif @@ -1658,7 +1658,7 @@ namespace GAGCore void GraphicContext::drawSurface(int x, int y, int w, int h, DrawableSurface *surface, int sx, int sy, int sw, int sh, Uint8 alpha) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) GraphicContext::drawSurface(static_cast(x), static_cast(y), static_cast(w), static_cast(h), surface, sx, sy, sw, sh, alpha); else #endif @@ -1668,7 +1668,7 @@ namespace GAGCore void GraphicContext::drawSurface(float x, float y, float w, float h, DrawableSurface *surface, int sx, int sy, int sw, int sh, Uint8 alpha) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { // upload if (surface->dirty) @@ -1701,7 +1701,7 @@ namespace GAGCore void GraphicContext::drawAlphaMap(const std::valarray &map, int mapW, int mapH, int x, int y, int cellW, int cellH, const Color &color) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { assert(mapW * mapH <= static_cast(map.size())); float fr = 255.0f*(float)color.r; @@ -1741,16 +1741,16 @@ namespace GAGCore glState.doTexture(false); for (int dy=0; dy < mapH-1; dy++) { - int midy = y + dy * cellH + cellH/2; + int midY = y + dy * cellH + cellH/2; for (int dx=0; dx < mapW-1; dx++) { glBegin(GL_TRIANGLE_FAN); //This interpolates to find the center color, then fans out to the four corners. - int midx = x + dx * cellW + cellW/2; + int midX = x + dx * cellW + cellW/2; float mid_top_alpha = (map[mapW * dy + dx] + map[mapW * dy + dx + 1])/2; float mid_bottom_alpha = (map[mapW * (dy + 1) + dx] + map[mapW * (dy + 1) + dx + 1])/2; glColor4f(fr, color.g, color.b, (mid_top_alpha + mid_bottom_alpha) / 2); - glVertex2f(midx, midy); + glVertex2f(midX, midY); //Touch each of the four corners glColor4f(fr, fg, fb, map[mapW * dy + dx]); glVertex2f(x + dx * cellW, y + dy * cellH); @@ -1777,7 +1777,7 @@ namespace GAGCore void GraphicContext::drawAlphaMap(const std::valarray &map, int mapW, int mapH, int x, int y, int cellW, int cellH, const Color &color) { #ifdef HAVE_OPENGL - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { assert(mapW * mapH <= static_cast(map.size())); if(EXPERIMENTAL) { @@ -1815,17 +1815,17 @@ namespace GAGCore glState.doTexture(false); for (int dy=0; dy < mapH-1; dy++) { - int midy = y + dy * cellH + cellH/2; + int midY = y + dy * cellH + cellH/2; for (int dx=0; dx < mapW-1; dx++) { glBegin(GL_TRIANGLE_FAN); //This interpolates to find the center color, then fans out to the four corners. - int midx = x + dx * cellW + cellW/2; + int midX = x + dx * cellW + cellW/2; int mid_top_alpha = (map[mapW * dy + dx] + map[mapW * dy + dx + 1])/2; int mid_bottom_alpha = (map[mapW * (dy + 1) + dx] + map[mapW * (dy + 1) + dx + 1])/2; glColor4ub(color.r, color.g, color.b, (mid_top_alpha + mid_bottom_alpha) / 2); - glVertex2f(midx, midy); + glVertex2f(midX, midY); //Touch each of the four corners glColor4ub(color.r, color.g, color.b, map[mapW * dy + dx]); glVertex2f(x + dx * cellW, y + dy * cellH); @@ -1873,7 +1873,7 @@ namespace GAGCore void GraphicContext::drawVertLine(int x, int y, int l, Uint8 r, Uint8 g, Uint8 b, Uint8 a) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) drawLine(x, y, x, y+l, Color(r, g, b, a)); else #endif @@ -1883,7 +1883,7 @@ namespace GAGCore void GraphicContext::drawVertLine(int x, int y, int l, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) drawLine(x, y, x, y+l, color); else #endif @@ -1893,7 +1893,7 @@ namespace GAGCore void GraphicContext::drawHorzLine(int x, int y, int l, Uint8 r, Uint8 g, Uint8 b, Uint8 a) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) drawLine(x, y, x+l, y, Color(r, g, b, a)); else #endif @@ -1903,7 +1903,7 @@ namespace GAGCore void GraphicContext::drawHorzLine(int x, int y, int l, const Color& color) { #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) drawLine(x, y, x+l, y, color); else #endif @@ -1968,7 +1968,7 @@ namespace GAGCore assert(sizeof(Color) == 4); minW = minH = 0; - sdlsurface = NULL; + sdlSurface = NULL; optionFlags = DEFAULT; // Load the SDL library @@ -2000,7 +2000,7 @@ namespace GAGCore { TTF_Quit(); SDL_Quit(); - sdlsurface = NULL; + sdlSurface = NULL; if (verbose) fprintf(stderr, "Toolkit : Graphic Context destroyed\n"); @@ -2025,20 +2025,20 @@ namespace GAGCore // set flags optionFlags = flags; Uint32 sdlFlags = 0; - if (flags & FULLSCREEN) + if (flags & FULL_SCREEN) sdlFlags |= SDL_WINDOW_FULLSCREEN; // FIXME: window resize is broken // if (flags & RESIZABLE) // sdlFlags |= SDL_WINDOW_RESIZABLE; #ifdef HAVE_OPENGL - if (flags & USEGPU) + if (flags & USE_GPU) { SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); sdlFlags |= SDL_WINDOW_OPENGL; } #else // remove GL from options - optionFlags &= ~USEGPU; + optionFlags &= ~USE_GPU; #endif // if window exists, delete it @@ -2048,10 +2048,10 @@ namespace GAGCore } // create the new window and the surface window = SDL_CreateWindow(windowTitle.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, sdlFlags); - sdlsurface = window != nullptr ? SDL_GetWindowSurface(window) : nullptr; + sdlSurface = window != nullptr ? SDL_GetWindowSurface(window) : nullptr; // check surface - if (!sdlsurface) + if (!sdlSurface) { fprintf(stderr, "Toolkit : can't set screen to %dx%d at 32 bpp\n", w, h); fprintf(stderr, "Toolkit : %s\n", SDL_GetError()); @@ -2061,13 +2061,13 @@ namespace GAGCore { _gc = this; // enable GL context - if (flags & USEGPU) + if (flags & USE_GPU) { SDL_GLContext context = SDL_GL_CreateContext(window); SDL_GL_MakeCurrent(window, context); } // set _glFormat - if ((optionFlags & USEGPU) && (_gc->sdlsurface->format->BitsPerPixel != 32)) + if ((optionFlags & USE_GPU) && (_gc->sdlSurface->format->BitsPerPixel != 32)) { _glFormat.palette = NULL; _glFormat.BitsPerPixel = 32; @@ -2099,7 +2099,7 @@ namespace GAGCore } else { - memcpy(&_glFormat, _gc->sdlsurface->format, sizeof(SDL_PixelFormat)); + memcpy(&_glFormat, _gc->sdlSurface->format, sizeof(SDL_PixelFormat)); unsigned alphaPos(24); if ((_glFormat.Rshift == 24) || (_glFormat.Gshift == 24) || (_glFormat.Bshift == 24)) alphaPos = 0; @@ -2109,7 +2109,7 @@ namespace GAGCore } #ifdef HAVE_OPENGL - if (optionFlags & USEGPU) + if (optionFlags & USE_GPU) glState.checkExtensions(); #endif // HAVE_OPENGL @@ -2122,7 +2122,7 @@ namespace GAGCore } setClipRect(); - if (flags & CUSTOMCURSOR) + if (flags & CUSTOM_CURSOR) { // disable system cursor SDL_ShowCursor(SDL_DISABLE); @@ -2134,13 +2134,13 @@ namespace GAGCore if (verbose) fprintf(stderr, - (flags & FULLSCREEN) + (flags & FULL_SCREEN) ?"Toolkit : Screen set to %dx%d at 32 bpp in fullscreen\n" :"Toolkit : Screen set to %dx%d at 32 bpp in window\n", w, h); #ifdef HAVE_OPENGL - if (optionFlags & USEGPU) + if (optionFlags & USE_GPU) { gluOrtho2D(0, w, h, 0); glEnable(GL_LINE_SMOOTH); @@ -2157,9 +2157,9 @@ namespace GAGCore void GraphicContext::nextFrame(void) { DrawableSurface::nextFrame(); - if (sdlsurface) + if (sdlSurface) { - if (optionFlags & CUSTOMCURSOR) + if (optionFlags & CUSTOM_CURSOR) { int mx, my; unsigned b = SDL_GetMouseState(&mx, &my); @@ -2169,10 +2169,10 @@ namespace GAGCore } #ifdef HAVE_OPENGL - if (optionFlags & GraphicContext::USEGPU) + if (optionFlags & GraphicContext::USE_GPU) { SDL_GL_SwapWindow(window); - //fprintf(stderr, "%d allocated GPU textures\n", glState.alocatedTextureCount); + //fprintf(stderr, "%d allocated GPU textures\n", glState.allocatedTextureCount); } else #endif @@ -2189,16 +2189,16 @@ namespace GAGCore // Fetch the surface to print #ifdef HAVE_OPENGL std::unique_ptr toPrint = nullptr; - if (_gc->optionFlags & GraphicContext::USEGPU) + if (_gc->optionFlags & GraphicContext::USE_GPU) { toPrint = std::make_unique(getW(), getH()); glFlush(); toPrint->drawSurface(0, 0, this); - toPrintSurface = toPrint->sdlsurface; + toPrintSurface = toPrint->sdlSurface; } else #endif - toPrintSurface = sdlsurface; + toPrintSurface = sdlSurface; // Print it using virtual filesystem if (toPrintSurface) diff --git a/libgag/src/KeyPress.cpp b/libgag/src/KeyPress.cpp index 228891f0..3c09055f 100644 --- a/libgag/src/KeyPress.cpp +++ b/libgag/src/KeyPress.cpp @@ -27,34 +27,34 @@ using namespace GAGCore; using namespace GAGGUI; -KeyPress::KeyPress(SDL_Keysym nkey, bool pressed) +KeyPress::KeyPress(SDL_Keysym nKey, bool pressed) : pressed(pressed) { - if(nkey.mod & KMOD_CTRL) + if(nKey.mod & KMOD_CTRL) control = true; else control = false; - if(nkey.mod & KMOD_SHIFT) + if(nKey.mod & KMOD_SHIFT) shift = true; else shift = false; - if(nkey.mod & KMOD_LGUI || nkey.mod & KMOD_RGUI) + if(nKey.mod & KMOD_LGUI || nKey.mod & KMOD_RGUI) meta = true; else meta = false; - if(nkey.mod & KMOD_ALT) + if(nKey.mod & KMOD_ALT) alt = true; else alt = false; - std::string name = SDL_GetKeyName(nkey.sym); + std::string name = SDL_GetKeyName(nKey.sym); std::transform(name.begin(), name.end(), name.begin(), ::tolower); std::string key_s = std::string("[") + name + std::string("]"); Uint16 c=0; - //This is to get over a bug where ctrl-d ctrl-a etc... would cause nkey.unicode to be mangled, - //whereas nkey.sym is still fine - if(nkey.sym < 128) - c = nkey.sym; + //This is to get over a bug where ctrl-d ctrl-a etc... would cause nKey.unicode to be mangled, + //whereas nKey.sym is still fine + if(nKey.sym < 128) + c = nKey.sym; if(Toolkit::getStringTable()->doesStringExist(key_s)) { @@ -64,8 +64,8 @@ KeyPress::KeyPress(SDL_Keysym nkey, bool pressed) { char utf8text[4]; UCS16toUTF8(c, utf8text); - size_t lutf8=strlen(utf8text); - key = std::string(utf8text, lutf8); + size_t lUtf8=strlen(utf8text); + key = std::string(utf8text, lUtf8); } else { @@ -75,10 +75,10 @@ KeyPress::KeyPress(SDL_Keysym nkey, bool pressed) -KeyPress::KeyPress(KeyPress key, bool npressed) +KeyPress::KeyPress(KeyPress key, bool nPressed) { *this = key; - pressed = npressed; + pressed = nPressed; } @@ -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/StreamBackend.cpp b/libgag/src/StreamBackend.cpp index 58a12c04..f30fd222 100644 --- a/libgag/src/StreamBackend.cpp +++ b/libgag/src/StreamBackend.cpp @@ -35,8 +35,8 @@ namespace GAGCore while(!gzeof(fp)) { unsigned char b[1024]; - long ammount = gzread(fp, b, 1024); - buffer->write(b, ammount); + long amount = gzread(fp, b, 1024); + buffer->write(b, amount); } buffer->seekFromStart(0); } @@ -110,33 +110,33 @@ namespace GAGCore return (file.size()>0 && buffer->isValid()); } - MemoryStreamBackend::MemoryStreamBackend(const void *data, const size_t size) + MemoryStreamBackend::MemoryStreamBackend(const void *datum, const size_t size) { index = 0; if (size) - write(data, size); + write(datum, size); } - void MemoryStreamBackend::write(const void *data, const size_t size) + void MemoryStreamBackend::write(const void *datum, const size_t size) { - const char *_data = static_cast(data); - if ((index + size) > datas.size()) - datas.resize(index + size); - std::copy(_data, _data+size, datas.begin()+index); + const char *_datum = static_cast(datum); + if ((index + size) > data.size()) + data.resize(index + size); + std::copy(_datum, _datum+size, data.begin()+index); index += size; } - void MemoryStreamBackend::read(void *data, size_t size) + void MemoryStreamBackend::read(void *datum, size_t size) { - char *_data = static_cast(data); - if (index+size > datas.size()) + char *_datum = static_cast(datum); + if (index+size > data.size()) { - // overread, read 0 - std::fill(_data, _data+size, 0); + // over read, read 0 + std::fill(_datum, _datum+size, 0); } else { - std::copy(datas.data() + index, datas.data() + index + size, _data); + std::copy(data.data() + index, data.data() + index + size, _datum); index += size; } } @@ -157,19 +157,19 @@ namespace GAGCore void MemoryStreamBackend::seekFromStart(int displacement) { - index = std::min(static_cast(displacement), datas.size()); + index = std::min(static_cast(displacement), data.size()); } void MemoryStreamBackend::seekFromEnd(int displacement) { - index = static_cast(std::max(0, static_cast(datas.size()) - displacement)); + index = static_cast(std::max(0, static_cast(data.size()) - displacement)); } void MemoryStreamBackend::seekRelative(int displacement) { int newIndex = static_cast(index) + displacement; newIndex = std::max(newIndex, 0); - newIndex = std::min(newIndex, static_cast(datas.size())); + newIndex = std::min(newIndex, static_cast(data.size())); index = static_cast(newIndex); } @@ -180,7 +180,7 @@ namespace GAGCore bool MemoryStreamBackend::isEndOfStream(void) { - return index >= datas.size(); + return index >= data.size(); } void HashStreamBackend::write(const void *data, const size_t size) diff --git a/libgag/src/StringTable.cpp b/libgag/src/StringTable.cpp index 48a735ae..231964cb 100644 --- a/libgag/src/StringTable.cpp +++ b/libgag/src/StringTable.cpp @@ -179,14 +179,14 @@ namespace GAGCore for (std::map::iterator it=stringAccess.begin(); it!=stringAccess.end(); ++it) { // For each entry... - bool lcwp=false; + bool lastCharWasPct=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; jsecond]->data.size(); i++) { const std::string &s = strings[it->second]->data[i]; - bool lcwp=false; + bool lastCharWasPct=false; int count=0; for (size_t j=0; j::const_iterator accessIt = stringAccess.find(key); if (accessIt == stringAccess.end()) { @@ -316,15 +316,15 @@ namespace GAGCore return true; } - const std::string StringTable::getStringInLang(const std::string stringname, int lang) const + const std::string StringTable::getStringInLang(const std::string stringName, int lang) const { if ((lang < languageCount) && (lang >= 0)) { - std::map::const_iterator accessIt = stringAccess.find(stringname); + std::map::const_iterator accessIt = stringAccess.find(stringName); if (accessIt == stringAccess.end()) { - std::cerr << "StringTable::getStringInLang(\"" << stringname << ", " << lang << "\") : error, no such key." << std::endl; - return stringname; + std::cerr << "StringTable::getStringInLang(\"" << stringName << ", " << lang << "\") : error, no such key." << std::endl; + return stringName; } else { @@ -333,7 +333,7 @@ namespace GAGCore } else { - std::cerr << "StringTable::getStringInLang(\"" << stringname << ", " << lang << "\") : error, bad language selected." << std::endl; + std::cerr << "StringTable::getStringInLang(\"" << stringName << ", " << lang << "\") : error, bad language selected." << std::endl; return "ERROR, BAD LANG ID"; } } diff --git a/libgag/src/SupportFunctions.cpp b/libgag/src/SupportFunctions.cpp index a40f9608..9b164661 100644 --- a/libgag/src/SupportFunctions.cpp +++ b/libgag/src/SupportFunctions.cpp @@ -96,7 +96,7 @@ namespace GAGCore void sdcRects(SDL_Rect *source, SDL_Rect *destination, const SDL_Rect &clipping) { //sdc= Source-Destination-Clipping - //Use if destination have the same size than source & cliping on destination + //Use if destination have the same size than source & clipping on destination int dx=clipping.x-destination->x; int dy=clipping.y-destination->y; diff --git a/libgag/src/TextStream.cpp b/libgag/src/TextStream.cpp index 6847f18a..f14a3305 100644 --- a/libgag/src/TextStream.cpp +++ b/libgag/src/TextStream.cpp @@ -321,7 +321,7 @@ namespace GAGCore std::vector levels; std::string id; std::string fullId; - std::stack autovectors; // stack of unsigned used for implicit vectors. If value is 0, the level is not considered using autovector + std::stack autoVectors; // stack of unsigned used for implicit vectors. If value is 0, the level is not considered using autoVector assert(table); @@ -333,15 +333,15 @@ namespace GAGCore { if (levels.size()) { - // when using autovector, add a count member - if (autovectors.top() > 0) + // when using autoVector, add a count member + if (autoVectors.top() > 0) { std::ostringstream oss; - oss << autovectors.top(); + oss << autoVectors.top(); (*table)[fullId + ".count"] = oss.str(); } - autovectors.pop(); + autoVectors.pop(); levels.pop_back(); fullId.clear(); @@ -367,9 +367,9 @@ namespace GAGCore { if (token.type == Token::OPEN_BRACKET) { - // autovector entry + // autoVector entry std::ostringstream oss; - oss << autovectors.top()++; + oss << autoVectors.top()++; id = oss.str(); } else @@ -408,7 +408,7 @@ namespace GAGCore fullId += "."; fullId += id; levels.push_back(id); - autovectors.push(0); + autoVectors.push(0); nextToken(); CHECK_NOT_EOF } @@ -428,7 +428,7 @@ namespace GAGCore fullId += "."; fullId += id; levels.push_back(id); - autovectors.push(0); + autoVectors.push(0); // copy subkeys to actual size_t len = copyPathSource.length(); diff --git a/src/AI.cpp b/src/AI.cpp index 52042bcd..a068c24e 100644 --- a/src/AI.cpp +++ b/src/AI.cpp @@ -40,15 +40,15 @@ using boost::shared_ptr; /*AI::AI(Player *player) { aiImplementation=new AICastor(player); - this->implementitionID=NUMBI; + this->implementationID=NUMBI; this->player=player; }*/ -AI::AI(ImplementitionID implementitionID, Player *player) +AI::AI(ImplementationID implementationID, Player *player) { aiImplementation=NULL; - switch (implementitionID) + switch (implementationID) { case NONE: aiImplementation=new AINull(); @@ -65,7 +65,7 @@ AI::AI(ImplementitionID implementitionID, Player *player) case WARRUSH: aiImplementation=new AIWarrush(player); break; - case REACHTOINFINITY: + case REACH_TO_INFINITY: aiImplementation=new AIEcho::Echo(new AIEcho::ReachToInfinity, player); break; case TOUBIB: @@ -76,14 +76,14 @@ AI::AI(ImplementitionID implementitionID, Player *player) break; } - this->implementitionID=implementitionID; + this->implementationID=implementationID; this->player=player; } AI::AI(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { aiImplementation=NULL; - implementitionID=NONE; + implementationID=NONE; this->player=player; bool goodLoad=load(stream, versionMinor); assert(goodLoad); @@ -119,14 +119,14 @@ bool AI::load(GAGCore::InputStream *stream, Sint32 versionMinor) stream->read(signature, 4, "signatureStart"); if (memcmp(signature,"AI b", 4)!=0) { - fprintf(stderr, "AI::bad begining signature\n"); + fprintf(stderr, "AI::bad beginning signature\n"); stream->readLeaveSection(); return false; } - implementitionID=(ImplementitionID)stream->readUint32("implementitionID"); + implementationID=(ImplementationID)stream->readUint32("implementitionID"); - switch (implementitionID) + switch (implementationID) { case NONE: aiImplementation=new AINull(); @@ -141,7 +141,7 @@ bool AI::load(GAGCore::InputStream *stream, Sint32 versionMinor) aiImplementation=new AIEcho::Echo(new NewNicowar, player); aiImplementation->load(stream, player, versionMinor); break; - case REACHTOINFINITY: + case REACH_TO_INFINITY: aiImplementation=new AIEcho::Echo(new AIEcho::ReachToInfinity, player); aiImplementation->load(stream, player, versionMinor); break; @@ -152,7 +152,7 @@ bool AI::load(GAGCore::InputStream *stream, Sint32 versionMinor) aiImplementation=new AIWarrush(stream, player, versionMinor); break; default: - fprintf(stderr, "AI id %d does not exist, you probably try to load a map from a more recent version of glob2.\n", implementitionID); + fprintf(stderr, "AI id %d does not exist, you probably try to load a map from a more recent version of glob2.\n", implementationID); assert(false); break; } @@ -173,7 +173,7 @@ void AI::save(GAGCore::OutputStream *stream) stream->writeEnterSection("AI"); stream->write("AI b", 4, "signatureStart"); - stream->writeUint32(static_cast(implementitionID), "implementitionID"); + stream->writeUint32(static_cast(implementationID), "implementitionID"); assert(aiImplementation); aiImplementation->save(stream); diff --git a/src/AI.h b/src/AI.h index 5686a837..e7f174b9 100644 --- a/src/AI.h +++ b/src/AI.h @@ -38,7 +38,7 @@ class AI { public: ///TODO: Explain - enum ImplementitionID + enum ImplementationID { ///Reference to AINull NONE=0, @@ -49,7 +49,7 @@ class AI ///Reference to AIWarrush WARRUSH=3, ///Reference to the AIEcho based AIReachToInfinity - REACHTOINFINITY=4, + REACH_TO_INFINITY=4, ///Reference to the AIEcho based AINicowar NICOWAR=5, @@ -58,17 +58,17 @@ class AI EXPERIMENTAL_SIZE }; - static const ImplementitionID toggleAI=CASTOR; + static const ImplementationID toggleAI=CASTOR; public: //AI(Player *player); //TODO: remove this constructor, and choose the AI the user wants. - AI(ImplementitionID implementitionID, Player *player); + AI(ImplementationID implementationID, Player *player); AI(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); ~AI(); - //void init(ImplementitionID ImplementitionID, Player *player); + //void init(ImplementationID ImplementationID, Player *player); AIImplementation *aiImplementation; - ImplementitionID implementitionID; + ImplementationID implementationID; Player *player; diff --git a/src/AICastor.cpp b/src/AICastor.cpp index a075c878..f2cde6ae 100644 --- a/src/AICastor.cpp +++ b/src/AICastor.cpp @@ -125,7 +125,7 @@ void AICastor::firstInit() enemyPowerMap=NULL; enemyRangeMap=NULL; - ressourcesCluster=NULL; + resourcesCluster=NULL; } AICastor::AICastor(Player *player) @@ -279,9 +279,9 @@ void AICastor::init(Player *player) delete[] enemyWarriorsMap; enemyWarriorsMap=new Uint8[size]; - if (ressourcesCluster!=NULL) - delete[] ressourcesCluster; - ressourcesCluster=new Uint16[size]; + if (resourcesCluster!=NULL) + delete[] resourcesCluster; + resourcesCluster=new Uint16[size]; } AICastor::~AICastor() @@ -337,8 +337,8 @@ AICastor::~AICastor() if (enemyWarriorsMap!=NULL) delete[] enemyWarriorsMap; - if (ressourcesCluster!=NULL) - delete[] ressourcesCluster; + if (resourcesCluster!=NULL) + delete[] resourcesCluster; for(std::list::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(); @@ -1250,7 +1250,7 @@ bool AICastor::addProject(Project *project) { if (buildingSum[project->shortTypeNum][0]>=project->amount) { - fprintf(logFile, "will not add project (%s x%d) as it already succeded\n", project->debugName, project->amount); + fprintf(logFile, "will not add project (%s x%d) as it already succeeded\n", project->debugName, project->amount); delete project; return false; } @@ -1281,8 +1281,8 @@ bool AICastor::addProject(Project *project) void AICastor::addProjects() { - //printf(" canFeedUnit=%d, swarms=%d, pool=%d+%d, attaque=%d+%d, speed=%d+%d\n", - // canFeedUnit, swarms, pool, poolSite, attaque, attaqueSite, speed, speedSite); + //printf(" canFeedUnit=%d, swarms=%d, pool=%d+%d, attack=%d+%d, speed=%d+%d\n", + // canFeedUnit, swarms, pool, poolSite, attack, attackSite, speed, speedSite); buildsAmount=-1; @@ -1376,7 +1376,7 @@ void AICastor::addProjects() if (addProject(project)) return; }*/ - // all critical projects succeded. + // all critical projects succeeded. // enough workers //Strategy::Builds buildsCurrent=strategy.buildsBase; @@ -1492,7 +1492,7 @@ boost::shared_ptrAICastor::continueProject(Project *project) { // boot phase project->subPhase=2; - fprintf(logFile, "(%s) (boot) (switching to subphase 2)\n", project->debugName); + fprintf(logFile, "(%s) (boot) (switching to sub-phase 2)\n", project->debugName); } else if (project->subPhase==1) { @@ -1518,9 +1518,9 @@ boost::shared_ptrAICastor::continueProject(Project *project) computeWorkRangeMap(); computeWorkAbilityMap(); - boost::shared_ptrgfbm=findGoodBuilding(typeNum, project->food, project->defense, project->critical); + boost::shared_ptrgFbm=findGoodBuilding(typeNum, project->food, project->defense, project->critical); project->timer=timer; - if (gfbm) + if (gFbm) { if (project->successWait>0) { @@ -1530,8 +1530,8 @@ boost::shared_ptrAICastor::continueProject(Project *project) else { project->subPhase=2; - fprintf(logFile, "(%s) (one construction site placed) (switching to next subphase 2)\n", project->debugName); - return gfbm; + fprintf(logFile, "(%s) (one construction site placed) (switching to next sub-phase 2)\n", project->debugName); + return gFbm; } } else if (project->triesLeft>0) @@ -1557,11 +1557,11 @@ boost::shared_ptrAICastor::continueProject(Project *project) if (real>=project->amount) { project->subPhase=6; - fprintf(logFile, "(%s) ([%d>=%d] building finished) (switching to subphase 6).\n", + fprintf(logFile, "(%s) ([%d>=%d] building finished) (switching to sub-phase 6).\n", project->debugName, real, project->amount); if (!project->waitFinished) { - fprintf(logFile, "(%s) (deblocking [%d, %d])\n", project->debugName, project->blocking, project->critical); + fprintf(logFile, "(%s) (de-blocking [%d, %d])\n", project->debugName, project->blocking, project->critical); project->blocking=false; project->critical=false; } @@ -1569,17 +1569,17 @@ boost::shared_ptrAICastor::continueProject(Project *project) else if (sumamount) { project->subPhase=1; - fprintf(logFile, "(%s) (need more construction site [%d+%d<%d]) (switching back to subphase 1)\n", + fprintf(logFile, "(%s) (need more construction site [%d+%d<%d]) (switching back to sub-phase 1)\n", project->debugName, real, site, project->amount); } else { project->subPhase=3; - fprintf(logFile, "(%s) (enough real building site found [%d+%d>=%d]) (switching to next subphase 3)\n", + fprintf(logFile, "(%s) (enough real building site found [%d+%d>=%d]) (switching to next sub-phase 3)\n", project->debugName, real, site, project->amount); if (!project->waitFinished) { - fprintf(logFile, "(%s) (deblocking [%d, %d])\n", project->debugName, project->blocking, project->critical); + fprintf(logFile, "(%s) (de-blocking [%d, %d])\n", project->debugName, project->blocking, project->critical); project->blocking=false; project->critical=false; } @@ -1677,13 +1677,13 @@ boost::shared_ptrAICastor::continueProject(Project *project) if (real>=project->amount) { project->subPhase=6; - fprintf(logFile, "(%s) (building finished [%d+%d>=%d]) (switching to subphase 6).\n", + fprintf(logFile, "(%s) (building finished [%d+%d>=%d]) (switching to sub-phase 6).\n", project->debugName, real, site, project->amount); } else if (sumamount) { project->subPhase=1; - fprintf(logFile, "(%s) (need more construction site [%d+%d<%d]) (switching back to subphase 1)\n", + fprintf(logFile, "(%s) (need more construction site [%d+%d<%d]) (switching back to sub-phase 1)\n", project->debugName, real, site, project->amount); } else if (project->multipleStart) @@ -1693,18 +1693,18 @@ boost::shared_ptrAICastor::continueProject(Project *project) if (isFree>1) { project->subPhase=1; - fprintf(logFile, "(%s) (enough free workers %d) (switching back to subphase 1)\n", project->debugName, isFree); + fprintf(logFile, "(%s) (enough free workers %d) (switching back to sub-phase 1)\n", project->debugName, isFree); } else { project->subPhase=5; - fprintf(logFile, "(%s) (no more free workers) (switching to next subphase 5)\n", project->debugName); + fprintf(logFile, "(%s) (no more free workers) (switching to next sub-phase 5)\n", project->debugName); } } else { project->subPhase=5; - fprintf(logFile, "(%s) (enough construction site [%d+%d>=%d]) (switching to next subphase 5)\n", + fprintf(logFile, "(%s) (enough construction site [%d+%d>=%d]) (switching to next sub-phase 5)\n", project->debugName, real, site, project->amount); } } @@ -1739,13 +1739,13 @@ boost::shared_ptrAICastor::continueProject(Project *project) if (real>=project->amount) { project->subPhase=6; - fprintf(logFile, "(%s) (building finished [%d+%d>=%d]) (switching to subphase 6).\n", + fprintf(logFile, "(%s) (building finished [%d+%d>=%d]) (switching to sub-phase 6).\n", project->debugName, real, site, project->amount); } else if (sumamount) { project->subPhase=2; - fprintf(logFile, "(%s) (building destroyed! [%d+%d<%d]) (switching to subphase 2).\n", + fprintf(logFile, "(%s) (building destroyed! [%d+%d<%d]) (switching to sub-phase 2).\n", project->debugName, real, site, project->amount); } } @@ -1755,7 +1755,7 @@ boost::shared_ptrAICastor::continueProject(Project *project) if (project->blocking) { - fprintf(logFile, "(%s) (deblocking [%d, %d])\n", project->debugName, project->blocking, project->critical); + fprintf(logFile, "(%s) (de-blocking [%d, %d])\n", project->debugName, project->blocking, project->critical); project->blocking=false; project->critical=false; } @@ -1784,7 +1784,7 @@ boost::shared_ptrAICastor::continueProject(Project *project) if (buildingSum[project->shortTypeNum][1]==0) { project->finished=true; - fprintf(logFile, "(%s) (all finalWorkers set) (project succeded)\n", project->debugName); + fprintf(logFile, "(%s) (all finalWorkers set) (project succeeded)\n", project->debugName); } } else @@ -1834,8 +1834,8 @@ bool AICastor::enoughFreeWorkers() void AICastor::computeCanSwim() { //printf("computeCanSwim()...\n"); - // If our population has more healthy-working-units able to swimm than healthy-working-units - // unable to swimm then we choose to be able to go trough water: + // If our population has more healthy-working-units able to swim than healthy-working-units + // unable to swim then we choose to be able to go through water: Unit **myUnits=team->myUnits; int sumCanSwim=0; int sumCantSwim=0; @@ -2005,18 +2005,18 @@ 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; i=256) && (c.terrain<256+16)) // !canSwim && isWatter ? + else if (!canSwim && (c.terrain>=256) && (c.terrain<256+16)) // !canSwim && isWater ? obstacleUnitMap[i]=0; else obstacleUnitMap[i]=1; @@ -2035,15 +2035,15 @@ void AICastor::computeObstacleBuildingMap() //int hDec=map->hDec; //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,9 +2104,9 @@ 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]; + //Uint8 *wheatGradient=map->resourcesGradient[team->teamNumber][CORN][canSwim]; /*int bx=b->posX; int by=b->posY; @@ -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; } @@ -2514,8 +2514,8 @@ void AICastor::computeWheatCareMap() //int wDec=map->wDec; size_t size=w*h; size_t sizeMask=(size-1); - //Uint8 *wheatGradient=map->ressourcesGradient[team->teamNumber][CORN][canSwim]; - //Case *cases=map->cases; + //Uint8 *wheatGradient=map->resourcesGradient[team->teamNumber][CORN][canSwim]; + //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; yAICastor::findGoodBuilding(Sint32 typeNum, bool food, bo return shared_ptr(); } -void AICastor::computeRessourcesCluster() +void AICastor::computeResourcesCluster() { - fprintf(logFile, "computeRessourcesCluster()\n"); + fprintf(logFile, "computeResourcesCluster()\n"); int w=map->w; int h=map->h; //int wMask=map->wMask; int hMask=map->hMask; 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 - Uint8 rt=r.type; // ressources type + const auto& c = map->tiles[map->coordToIndex(x, y)]; // case + const auto& r=c.resource; // resource + Uint8 rt=r.type; // resources 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); } @@ -2959,13 +2959,13 @@ void AICastor::computeRessourcesCluster() } else { - Uint16 oldid=id; - usedid[oldid]=false; + Uint16 oldId=id; + usedId[oldId]=false; id=rc; // newid - fprintf(logFile, " cleaning oldid=%d to id=%d.\n", oldid, id); - // We have to correct last ressourcesCluster values: + fprintf(logFile, " cleaning oldId=%d to id=%d.\n", oldId, id); + // We have to correct last resourcesCluster values: *rcp=id; - while (*rcp==oldid) + while (*rcp==oldId) { *rcp=id; rcp--; @@ -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); + fprintf(logFile, "computeResourcesCluster(), 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 tile at Left, "r" for one tile 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 bdef4339..ab011f65 100644 --- a/src/AICastor.h +++ b/src/AICastor.h @@ -28,7 +28,7 @@ #include -struct Case; +struct Tile; class Game; class Map; class Order; @@ -52,7 +52,7 @@ class AICastor : public AIImplementation IntBuildingType::Number shortTypeNum; int amount; // number of buildings wanted bool food; // place closer to wheat of further - bool defense; // place at incpoming places. + bool defense; // place at incoming places. std::string debugStdName; const char *debugName; @@ -178,7 +178,7 @@ class AICastor : public AIImplementation boost::shared_ptrfindGoodBuilding(Sint32 typeNum, bool food, bool defense, bool critical); - void computeRessourcesCluster(); + void computeResourcesCluster(); public: void updateGlobalGradientNoObstacle(Uint8 *gradient); @@ -201,7 +201,7 @@ class AICastor : public AIImplementation bool strikeTeamSelected; int strikeTeam; - bool foodWarning; // true if wwe are aproaching a foodLock + bool foodWarning; // true if wwe are approaching a foodLock bool foodLock; // we stop producing any unit until we get more food buildings bool foodSurplus; // we have too many food buildings Uint32 foodLockStats[2]; @@ -250,7 +250,7 @@ class AICastor : public AIImplementation Uint8 *enemyRangeMap; Uint8 *enemyWarriorsMap; - Uint16 *ressourcesCluster; + Uint16 *resourcesCluster; private: FILE *logFile; diff --git a/src/AIDescriptionScreen.cpp b/src/AIDescriptionScreen.cpp index c2f3b3db..a1a9df40 100644 --- a/src/AIDescriptionScreen.cpp +++ b/src/AIDescriptionScreen.cpp @@ -30,10 +30,10 @@ AIDescriptionScreen::AIDescriptionScreen() ok = new TextButton(440, 360, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[ok]"), OK, 13); addWidget(ok); - ailist = new List(60, 50, 200, 300, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard"); + aiList = new List(60, 50, 200, 300, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard"); for (int aii=0; aiiaddText(AINames::getAIText(aii)); - addWidget(ailist); + aiList->addText(AINames::getAIText(aii)); + addWidget(aiList); description = new TextArea(310, 50, 250, 300, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", true); addWidget(description); @@ -55,9 +55,9 @@ void AIDescriptionScreen::onAction(Widget *source, Action action, int par1, int } if (action == LIST_ELEMENT_SELECTED) { - if(ailist->getSelectionIndex() != -1) + if(aiList->getSelectionIndex() != -1) { - description->setText(AINames::getAIDescription(ailist->getSelectionIndex()).c_str()); + description->setText(AINames::getAIDescription(aiList->getSelectionIndex()).c_str()); } } } diff --git a/src/AIDescriptionScreen.h b/src/AIDescriptionScreen.h index f6dbbe9c..3cd3b323 100644 --- a/src/AIDescriptionScreen.h +++ b/src/AIDescriptionScreen.h @@ -46,7 +46,7 @@ class AIDescriptionScreen : public Glob2Screen private: TextButton* ok; TextArea *description; - List *ailist; + List *aiList; Text *title; }; diff --git a/src/AIEcho.cpp b/src/AIEcho.cpp index c9d5df57..7ed8d05a 100644 --- a/src/AIEcho.cpp +++ b/src/AIEcho.cpp @@ -58,7 +58,7 @@ void AIEcho::signature_check(GAGCore::InputStream *stream, Player *player, Sint3 if (memcmp(signature,"EchoSig", 7)!=0) { - std::cerr<<"Signature match failed. Expected \"EchoSig\", recieved \""<load(stream, player, versionMinor); break; - case Entities::ERessource: - entity = new Entities::Ressource; + case Entities::EResource: + entity = new Entities::Resource; entity->load(stream, player, versionMinor); break; - case Entities::EAnyRessource: - entity = new Entities::AnyRessource; + case Entities::EAnyResource: + entity = new Entities::AnyResource; entity->load(stream, player, versionMinor); break; case Entities::EWater: @@ -127,9 +127,9 @@ Entities::Building::Building(int building_type, int team, bool under_constructio } -bool Entities::Building::is_entity(Map* map, int posx, int posy) +bool Entities::Building::is_entity(Map* map, int posX, int posY) { - int building_id=map->getBuilding(posx, posy); + int building_id=map->getBuilding(posX, posY); if(building_id!=NOGBID) { int team_id=::Building::GIDtoTeam(building_id); @@ -201,9 +201,9 @@ Entities::AnyTeamBuilding::AnyTeamBuilding(int team, bool under_construction) : -bool Entities::AnyTeamBuilding::is_entity(Map* map, int posx, int posy) +bool Entities::AnyTeamBuilding::is_entity(Map* map, int posX, int posY) { - int building_id=map->getBuilding(posx, posy); + int building_id=map->getBuilding(posX, posY); if(building_id!=NOGBID) { int team_id=::Building::GIDtoTeam(building_id); @@ -272,9 +272,9 @@ Entities::AnyBuilding::AnyBuilding(bool under_construction) : under_construction -bool Entities::AnyBuilding::is_entity(Map* map, int posx, int posy) +bool Entities::AnyBuilding::is_entity(Map* map, int posX, int posY) { - int building_id=map->getBuilding(posx, posy); + int building_id=map->getBuilding(posX, posY); if(building_id!=NOGBID) { int team_id=::Building::GIDtoTeam(building_id); @@ -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 resource_type) : resource_type(resource_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, resource_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).resource_type==resource_type ) return true; return false; @@ -359,51 +359,51 @@ 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) + if(resource_type==WOOD || resource_type==CORN || resource_type==ALGA) return true; return false; } -Entities::EntityType Entities::Ressource::get_type() +Entities::EntityType Entities::Resource::get_type() { - return Entities::ERessource; + return Entities::EResource; } -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"); - ressource_type = stream->readSint32("ressource_type"); + stream->readEnterSection("Resource"); + resource_type = stream->readSint32("ressource_type"); stream->readLeaveSection(); return true; } -void Entities::Ressource::save(GAGCore::OutputStream *stream) +void Entities::Resource::save(GAGCore::OutputStream *stream) { - stream->writeEnterSection("Ressource"); - stream->writeSint32(ressource_type, "ressource_type"); + stream->writeEnterSection("Resource"); + stream->writeSint32(resource_type, "ressource_type"); stream->writeLeaveSection(); } -Entities::AnyRessource:: AnyRessource() +Entities::AnyResource:: AnyResource() { } -bool Entities::AnyRessource:: is_entity(Map* map, int posx, int posy) +bool Entities::AnyResource:: is_entity(Map* map, int posX, int posY) { - if(map->isRessource(posx, posy)) + if(map->isResource(posX, posY)) { return true; } @@ -412,30 +412,30 @@ bool Entities::AnyRessource:: is_entity(Map* map, int posx, int posy) -bool Entities::AnyRessource::operator==(const Entity& rhs) +bool Entities::AnyResource::operator==(const Entity& rhs) { - if(typeid(rhs)==typeid(Entities::AnyRessource)) + if(typeid(rhs)==typeid(Entities::AnyResource)) return true; return false; } -bool Entities::AnyRessource::can_change() +bool Entities::AnyResource::can_change() { return true; } -Entities::EntityType Entities::AnyRessource::get_type() +Entities::EntityType Entities::AnyResource::get_type() { - return Entities::EAnyRessource; + return Entities::EAnyResource; } -bool Entities::AnyRessource::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) +bool Entities::AnyResource::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { stream->readEnterSection("AnyRessource"); stream->readLeaveSection(); @@ -444,7 +444,7 @@ bool Entities::AnyRessource::load(GAGCore::InputStream *stream, Player *player, -void Entities::AnyRessource::save(GAGCore::OutputStream *stream) +void Entities::AnyResource::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("AnyRessource"); stream->writeLeaveSection(); @@ -459,9 +459,9 @@ Entities::Water::Water() -bool Entities::Water::is_entity(Map* map, int posx, int posy) +bool Entities::Water::is_entity(Map* map, int posX, int posY) { - if(map->isWater(posx, posy)) + if(map->isWater(posX, posY)) { return true; } @@ -515,9 +515,9 @@ Entities::Position::Position(int x, int y) : x(x), y(y) } -bool Entities::Position::is_entity(Map* map, int posx, int posy) +bool Entities::Position::is_entity(Map* map, int posX, int posY) { - if(x==posx && y==posy) + if(x==posX && y==posY) { return true; } @@ -574,9 +574,9 @@ Entities::Sand::Sand() -bool Entities::Sand::is_entity(Map* map, int posx, int posy) +bool Entities::Sand::is_entity(Map* map, int posX, int posY) { - if(map->hasSand(posx, posy)) + if(map->hasSand(posX, posY)) { return true; } @@ -649,19 +649,19 @@ void GradientInfo::add_obstacle(Entities::Entity* obstacle) } -bool GradientInfo::match_source(Map* map, int posx, int posy) +bool GradientInfo::match_source(Map* map, int posX, int posY) { for(unsigned int x=0; xis_entity(map, posx, posy)) + if(sources[x]->is_entity(map, posX, posY)) return true; return false; } -bool GradientInfo::match_obstacle(Map* map, int posx, int posy) +bool GradientInfo::match_obstacle(Map* map, int posX, int posY) { for(unsigned int x=0; xis_entity(map, posx, posy)) + if(obstacles[x]->is_entity(map, posX, posY)) return true; return false; } @@ -924,9 +924,9 @@ void Gradient::recalculate(Map* map) } -int Gradient::get_height(int posx, int posy) const +int Gradient::get_height(int posX, int posY) const { - return gradient[get_pos(posx, posy)]-2; + return gradient[get_pos(posX, posY)]-2; } @@ -1326,7 +1326,7 @@ void CenterOfBuilding::save(GAGCore::OutputStream *stream) -SinglePosition::SinglePosition(int posx, int posy) : posx(posx), posy(posy) +SinglePosition::SinglePosition(int posX, int posY) : posX(posX), posY(posY) { } @@ -1342,7 +1342,7 @@ int SinglePosition::calculate_constraint(Echo& echo, int x, int y) bool SinglePosition::passes_constraint(Echo& echo, int x, int y) { - if(posx==x && posy==y) + if(posX==x && posY==y) return true; return false; } @@ -1359,8 +1359,8 @@ ConstraintType SinglePosition::get_type() bool SinglePosition::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { stream->readEnterSection("SinglePosition"); - posx = stream->readSint32("posx"); - posy = stream->readSint32("posy"); + posX = stream->readSint32("posx"); + posY = stream->readSint32("posy"); stream->readLeaveSection(); return true; } @@ -1370,8 +1370,8 @@ bool SinglePosition::load(GAGCore::InputStream *stream, Player *player, Sint32 v void SinglePosition::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("SinglePosition"); - stream->writeSint32(posx, "posx"); - stream->writeSint32(posy, "posy"); + stream->writeSint32(posX, "posx"); + stream->writeSint32(posY, "posy"); stream->writeLeaveSection(); } @@ -1573,7 +1573,7 @@ void BuildingOrder::queue_gradients(Gradients::GradientManager& manager) } -FlagMap::FlagMap(Echo& echo) : flagmap(echo.player->map->getW()*echo.player->map->getH(), NOGBID), width(echo.player->map->getW()), echo(echo) +FlagMap::FlagMap(Echo& echo) : flagMap(echo.player->map->getW()*echo.player->map->getH(), NOGBID), width(echo.player->map->getW()), echo(echo) { } @@ -1581,14 +1581,14 @@ FlagMap::FlagMap(Echo& echo) : flagmap(echo.player->map->getW()*echo.player->map int FlagMap::get_flag(int x, int y) { - return flagmap[y*width+x]; + return flagMap[y*width+x]; } void FlagMap::set_flag(int x, int y, int gid) { - flagmap[y*width+x]=gid; + flagMap[y*width+x]=gid; } @@ -1598,11 +1598,11 @@ bool FlagMap::load(GAGCore::InputStream *stream, Player *player, Sint32 versionM stream->readEnterSection("FlagMap"); stream->readEnterSection("flagmap"); Uint32 size=stream->readUint32("size"); - flagmap.resize(size); - for (Uint32 flagmap_index = 0; flagmap_index < size; flagmap_index++) + flagMap.resize(size); + for (Uint32 flagMap_index = 0; flagMap_index < size; flagMap_index++) { - stream->readEnterSection(flagmap_index); - flagmap[flagmap_index]=stream->readUint32("gid"); + stream->readEnterSection(flagMap_index); + flagMap[flagMap_index]=stream->readUint32("gid"); stream->readLeaveSection(); } stream->readLeaveSection(); @@ -1617,11 +1617,11 @@ void FlagMap::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("FlagMap"); stream->writeEnterSection("flagmap"); - stream->writeUint32(flagmap.size(), "size"); - for (Uint32 flagmap_index = 0; flagmap_index < flagmap.size(); flagmap_index++) + stream->writeUint32(flagMap.size(), "size"); + for (Uint32 flagMap_index = 0; flagMap_index < flagMap.size(); flagMap_index++) { - stream->writeEnterSection(flagmap_index); - stream->writeUint32(flagmap[flagmap_index], "gid"); + stream->writeEnterSection(flagMap_index); + stream->writeUint32(flagMap[flagMap_index], "gid"); stream->writeLeaveSection(); } stream->writeLeaveSection(); @@ -1699,8 +1699,8 @@ bool BuildingRegister::load(GAGCore::InputStream *stream, Player *player, Sint32 { stream->readEnterSection(found_index); Uint32 id=stream->readUint32("echo_building_id"); - Uint32 xpos=stream->readUint32("xpos"); - Uint32 ypos=stream->readUint32("ypos"); + Uint32 xPos=stream->readUint32("xpos"); + Uint32 yPos=stream->readUint32("ypos"); Uint32 building_type=stream->readUint32("building_type"); Uint32 gid=stream->readUint32("gid"); Uint8 upgrade_status=stream->readUint8("upgrade_status"); @@ -1711,7 +1711,7 @@ bool BuildingRegister::load(GAGCore::InputStream *stream, Player *player, Sint32 t=true; else t=indeterminate; - found_buildings[id]=boost::make_tuple(xpos, ypos, building_type, gid, t); + found_buildings[id]=boost::make_tuple(xPos, yPos, building_type, gid, t); stream->readLeaveSection(); } stream->readLeaveSection(); @@ -2173,9 +2173,9 @@ bool EnemyBuildingDestroyed::load(GAGCore::InputStream *stream, Player *player, gbid=stream->readUint32("gbid"); type=stream->readUint32("type"); level=stream->readUint32("level"); - int posx=stream->readUint32("posx"); - int posy=stream->readUint32("posy"); - location=position(posx, posy); + int posX=stream->readUint32("posx"); + int posY=stream->readUint32("posy"); + location=position(posX, posY); stream->readLeaveSection(); return true; } @@ -2515,12 +2515,12 @@ BuildingCondition* BuildingCondition::load_condition(GAGCore::InputStream *strea condition=new Upgradable; condition->load(stream, player, versionMinor); break; - case CRessourceTrackerAmount: - condition=new RessourceTrackerAmount; + case CResourceTrackerAmount: + condition=new ResourceTrackerAmount; condition->load(stream, player, versionMinor); break; - case CRessourceTrackerAge: - condition=new RessourceTrackerAge; + case CResourceTrackerAge: + condition=new ResourceTrackerAge; condition->load(stream, player, versionMinor); break; case CTicksPassed: @@ -2811,43 +2811,43 @@ void Upgradable::save(GAGCore::OutputStream *stream) -RessourceTrackerAmount::RessourceTrackerAmount(int amount, TrackerMethod tracker_method) : amount(amount), tracker_method(tracker_method) +ResourceTrackerAmount::ResourceTrackerAmount(int amount, TrackerMethod tracker_method) : amount(amount), tracker_method(tracker_method) { } -RessourceTrackerAmount::RessourceTrackerAmount() +ResourceTrackerAmount::ResourceTrackerAmount() { } -bool RessourceTrackerAmount::passes(Echo& echo, int id) +bool ResourceTrackerAmount::passes(Echo& echo, int id) { if(tracker_method==Greater) { - return echo.get_ressource_tracker(id)->get_total_level() > amount; + return echo.get_resource_tracker(id)->get_total_level() > amount; } else if(tracker_method==Lesser) { - return echo.get_ressource_tracker(id)->get_total_level() < amount; + return echo.get_resource_tracker(id)->get_total_level() < amount; } return false; } -BuildingConditionType RessourceTrackerAmount::get_type() +BuildingConditionType ResourceTrackerAmount::get_type() { - return CRessourceTrackerAmount; + return CResourceTrackerAmount; } -bool RessourceTrackerAmount::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) +bool ResourceTrackerAmount::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { stream->readEnterSection("RessourceTrackerAmount"); amount=stream->readUint32("amount"); @@ -2858,7 +2858,7 @@ bool RessourceTrackerAmount::load(GAGCore::InputStream *stream, Player *player, -void RessourceTrackerAmount::save(GAGCore::OutputStream *stream) +void ResourceTrackerAmount::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("RessourceTrackerAmount"); stream->writeUint32(amount, "amount"); @@ -2868,43 +2868,43 @@ void RessourceTrackerAmount::save(GAGCore::OutputStream *stream) -RessourceTrackerAge::RessourceTrackerAge(int age, TrackerMethod tracker_method) : age(age), tracker_method(tracker_method) +ResourceTrackerAge::ResourceTrackerAge(int age, TrackerMethod tracker_method) : age(age), tracker_method(tracker_method) { } -RessourceTrackerAge::RessourceTrackerAge() +ResourceTrackerAge::ResourceTrackerAge() { } -bool RessourceTrackerAge::passes(Echo& echo, int id) +bool ResourceTrackerAge::passes(Echo& echo, int id) { if(tracker_method==Greater) { - return echo.get_ressource_tracker(id)->get_age() > age; + return echo.get_resource_tracker(id)->get_age() > age; } else if(tracker_method==Lesser) { - return echo.get_ressource_tracker(id)->get_age() < age; + return echo.get_resource_tracker(id)->get_age() < age; } return false; } -BuildingConditionType RessourceTrackerAge::get_type() +BuildingConditionType ResourceTrackerAge::get_type() { - return CRessourceTrackerAge; + return CResourceTrackerAge; } -bool RessourceTrackerAge::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) +bool ResourceTrackerAge::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { stream->readEnterSection("RessourceTrackerAge"); age=stream->readUint32("age"); @@ -2915,7 +2915,7 @@ bool RessourceTrackerAge::load(GAGCore::InputStream *stream, Player *player, Sin -void RessourceTrackerAge::save(GAGCore::OutputStream *stream) +void ResourceTrackerAge::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("RessourceTrackerAge"); stream->writeUint32(age, "age"); @@ -3014,16 +3014,16 @@ ManagementOrder* ManagementOrder::load_order(GAGCore::InputStream *stream, Playe mo=new DestroyBuilding; mo->load(stream, player, versionMinor); break; - case MAddRessourceTracker: - mo=new AddRessourceTracker; + case MAddResourceTracker: + mo=new AddResourceTracker; mo->load(stream, player, versionMinor); break; - case MPauseRessourceTracker: - mo=new PauseRessourceTracker; + case MPauseResourceTracker: + mo=new PauseResourceTracker; mo->load(stream, player, versionMinor); break; - case MUnPauseRessourceTracker: - mo=new UnPauseRessourceTracker; + case MUnPauseResourceTracker: + mo=new UnPauseResourceTracker; mo->load(stream, player, versionMinor); break; case MChangeFlagSize: @@ -3230,20 +3230,20 @@ 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) +ResourceTracker::ResourceTracker(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) { } -void RessourceTracker::tick() +void ResourceTracker::tick() { timer++; 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; @@ -3251,7 +3251,7 @@ void RessourceTracker::tick() } -int RessourceTracker::get_total_level() +int ResourceTracker::get_total_level() { int sum=0; for(unsigned int n=0; nreadEnterSection("RessourceTracker"); stream->readEnterSection("record"); @@ -3280,14 +3280,14 @@ 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; } -void RessourceTracker::save(GAGCore::OutputStream *stream) +void ResourceTracker::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("RessourceTracker"); stream->writeEnterSection("record"); @@ -3303,27 +3303,27 @@ 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) +AddResourceTracker::AddResourceTracker(int length, int resource, int building_id) : length(length), building_id(building_id), resource(resource) { } -void AddRessourceTracker::modify(Echo& echo) +void AddResourceTracker::modify(Echo& echo) { - echo.add_ressource_tracker(new RessourceTracker(echo, building_id, length, ressource), building_id); + echo.add_resource_tracker(new ResourceTracker(echo, building_id, length, resource), building_id); } -boost::logic::tribool AddRessourceTracker::wait(Echo& echo) +boost::logic::tribool AddResourceTracker::wait(Echo& echo) { if(echo.get_building_register().is_building_found(building_id)) return true; @@ -3335,46 +3335,46 @@ boost::logic::tribool AddRessourceTracker::wait(Echo& echo) -bool AddRessourceTracker::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) +bool AddResourceTracker::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { stream->readEnterSection("AddRessourceTracker"); 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; } -void AddRessourceTracker::save(GAGCore::OutputStream *stream) +void AddResourceTracker::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("AddRessourceTracker"); ManagementOrder::save(stream); stream->writeUint32(length, "length"); stream->writeUint32(building_id, "building_id"); - stream->writeUint32(ressource, "ressource"); + stream->writeUint32(resource, "resource"); stream->writeLeaveSection(); } -PauseRessourceTracker::PauseRessourceTracker(int building_id) : building_id(building_id) +PauseResourceTracker::PauseResourceTracker(int building_id) : building_id(building_id) { } -void PauseRessourceTracker::modify(Echo& echo) +void PauseResourceTracker::modify(Echo& echo) { - echo.pause_ressource_tracker(building_id); + echo.pause_resource_tracker(building_id); } -boost::logic::tribool PauseRessourceTracker::wait(Echo& echo) +boost::logic::tribool PauseResourceTracker::wait(Echo& echo) { if(echo.get_building_register().is_building_found(building_id)) return true; @@ -3386,7 +3386,7 @@ boost::logic::tribool PauseRessourceTracker::wait(Echo& echo) -bool PauseRessourceTracker::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) +bool PauseResourceTracker::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { stream->readEnterSection("PauseRessourceTracker"); ManagementOrder::load(stream, player, versionMinor); @@ -3397,7 +3397,7 @@ bool PauseRessourceTracker::load(GAGCore::InputStream *stream, Player *player, S -void PauseRessourceTracker::save(GAGCore::OutputStream *stream) +void PauseResourceTracker::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("PauseRessourceTracker"); ManagementOrder::save(stream); @@ -3407,21 +3407,21 @@ void PauseRessourceTracker::save(GAGCore::OutputStream *stream) -UnPauseRessourceTracker::UnPauseRessourceTracker(int building_id) : building_id(building_id) +UnPauseResourceTracker::UnPauseResourceTracker(int building_id) : building_id(building_id) { } -void UnPauseRessourceTracker::modify(Echo& echo) +void UnPauseResourceTracker::modify(Echo& echo) { - echo.unpause_ressource_tracker(building_id); + echo.unpause_resource_tracker(building_id); } -boost::logic::tribool UnPauseRessourceTracker::wait(Echo& echo) +boost::logic::tribool UnPauseResourceTracker::wait(Echo& echo) { if(echo.get_building_register().is_building_found(building_id)) return true; @@ -3433,7 +3433,7 @@ boost::logic::tribool UnPauseRessourceTracker::wait(Echo& echo) -bool UnPauseRessourceTracker::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) +bool UnPauseResourceTracker::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor) { stream->readEnterSection("UnPauseRessourceTracker"); ManagementOrder::load(stream, player, versionMinor); @@ -3444,7 +3444,7 @@ bool UnPauseRessourceTracker::load(GAGCore::InputStream *stream, Player *player, -void UnPauseRessourceTracker::save(GAGCore::OutputStream *stream) +void UnPauseResourceTracker::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("UnPauseRessourceTracker"); ManagementOrder::save(stream); @@ -3693,7 +3693,7 @@ void AdjustPriority::save(GAGCore::OutputStream *stream) -AddArea::AddArea(AreaType areatype) : areatype(areatype) +AddArea::AddArea(AreaType areaType) : areaType(areaType) { } @@ -3716,16 +3716,16 @@ void AddArea::modify(Echo& echo) } if(acc.getApplicationCount()>0) { - switch(areatype) + switch(areaType) { case ClearingArea: - echo.push_order(shared_ptr(new OrderAlterateClearArea(echo.player->team->teamNumber, BrushTool::MODE_ADD, &acc, echo.player->map))); + echo.push_order(shared_ptr(new OrderAlterClearArea(echo.player->team->teamNumber, BrushTool::MODE_ADD, &acc, echo.player->map))); break; case ForbiddenArea: - echo.push_order(shared_ptr(new OrderAlterateForbidden(echo.player->team->teamNumber, BrushTool::MODE_ADD, &acc, echo.player->map))); + echo.push_order(shared_ptr(new OrderAlterForbidden(echo.player->team->teamNumber, BrushTool::MODE_ADD, &acc, echo.player->map))); break; case GuardArea: - echo.push_order(shared_ptr(new OrderAlterateGuardArea(echo.player->team->teamNumber, BrushTool::MODE_ADD, &acc, echo.player->map))); + echo.push_order(shared_ptr(new OrderAlterGuardArea(echo.player->team->teamNumber, BrushTool::MODE_ADD, &acc, echo.player->map))); break; } } @@ -3744,7 +3744,7 @@ bool AddArea::load(GAGCore::InputStream *stream, Player *player, Sint32 versionM { stream->readEnterSection("AddArea"); ManagementOrder::load(stream, player, versionMinor); - areatype=static_cast(stream->readUint32("area_type")); + areaType=static_cast(stream->readUint32("area_type")); stream->readEnterSection("locations"); Uint32 size=stream->readUint32("size"); locations.resize(size); @@ -3765,7 +3765,7 @@ void AddArea::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("AddArea"); ManagementOrder::save(stream); - stream->writeUint32(areatype, "area_type"); + stream->writeUint32(areaType, "area_type"); stream->writeEnterSection("locations"); stream->writeUint32(locations.size(), "size"); for(Uint32 location_index=0; location_index0) { - switch(areatype) + switch(areaType) { case ClearingArea: - echo.push_order(shared_ptr(new OrderAlterateClearArea(echo.player->team->teamNumber, BrushTool::MODE_DEL, &acc, echo.player->map))); + echo.push_order(shared_ptr(new OrderAlterClearArea(echo.player->team->teamNumber, BrushTool::MODE_DEL, &acc, echo.player->map))); break; case ForbiddenArea: - echo.push_order(shared_ptr(new OrderAlterateForbidden(echo.player->team->teamNumber, BrushTool::MODE_DEL, &acc, echo.player->map))); + echo.push_order(shared_ptr(new OrderAlterForbidden(echo.player->team->teamNumber, BrushTool::MODE_DEL, &acc, echo.player->map))); break; case GuardArea: - echo.push_order(shared_ptr(new OrderAlterateGuardArea(echo.player->team->teamNumber, BrushTool::MODE_DEL, &acc, echo.player->map))); + echo.push_order(shared_ptr(new OrderAlterGuardArea(echo.player->team->teamNumber, BrushTool::MODE_DEL, &acc, echo.player->map))); break; } } @@ -3832,7 +3832,7 @@ bool RemoveArea::load(GAGCore::InputStream *stream, Player *player, Sint32 versi { stream->readEnterSection("RemoveArea"); ManagementOrder::load(stream, player, versionMinor); - areatype=static_cast(stream->readUint32("area_type")); + areaType=static_cast(stream->readUint32("area_type")); stream->readEnterSection("locations"); Uint32 size=stream->readUint32("size"); locations.resize(size); @@ -3853,7 +3853,7 @@ void RemoveArea::save(GAGCore::OutputStream *stream) { stream->writeEnterSection("RemoveArea"); ManagementOrder::save(stream); - stream->writeUint32(areatype, "area_type"); + stream->writeUint32(areaType, "area_type"); stream->writeEnterSection("locations"); stream->writeUint32(locations.size(), "size"); for(Uint32 location_index=0; location_indexgame->teams[team]; if(is_allied) - alliedmask|=t->me; + alliedMask|=t->me; else if(!is_allied) - if(alliedmask&t->me) - alliedmask^=t->me; + if(alliedMask&t->me) + alliedMask^=t->me; if(is_enemy) - enemymask|=t->me; + enemyMask|=t->me; else if(!is_enemy) - if(enemymask&t->me) - enemymask^=t->me; + if(enemyMask&t->me) + enemyMask^=t->me; if(view_market) market_mask|=t->me; @@ -3913,13 +3913,13 @@ void ChangeAlliances::modify(Echo& echo) if(other_mask&t->me) other_mask^=t->me; - echo.allies=alliedmask; - echo.enemies=enemymask; + echo.allies=alliedMask; + echo.enemies=enemyMask; echo.market_view=market_mask; echo.inn_view=inn_mask; echo.other_view=other_mask; - echo.push_order(shared_ptr(new SetAllianceOrder(echo.player->team->teamNumber, alliedmask, enemymask, market_mask, inn_mask, other_mask))); + echo.push_order(shared_ptr(new SetAllianceOrder(echo.player->team->teamNumber, alliedMask, enemyMask, market_mask, inn_mask, other_mask))); } @@ -4089,7 +4089,7 @@ SendMessage::SendMessage(const std::string& message) : message(message) void SendMessage::modify(Echo& echo) { - echo.echoai->handle_message(echo, message); + echo.echoAi->handle_message(echo, message); } @@ -4195,8 +4195,8 @@ void building_search_iterator::set_to_next() return; } if(position->first==-1 && positionSaved==position) - { // This fixes an infinit loop. - is_end=true; // In some special cases the program Logic + { // This fixes an infinite loop. + is_end=true; // In some special tiles the program Logic return; // must have been wrong. } found_id=position->first; @@ -4495,16 +4495,16 @@ bool MapInfo::is_discovered(int x, int y) -bool MapInfo::is_ressource(int x, int y, int type) +bool MapInfo::is_resource(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) +bool MapInfo::is_resource(int x, int y) { - return echo.player->map->isRessource(x, y); + return echo.player->map->isResource(x, y); } @@ -4553,14 +4553,14 @@ bool MapInfo::backs_onto_sand(int x, int y) -int MapInfo::get_ammount_ressource(int x, int y) +int MapInfo::get_amount_resource(int x, int y) { - return echo.player->map->getRessource(x, y).amount; + return echo.player->map->getResource(x, y).amount; } -Echo::Echo(EchoAI* echoai, Player* player) : player(player), echoai(echoai), gm(), br(player, *this), fm(*this), timer(0) +Echo::Echo(EchoAI* echoAi, Player* player) : player(player), echoAi(echoAi), gm(), br(player, *this), fm(*this), timer(0) { previous_building_id=-1; from_load_timer=0; @@ -4613,45 +4613,45 @@ void Echo::update_management_orders() -void Echo::add_ressource_tracker(Management::RessourceTracker* rt, int building_id) +void Echo::add_resource_tracker(Management::ResourceTracker* rt, int building_id) { - ressource_trackers[building_id]=boost::make_tuple(boost::shared_ptr(rt), true); + resource_trackers[building_id]=boost::make_tuple(boost::shared_ptr(rt), true); } -boost::shared_ptr Echo::get_ressource_tracker(int building_id) +boost::shared_ptr Echo::get_resource_tracker(int building_id) { - if(ressource_trackers.find(building_id)==ressource_trackers.end()) - return boost::shared_ptr(); - return ressource_trackers[building_id].get<0>(); + if(resource_trackers.find(building_id)==resource_trackers.end()) + return boost::shared_ptr(); + return resource_trackers[building_id].get<0>(); } -void Echo::pause_ressource_tracker(int building_id) +void Echo::pause_resource_tracker(int building_id) { - ressource_trackers[building_id].get<1>()=false; + resource_trackers[building_id].get<1>()=false; } -void Echo::unpause_ressource_tracker(int building_id) +void Echo::unpause_resource_tracker(int building_id) { - ressource_trackers[building_id].get<1>()=true; + resource_trackers[building_id].get<1>()=true; } -void Echo::update_ressource_trackers() +void Echo::update_resource_trackers() { - for(std::map, bool> >::iterator i = ressource_trackers.begin(); i!=ressource_trackers.end();) + for(std::map, bool> >::iterator i = resource_trackers.begin(); i!=resource_trackers.end();) { if(!br.is_building_found(i->first) && !br.is_building_pending(i->first)) { - std::map, bool> >::iterator current=i; + std::map, bool> >::iterator current=i; ++i; - ressource_trackers.erase(current); + resource_trackers.erase(current); continue; } else if(br.is_building_found(i->first)) @@ -4744,11 +4744,11 @@ void Echo::check_fruit() { for(int y=0; yreadEnterSection("ressource_trackers"); - Uint32 ressourceTrackerSize=stream->readUint32("size"); - for(Uint32 ressourceTrackerIndex=0; ressourceTrackerIndexreadUint32("size"); + for(Uint32 resourceTrackerIndex=0; resourceTrackerIndexreadEnterSection(ressourceTrackerIndex); + stream->readEnterSection(resourceTrackerIndex); int id=stream->readUint32("echo_building_id"); - boost::shared_ptr rt(new RessourceTracker(*this, stream, player, versionMinor)); + boost::shared_ptr rt(new ResourceTracker(*this, stream, player, versionMinor)); bool activated=stream->readUint8("active"); - ressource_trackers[id]=boost::make_tuple(rt, activated); + resource_trackers[id]=boost::make_tuple(rt, activated); stream->readLeaveSection(); } stream->readLeaveSection(); @@ -4857,7 +4857,7 @@ bool Echo::load(GAGCore::InputStream *stream, Player *player, Sint32 versionMino signature_check(stream, player, versionMinor); - echoai->load(stream, player, versionMinor); + echoAi->load(stream, player, versionMinor); signature_check(stream, player, versionMinor); @@ -4932,11 +4932,11 @@ void Echo::save(GAGCore::OutputStream *stream) signature_write(stream); stream->writeEnterSection("ressource_trackers"); - stream->writeUint32(ressource_trackers.size(), "size"); - Uint32 ressourceTrackerIndex=0; - for(tracker_iterator i=ressource_trackers.begin(); i!=ressource_trackers.end(); ++ressourceTrackerIndex, ++i) + stream->writeUint32(resource_trackers.size(), "size"); + Uint32 resourceTrackerIndex=0; + for(tracker_iterator i=resource_trackers.begin(); i!=resource_trackers.end(); ++resourceTrackerIndex, ++i) { - stream->writeEnterSection(ressourceTrackerIndex); + stream->writeEnterSection(resourceTrackerIndex); stream->writeUint32(i->first, "echo_building_id"); i->second.get<0>()->save(stream); stream->writeUint8(i->second.get<1>(), "active"); @@ -4970,7 +4970,7 @@ void Echo::save(GAGCore::OutputStream *stream) signature_write(stream); - echoai->save(stream); + echoAi->save(stream); signature_write(stream); @@ -5048,9 +5048,9 @@ boost::shared_ptr Echo::getOrder(void) if(update_gm) gm->update(); br.tick(); - update_ressource_trackers(); + update_resource_trackers(); update_management_orders(); - echoai->tick(*this); + echoAi->tick(*this); update_management_orders(); update_building_orders(); timer++; @@ -5132,12 +5132,12 @@ void ReachToInfinity::tick(Echo& echo) mo_ratios->add_condition(new ParticularBuilding(new NotUnderConstruction, *i)); echo.add_management_order(mo_ratios); - ManagementOrder* mo_tracker=new AddRessourceTracker(12, CORN, *i); + ManagementOrder* mo_tracker=new AddResourceTracker(12, CORN, *i); echo.add_management_order(mo_tracker); } if(echo.get_building_register().get_type(*i)==IntBuildingType::FOOD_BUILDING) { - ManagementOrder* mo_tracker=new AddRessourceTracker(12, CORN, *i); + ManagementOrder* mo_tracker=new AddResourceTracker(12, CORN, *i); echo.add_management_order(mo_tracker); } } @@ -5157,15 +5157,15 @@ void ReachToInfinity::tick(Echo& echo) //The main order for the inn BuildingOrder* bo = new BuildingOrder(IntBuildingType::FOOD_BUILDING, 2); - //Constraints arround the location of wheat + //Constraints around 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 bo->add_constraint(new AIEcho::Construction::MaximumDistance(gi_wheat, 10)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); @@ -5178,12 +5178,12 @@ void ReachToInfinity::tick(Echo& echo) //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 3)); - //Constraints arround the location of fruit + //Constraints around 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)); - //You want to be reasnobly close to fruit, closer if possible + 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 reasonably close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); if(prev_id!=-1) @@ -5273,7 +5273,7 @@ void ReachToInfinity::tick(Echo& echo) // const int number=bs_flag.count_buildings(); if(echo.get_team_stats().numberUnitPerType[EXPLORER]>=6 && !flag_on_cherry && !flag_on_orange && !flag_on_prune) { - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); @@ -5285,10 +5285,10 @@ void ReachToInfinity::tick(Echo& echo) //You want the closest fruit to your settlement possible bo_cherry->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); - //Constraint arround the location of fruit + //Constraint around the location of fruit AIEcho::Gradients::GradientInfo gi_cherry; - gi_cherry.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); - //You want to be ontop of the cherry trees + gi_cherry.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); + //You want to be on top of the cherry trees bo_cherry->add_constraint(new AIEcho::Construction::MaximumDistance(gi_cherry, 0)); //Add the building order to the list of orders @@ -5316,10 +5316,10 @@ void ReachToInfinity::tick(Echo& echo) //You want the closest fruit to your settlement possible bo_orange->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); - //Constraints arround the location of fruit + //Constraints around the location of fruit AIEcho::Gradients::GradientInfo gi_orange; - gi_orange.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); - //You want to be ontop of the orange trees + gi_orange.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); + //You want to be on top 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); @@ -5347,8 +5347,8 @@ 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)); - //You want to be ontop of the prune trees + gi_prune.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); + //You want to be on top of the prune trees bo_prune->add_constraint(new AIEcho::Construction::MaximumDistance(gi_prune, 0)); //Add the building order to the list of orders @@ -5428,35 +5428,35 @@ void ReachToInfinity::tick(Echo& echo) //The main order for the inn BuildingOrder* bo = new BuildingOrder(IntBuildingType::FOOD_BUILDING, 2); - //Constraints arround the location of wheat + //Constraints around 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 bo->add_constraint(new AIEcho::Construction::MaximumDistance(gi_wheat, 10)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 3)); if(echo.is_fruit_on_map()) { - //Constraints arround the location of fruit + //Constraints around 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)); - //You want to be reasnobly close to fruit, closer if possible + 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 reasonably close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); } @@ -5469,7 +5469,7 @@ void ReachToInfinity::tick(Echo& echo) mo_completion->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_completion); - ManagementOrder* mo_tracker=new AddRessourceTracker(12, CORN, id); + ManagementOrder* mo_tracker=new AddResourceTracker(12, CORN, id); mo_tracker->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_tracker); } @@ -5488,22 +5488,22 @@ void ReachToInfinity::tick(Echo& echo) //The main order for the swarm BuildingOrder* bo = new BuildingOrder(IntBuildingType::SWARM_BUILDING, 3); - //Constraints arround the location of wheat + //Constraints around 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)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 3)); @@ -5523,7 +5523,7 @@ void ReachToInfinity::tick(Echo& echo) echo.add_management_order(mo_ratios); //Add a tracker - ManagementOrder* mo_tracker=new AddRessourceTracker(12, CORN, id); + ManagementOrder* mo_tracker=new AddResourceTracker(12, CORN, id); mo_tracker->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_tracker); @@ -5541,30 +5541,30 @@ void ReachToInfinity::tick(Echo& echo) //The main order for the racetrack BuildingOrder* bo = new BuildingOrder(IntBuildingType::WALKSPEED_BUILDING, 6); - //Constraints arround the location of wood + //Constraints around 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 + //Constraints around 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 bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_stone, 2)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 4)); @@ -5581,37 +5581,37 @@ void ReachToInfinity::tick(Echo& echo) const int number=bs.count_buildings(); if((echo.player->team->stats.getLatestStat()->totalUnit/60)>=number && number<3) { - //The main order for the swimmingpool + //The main order for the swimming pool BuildingOrder* bo = new BuildingOrder(IntBuildingType::SWIMSPEED_BUILDING, 6); - //Constraints arround the location of wood + //Constraints around 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 + //Constraints around 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 + //Constraints around 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)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 4)); @@ -5632,26 +5632,26 @@ void ReachToInfinity::tick(Echo& echo) //The main order for the school BuildingOrder* bo = new BuildingOrder(IntBuildingType::SCIENCE_BUILDING, 5); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 4)); - //Constraints arround the enemy + //Constraints around the enemy AIEcho::Gradients::GradientInfo gi_enemy; for(enemy_team_iterator i(echo); i!=enemy_team_iterator(); ++i) { gi_enemy.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(*i, false)); } - gi_enemy.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_enemy.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); bo->add_constraint(new AIEcho::Construction::MaximizedDistance(gi_enemy, 3)); //Add the building order to the list of orders @@ -5699,11 +5699,11 @@ void ReachToInfinity::tick(Echo& echo) if(echo.get_building_register().get_type(buildings[chosen])==IntBuildingType::FOOD_BUILDING) { - ManagementOrder* mo_tracker_pause=new PauseRessourceTracker(buildings[chosen]); + ManagementOrder* mo_tracker_pause=new PauseResourceTracker(buildings[chosen]); mo_tracker_pause->add_condition(new ParticularBuilding(new UnderConstruction, buildings[chosen])); echo.add_management_order(mo_tracker_pause); - ManagementOrder* mo_tracker_unpause=new UnPauseRessourceTracker(buildings[chosen]); + ManagementOrder* mo_tracker_unpause=new UnPauseResourceTracker(buildings[chosen]); mo_tracker_unpause->add_condition(new ParticularBuilding(new NotUnderConstruction, buildings[chosen])); echo.add_management_order(mo_tracker_unpause); @@ -5767,11 +5767,11 @@ void ReachToInfinity::tick(Echo& echo) if(echo.get_building_register().get_type(buildings[chosen])==IntBuildingType::FOOD_BUILDING) { - ManagementOrder* mo_tracker_pause=new PauseRessourceTracker(buildings[chosen]); + ManagementOrder* mo_tracker_pause=new PauseResourceTracker(buildings[chosen]); mo_tracker_pause->add_condition(new ParticularBuilding(new UnderConstruction, buildings[chosen])); echo.add_management_order(mo_tracker_pause); - ManagementOrder* mo_tracker_unpause=new UnPauseRessourceTracker(buildings[chosen]); + ManagementOrder* mo_tracker_unpause=new UnPauseResourceTracker(buildings[chosen]); mo_tracker_unpause->add_condition(new ParticularBuilding(new NotUnderConstruction, buildings[chosen])); echo.add_management_order(mo_tracker_unpause); @@ -5799,7 +5799,7 @@ void ReachToInfinity::tick(Echo& echo) inns.add_condition(new NotUnderConstruction); for(building_search_iterator i=inns.begin(); i!=inns.end(); ++i) { - boost::shared_ptr rt=echo.get_ressource_tracker(*i); + boost::shared_ptr rt=echo.get_resource_tracker(*i); if(rt) { if(rt->get_age()>1500) @@ -5819,7 +5819,7 @@ void ReachToInfinity::tick(Echo& echo) swarms.add_condition(new NotUnderConstruction); for(building_search_iterator i=swarms.begin(); i!=swarms.end(); ++i) { - boost::shared_ptr rt=echo.get_ressource_tracker(*i); + boost::shared_ptr rt=echo.get_resource_tracker(*i); if(rt) { if(rt->get_age()>2500) @@ -5849,16 +5849,16 @@ void ReachToInfinity::tick(Echo& echo) { if((x%2==1 && y%2==1)) { - if((!mi.is_ressource(x, y, WOOD) && - !mi.is_ressource(x, y, CORN)) && + if((!mi.is_resource(x, y, WOOD) && + !mi.is_resource(x, y, CORN)) && mi.is_forbidden_area(x, y)) { mo_non_farming->add_location(x, y); } else { - if((mi.is_ressource(x, y, WOOD) || - mi.is_ressource(x, y, CORN)) && + if((mi.is_resource(x, y, WOOD) || + mi.is_resource(x, y, CORN)) && mi.is_discovered(x, y) && !mi.is_forbidden_area(x, y) && gradient.get_height(x, y)<10) @@ -5882,35 +5882,35 @@ void ReachToInfinity::handle_message(Echo& echo, const std::string& message) //The main order for the inn BuildingOrder* bo = new BuildingOrder(IntBuildingType::FOOD_BUILDING, 2); - //Constraints arround the location of wheat + //Constraints around 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 bo->add_constraint(new AIEcho::Construction::MaximumDistance(gi_wheat, 10)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 3)); - //Constraints arround the location of fruit + //Constraints around the location of fruit 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)); - //You want to be reasnobly close to fruit, closer if possible + 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 reasonably close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); } @@ -5923,7 +5923,7 @@ void ReachToInfinity::handle_message(Echo& echo, const std::string& message) mo_completion->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_completion); - ManagementOrder* mo_tracker=new AddRessourceTracker(12, CORN, id); + ManagementOrder* mo_tracker=new AddResourceTracker(12, CORN, id); mo_tracker->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_tracker); } diff --git a/src/AIEcho.h b/src/AIEcho.h index e3a2054c..2301a0fe 100644 --- a/src/AIEcho.h +++ b/src/AIEcho.h @@ -49,8 +49,8 @@ namespace AIEcho class Building; class AnyTeamBuilding; class AnyBuilding; - class Ressource; - class AnyRessource; + class Resource; + class AnyResource; class Water; }; class GradientInfo; @@ -98,10 +98,10 @@ namespace AIEcho class AssignWorkers; class ChangeSwarm; class DestroyBuilding; - class RessourceTracker; - class AddRessourceTracker; - class PauseRessourceTracker; - class UnPauseRessourceTracker; + class ResourceTracker; + class AddResourceTracker; + class PauseResourceTracker; + class UnPauseResourceTracker; class ChangeFlagSize; class ChangeFlagMinimumLevel; class GlobalManagementOrder; @@ -127,7 +127,7 @@ namespace AIEcho namespace AIEcho { - ///A position on a map. Simple x and y cordinates, and a comparison operator for stoarge and maps and sets + ///A position on a map. Simple x and y coordinates, and a comparison operator for storage and maps and sets class position { public: @@ -156,8 +156,8 @@ namespace AIEcho EBuilding, EAnyTeamBuilding, EAnyBuilding, - ERessource, - EAnyRessource, + EResource, + EAnyResource, EWater, EPosition, ESand, @@ -170,7 +170,7 @@ namespace AIEcho virtual ~Entity(){} friend class AIEcho::Gradients::GradientInfo; protected: - virtual bool is_entity(Map* map, int posx, int posy)=0; + virtual bool is_entity(Map* map, int posX, int posY)=0; ///The comparison operator is used to reference gradients by the entities and sources that was use to compute them virtual bool operator==(const Entity& rhs)=0; @@ -193,7 +193,7 @@ namespace AIEcho protected: Building() : building_type(-1), team(-1), under_construction(false) {} friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); @@ -205,7 +205,7 @@ namespace AIEcho bool under_construction; }; - ///Matches any building of a particular team and consruction state + ///Matches any building of a particular team and construction state class AnyTeamBuilding : public Entity { public: @@ -213,7 +213,7 @@ namespace AIEcho protected: AnyTeamBuilding() : team(-1), under_construction(false) {} friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); @@ -232,7 +232,7 @@ namespace AIEcho protected: AnyBuilding() : under_construction(false) {} friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); @@ -242,32 +242,32 @@ 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 resource_type); protected: - Ressource() : ressource_type(-1) {} + Resource() : resource_type(-1) {} friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); void save(GAGCore::OutputStream *stream); private: - int ressource_type; + int resource_type; }; - ///Matches any ressource type - class AnyRessource : public Entity + ///Matches any resource type + class AnyResource : public Entity { public: - AnyRessource(); + AnyResource(); protected: friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); @@ -282,7 +282,7 @@ namespace AIEcho Water(); protected: friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); @@ -298,7 +298,7 @@ namespace AIEcho protected: Position() : x(-1), y(-1) {} friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); @@ -315,7 +315,7 @@ namespace AIEcho Sand(); protected: friend class Entity; - bool is_entity(Map* map, int posx, int posy); + bool is_entity(Map* map, int posX, int posY); bool operator==(const Entity& rhs); bool can_change(); EntityType get_type(); @@ -324,7 +324,7 @@ namespace AIEcho }; }; - ///The gradient info class is used to hold the information about sources and obstacles taht are used to compute a gradient + ///The gradient info class is used to hold the information about sources and obstacles that are used to compute a gradient class GradientInfo { public: @@ -346,12 +346,12 @@ namespace AIEcho bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); void save(GAGCore::OutputStream *stream); - ///Returns true if the provided position matches any of the sources that where added - bool match_source(Map* map, int posx, int posy); - ///Returns true if the provided position matches any of the obstacles that where added - bool match_obstacle(Map* map, int posx, int posy); + ///Returns true if the provided position matches any of the sources that were added + bool match_source(Map* map, int posX, int posY); + ///Returns true if the provided position matches any of the obstacles that were added + bool match_obstacle(Map* map, int posX, int posY); ///Returns true if this GradientInfo has any entities that can change, causing it to need to be updated. - ///This is an optmization, as many gradients don't need to be update + ///This is an optimization, as many gradients don't need to be update bool needs_updating() const; bool operator==(const GradientInfo& rhs) const; @@ -371,14 +371,14 @@ namespace AIEcho ///A generic, all purpose gradient. The gradient is referenced by its GradientInfo, which it uses continually in its computation. - ///Echo gradients are probably the slowest gradients in the game. However, they have one key difference compared to other gradinents, - ///they can be shared, and they are generic, even more so than Nicowar gradients (which where decently generic, but not entirely). + ///Echo gradients are probably the slowest gradients in the game. However, they have one key difference compared to other gradients, + ///they can be shared, and they are generic, even more so than Nicowar gradients (which were decently generic, but not entirely). class Gradient { public: explicit Gradient(const GradientInfo& gi); ///Gets the distance of the provided position from the nearest source - int get_height(int posx, int posy) const; + int get_height(int posX, int posY) const; private: friend class AIEcho::Gradients::GradientManager; @@ -395,13 +395,13 @@ 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 - ///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. + ///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 separately. This saves a lot of cpu time when their are multiple Echo AI's. class GradientManager { public: explicit GradientManager(Map* map); - ///A simple function, returns the Gradient that matches the GradientInfo. Its garunteed to be up to date within the last 150 ticks. + ///A simple function, returns the Gradient that matches the GradientInfo. It's guaranteed to be up to date within the last 150 ticks. ///If a matching gradient isn't found, a new one is created. 150 ticks may sound like a large amount of leeway, however, most ///gradients are updated sooner than that. As well, at normal game speed, 150 ticks is only 6 seconds, and you can count it yourself, ///not much changes in the game in six seconds. @@ -543,7 +543,7 @@ namespace AIEcho ///This constraint doesn't use gradients, unlike the other ones. In particular, it only allows one ///position to be allowed, the center of the building with the provided GBID. Notice this is not - ///like other building ID's, it can only be obtained with enemy_building_iterator or a similair + ///like other building ID's, it can only be obtained with enemy_building_iterator or a similar ///method. class CenterOfBuilding : public Constraint { @@ -563,15 +563,15 @@ namespace AIEcho }; - ///This constraint, againt unlike the others, does not use gradients. It only allows the given + ///This constraint, again unlike the others, does not use gradients. It only allows the given ///position to be allowed. The resulting building will *not* be centered on it except if it is ///a 1x1 building class SinglePosition : public Constraint { public: - SinglePosition(int posx, int posy); + SinglePosition(int posX, int posY); protected: - SinglePosition() : posx(0), posy(0) {} + SinglePosition() : posX(0), posY(0) {} friend class Constraint; int calculate_constraint(Echo& echo, int x, int y); bool passes_constraint(Echo& echo, int x, int y); @@ -580,8 +580,8 @@ namespace AIEcho bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); void save(GAGCore::OutputStream *stream); private: - int posx; - int posy; + int posX; + int posY; }; @@ -626,20 +626,20 @@ namespace AIEcho void set_flag(int x, int y, int gid); bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); void save(GAGCore::OutputStream *stream); - std::vector flagmap; + std::vector flagMap; int width; Echo& echo; }; ///The building register is a very important sub system of Echo. It keeps track of buildings. ///A seemingly simple process, but very, very important. Buildings you construct are looked for, - ///found, recorded, etc. Allot of seemingly odd code is found here, meant to work arround some - ///of the difficulties of other parts of glob2, so that the AI programmer can have a seemless, + ///found, recorded, etc. A lot of seemingly odd code is found here, meant to work around some + ///of the difficulties of other parts of glob2, so that the AI programmer can have a seamless, ///comfortable interface. Nothing here is directly important to an AI programmer. ///The system puts buildings through three stages. The first is where the building order has been ///issued by the ai, but it hasn't satisfied its conditions, and thus hasn't been sent to the glob2 ///engine. The second is where the building conditions are satisfied and the building order - ///has been sent, but the engine is awaiting the pertimiter of the building to be cleared before + ///has been sent, but the engine is awaiting the perimeter of the building to be cleared before ///it sets the building in place. The third stage is where the building has been set in place, ///and was detected on the map. In this stage, an engine gid has been found and a pointer to ///the building in memory secured. The fourth stage is where the building is being upgraded. @@ -648,7 +648,7 @@ namespace AIEcho ///If the register knows when a building is being upgraded, it knows when the building is ///expected to change in size and to what size, and this bug is solved. ///Another unmentioned part is that during the second stage, the building can be timed out if - ///it was unable to be set for various reasons (ressources grew into its area) + ///it was unable to be set for various reasons (resources grew into its area) class BuildingRegister { public: @@ -681,10 +681,10 @@ namespace AIEcho friend class AIEcho::Management::AssignWorkers; friend class AIEcho::Management::ChangeSwarm; friend class AIEcho::Management::DestroyBuilding; - friend class AIEcho::Management::RessourceTracker; - friend class AIEcho::Management::AddRessourceTracker; - friend class AIEcho::Management::PauseRessourceTracker; - friend class AIEcho::Management::UnPauseRessourceTracker; + friend class AIEcho::Management::ResourceTracker; + friend class AIEcho::Management::AddResourceTracker; + friend class AIEcho::Management::PauseResourceTracker; + friend class AIEcho::Management::UnPauseResourceTracker; friend class AIEcho::Management::ChangeFlagSize; friend class AIEcho::Management::ChangeFlagMinimumLevel; friend class AIEcho::Management::GlobalManagementOrder; @@ -715,8 +715,8 @@ namespace AIEcho found_iterator end() { return found_buildings.end(); } ///The last variables in both of these is simply a "this exists" variable. Its used to combat the fact ///that pending_buildings[id] may create a new object, and the system can't tell the difference between it and something - ///real. So bassically, the last variable is set to true when the object is supposed to be there, false is - ///the default value if its accidentilly created. + ///real. So basically, the last variable is set to true when the object is supposed to be there, false is + ///the default value if its accidentally created. std::map > pending_buildings; std::map > found_buildings; unsigned int building_id; @@ -727,8 +727,8 @@ namespace AIEcho }; ///These are all conditions on a particular Building. They are used in several places, such as when counting numbers of buildings, or - ///for setting a condition on an order to change the number of units assigned, making them very usefull. Its important to note that - ///none of the conditions work on enemies buildings, they only work on buildings on you're own team. + ///for setting a condition on an order to change the number of units assigned, making them very useful. Its important to note that + ///none of the conditions work on enemies buildings, they only work on buildings on your own team. namespace Conditions { ///This is used for loading and saving purposes only @@ -753,7 +753,7 @@ namespace AIEcho friend class EitherCondition; friend class AllConditions; ///This function checks if the condition passes. The third state, indeterminate, means that the condition - ///is impossible to fullfill. For example, a condition on a particular building could never pass if that + ///is impossible to fulfill. For example, a condition on a particular building could never pass if that ///building is destroyed. virtual boost::logic::tribool passes(Echo& echo)=0; virtual ConditionType get_type()=0; @@ -895,8 +895,8 @@ namespace AIEcho CNotSpecificBuildingType, CBuildingLevel, CUpgradable, - CRessourceTrackerAmount, - CRessourceTrackerAge, + CResourceTrackerAmount, + CResourceTrackerAge, CTicksPassed }; @@ -951,8 +951,8 @@ namespace AIEcho void save(GAGCore::OutputStream *stream); }; - ///Similair to BeingUpgraded, but this also takes a level, in which the building is being upgraded - ///to a particular level. When possible, use this instead od combining BeingUpgraded and BuildingLevel + ///Similar to BeingUpgraded, but this also takes a level, in which the building is being upgraded + ///to a particular level. When possible, use this instead of combining BeingUpgraded and BuildingLevel class BeingUpgradedTo : public BuildingCondition { public: @@ -1023,8 +1023,8 @@ namespace AIEcho void save(GAGCore::OutputStream *stream); }; - ///This class compares the total amount of ressources recorded by a ressource tracker. - class RessourceTrackerAmount : public BuildingCondition + ///This class compares the total amount of resources recorded by a resource tracker. + class ResourceTrackerAmount : public BuildingCondition { public: enum TrackerMethod @@ -1033,10 +1033,10 @@ namespace AIEcho Lesser, }; - explicit RessourceTrackerAmount(int amount, TrackerMethod tracker_method); + explicit ResourceTrackerAmount(int amount, TrackerMethod tracker_method); private: friend class BuildingCondition; - RessourceTrackerAmount(); + ResourceTrackerAmount(); bool passes(Echo& echo, int id); BuildingConditionType get_type(); bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); @@ -1045,8 +1045,8 @@ namespace AIEcho int tracker_method; }; - ///This class compares the age provided by a ressource tracker - class RessourceTrackerAge : public BuildingCondition + ///This class compares the age provided by a resource tracker + class ResourceTrackerAge : public BuildingCondition { public: enum TrackerMethod @@ -1055,10 +1055,10 @@ namespace AIEcho Lesser, }; - explicit RessourceTrackerAge(int age, TrackerMethod tracker_method); + explicit ResourceTrackerAge(int age, TrackerMethod tracker_method); private: friend class BuildingCondition; - RessourceTrackerAge(); + ResourceTrackerAge(); bool passes(Echo& echo, int id); BuildingConditionType get_type(); bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); @@ -1092,9 +1092,9 @@ namespace AIEcho MAssignWorkers, MChangeSwarm, MDestroyBuilding, - MAddRessourceTracker, - MPauseRessourceTracker, - MUnPauseRessourceTracker, + MAddResourceTracker, + MPauseResourceTracker, + MUnPauseResourceTracker, MChangeFlagSize, MChangeFlagMinimumLevel, MAddArea, @@ -1108,7 +1108,7 @@ namespace AIEcho ///A generic management order can have conditions attached to it. This makes management orders - ///both convinient and usefull. They will wait for the conditions to be satisfied before + ///both convenient and useful. They will wait for the conditions to be satisfied before ///performing their change. class ManagementOrder { @@ -1121,8 +1121,8 @@ namespace AIEcho ///This acts somewhat like a condition tester of its own. Like passes_conditions, this one ///checks for the conditions for the management order to execute at all. indeterminate means ///that its impossible to execute, false means wait some more and true means ready to execute - ///For example, the ChangeFlagSize order requires that the building be in existance, and - ///that its a flag. + ///For example, the ChangeFlagSize order requires that the building be in existence, and + ///that it's a flag. virtual boost::logic::tribool wait(Echo& echo)=0; virtual bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); @@ -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 - ///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 + ///A resource tracker is generally used for management, like most other things. A resource tracker's job is to keep + ///track of the number of resources in a particular building, and returning averages over a small period of time. + ///It's 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 + class ResourceTracker { public: - RessourceTracker(Echo& echo, GAGCore::InputStream* stream, Player* player, Sint32 versionMinor) : echo(echo) + ResourceTracker(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); - ///Returns the total ressources the building possessed within the time frame + ResourceTracker(Echo& echo, int building_id, int length, int resource); + ///Returns the total resources 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 - class AddRessourceTracker : public ManagementOrder + ///This adds a resource tracker to a building + class AddResourceTracker : public ManagementOrder { public: - AddRessourceTracker(int length, int ressource, int building_id); - AddRessourceTracker() : length(0), building_id(0), ressource(0) {} + AddResourceTracker(int length, int resource, int building_id); + AddResourceTracker() : length(0), building_id(0), resource(0) {} protected: void modify(Echo& echo); boost::logic::tribool wait(Echo& echo); @@ -1232,15 +1232,15 @@ 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. - class PauseRessourceTracker : public ManagementOrder + ///This pauses a resource tracker. This is mainly done when a building is about to be upgraded. + class PauseResourceTracker : public ManagementOrder { public: - PauseRessourceTracker() : building_id(0) {} - PauseRessourceTracker(int building_id); + PauseResourceTracker() : building_id(0) {} + PauseResourceTracker(int building_id); protected: void modify(Echo& echo); boost::logic::tribool wait(Echo& echo); @@ -1250,12 +1250,12 @@ namespace AIEcho int building_id; }; - ///This unpauses a ressource tracker. This should be done when a building is done being upgraded. - class UnPauseRessourceTracker : public ManagementOrder + ///This unpauses a resource tracker. This should be done when a building is done being upgraded. + class UnPauseResourceTracker : public ManagementOrder { public: - UnPauseRessourceTracker() : building_id(0) {} - UnPauseRessourceTracker(int building_id); + UnPauseResourceTracker() : building_id(0) {} + UnPauseResourceTracker(int building_id); protected: void modify(Echo& echo); boost::logic::tribool wait(Echo& echo); @@ -1351,7 +1351,7 @@ namespace AIEcho { public: AddArea() {} - explicit AddArea(AreaType areatype); + explicit AddArea(AreaType areaType); void add_location(int x, int y); protected: void modify(Echo& echo); @@ -1360,7 +1360,7 @@ namespace AIEcho bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); void save(GAGCore::OutputStream *stream); private: - AreaType areatype; + AreaType areaType; std::vector locations; }; @@ -1371,7 +1371,7 @@ namespace AIEcho { public: RemoveArea() {} - explicit RemoveArea(AreaType areatype); + explicit RemoveArea(AreaType areaType); void add_location(int x, int y); protected: void modify(Echo& echo); @@ -1380,7 +1380,7 @@ namespace AIEcho bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); void save(GAGCore::OutputStream *stream); private: - AreaType areatype; + AreaType areaType; std::vector locations; }; @@ -1391,7 +1391,7 @@ namespace AIEcho ChangeAlliances() {} ///You pass in a team number, that can be retrieved from enemy_team_iterator or a similar method. Then you pass in modifiers ///on each of the possible alliances. If you pass in true, that alliance mode is set. If you pass in false, that alliance - ///mode is unset. If you pass in undeterminate, that alliance mode is not changed, keeping whatever value it had before. + ///mode is unset. If you pass in indeterminate, that alliance mode is not changed, keeping whatever value it had before. ChangeAlliances(int team, boost::logic::tribool is_allied, boost::logic::tribool is_enemy, boost::logic::tribool view_market, boost::logic::tribool view_inn, boost::logic::tribool view_other); void modify(Echo& echo); boost::logic::tribool wait(Echo& echo); @@ -1486,7 +1486,7 @@ namespace AIEcho void add_condition(Conditions::BuildingCondition* condition); ///This counts up all the buildings that satisfy the conditions int count_buildings(); - ///Returns the begininng iterator + ///Returns the beginning iterator building_search_iterator begin(); ///Returns the one-past-the-end iterator building_search_iterator end(); @@ -1498,7 +1498,7 @@ namespace AIEcho }; ///This class is a standard iterator that is used to iterate over teams that qualify as "enemies". - ///It returns an integer corrosponding to the teams id. + ///It returns an integer corresponding to the teams id. class enemy_team_iterator { public: @@ -1575,13 +1575,13 @@ namespace AIEcho bool is_guard_area(int x, int y); bool is_clearing_area(int x, int y); bool is_discovered(int x, int y); - bool is_ressource(int x, int y, int type); - bool is_ressource(int x, int y); + bool is_resource(int x, int y, int type); + bool is_resource(int x, int y); bool is_water(int x, int y); bool is_sand(int x, int y); bool is_grass(int x, int y); bool backs_onto_sand(int x, int y); - int get_ammount_ressource(int x, int y); + int get_amount_resource(int x, int y); private: Echo& echo; }; @@ -1625,7 +1625,7 @@ namespace AIEcho class Echo : public AIImplementation { public: - Echo(EchoAI* echoai, Player* player); + Echo(EchoAI* echoAi, Player* player); bool load(GAGCore::InputStream *stream, Player *player, Sint32 versionMinor); void save(GAGCore::OutputStream *stream); @@ -1633,8 +1633,8 @@ namespace AIEcho unsigned int add_building_order(Construction::BuildingOrder* bo); void add_management_order(Management::ManagementOrder* mo); - void add_ressource_tracker(Management::RessourceTracker* rt, int building_id); - boost::shared_ptr get_ressource_tracker(int building_id); + void add_resource_tracker(Management::ResourceTracker* rt, int building_id); + boost::shared_ptr get_resource_tracker(int building_id); TeamStat& get_team_stats(); void flare(int x, int y); @@ -1649,9 +1649,9 @@ namespace AIEcho Player* player; private: - friend class AIEcho::Management::AddRessourceTracker; - friend class AIEcho::Management::PauseRessourceTracker; - friend class AIEcho::Management::UnPauseRessourceTracker; + friend class AIEcho::Management::AddResourceTracker; + friend class AIEcho::Management::PauseResourceTracker; + friend class AIEcho::Management::UnPauseResourceTracker; friend class AIEcho::Management::ChangeAlliances; friend class AIEcho::Management::SendMessage; @@ -1663,25 +1663,25 @@ namespace AIEcho Uint32 other_view; void update_management_orders(); - void pause_ressource_tracker(int building_id); - void unpause_ressource_tracker(int building_id); + void pause_resource_tracker(int building_id); + void unpause_resource_tracker(int building_id); void init_starting_buildings(); - void update_ressource_trackers(); + void update_resource_trackers(); void update_building_orders(); void check_fruit(); std::list > orders; - boost::shared_ptr echoai; + boost::shared_ptr echoAi; boost::shared_ptr gm; Construction::BuildingRegister br; Construction::FlagMap fm; std::vector > building_orders; std::vector > management_orders; - std::map, bool> > ressource_trackers; - typedef std::map, bool> >::iterator tracker_iterator; + std::map, bool> > resource_trackers; + typedef std::map, bool> >::iterator tracker_iterator; std::set starting_buildings; int timer; - ///This to keep multiuple buildings from being constructed on the same tick. + ///This to keep multiple buildings from being constructed on the same tick. ///Before the next building is constructed, the previous building must be ///found on the BuildingRegister int previous_building_id; @@ -1810,30 +1810,30 @@ inline AIEcho::Management::ManagementOrderType AIEcho::Management::DestroyBuildi } -inline int AIEcho::Management::RessourceTracker::get_age() +inline int AIEcho::Management::ResourceTracker::get_age() { return timer; } -inline AIEcho::Management::ManagementOrderType AIEcho::Management::AddRessourceTracker::get_type() +inline AIEcho::Management::ManagementOrderType AIEcho::Management::AddResourceTracker::get_type() { - return MAddRessourceTracker; + return MAddResourceTracker; } -inline AIEcho::Management::ManagementOrderType AIEcho::Management::PauseRessourceTracker::get_type() +inline AIEcho::Management::ManagementOrderType AIEcho::Management::PauseResourceTracker::get_type() { - return MPauseRessourceTracker; + return MPauseResourceTracker; } -inline AIEcho::Management::ManagementOrderType AIEcho::Management::UnPauseRessourceTracker::get_type() +inline AIEcho::Management::ManagementOrderType AIEcho::Management::UnPauseResourceTracker::get_type() { - return MUnPauseRessourceTracker; + return MUnPauseResourceTracker; } diff --git a/src/AIImplementation.h b/src/AIImplementation.h index 2d627e38..499e41f8 100644 --- a/src/AIImplementation.h +++ b/src/AIImplementation.h @@ -40,10 +40,10 @@ class Order; /* Howto make a new AI ? If you want to build a new way AI behave, you have to: -Add a new Strategy to the AI::ImplementitionID enum. +Add a new Strategy to the AI::ImplementationID enum. Add a new case in the AI::load method. Create a subclass of AIImplementation. -Fill AIImplenetation's methods correctly for that subclass. +Fill AIImplementation's methods correctly for that subclass. Warning: You have to understand how the Order class is used. @@ -52,7 +52,7 @@ Never use rand(), always syncRand(). Be sure to return at least a *NullOrder, not NULL. Idea: -You can access usefull data this way: +You can access useful data this way: player player->team player->team->game diff --git a/src/AINames.cpp b/src/AINames.cpp index a6bfb579..cc3401bd 100644 --- a/src/AINames.cpp +++ b/src/AINames.cpp @@ -40,7 +40,7 @@ namespace AINames break; case AI::WARRUSH: sAi="[AIWarrush]"; break; - case AI::REACHTOINFINITY: sAi="[AIReachToInfinity]"; + case AI::REACH_TO_INFINITY: sAi="[AIReachToInfinity]"; break; case AI::NICOWAR: sAi="[AINicowar]"; break; @@ -65,7 +65,7 @@ namespace AINames break; case AI::WARRUSH: sAi="[AIWarrush-Description]"; break; - case AI::REACHTOINFINITY: sAi="[AIReachToInfinity-Description]"; + case AI::REACH_TO_INFINITY: sAi="[AIReachToInfinity-Description]"; break; case AI::NICOWAR: sAi="[AINicowar-Description]"; break; diff --git a/src/AINicowar.cpp b/src/AINicowar.cpp index 931f7931..63355706 100644 --- a/src/AINicowar.cpp +++ b/src/AINicowar.cpp @@ -51,9 +51,9 @@ void NicowarStrategy::loadFromConfigFile(const ConfigBlock *configBlock) configBlock->load(upgrading_phase_2_unit_min, "upgrading_phase_2_unit_min"); configBlock->load(upgrading_phase_2_trained_worker_min, "upgrading_phase_2_trained_worker_min"); configBlock->load(minimum_warrior_level_for_trained, "minimum_warrior_level_for_trained"); - configBlock->load(war_preperation_phase_unit_min, "war_preperation_phase_unit_min"); - configBlock->load(war_preperation_phase_barracks_max, "war_preperation_phase_barracks_max"); - configBlock->load(war_preperation_phase_trained_warrior_max, "war_preperation_phase_trained_warrior_max"); + configBlock->load(war_preparation_phase_unit_min, "war_preperation_phase_unit_min"); + configBlock->load(war_preparation_phase_barracks_max, "war_preperation_phase_barracks_max"); + configBlock->load(war_preparation_phase_trained_warrior_max, "war_preperation_phase_trained_warrior_max"); configBlock->load(war_phase_trained_warrior_min, "war_phase_trained_warrior_min"); configBlock->load(fruit_phase_unit_min, "fruit_phase_unit_min"); configBlock->load(starvation_recovery_phase_starving_no_inn_min_percent, "starvation_recovery_phase_starving_no_inn_min_percent"); @@ -70,12 +70,12 @@ void NicowarStrategy::loadFromConfigFile(const ConfigBlock *configBlock) configBlock->load(skilled_work_phase_number_of_schools, "skilled_work_phase_number_of_schools"); configBlock->load(war_preparation_phase_number_of_barracks, "war_preparation_phase_number_of_barracks"); configBlock->load(base_number_of_hospitals, "base_number_of_hospitals"); - configBlock->load(war_preperation_phase_warriors_per_hospital, "war_preperation_phase_warriors_per_hospital"); + configBlock->load(war_preparation_phase_warriors_per_hospital, "war_preperation_phase_warriors_per_hospital"); configBlock->load(base_number_of_construction_sites, "base_number_of_construction_sites"); configBlock->load(starving_recovery_phase_number_of_extra_construction_sites, "starving_recovery_phase_number_of_extra_construction_sites"); - configBlock->load(level_1_inn_low_wheat_trigger_ammount, "level_1_inn_low_wheat_trigger_ammount"); - configBlock->load(level_2_inn_low_wheat_trigger_ammount, "level_2_inn_low_wheat_trigger_ammount"); - configBlock->load(level_3_inn_low_wheat_trigger_ammount, "level_3_inn_low_wheat_trigger_ammount"); + configBlock->load(level_1_inn_low_wheat_trigger_amount, "level_1_inn_low_wheat_trigger_ammount"); + configBlock->load(level_2_inn_low_wheat_trigger_amount, "level_2_inn_low_wheat_trigger_ammount"); + configBlock->load(level_3_inn_low_wheat_trigger_amount, "level_3_inn_low_wheat_trigger_ammount"); configBlock->load(level_1_inn_units_assigned_normal_wheat, "level_1_inn_units_assigned_normal_wheat"); configBlock->load(level_2_inn_units_assigned_normal_wheat, "level_2_inn_units_assigned_normal_wheat"); configBlock->load(level_3_inn_units_assigned_normal_wheat, "level_3_inn_units_assigned_normal_wheat"); @@ -83,14 +83,14 @@ void NicowarStrategy::loadFromConfigFile(const ConfigBlock *configBlock) configBlock->load(level_2_inn_units_assigned_low_wheat, "level_2_inn_units_assigned_low_wheat"); configBlock->load(level_3_inn_units_assigned_low_wheat, "level_3_inn_units_assigned_low_wheat"); configBlock->load(base_swarm_units_assigned, "base_swarm_units_assigned"); - configBlock->load(base_swarm_low_wheat_trigger_ammount, "base_swarm_low_wheat_trigger_ammount"); + configBlock->load(base_swarm_low_wheat_trigger_amount, "base_swarm_low_wheat_trigger_ammount"); configBlock->load(base_swarm_hungry_reduce_trigger_percent, "base_swarm_hungry_reduce_trigger_percent"); configBlock->load(growth_phase_swarm_worker_ratio, "growth_phase_swarm_worker_ratio"); configBlock->load(non_growth_phase_swarm_worker_ratio, "non_growth_phase_swarm_worker_ratio"); configBlock->load(base_number_of_explorers, "base_number_of_explorers"); configBlock->load(fruit_phase_extra_number_of_explorers, "fruit_phase_extra_number_of_explorers"); configBlock->load(base_swarm_explorer_ratio, "base_swarm_explorer_ratio"); - configBlock->load(war_preperation_swarm_warrior_ratio, "war_preperation_swarm_warrior_ratio"); + configBlock->load(war_preparation_swarm_warrior_ratio, "war_preperation_swarm_warrior_ratio"); configBlock->load(defense_explorer_population_percent, "defense_explorer_population_percent"); configBlock->load(offense_explorer_number, "offense_explorer_number"); configBlock->load(offense_explorer_minimum, "offense_explorer_minimum"); @@ -165,14 +165,14 @@ NewNicowar::NewNicowar() skilled_work_phase=0; upgrading_phase_1=false; upgrading_phase_2=false; - war_preperation=false; + war_preparation=false; war=false; fruit_phase=false; starving_recovery=false; no_workers_phase=false; can_swim=false; defend_explorers=false; - explorer_attack_preperation_phase=false; + explorer_attack_preparation_phase=false; explorer_attack_phase=false; starving_recovery_inns = 0; exploration_on_fruit=false; @@ -205,7 +205,7 @@ bool NewNicowar::load(GAGCore::InputStream *stream, Player *player, Sint32 versi skilled_work_phase=stream->readUint8("skilled_work_phase"); upgrading_phase_1=stream->readUint8("upgrading_phase_1"); upgrading_phase_2=stream->readUint8("upgrading_phase_2"); - war_preperation=stream->readUint8("war_preperation"); + war_preparation=stream->readUint8("war_preperation"); war=stream->readUint8("war"); fruit_phase=stream->readUint8("fruit_phase"); starving_recovery=stream->readUint8("starving_recovery"); @@ -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"); @@ -297,7 +297,7 @@ void NewNicowar::save(GAGCore::OutputStream *stream) stream->writeUint8(skilled_work_phase, "skilled_work_phase"); stream->writeUint8(upgrading_phase_1, "upgrading_phase_1"); stream->writeUint8(upgrading_phase_2, "upgrading_phase_2"); - stream->writeUint8(war_preperation, "war_preperation"); + stream->writeUint8(war_preparation, "war_preperation"); stream->writeUint8(war, "war"); stream->writeUint8(fruit_phase, "fruit_phase"); stream->writeUint8(starving_recovery, "starving_recovery"); @@ -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"); @@ -524,13 +524,13 @@ void NewNicowar::initialize(Echo& echo) { if(echo.get_building_register().get_type(*i)==IntBuildingType::SWARM_BUILDING) { - ManagementOrder* mo_tracker=new AddRessourceTracker(25, CORN, *i); + ManagementOrder* mo_tracker=new AddResourceTracker(25, CORN, *i); mo_tracker->add_condition(new ParticularBuilding(new NotUnderConstruction, *i)); echo.add_management_order(mo_tracker); } if(echo.get_building_register().get_type(*i)==IntBuildingType::FOOD_BUILDING) { - ManagementOrder* mo_tracker=new AddRessourceTracker(25, CORN, *i); + ManagementOrder* mo_tracker=new AddResourceTracker(25, CORN, *i); mo_tracker->add_condition(new ParticularBuilding(new NotUnderConstruction, *i)); echo.add_management_order(mo_tracker); } @@ -567,9 +567,9 @@ void NewNicowar::check_phases(Echo& echo) } ///Qualifications for the upgrading phase 1: - ///1) Atleast strategy.upgrading_phase_1_school_min schools - ///2) Atleast strategy.upgrading_phase_1_unit_min units - ///3) Atleast strategy.upgrading_phase_1_trained_worker_min of them are trained for upgrading to level 2 + ///1) At least strategy.upgrading_phase_1_school_min schools + ///2) At least strategy.upgrading_phase_1_unit_min units + ///3) At least strategy.upgrading_phase_1_trained_worker_min of them are trained for upgrading to level 2 BuildingSearch schools(echo); schools.add_condition(new SpecificBuildingType(IntBuildingType::SCIENCE_BUILDING)); schools.add_condition(new NotUnderConstruction); @@ -586,9 +586,9 @@ void NewNicowar::check_phases(Echo& echo) } ///Qualifications for the upgrading phase 2: - ///1) Atleast strategy.upgrading_phase_2_school_min level 2 or level 3 schools - ///2) Atleast strategy.upgrading_phase_2_unit_min units - ///3) Atleast strategy.upgrading_phase_2_trained_worker_min of them are trained for upgrading to level 3 + ///1) At least strategy.upgrading_phase_2_school_min level 2 or level 3 schools + ///2) At least strategy.upgrading_phase_2_unit_min units + ///3) At least strategy.upgrading_phase_2_trained_worker_min of them are trained for upgrading to level 3 BuildingSearch schools_2(echo); schools_2.add_condition(new SpecificBuildingType(IntBuildingType::SCIENCE_BUILDING)); schools_2.add_condition(new NotUnderConstruction); @@ -609,10 +609,10 @@ void NewNicowar::check_phases(Echo& echo) upgrading_phase_2=false; } - ///Qualifications for the war preperation phase: - ///1) Atleast strategy.war_preperation_phase_unit_min units - ///2) Less than strategy.war_preperation_phase_barracks_max barracks OR - ///3) Less than strategy.war_preperation_phase_trained_warrior_max trained warriors + ///Qualifications for the war preparation phase: + ///1) At least strategy.war_preparation_phase_unit_min units + ///2) Less than strategy.war_preparation_phase_barracks_max barracks OR + ///3) Less than strategy.war_preparation_phase_trained_warrior_max trained warriors BuildingSearch barracks(echo); barracks.add_condition(new SpecificBuildingType(IntBuildingType::ATTACK_BUILDING)); int barracks_count=barracks.count_buildings(); @@ -623,17 +623,17 @@ void NewNicowar::check_phases(Echo& echo) warrior_count += stat->upgradeState[ATTACK_SPEED][i]; } - if(stat->totalUnit>=strategy.war_preperation_phase_unit_min && (warrior_count < strategy.war_preperation_phase_trained_warrior_max || barracks_counttotalUnit>=strategy.war_preparation_phase_unit_min && (warrior_count < strategy.war_preparation_phase_trained_warrior_max || barracks_count= strategy.war_phase_trained_warrior_min) { war=true; @@ -643,8 +643,8 @@ void NewNicowar::check_phases(Echo& echo) war=false; } - ///Qualifcations for the fruit phase: - ///Atleast strategy.fruit_phase_unit_min units, and fruits on the map + ///Qualifications for the fruit phase: + ///At least strategy.fruit_phase_unit_min units, and fruits on the map if(echo.is_fruit_on_map() && stat->totalUnit >= strategy.fruit_phase_unit_min) { fruit_phase=true; @@ -656,7 +656,7 @@ void NewNicowar::check_phases(Echo& echo) ///Qualifications for the starving recovery phase: ///1) More than strategy.starvation_recovery_phase_starving_no_inn_min_percent % units hungry but not able to eat - ///2) Atleast one unit (because of devision by 0) + ///2) At least one unit (because of division by 0) if(stat->totalUnit > 1) { int total_starving_percent = stat->needFoodNoInns * 100 / stat->totalUnit; @@ -675,9 +675,9 @@ void NewNicowar::check_phases(Echo& echo) } ///Qualifications for the no worker phase: - ///1) More than strategy.no_workers_phase_free_worker_minimum_percen % workers free + ///1) More than strategy.no_workers_phase_free_worker_minimum_percent % workers free ///2) No needed jobs - ///3) Atleast one worker (because of devision by 0) + ///3) At least one worker (because of division by 0) if(stat->numberUnitPerType[WORKER] > 0) { const int workers_free = (stat->isFree[WORKER] - stat->totalNeeded) * 100 / stat->numberUnitPerType[WORKER]; @@ -696,7 +696,7 @@ void NewNicowar::check_phases(Echo& echo) } ///Qualifications for the can swim phase: - ///1) Atleast one worker that can swim + ///1) At least one worker that can swim int total_can_swim=0; for(int i=0; i<4; ++i) total_can_swim += stat->upgradeStatePerType[WORKER][SWIM][i]; @@ -724,11 +724,11 @@ void NewNicowar::check_phases(Echo& echo) //1) This teams prestige greater than 0 if(echo.player->team->prestige > 0) { - explorer_attack_preperation_phase = true; + explorer_attack_preparation_phase = true; } else { - explorer_attack_preperation_phase = false; + explorer_attack_preparation_phase = false; } ///Qualifications for the explorer attack phase @@ -918,7 +918,7 @@ void NewNicowar::queue_barracks(Echo& echo) const int barracks_count=bs_finished.count_buildings() + bs_upgrading.count_buildings() + buildings_under_construction_per_type[RegularBarracks]; int demand=0; - if(war_preperation) + if(war_preparation) { demand=strategy.war_preparation_phase_number_of_barracks; ///This only kicks in right at the start, so that it doesn't build barracks when it doesn't need to @@ -948,9 +948,9 @@ void NewNicowar::queue_hospitals(Echo& echo) int demand=0; if(echo.player->team->stats.getLatestStat()->needHeal > 0) demand += strategy.base_number_of_hospitals; - if(war_preperation || war) + if(war_preparation || war) { - demand+=total_warrior/strategy.war_preperation_phase_warriors_per_hospital; + demand+=total_warrior/strategy.war_preparation_phase_warriors_per_hospital; } if(demand > hospital_count) @@ -1046,9 +1046,9 @@ int NewNicowar::order_regular_inn(Echo& echo) //The main order for the inn BuildingOrder* bo = new BuildingOrder(IntBuildingType::FOOD_BUILDING, 2); - //Constraints arround the location of wheat + //Constraints around 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 @@ -1060,10 +1060,10 @@ int NewNicowar::order_regular_inn(Echo& echo) //You dont want to be too close to water, so that farm can develop between it and water bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_water, 6)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building.add_obstacle(new AIEcho::Gradients::Entities::Water); //You want to be close to other buildings, but wheat is more important @@ -1071,7 +1071,7 @@ int NewNicowar::order_regular_inn(Echo& echo) AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::Water); //You don't want to be too close @@ -1087,12 +1087,12 @@ int NewNicowar::order_regular_inn(Echo& echo) if(echo.is_fruit_on_map()) { - //Constraints arround the location of fruit + //Constraints around 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)); - //You want to be reasnobly close to fruit, closer if possible + 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 reasonably close to fruit, closer if possible bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1)); } @@ -1100,11 +1100,11 @@ 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); - ManagementOrder* mo_tracker=new AddRessourceTracker(25, CORN, id); + ManagementOrder* mo_tracker=new AddResourceTracker(25, CORN, id); mo_tracker->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_tracker); @@ -1117,22 +1117,22 @@ int NewNicowar::order_regular_swarm(Echo& echo) //The main order for the swarm BuildingOrder* bo = new BuildingOrder(IntBuildingType::SWARM_BUILDING, 4); - //Constraints arround the location of wheat + //Constraints around 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)); //Constraints about the distance to water. AIEcho::Gradients::GradientInfo gi_water; gi_water.add_source(new AIEcho::Gradients::Entities::Water); - //You dont want to be too close to water, so that farm can develop between it and water + //You don't want to be too close to water, so that farm can develop between it and water bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_water, 6)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building.add_obstacle(new AIEcho::Gradients::Entities::Water); //You want to be close to other buildings, but wheat is more important @@ -1140,7 +1140,7 @@ int NewNicowar::order_regular_swarm(Echo& echo) AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::Water); //You don't want to be too close @@ -1150,11 +1150,11 @@ 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); - ManagementOrder* mo_tracker=new AddRessourceTracker(25, CORN, id); + ManagementOrder* mo_tracker=new AddResourceTracker(25, CORN, id); mo_tracker->add_condition(new ParticularBuilding(new NotUnderConstruction, id)); echo.add_management_order(mo_tracker); @@ -1167,9 +1167,9 @@ int NewNicowar::order_regular_racetrack(Echo& echo) //The main order for the racetrack BuildingOrder* bo = new BuildingOrder(IntBuildingType::WALKSPEED_BUILDING, 6); - //Constraints arround the location of wood + //Constraints around 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)); @@ -1179,31 +1179,31 @@ int NewNicowar::order_regular_racetrack(Echo& echo) //You dont want to be too close to water. allows farms to develop bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_water, 6)); - //Constraints arround the location of stone + //Constraints around 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 bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_stone, 2)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building.add_obstacle(new AIEcho::Gradients::Entities::Water); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2)); - //Constraints arround water. Can't be too close to sand. + //Constraints around water. Can't be too close to sand. AIEcho::Gradients::GradientInfo gi_sand; gi_sand.add_source(new AIEcho::Gradients::Entities::Sand); bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_sand, 2)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::Water); //You don't want to be too close @@ -1218,12 +1218,12 @@ int NewNicowar::order_regular_racetrack(Echo& echo) int NewNicowar::order_regular_swimmingpool(Echo& echo) { - //The main order for the swimmingpool + //The main order for the swimming pool BuildingOrder* bo = new BuildingOrder(IntBuildingType::SWIMSPEED_BUILDING, 6); - //Constraints arround the location of wood + //Constraints around 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)); @@ -1233,35 +1233,35 @@ int NewNicowar::order_regular_swimmingpool(Echo& echo) //You dont want to be too close to water. allows farms to develop bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_water, 6)); - //Constraints arround the location of wheat + //Constraints around 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 + //Constraints around 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)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building.add_obstacle(new AIEcho::Gradients::Entities::Water); //You want to be close to other buildings, but wheat is more important bo->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2)); - //Constraints arround water. Can't be too close to sand. + //Constraints around water. Can't be too close to sand. AIEcho::Gradients::GradientInfo gi_sand; gi_sand.add_source(new AIEcho::Gradients::Entities::Sand); bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_sand, 2)); AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::Water); //You don't want to be too close @@ -1279,10 +1279,10 @@ int NewNicowar::order_regular_school(Echo& echo) //The main order for the school BuildingOrder* bo = new BuildingOrder(IntBuildingType::SCIENCE_BUILDING, 5); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building.add_obstacle(new AIEcho::Gradients::Entities::Water); //You want to be close to other buildings @@ -1296,19 +1296,19 @@ int NewNicowar::order_regular_school(Echo& echo) AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::Water); //You don't want to be too close bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_building_construction, 4)); - //Constraints arround the enemy + //Constraints around the enemy AIEcho::Gradients::GradientInfo gi_enemy; for(enemy_team_iterator i(echo); i!=enemy_team_iterator(); ++i) { gi_enemy.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(*i, false)); } -// gi_enemy.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); +// gi_enemy.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); bo->add_constraint(new AIEcho::Construction::MaximizedDistance(gi_enemy, 3)); //Add the building order to the list of orders @@ -1329,22 +1329,22 @@ int NewNicowar::order_regular_barracks(Echo& echo) //You dont want to be too close to water. allows farms to develop bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_water, 6)); - //Constraints arround the location of stone + //Constraints around 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 + //Constraints around 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)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building.add_obstacle(new AIEcho::Gradients::Entities::Water); //You want to be close to other buildings @@ -1352,7 +1352,7 @@ int NewNicowar::order_regular_barracks(Echo& echo) AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::Water); //You don't want to be too close @@ -1370,9 +1370,9 @@ int NewNicowar::order_regular_hospital(Echo& echo) //The main order for the hospital BuildingOrder* bo = new BuildingOrder(IntBuildingType::HEAL_BUILDING, 2); - //Constraints arround the location of wood + //Constraints around 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)); @@ -1382,10 +1382,10 @@ int NewNicowar::order_regular_hospital(Echo& echo) //You dont want to be too close to water. allows farms to develop bo->add_constraint(new AIEcho::Construction::MinimumDistance(gi_water, 6)); - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building.add_obstacle(new AIEcho::Gradients::Entities::Water); //You want to be close to other buildings @@ -1393,7 +1393,7 @@ int NewNicowar::order_regular_hospital(Echo& echo) AIEcho::Gradients::GradientInfo gi_building_construction; gi_building_construction.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, true)); - gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource); + gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::AnyResource); if(!can_swim) gi_building_construction.add_obstacle(new AIEcho::Gradients::Entities::Water); //You don't want to be too close @@ -1430,25 +1430,25 @@ void NewNicowar::manage_inn(Echo& echo, int id) int level=echo.get_building_register().get_level(id); int assigned=echo.get_building_register().get_assigned(id); - //Do nothing if the ressource_tracker order hasn't been processed yet - if(! echo.get_ressource_tracker(id)) + //Do nothing if the resource_tracker order hasn't been processed yet + if(! echo.get_resource_tracker(id)) return; - int total_ressource_level = echo.get_ressource_tracker(id)->get_total_level(); + int total_resource_level = echo.get_resource_tracker(id)->get_total_level(); int to_assign = 0; - if(level==1 && total_ressource_level>(strategy.level_1_inn_low_wheat_trigger_ammount*25)) + if(level==1 && total_resource_level>(strategy.level_1_inn_low_wheat_trigger_amount*25)) to_assign=strategy.level_1_inn_units_assigned_normal_wheat; - else if(level==1 && total_ressource_level<=(strategy.level_1_inn_low_wheat_trigger_ammount*25)) + else if(level==1 && total_resource_level<=(strategy.level_1_inn_low_wheat_trigger_amount*25)) to_assign=strategy.level_1_inn_units_assigned_low_wheat; - if(level==2 && total_ressource_level>(strategy.level_2_inn_low_wheat_trigger_ammount*25)) + if(level==2 && total_resource_level>(strategy.level_2_inn_low_wheat_trigger_amount*25)) to_assign=strategy.level_2_inn_units_assigned_normal_wheat; - else if(level==2 && total_ressource_level<=(strategy.level_2_inn_low_wheat_trigger_ammount*25)) + else if(level==2 && total_resource_level<=(strategy.level_2_inn_low_wheat_trigger_amount*25)) to_assign=strategy.level_2_inn_units_assigned_low_wheat; - if(level==3 && total_ressource_level>(strategy.level_3_inn_low_wheat_trigger_ammount*25)) + if(level==3 && total_resource_level>(strategy.level_3_inn_low_wheat_trigger_amount*25)) to_assign=strategy.level_3_inn_units_assigned_normal_wheat; - else if(level==3 && total_ressource_level<=(strategy.level_3_inn_low_wheat_trigger_ammount*25)) + else if(level==3 && total_resource_level<=(strategy.level_3_inn_low_wheat_trigger_amount*25)) to_assign=strategy.level_3_inn_units_assigned_low_wheat; ///The number of units assigned to an Inn depends entirely on its level @@ -1473,10 +1473,10 @@ void NewNicowar::manage_swarm(Echo& echo, int id) int assigned=echo.get_building_register().get_assigned(id); int to_assign=0; - //Do nothing if the ressource_tracker order hasn't been processed yet - if(! echo.get_ressource_tracker(id)) + //Do nothing if the resource_tracker order hasn't been processed yet + if(! echo.get_resource_tracker(id)) return; - int total_ressource_level = echo.get_ressource_tracker(id)->get_total_level(); + int total_resource_level = echo.get_resource_tracker(id)->get_total_level(); int worker_ratio=0; int explorer_ratio=0; @@ -1485,8 +1485,8 @@ void NewNicowar::manage_swarm(Echo& echo, int id) to_assign=strategy.base_swarm_units_assigned; - ///Double units when ressource level is low - if(total_ressource_level <= (strategy.base_swarm_low_wheat_trigger_ammount * 25)) + ///Double units when resource level is low + if(total_resource_level <= (strategy.base_swarm_low_wheat_trigger_amount * 25)) to_assign*=2; ///Half units if world is hungry @@ -1519,7 +1519,7 @@ void NewNicowar::manage_swarm(Echo& echo, int id) needed_explorers+=strategy.fruit_phase_extra_number_of_explorers; if(defend_explorers) needed_explorers+=(stat->totalUnit * strategy.defense_explorer_population_percent) / 100; - if(explorer_attack_preperation_phase) + if(explorer_attack_preparation_phase) needed_explorers+=strategy.offense_explorer_number; if(total_explorersadd_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); } @@ -1770,7 +1770,7 @@ int NewNicowar::choose_building_to_attack(Echo& echo) AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new Entities::AnyRessource); + gi_building.add_obstacle(new Entities::AnyResource); Gradient& gradient=echo.get_gradient_manager().get_gradient(gi_building); for(enemy_building_iterator ebi(echo, target, -1, -1, indeterminate); ebi!=enemy_building_iterator(); ++ebi) @@ -1843,7 +1843,7 @@ void NewNicowar::control_attacks(Echo& echo) AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new Entities::AnyRessource); + gi_building.add_obstacle(new Entities::AnyResource); if(num_pool == 0) gi_building.add_obstacle(new Entities::Water); Gradient& gradient=echo.get_gradient_manager().get_gradient(gi_building); @@ -1868,7 +1868,7 @@ void NewNicowar::choose_enemy_target(Echo& echo) { AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new Entities::AnyRessource); + gi_building.add_obstacle(new Entities::AnyResource); Gradient& gradient=echo.get_gradient_manager().get_gradient(gi_building); if(target==-1 || !echo.player->game->teams[target]->isAlive) @@ -1920,7 +1920,7 @@ bool NewNicowar::dig_out_enemy(Echo& echo) AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); - gi_building.add_obstacle(new Entities::AnyRessource); + gi_building.add_obstacle(new Entities::AnyResource); Gradient& gradient=echo.get_gradient_manager().get_gradient(gi_building); for(enemy_building_iterator ebi(echo, target, -1, -1, indeterminate); ebi!=enemy_building_iterator(); ++ebi) @@ -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 @@ -1968,79 +1968,79 @@ bool NewNicowar::dig_out_enemy(Echo& echo) } } - ///Next, follow a path arround stone between the closest point and the buildings position, + ///Next, follow a path around stone between the closest point and the buildings position, ///placing Clearing flags as you go - int xpos=closest_x; - int ypos=closest_y; + int xPos=closest_x; + int yPos=closest_y; int flag_dist_count=3; int w=mi.get_width(); int h=mi.get_height(); - while(xpos != bx || ypos!=by) + while(xPos != bx || yPos!=by) { - int nxpos = xpos; - int nypos = ypos; - int rx=(xpos+1+w) % w; - int lx=(xpos-1+w) % w; - int dy=(ypos+1+h) % h; - int uy=(ypos-1+h) % h; - int lowest_entity=gradient_pathfind.get_height(xpos, ypos)+2; + int nxPos = xPos; + int nyPos = yPos; + int rx=(xPos+1+w) % w; + int lx=(xPos-1+w) % w; + int dy=(yPos+1+h) % h; + int uy=(yPos-1+h) % h; + int lowest_entity=gradient_pathfind.get_height(xPos, yPos)+2; if(lowest_entity == 0) break; - //Test diagnols first, then the horizontals and verticals. + //Test diagonals first, then the horizontals and verticals. if(gradient_pathfind.get_height(lx, uy) < lowest_entity && gradient_pathfind.get_height(lx, uy)>=0) { lowest_entity=gradient_pathfind.get_height(lx, uy); - nxpos=lx; - nypos=uy; + nxPos=lx; + nyPos=uy; } if(gradient_pathfind.get_height(rx, uy) < lowest_entity && gradient_pathfind.get_height(rx, uy)>=0) { lowest_entity=gradient_pathfind.get_height(rx, uy); - nxpos=rx; - nypos=uy; + nxPos=rx; + nyPos=uy; } if(gradient_pathfind.get_height(lx, dy) < lowest_entity && gradient_pathfind.get_height(lx, dy)>=0) { lowest_entity=gradient_pathfind.get_height(lx, dy); - nxpos=lx; - nypos=dy; + nxPos=lx; + nyPos=dy; } if(gradient_pathfind.get_height(rx, dy) < lowest_entity && gradient_pathfind.get_height(rx, dy)>=0) { lowest_entity=gradient_pathfind.get_height(rx, dy); - nxpos=rx; - nypos=dy; + nxPos=rx; + nyPos=dy; } - if(gradient_pathfind.get_height(xpos, uy) < lowest_entity && gradient_pathfind.get_height(xpos, uy)>=0) + if(gradient_pathfind.get_height(xPos, uy) < lowest_entity && gradient_pathfind.get_height(xPos, uy)>=0) { - lowest_entity=gradient_pathfind.get_height(xpos, uy); - nxpos=xpos; - nypos=uy; + lowest_entity=gradient_pathfind.get_height(xPos, uy); + nxPos=xPos; + nyPos=uy; } - if(gradient_pathfind.get_height(lx, ypos) < lowest_entity && gradient_pathfind.get_height(lx, ypos)>=0) + if(gradient_pathfind.get_height(lx, yPos) < lowest_entity && gradient_pathfind.get_height(lx, yPos)>=0) { - lowest_entity=gradient_pathfind.get_height(lx, ypos); - nxpos=lx; - nypos=ypos; + lowest_entity=gradient_pathfind.get_height(lx, yPos); + nxPos=lx; + nyPos=yPos; } - if(gradient_pathfind.get_height(rx, ypos) < lowest_entity && gradient_pathfind.get_height(rx, ypos)>=0) + if(gradient_pathfind.get_height(rx, yPos) < lowest_entity && gradient_pathfind.get_height(rx, yPos)>=0) { - lowest_entity=gradient_pathfind.get_height(rx, ypos); - nxpos=rx; - nypos=ypos; + lowest_entity=gradient_pathfind.get_height(rx, yPos); + nxPos=rx; + nyPos=yPos; } - if(gradient_pathfind.get_height(xpos, dy) < lowest_entity && gradient_pathfind.get_height(xpos, dy)>=0) + if(gradient_pathfind.get_height(xPos, dy) < lowest_entity && gradient_pathfind.get_height(xPos, dy)>=0) { - lowest_entity=gradient_pathfind.get_height(xpos, dy); - nxpos=xpos; - nypos=dy; + lowest_entity=gradient_pathfind.get_height(xPos, dy); + nxPos=xPos; + nyPos=dy; } @@ -2053,7 +2053,7 @@ bool NewNicowar::dig_out_enemy(Echo& echo) //The main order for the clearing flag BuildingOrder* bo_flag = new BuildingOrder(IntBuildingType::CLEARING_FLAG, 10); //Place it on the current point - bo_flag->add_constraint(new Construction::SinglePosition(xpos, ypos)); + bo_flag->add_constraint(new Construction::SinglePosition(xPos, yPos)); //Add the building order to the list of orders unsigned int id_flag=echo.add_building_order(bo_flag); @@ -2065,8 +2065,8 @@ bool NewNicowar::dig_out_enemy(Echo& echo) ManagementOrder* mo_completion=new ChangeFlagSize(3, id_flag); echo.add_management_order(mo_completion); } - xpos = nxpos; - ypos = nypos; + xPos = nxPos; + yPos = nyPos; } @@ -2093,7 +2093,7 @@ void NewNicowar::compute_defense_flag_positioning(AIEcho::Echo& echo) //This algorithm does that, except optimized. A list is maintained to keep track of squares //that have a value other than 0 as these are the only ones we want to place a flag on, and //when a defense flag position is chosen, all units or buildings within range of the flag - //have all squares within their range -1, effectivly doing the same as recalculating all + //have all squares within their range -1, effectively doing the same as recalculating all //squares excluding those units now covered by a defense flag MapInfo mi(echo); const int w = mi.get_width(); @@ -2385,7 +2385,7 @@ void NewNicowar::modify_points(Uint16* counts, int w, int h, int x, int y, int d void NewNicowar::compute_explorer_flag_attack_positioning(AIEcho::Echo& echo) { - //The algorithm here is interesting. Bassically, an enemy unit is selected. Every enemy unit within 4 squares of this unit + //The algorithm here is interesting. Basically, an enemy unit is selected. Every enemy unit within 4 squares of this unit //is counted as part of the larger group, and every unit 4 squares from those and so on, as long as it doesn't go past //6 squares from the average. Flags are put on the average x and y of largest groups MapInfo mi(echo); @@ -2420,8 +2420,8 @@ void NewNicowar::compute_explorer_flag_attack_positioning(AIEcho::Echo& echo) int group_size = 0; std::queue proccess; - std::queue xposs; - std::queue yposs; + std::queue xPoses; + std::queue yPoses; for(int i=0; iposX; group_y += units[i]->posY; proccess.push(units[i]); - xposs.push(units[i]->posX); - yposs.push(units[i]->posY); + xPoses.push(units[i]->posX); + yPoses.push(units[i]->posY); units[i] = NULL; group_size+=1; break; @@ -2443,11 +2443,11 @@ void NewNicowar::compute_explorer_flag_attack_positioning(AIEcho::Echo& echo) while(!proccess.empty()) { Unit* top = proccess.front(); - int ix = xposs.front(); - int iy = yposs.front(); + int ix = xPoses.front(); + int iy = yPoses.front(); proccess.pop(); - xposs.pop(); - yposs.pop(); + xPoses.pop(); + yPoses.pop(); for(int dx = -4; dx<=4; ++dx) { int nx = (top->posX + dx + w) % w; @@ -2465,8 +2465,8 @@ void NewNicowar::compute_explorer_flag_attack_positioning(AIEcho::Echo& echo) group_x += ix + dx; group_y += iy + dy; proccess.push(units[id]); - xposs.push(ix + dx); - yposs.push(iy + dy); + xPoses.push(ix + dx); + yPoses.push(iy + dy); units[id] = NULL; group_size+=1; } @@ -2595,15 +2595,15 @@ void NewNicowar::update_farming(Echo& echo) const int wood_dist = 6; const int wheat_dist = 10; - bool is_wood = mi.is_ressource(x, y, WOOD); - bool is_wheat = mi.is_ressource(x, y, CORN); + bool is_wood = mi.is_resource(x, y, WOOD); + bool is_wheat = mi.is_resource(x, y, CORN); bool is_in_wheat_zone = water_gradient.get_height(x,y) < wheat_dist; bool is_in_wood_zone = water_gradient.get_height(x,y) < wood_dist; bool farm_spot = false; - //Permament farming exists for every second row and column + //Permanent farming exists for every second row and column if(x%2==1 && y%2==1) { if((is_wood && is_in_wood_zone) || (is_wheat && is_in_wheat_zone)) @@ -2615,19 +2615,19 @@ void NewNicowar::update_farming(Echo& echo) //Expand the farm horizontally if((x%2==0 && y%2==1)) { - if(is_wood && mi.is_ressource(x-1, y, WOOD) && !mi.is_ressource(x+1,y) && water_gradient.get_height(x+1, y) < wood_dist && mi.is_grass(x+1,y)) + if(is_wood && mi.is_resource(x-1, y, WOOD) && !mi.is_resource(x+1,y) && water_gradient.get_height(x+1, y) < wood_dist && mi.is_grass(x+1,y)) { farm_spot = true; } - else if(is_wheat && mi.is_ressource(x-1, y, CORN) && !mi.is_ressource(x+1,y) && water_gradient.get_height(x+1, y) < wheat_dist && mi.is_grass(x+1,y)) + else if(is_wheat && mi.is_resource(x-1, y, CORN) && !mi.is_resource(x+1,y) && water_gradient.get_height(x+1, y) < wheat_dist && mi.is_grass(x+1,y)) { farm_spot = true; } - else if(is_wood && mi.is_ressource(x+1, y, WOOD) && !mi.is_ressource(x-1,y) && water_gradient.get_height(x-1, y) < wood_dist && mi.is_grass(x-1,y)) + else if(is_wood && mi.is_resource(x+1, y, WOOD) && !mi.is_resource(x-1,y) && water_gradient.get_height(x-1, y) < wood_dist && mi.is_grass(x-1,y)) { farm_spot = true; } - else if(is_wheat && mi.is_ressource(x+1, y, CORN) && !mi.is_ressource(x-1,y) && water_gradient.get_height(x-1, y) < wheat_dist && mi.is_grass(x-1,y)) + else if(is_wheat && mi.is_resource(x+1, y, CORN) && !mi.is_resource(x-1,y) && water_gradient.get_height(x-1, y) < wheat_dist && mi.is_grass(x-1,y)) { farm_spot = true; } @@ -2636,19 +2636,19 @@ void NewNicowar::update_farming(Echo& echo) //Expand the farm vertically if((x%2==1 && y%2==0)) { - if(is_wood && mi.is_ressource(x, y-1, WOOD) && !mi.is_ressource(x,y+1) && water_gradient.get_height(x, y+1) < wood_dist && mi.is_grass(x,y+1)) + if(is_wood && mi.is_resource(x, y-1, WOOD) && !mi.is_resource(x,y+1) && water_gradient.get_height(x, y+1) < wood_dist && mi.is_grass(x,y+1)) { farm_spot = true; } - else if(is_wheat && mi.is_ressource(x, y-1, CORN) && !mi.is_ressource(x,y+1) && water_gradient.get_height(x, y+1) < wheat_dist && mi.is_grass(x,y+1)) + else if(is_wheat && mi.is_resource(x, y-1, CORN) && !mi.is_resource(x,y+1) && water_gradient.get_height(x, y+1) < wheat_dist && mi.is_grass(x,y+1)) { farm_spot = true; } - else if(is_wood && mi.is_ressource(x, y+1, WOOD) && !mi.is_ressource(x,y-1) && water_gradient.get_height(x, y-1) < wood_dist && mi.is_grass(x,y-1)) + else if(is_wood && mi.is_resource(x, y+1, WOOD) && !mi.is_resource(x,y-1) && water_gradient.get_height(x, y-1) < wood_dist && mi.is_grass(x,y-1)) { farm_spot = true; } - else if(is_wheat && mi.is_ressource(x, y+1, CORN) && !mi.is_ressource(x,y-1) && water_gradient.get_height(x, y-1) < wheat_dist && mi.is_grass(x,y-1)) + else if(is_wheat && mi.is_resource(x, y+1, CORN) && !mi.is_resource(x,y-1) && water_gradient.get_height(x, y-1) < wheat_dist && mi.is_grass(x,y-1)) { farm_spot = true; } @@ -2685,7 +2685,7 @@ void NewNicowar::update_fruit_flags(AIEcho::Echo& echo) { if(fruit_phase && !exploration_on_fruit) { - //Constraints arround nearby settlement + //Constraints around nearby settlement AIEcho::Gradients::GradientInfo gi_building; gi_building.add_source(new AIEcho::Gradients::Entities::AnyTeamBuilding(echo.player->team->teamNumber, false)); @@ -2694,10 +2694,10 @@ void NewNicowar::update_fruit_flags(AIEcho::Echo& echo) BuildingOrder* bo_cherry = new BuildingOrder(IntBuildingType::EXPLORATION_FLAG, 2); //You want the closest fruit to your settlement possible bo_cherry->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); - //Constraint arround the location of fruit + //Constraint around the location of fruit AIEcho::Gradients::GradientInfo gi_cherry; - gi_cherry.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY)); - //You want to be ontop of the cherry trees + gi_cherry.add_source(new AIEcho::Gradients::Entities::Resource(CHERRY)); + //You want to be on top of the cherry trees bo_cherry->add_constraint(new AIEcho::Construction::MaximumDistance(gi_cherry, 0)); //Add the building order to the list of orders unsigned int id_cherry=echo.add_building_order(bo_cherry); @@ -2711,10 +2711,10 @@ void NewNicowar::update_fruit_flags(AIEcho::Echo& echo) BuildingOrder* bo_orange = new BuildingOrder(IntBuildingType::EXPLORATION_FLAG, 2); //You want the closest fruit to your settlement possible bo_orange->add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 1)); - //Constraints arround the location of fruit + //Constraints around the location of fruit AIEcho::Gradients::GradientInfo gi_orange; - gi_orange.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE)); - //You want to be ontop of the orange trees + gi_orange.add_source(new AIEcho::Gradients::Entities::Resource(ORANGE)); + //You want to be on top 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); @@ -2726,8 +2726,8 @@ 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)); - //You want to be ontop of the prune trees + gi_prune.add_source(new AIEcho::Gradients::Entities::Resource(PRUNE)); + //You want to be on top of the prune trees bo_prune->add_constraint(new AIEcho::Construction::MaximumDistance(gi_prune, 0)); //Add the building order to the list of orders unsigned int id_prune=echo.add_building_order(bo_prune); diff --git a/src/AINicowar.h b/src/AINicowar.h index b767efdb..fd3f5fe9 100644 --- a/src/AINicowar.h +++ b/src/AINicowar.h @@ -22,7 +22,7 @@ #include "AIEcho.h" #include "ConfigFiles.h" -///This class represents the configuragle strategy that Nicowar will take. It uses the same algorithms, +///This class represents the configurable strategy that Nicowar will take. It uses the same algorithms, ///but this can allow it to fine tune the variables in those algorithms class NicowarStrategy : LoadableFromConfigFile { @@ -55,14 +55,14 @@ class NicowarStrategy : LoadableFromConfigFile int upgrading_phase_2_unit_min; ///Minimum number of trained workers to activate the upgrading phase 2 int upgrading_phase_2_trained_worker_min; - ///The minimum warrior level to be considered "trained" for the war preperation and war phases, starting at 0 + ///The minimum warrior level to be considered "trained" for the war preparation and war phases, starting at 0 int minimum_warrior_level_for_trained; - ///Minimum number of units to activate the war preperation phase - int war_preperation_phase_unit_min; - ///Maximum number of barracks to activate the war preperation phase - int war_preperation_phase_barracks_max; - ///Maximum number of trained warriors to activate the war preperation phase - int war_preperation_phase_trained_warrior_max; + ///Minimum number of units to activate the war preparation phase + int war_preparation_phase_unit_min; + ///Maximum number of barracks to activate the war preparation phase + int war_preparation_phase_barracks_max; + ///Maximum number of trained warriors to activate the war preparation phase + int war_preparation_phase_trained_warrior_max; ///Minimum number of trained warriors to activate the war phase int war_phase_trained_warrior_min; ///Minimum number of units to activate the fruit phase @@ -79,34 +79,34 @@ class NicowarStrategy : LoadableFromConfigFile int level_2_inn_units_can_feed; ///How many units a level 3 Inn can feed, used to determine when more inns are needed int level_3_inn_units_can_feed; - ///How many units it takes to consitute a new swarm when in the growth phase + ///How many units it takes to constitute a new swarm when in the growth phase int growth_phase_units_per_swarm; - ///How many units it takes to consitute a new swarm when not in the growth phase + ///How many units it takes to constitute a new swarm when not in the growth phase int non_growth_phase_units_per_swarm; ///The maximum number of swarms that can be made during the growth phase int growth_phase_maximum_swarms; ///The number of racetracks to be built during the skilled work phase int skilled_work_phase_number_of_racetracks; - ///The number of swimmingpools to be built during the skilled work phase + ///The number of swimming pools to be built during the skilled work phase int skilled_work_phase_number_of_swimmingpools; ///The number of schools to be built during the skilled work phase int skilled_work_phase_number_of_schools; - ///The number of barracks to be built during the war preperation phase + ///The number of barracks to be built during the war preparation phase int war_preparation_phase_number_of_barracks; ///The base number of hospitals to build, these are only built when there is first demand int base_number_of_hospitals; ///The number of warriors required to trigger another hospital - int war_preperation_phase_warriors_per_hospital; + int war_preparation_phase_warriors_per_hospital; ///The base number of construction sites that can go at once int base_number_of_construction_sites; ///The number of extra construction sites when in starving recovery mode (to facilitate extra inns to be constructed0 int starving_recovery_phase_number_of_extra_construction_sites; - ///The ammount of wheat that triggers a level 1 inn to increase the units working - int level_1_inn_low_wheat_trigger_ammount; - ///The ammount of wheat that triggers a level 2 inn to increase the units working - int level_2_inn_low_wheat_trigger_ammount; - ///The ammount of wheat that triggers a level 3 inn to increase the units working - int level_3_inn_low_wheat_trigger_ammount; + ///The amount of wheat that triggers a level 1 inn to increase the units working + int level_1_inn_low_wheat_trigger_amount; + ///The amount of wheat that triggers a level 2 inn to increase the units working + int level_2_inn_low_wheat_trigger_amount; + ///The amount of wheat that triggers a level 3 inn to increase the units working + int level_3_inn_low_wheat_trigger_amount; ///The number of units to assign to an level 1 inn when its wheat is above the trigger int level_1_inn_units_assigned_normal_wheat; ///The number of units to assign to an level 2 inn when its wheat is above the trigger @@ -121,8 +121,8 @@ class NicowarStrategy : LoadableFromConfigFile int level_3_inn_units_assigned_low_wheat; ///The base number of units to assign to a swarm, which is doubled/halved based on conditions int base_swarm_units_assigned; - ///The ammount of ressources that caused a swarm to double its units assigned if it goes below this ammount - int base_swarm_low_wheat_trigger_ammount; + ///The amount of resources that caused a swarm to double its units assigned if it goes below this amount + int base_swarm_low_wheat_trigger_amount; ///The percentage of units that are hungry/starving that will cause swarms to halve the number of units assigned, (more wheat to inns) int base_swarm_hungry_reduce_trigger_percent; ///The ratio of workers assigned to swarms during the growth phase @@ -135,8 +135,8 @@ class NicowarStrategy : LoadableFromConfigFile int fruit_phase_extra_number_of_explorers; ///The base ratio of explorers to use when explorers are needed int base_swarm_explorer_ratio; - ///The warrior ratio during the war preperation phase - int war_preperation_swarm_warrior_ratio; + ///The warrior ratio during the war preparation phase + int war_preparation_swarm_warrior_ratio; ///The percentage of total population that should be dedicated to defense explorers, when they are created int defense_explorer_population_percent; ///The number of explorers to produce for attacks @@ -151,29 +151,29 @@ class NicowarStrategy : LoadableFromConfigFile int upgrading_phase_1_inn_chance; ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose an hospital int upgrading_phase_1_hospital_chance; - ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose an racetrack + ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose a racetrack int upgrading_phase_1_racetrack_chance; - ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose an swimmingpool + ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose a swimming pool int upgrading_phase_1_swimmingpool_chance; - ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose an barracks + ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose a barracks int upgrading_phase_1_barracks_chance; - ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose an school + ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose a school int upgrading_phase_1_school_chance; - ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose an tower + ///The random chance that, when selecting the type of level 1 building to upgrade, it will choose a tower int upgrading_phase_1_tower_chance; ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose an inn int upgrading_phase_2_inn_chance; ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose an hospital int upgrading_phase_2_hospital_chance; - ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose an racetrack + ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose a racetrack int upgrading_phase_2_racetrack_chance; - ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose an swimmingpool + ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose a swimming pool int upgrading_phase_2_swimmingpool_chance; - ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose an barracks + ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose a barracks int upgrading_phase_2_barracks_chance; - ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose an school + ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose a school int upgrading_phase_2_school_chance; - ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose an tower + ///The random chance that, when selecting the type of level 2 building to upgrade, it will choose a tower int upgrading_phase_2_tower_chance; ///The number of units to assign to an upgrade for upgrading phase level 1 int upgrading_phase_1_units_assigned; @@ -240,7 +240,7 @@ class NewNicowar : public AIEcho::EchoAI PlacementSize, }; - ///This function is called at the very begginning of the game, + ///This function is called at the very beginning of the game, ///to initialize the existing buildings with the right amount of units void initialize(AIEcho::Echo& echo); @@ -251,14 +251,14 @@ class NewNicowar : public AIEcho::EchoAI ///Swarms become a big priority, so does gaining territory and exploration. bool growth_phase; ///During the skilled work phase, Nicowar tries to better the skills of its workers - ///by building 1 Racetrack, 1 Swimmingpool and 2 Schools + ///by building 1 Racetrack, 1 Swimming pool and 2 Schools bool skilled_work_phase; ///During the upgrading_phase_1 , Nicowar tries to upgrade its level 1 buildings in small numbers. bool upgrading_phase_1; ///During the upgrading_phase_2 , Nicowar tries to upgrade its level 2 buildings in small numbers. bool upgrading_phase_2; - ///During the war preperation phase, warriors are made and barracks are prioritized - bool war_preperation; + ///During the war preparation phase, warriors are made and barracks are prioritized + bool war_preparation; ///During the war phase, the enemies are attacked bool war; ///During the fruit phase, explorers are stationed on fruit trees and Nicowar starts converting @@ -273,8 +273,8 @@ class NewNicowar : public AIEcho::EchoAI ///During this phase, Nicowar tries to construct many explorers, in case its attacked by enemy explorers bool defend_explorers; ///During this phase, Nicowar tries to construct many explorers so that it can launch an attack with them - bool explorer_attack_preperation_phase; - ///During this phase, Nicowar will activily attack its oppenents with explorers + bool explorer_attack_preparation_phase; + ///During this phase, Nicowar will actively attack its opponents with explorers bool explorer_attack_phase; @@ -289,7 +289,7 @@ class NewNicowar : public AIEcho::EchoAI void queue_swarms(AIEcho::Echo& echo); ///This function decides how many racetracks are needed and queues them up. void queue_racetracks(AIEcho::Echo& echo); - ///This function decides how many swimmingpools are needed and queues them up. + ///This function decides how many swimming pools are needed and queues them up. void queue_swimmingpools(AIEcho::Echo& echo); ///This function decides how many schools are needed and queues them up. void queue_schools(AIEcho::Echo& echo); @@ -300,7 +300,7 @@ class NewNicowar : public AIEcho::EchoAI ///This counts how many StarvingRecoveryInn's there are under construction int starving_recovery_inns; - ///This function starts construction on buildings that are queued for construction. Its carefull + ///This function starts construction on buildings that are queued for construction. It's careful ///not to construct too much or too little at once void order_buildings(AIEcho::Echo& echo); ///This function starts construction of a RegularInn, and returns the ID code @@ -322,7 +322,7 @@ class NewNicowar : public AIEcho::EchoAI ///This integer stores the number of buildings being constructed based on their placement id, ///it counts buildings that are queued to be constructed but have not been started yet int buildings_under_construction_per_type[PlacementSize]; - ///This is the queue for buildings that have yet to be proccessed for construction + ///This is the queue for buildings that have yet to be processed for construction std::list placement_queue; ///This is the queue for buildings that are going to be constructed std::list construction_queue; @@ -335,7 +335,7 @@ class NewNicowar : public AIEcho::EchoAI ///of a new Inn and periodically thereafter void manage_inn(AIEcho::Echo& echo, int id); ///This function updated the units assigned and the creation - ///ratios of a particular Swarm. Its done afeter the completion + ///ratios of a particular Swarm. Its done after the completion ///of a new swarm and periodically thereafter void manage_swarm(AIEcho::Echo& echo, int id); @@ -362,8 +362,8 @@ class NewNicowar : public AIEcho::EchoAI void control_attacks(AIEcho::Echo& echo); ///This function chooses the enemy team to target void choose_enemy_target(AIEcho::Echo& echo); - ///This function digs out an enemy building that is surrounded by ressources. - ///It will also cause Nicowar to dig itself out in certain situtation + ///This function digs out an enemy building that is surrounded by resources. + ///It will also cause Nicowar to dig itself out in certain situation ///Returns true if there are buildings that it can dig out, false otherwise bool dig_out_enemy(AIEcho::Echo& echo); @@ -377,7 +377,7 @@ class NewNicowar : public AIEcho::EchoAI ///This function calculates the positions of defense flags void compute_defense_flag_positioning(AIEcho::Echo& echo); - ///This function adds the specific value to the counts arround the given pos, used in compute_defense_flag_positioning + ///This function adds the specific value to the counts around the given pos, used in compute_defense_flag_positioning void modify_points(Uint16* counts, int w, int h, int x, int y, int dist, int value, std::list& locations); ///This vector stores the ID's for all current defense flags std::vector defense_flags; diff --git a/src/AINumbi.cpp b/src/AINumbi.cpp index a14bf2c4..7e73b74e 100644 --- a/src/AINumbi.cpp +++ b/src/AINumbi.cpp @@ -46,8 +46,8 @@ void AINumbi::init(Player *player) phase=0; phaseTime=1024; attackPhase=0; - critticalWarriors=20; - critticalTime=1024; + criticalWarriors=20; + criticalTime=1024; attackTimer=0; for (int i=0; ireadSint32("phase"); attackPhase = stream->readSint32("attackPhase"); phaseTime = stream->readSint32("phaseTime"); - critticalWarriors= stream->readSint32("critticalWarriors"); - critticalTime = stream->readSint32("critticalTime"); + criticalWarriors= stream->readSint32("critticalWarriors"); + criticalTime = stream->readSint32("critticalTime"); attackTimer = stream->readSint32("attackTimer"); for (int bi=0; biwriteSint32(phase, "phase"); stream->writeSint32(attackPhase, "attackPhase"); stream->writeSint32(phaseTime, "phaseTime"); - stream->writeSint32(critticalWarriors, "critticalWarriors"); - stream->writeSint32(critticalTime, "critticalTime"); + stream->writeSint32(criticalWarriors, "critticalWarriors"); + stream->writeSint32(criticalTime, "critticalTime"); stream->writeSint32(attackTimer, "attackTimer"); for (int bi=0; biAINumbi::getOrder(void) case 6: return adjustBuildings(70, 2, 3, IntBuildingType::ATTACK_BUILDING); case 7: - return mayAttack(critticalWarriors, critticalTime, 10); + return mayAttack(criticalWarriors, criticalTime, 10); case 8: return checkoutExpands(40, 5); case 9: @@ -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; @@ -387,11 +387,11 @@ int AINumbi::countUnits(const int medicalState) return 0; } -boost::shared_ptrAINumbi::swarmsForWorkers(const int minSwarmNumbers, const int nbWorkersFator, const int workers, const int explorers, const int warriors) +boost::shared_ptrAINumbi::swarmsForWorkers(const int minSwarmNumbers, const int nbWorkersFactor, const int workers, const int explorers, const int warriors) { std::list swarms=team->swarms; int ss=swarms.size(); - Sint32 numberRequested=1+(nbWorkersFator/(ss+1)); + Sint32 numberRequested=1+(nbWorkersFactor/(ss+1)); int nbu=countUnits(); for (std::list::iterator it=swarms.begin(); it!=swarms.end(); ++it) @@ -410,14 +410,14 @@ boost::shared_ptrAINumbi::swarmsForWorkers(const int minSwarmNumbers, con int f=estimateFood(b); int numberRequestedTemp=numberRequested; - int numberRequestedLoca=b->maxUnitWorking; + int numberRequestedLocal=b->maxUnitWorking; if (f<(nbu*3-1)) numberRequestedTemp=0; - else if (numberRequestedLoca==0) + else if (numberRequestedLocal==0) if (f<(nbu*5+1)) numberRequestedTemp=0; - if (numberRequestedLoca!=numberRequestedTemp) + if (numberRequestedLocal!=numberRequestedTemp) { //printf("AI: (%d) numberRequested changed to (nrt=%d) (nrl=%d)(f=%d) (nbu=%d).\n", b->UID, numberRequestedTemp, numberRequestedLoca, f, nbu); b->maxUnitWorkingLocal=numberRequestedTemp; @@ -472,7 +472,7 @@ void AINumbi::nextMainBuilding(const int buildingType) break; } mainBuilding[buildingType]=Building::GIDtoID(b->gid); - //printf("AI: nextMainBuilding newuid=%d\n", b->UID); + //printf("AI: nextMainBuilding new uid=%d\n", b->UID); } } @@ -617,7 +617,7 @@ bool AINumbi::parseBuildingType(const int buildingType) return (buildingType==IntBuildingType::DEFENSE_BUILDING); } -void AINumbi::squareCircleScann(int &dx, int &dy, int &sx, int &sy, int &x, int &y, int &mx, int &my) +void AINumbi::squareCircleScan(int &dx, int &dy, int &sx, int &sy, int &x, int &y, int &mx, int &my) { if (x>=mx) { @@ -669,7 +669,7 @@ bool AINumbi::findNewEmplacement(const int buildingType, int *posX, int *posY) } if (b==NULL) { - // TODO : scan the units and find a ressoucefull place. + // TODO : scan the units and find a resourceful place. return false; } int typeNum=globalContainer->buildingsTypes.getTypeNum(IntBuildingType::typeFromShortNumber(buildingType), 0, true); @@ -681,12 +681,12 @@ bool AINumbi::findNewEmplacement(const int buildingType, int *posX, int *posY) //printf("AI: findNewEmplacement(%d) valid=(%d), uid=(%d), s=(%d, %d).\n", buildingType, valid, b->UID, width, height); if (valid>299) { - int maxr; + int maxX; if (b->type->shortTypeNum==0) - maxr=64; + maxX=64; else - maxr=16; - //for (int r=0; r<=maxr; r++) + maxX=16; + //for (int r=0; r<=maxR; r++) // for (int d=0; d<8; d++) int dx, dy, sx, sy, px, py, mx, my; @@ -716,7 +716,7 @@ bool AINumbi::findNewEmplacement(const int buildingType, int *posX, int *posY) int bestValid=-1; for (int i=0; i<4096; i++) { - squareCircleScann(dx, dy, sx, sy, px, py, mx, my); + squareCircleScan(dx, dy, sx, sy, px, py, mx, my); //printf("AI:i=%d, d=(%d, %d), s=(%d, %d), p=(%d, %d), m=(%d, %d).\n", i, dx, dy, sx, sy, px, py, mx, my); //int dx, dy; @@ -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); @@ -771,7 +771,7 @@ bool AINumbi::findNewEmplacement(const int buildingType, int *posX, int *posY) return false; } -boost::shared_ptrAINumbi::mayAttack(int critticalMass, int critticalTimeout, Sint32 numberRequested) +boost::shared_ptrAINumbi::mayAttack(int criticalMass, int criticalTimeout, Sint32 numberRequested) { Unit **myUnits=team->myUnits; int ft=0; @@ -781,13 +781,13 @@ boost::shared_ptrAINumbi::mayAttack(int critticalMass, int critticalTimeo if (attackPhase==0) { - if (ft>=critticalMass) + if (ft>=criticalMass) { - //printf("AI:(crittical mass)new attack with %d units.\n", ft); + //printf("AI:(critical mass)new attack with %d units.\n", ft); attackPhase=1; } attackTimer++; - if ((attackTimer>=critticalTimeout)&&(ft>numberRequested)) + if ((attackTimer>=criticalTimeout)&&(ft>numberRequested)) { attackTimer=0; //printf("AI:(timeout)new attack with %d units.\n", ft); @@ -797,7 +797,7 @@ boost::shared_ptrAINumbi::mayAttack(int critticalMass, int critticalTimeo } else if (attackPhase==1) { - if (ft<=(critticalMass/2)) + if (ft<=(criticalMass/2)) { attackPhase=3; //printf("AI:stop attack.\n"); @@ -884,8 +884,8 @@ boost::shared_ptrAINumbi::mayAttack(int critticalMass, int critticalTimeo if ((*bit)->type->shortTypeNum==IntBuildingType::WAR_FLAG) return shared_ptr(new OrderDelete((*bit)->gid)); attackPhase=0; - critticalWarriors*=2; - critticalTime*=2; + criticalWarriors*=2; + criticalTime*=2; return shared_ptr(new NullOrder); } else @@ -970,7 +970,7 @@ boost::shared_ptrAINumbi::checkoutExpands(const int numbers, const int wo return shared_ptr(new NullOrder); } -boost::shared_ptrAINumbi::mayUpgrade(const int ptrigger, const int ntrigger) +boost::shared_ptrAINumbi::mayUpgrade(const int pTrigger, const int nTrigger) { Building **myBuildings=team->myBuildings; int numberFood[4]={0, 0, 0, 0}; // number of food buildings @@ -1080,8 +1080,8 @@ boost::shared_ptrAINumbi::mayUpgrade(const int ptrigger, const int ntrigg // We calculate if we may upgrade to level 1: int potential=wun[1]+wun[2]+wun[3]+4*(numberScience[0]+numberScience[1]+numberScience[2]+numberScience[3]); int now=fun[1]+fun[2]+fun[3]; - //printf("potential=(%d/%d), now=(%d/%d).\n", potential, ptrigger, now, ntrigger); - if ((potential>ptrigger)&&(now>ntrigger)) + //printf("potential=(%d/%d), now=(%d/%d).\n", potential, pTrigger, now, nTrigger); + if ((potential>pTrigger)&&(now>nTrigger)) { if (numberFood[0]>numberUpgradingFood[1]) { @@ -1115,10 +1115,10 @@ boost::shared_ptrAINumbi::mayUpgrade(const int ptrigger, const int ntrigg } } - // We calculate if we may upgrade to leverl 2: + // We calculate if we may upgrade to level 2: potential=wun[2]+wun[3]+4*(numberScience[1]+numberScience[2]+numberScience[3]); now=fun[2]+fun[3]; - if ((potential>ptrigger)&&(now>ntrigger)) + if ((potential>pTrigger)&&(now>nTrigger)) { if (numberFood[1]>numberUpgradingFood[2]) { diff --git a/src/AINumbi.h b/src/AINumbi.h index 84e59f1e..9186e77d 100644 --- a/src/AINumbi.h +++ b/src/AINumbi.h @@ -52,24 +52,24 @@ class AINumbi : public AIImplementation int phase; int attackPhase; int phaseTime; - int critticalWarriors; - int critticalTime; + int criticalWarriors; + int criticalTime; int attackTimer; int mainBuilding[15]; //BuildingType::NB_BUILDING=15 with lover versions void init(Player *player); int estimateFood(Building *building); int countUnits(void); int countUnits(const int medicalState); - boost::shared_ptrswarmsForWorkers(const int minSwarmNumbers, const int nbWorkersFator, const int workers, const int explorers, const int warriors); + boost::shared_ptrswarmsForWorkers(const int minSwarmNumbers, const int nbWorkersFactor, const int workers, const int explorers, const int warriors); void nextMainBuilding(const int buildingType); int nbFreeAround(const int buildingType, int posX, int posY, int width, int height); bool parseBuildingType(const int buildingType); - void squareCircleScann(int &dx, int &dy, int &sx, int &sy, int &x, int &y, int &mx, int &my); + void squareCircleScan(int &dx, int &dy, int &sx, int &sy, int &x, int &y, int &mx, int &my); bool findNewEmplacement(const int buildingType, int *posX, int *posY); - boost::shared_ptrmayAttack(int critticalMass, int critticalTimeout, Sint32 numberRequested); + boost::shared_ptrmayAttack(int criticalMass, int criticalTimeout, Sint32 numberRequested); boost::shared_ptradjustBuildings(const int numbers, const int numbersInc, const int workers, const int buildingType); boost::shared_ptrcheckoutExpands(const int numbers, const int workers); - boost::shared_ptrmayUpgrade(const int ptrigger, const int ntrigger); + boost::shared_ptrmayUpgrade(const int pTrigger, const int nTrigger); }; #endif diff --git a/src/AIWarrush.cpp b/src/AIWarrush.cpp index 2445f589..6425c108 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"; @@ -403,7 +403,7 @@ boost::shared_ptr AIWarrush::getOrder(void) { //This is basically a way to change all the swarms without bothering to remember //anything. (It can only issue one order per tick, so it has to do it over several - //ticks and calculate the orders seperately.) + //ticks and calculate the orders separately.) Building *out_of_date_swarm = getSwarmWithoutSettings(4,1,3); if(out_of_date_swarm) { @@ -440,15 +440,15 @@ boost::shared_ptr AIWarrush::pruneGuardAreas() if(map->isGuardArea(x,y,team->me)) { bool keep = false; - for(int xmod=-1;xmod<=1;xmod++) + for(int xMod=-1;xMod<=1;xMod++) { - for(int ymod=-1;ymod<=1;ymod++) + for(int yMod=-1;yMod<=1;yMod++) { //if there's a building... - if(map->getBuilding(x+xmod,y+ymod)!=NOGBID) + if(map->getBuilding(x+xMod,y+yMod)!=NOGBID) { //...AND it's an enemy building... - if(team->enemies & game->teams[Building::GIDtoTeam(map->getBuilding(x+xmod,y+ymod))]->me) + if(team->enemies & game->teams[Building::GIDtoTeam(map->getBuilding(x+xMod,y+yMod))]->me) { //...then we still want it guarded. keep=true; @@ -465,7 +465,7 @@ boost::shared_ptr AIWarrush::pruneGuardAreas() } if(acc.getApplicationCount()) { - return shared_ptr(new OrderAlterateGuardArea(team->teamNumber,BrushTool::MODE_DEL,&acc,map)); + return shared_ptr(new OrderAlterGuardArea(team->teamNumber,BrushTool::MODE_DEL,&acc,map)); } else return shared_ptr(new NullOrder); } @@ -518,7 +518,7 @@ boost::shared_ptr AIWarrush::placeGuardAreas() if(guard_add_acc.getApplicationCount()) { - return shared_ptr(new OrderAlterateGuardArea(team->teamNumber,BrushTool::MODE_ADD,&guard_add_acc, map)); + return shared_ptr(new OrderAlterGuardArea(team->teamNumber,BrushTool::MODE_ADD,&guard_add_acc, map)); } else return shared_ptr(new NullOrder); } @@ -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,24 +587,24 @@ 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)) { - for(int xmod=-1;xmod<=1;xmod++) + for(int xMod=-1;xMod<=1;xMod++) { - for(int ymod=-1;ymod<=1;ymod++) + for(int yMod=-1;yMod<=1;yMod++) { - if(map->isRessourceTakeable(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))) + 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))) { clr_add_acc.applyBrush(BrushApplication(x, y, 0), map); - goto doublebreak; + goto doubleBreak; } } } - doublebreak: + doubleBreak: /*statement for label to point to*/; } } @@ -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) ) @@ -648,13 +648,13 @@ boost::shared_ptr AIWarrush::farm() } if(del_acc.getApplicationCount()>0) - return shared_ptr(new OrderAlterateForbidden(team->teamNumber, BrushTool::MODE_DEL, &del_acc, map)); + return shared_ptr(new OrderAlterForbidden(team->teamNumber, BrushTool::MODE_DEL, &del_acc, map)); if(add_acc.getApplicationCount()>0) - return shared_ptr(new OrderAlterateForbidden(team->teamNumber, BrushTool::MODE_ADD, &add_acc, map)); + return shared_ptr(new OrderAlterForbidden(team->teamNumber, BrushTool::MODE_ADD, &add_acc, map)); if(clr_del_acc.getApplicationCount()>0) - return shared_ptr(new OrderAlterateClearArea(team->teamNumber, BrushTool::MODE_DEL, &clr_del_acc, map)); + return shared_ptr(new OrderAlterClearArea(team->teamNumber, BrushTool::MODE_DEL, &clr_del_acc, map)); if(clr_add_acc.getApplicationCount()>0) - return shared_ptr(new OrderAlterateClearArea(team->teamNumber, BrushTool::MODE_ADD, &clr_add_acc, map)); + return shared_ptr(new OrderAlterClearArea(team->teamNumber, BrushTool::MODE_ADD, &clr_add_acc, map)); //nothing to do... return shared_ptr(new NullOrder()); @@ -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.cpp b/src/BasePlayer.cpp index 1272aeae..16405bf6 100644 --- a/src/BasePlayer.cpp +++ b/src/BasePlayer.cpp @@ -30,7 +30,7 @@ BasePlayer::BasePlayer() init(); }; -BasePlayer::BasePlayer(Sint32 number, const std::string& nname, Sint32 teamNumber, PlayerType type) +BasePlayer::BasePlayer(Sint32 number, const std::string& name, Sint32 teamNumber, PlayerType type) { init(); @@ -38,12 +38,12 @@ BasePlayer::BasePlayer(Sint32 number, const std::string& nname, Sint32 teamNumbe assert(number=0); assert(teamNumbername=name; this->type=type; }; @@ -120,10 +120,10 @@ Uint32 BasePlayer::checkSum() //Uint32 netHost=SDL_SwapBE32(ip.host); //Uint32 netPort=(Uint32)SDL_SwapBE16(ip.port); //cs^=netHost; - // IP adress can't stay in checksum, because: - // We now support NAT or IP may simply be differents between computers + // IP address can't stay in checksum, because: + // We now support NAT or IP may simply be different between computers // And we uses checkSum in network. - // (we could uses two differents check sums, but the framework would be heavier) + // (we could uses two different check sums, but the framework would be heavier) //cs^=netPort; for (unsigned i=0; i=P_AI); - return (AI::ImplementitionID)((int)type-(int)P_AI); + return (AI::ImplementationID)((int)type-(int)P_AI); } //TODO: Explain - static PlayerType playerTypeFromImplementitionID(AI::ImplementitionID iid) + static PlayerType playerTypeFromImplementationID(AI::ImplementationID iid) { return (PlayerType)((int)iid+(int)P_AI); } @@ -93,10 +93,10 @@ class BasePlayer /** \param number \param name - \param teamn + \param teamNumber \param type */ - BasePlayer(Sint32 number, const std::string& name, Sint32 teamn, PlayerType type); + BasePlayer(Sint32 number, const std::string& name, Sint32 teamNumber, PlayerType type); //TODO: Explain void init(); virtual ~BasePlayer(void); @@ -108,7 +108,7 @@ class BasePlayer Uint32 checkSum(); - virtual void makeItAI(AI::ImplementitionID aiType); + virtual void makeItAI(AI::ImplementationID aiType); //TODO: Explain bool disableRecursiveDestruction; }; diff --git a/src/BaseTeam.cpp b/src/BaseTeam.cpp index a237d33d..c4a164de 100644 --- a/src/BaseTeam.cpp +++ b/src/BaseTeam.cpp @@ -41,7 +41,7 @@ BaseTeam::BaseTeam() bool BaseTeam::load(GAGCore::InputStream *stream, Sint32 versionMinor) { - // loading baseteam + // loading base team stream->readEnterSection("BaseTeam"); type = (TeamType)stream->readUint32("type"); teamNumber = stream->readSint32("teamNumber"); @@ -66,7 +66,7 @@ bool BaseTeam::load(GAGCore::InputStream *stream, Sint32 versionMinor) void BaseTeam::save(GAGCore::OutputStream *stream) const { - // saving baseteam + // saving base team stream->writeEnterSection("BaseTeam"); stream->writeUint32((Uint32)type, "type"); stream->writeSint32(teamNumber, "teamNumber"); diff --git a/src/BaseTeam.h b/src/BaseTeam.h index ac3aad3e..12cdba32 100644 --- a/src/BaseTeam.h +++ b/src/BaseTeam.h @@ -45,7 +45,7 @@ class BaseTeam TeamType type; Sint32 teamNumber; // index of the current team in the game::teams[] array. - Sint32 numberOfPlayer; // number of controling players + Sint32 numberOfPlayer; // number of controlling players GAGCore::Color color; Uint32 playersMask; diff --git a/src/BitArray.h b/src/BitArray.h index f795aee4..eb24f9e5 100644 --- a/src/BitArray.h +++ b/src/BitArray.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __BITARRAY_H -#define __BITARRAY_H +#ifndef __BIT_ARRAY_H +#define __BIT_ARRAY_H #include diff --git a/src/Brush.cpp b/src/Brush.cpp index 757994fe..775012f6 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); } } @@ -70,21 +70,21 @@ void BrushTool::handleClick(int x, int y) -void BrushTool::drawBrush(int x, int y, int viewportX, int viewportY, int originalX, int originalY, bool onlines) +void BrushTool::drawBrush(int x, int y, int viewportX, int viewportY, int originalX, int originalY, bool onLines) { /* We use 2/3 intensity to indicate removing areas. This was formerly 78% intensity, which was bright enough that it was hard to notice any difference, so the brightness has been lowered. */ int i = ((mode == MODE_ADD) ? 255 : 170); - drawBrush(x, y, Color(i,i,i), viewportX, viewportY, originalX, originalY, onlines); + drawBrush(x, y, Color(i,i,i), viewportX, viewportY, originalX, originalY, onLines); } -void BrushTool::drawBrush(int x, int y, GAGCore::Color c, int viewportX, int viewportY, int originalX, int originalY, bool onlines) +void BrushTool::drawBrush(int x, int y, GAGCore::Color c, int viewportX, int viewportY, int originalX, int originalY, bool onLines) { /* It violates good abstraction practices that Brush.cpp knows this much about the visual layout of the GUI. */ - x = ((x+(onlines ? 16 : 0)) & ~0x1f) + (!onlines ? 16 : 0); - y = ((y+(onlines ? 16 : 0)) & ~0x1f) + (!onlines ? 16 : 0); + x = ((x+(onLines ? 16 : 0)) & ~0x1f) + (!onLines ? 16 : 0); + y = ((y+(onLines ? 16 : 0)) & ~0x1f) + (!onLines ? 16 : 0); int w = getBrushWidth(figure); int h = getBrushHeight(figure); /* Move x and y from center of focus point to upper left of @@ -96,18 +96,18 @@ void BrushTool::drawBrush(int x, int y, GAGCore::Color c, int viewportX, int vie if(originalX == -1) originalX = viewportX + (x / cell_size); - else if(onlines) + else if(onLines) originalX+=1; if(originalY == -1) originalY = viewportY + (y / cell_size); - else if(onlines) + else if(onLines) originalY+=1; for (int cx = 0; cx < w; cx++) { for (int cy = 0; cy < h; cy++) { - // TODO: the brush is wrong, but without lookuping viewport in game gui, there is no way to know this + // TODO: the brush is wrong, but without looking up viewport in game gui, there is no way to know this if (getBrushValue(figure, cx, cy, viewportX + (x / cell_size), viewportY + (y / cell_size), originalX, originalY)) { globalContainer->gfx->drawRect(x + (cell_size * cx) + inset, y + (cell_size * cy) + inset, cell_size - inset, cell_size - inset, c); diff --git a/src/Brush.h b/src/Brush.h index 2dc9c770..1f48e60e 100644 --- a/src/Brush.h +++ b/src/Brush.h @@ -71,8 +71,8 @@ class BrushTool void defaultSelection(void) { mode = MODE_ADD; } //! Draw the actual brush (not the brush tool) - void drawBrush(int x, int y, int viewportX, int viewportY, int originalX=-1, int originalY=-1, bool onlines=false); - void drawBrush(int x, int y, GAGCore::Color c, int viewportX, int viewportY, int originalX=-1, int originalY=-1, bool onlines=false); + void drawBrush(int x, int y, int viewportX, int viewportY, int originalX=-1, int originalY=-1, bool onLines=false); + void drawBrush(int x, int y, GAGCore::Color c, int viewportX, int viewportY, int originalX=-1, int originalY=-1, bool onLines=false); //! Return the mode of the brush unsigned getType(void) { return static_cast(mode); } //! Set the mode of the brush diff --git a/src/Building.cpp b/src/Building.cpp index 8e3919f6..f5bb0847 100644 --- a/src/Building.cpp +++ b/src/Building.cpp @@ -41,7 +41,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); @@ -94,25 +94,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; @@ -127,10 +127,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; @@ -148,14 +148,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; @@ -185,17 +185,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; } } @@ -248,27 +248,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"); @@ -299,7 +299,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; @@ -369,22 +369,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"); @@ -507,7 +507,7 @@ void Building::saveCrossRef(GAGCore::OutputStream *stream) stream->writeSint32(maxUnitInside, "maxUnitInside"); //TODO: std::list::size() is O(n). We should investigate //if our intense use of this has an impact on overall performance. - //steph and nuage suggested to store and update size in a variable + //Stephane and nuage suggested to store and update size in a variable //what is faster but also more error prone. stream->writeUint32(unitsWorking.size(), "nbWorking"); fprintf(logFile, " nbWorking=%zd\n", unitsWorking.size()); @@ -563,28 +563,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; } @@ -665,7 +665,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) { @@ -761,8 +761,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; @@ -842,8 +842,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 @@ -898,7 +898,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) { @@ -983,11 +983,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; @@ -996,8 +996,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 @@ -1063,13 +1063,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(); @@ -1080,13 +1080,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; @@ -1101,7 +1101,7 @@ void Building::updateUnitsWorking(void) { minDistSquare=newDistSquare; fu=(*it); - ittemp=it; + itTemp=it; } } } @@ -1116,7 +1116,7 @@ void Building::updateUnitsWorking(void) { maxDistSquare=newDistSquare; fu=(*it); - ittemp=it; + itTemp=it; } } @@ -1126,7 +1126,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; @@ -1155,7 +1155,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); } @@ -1164,7 +1164,7 @@ void Building::updateUnitsHarvesting(void) void Building::update(void) { - computeWishedRessources(); + computeWishedResources(); if (buildingState==DEAD) return; desiredMaxUnitWorking = desiredNumberOfWorkers(); @@ -1189,7 +1189,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; @@ -1199,7 +1199,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) @@ -1207,7 +1207,7 @@ void Building::getRessourceCountToRepair(int ressources[BASIC_COUNT]) fTotErr-=65536; iVal++; } - ressources[i]=repairBt->maxRessource[i]-iVal; + resources[i]=repairBt->maxResource[i]-iVal; } } @@ -1245,9 +1245,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) @@ -1255,7 +1255,7 @@ bool Building::tryToBuildingSiteRoom(void) fTotErr-=65536; iVal++; } - ressources[i]=iVal; + resources[i]=iVal; } } @@ -1271,24 +1271,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; } } @@ -1309,14 +1309,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; @@ -1395,19 +1395,19 @@ bool Building::isHardSpaceForBuildingSite(void) bool Building::isHardSpaceForBuildingSite(ConstructionResultState constructionResultState) { - int tltn=-1; + int futureBuildingTypeId=-1; if (constructionResultState==UPGRADE) - tltn=type->nextLevel; + futureBuildingTypeId=type->nextLevel; else if (constructionResultState==REPAIR) - tltn=type->prevLevel; + futureBuildingTypeId=type->prevLevel; else assert(false); - if (tltn==-1) + if (futureBuildingTypeId==-1) return true; - BuildingType *bt=globalContainer->buildingsTypes.get(tltn); - int x=posX+bt->decLeft-type->decLeft; - int y=posY+bt->decTop -type->decTop ; + BuildingType *bt=globalContainer->buildingsTypes.get(futureBuildingTypeId); + int x=posX + bt->decLeft - type->decLeft; + int y=posY + bt->decTop - type->decTop ; int w=bt->width; int h=bt->height; @@ -1418,7 +1418,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); @@ -1428,29 +1428,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) @@ -1461,7 +1461,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; @@ -1512,11 +1512,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; @@ -1528,9 +1528,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); @@ -1584,7 +1584,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)) { @@ -1596,12 +1596,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 { @@ -1613,9 +1613,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); @@ -1700,7 +1700,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]; @@ -1734,8 +1734,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]; @@ -1832,11 +1832,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; } @@ -1848,14 +1848,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; @@ -1882,7 +1882,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; @@ -1907,11 +1907,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; @@ -1979,7 +1979,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) @@ -2021,7 +2021,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; @@ -2053,19 +2053,19 @@ 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 + // we need to be stone-fed updateCallLists(); } // compute cooldown if (shootingCooldown > 0) { - shootingCooldown -= type->shootRythme; + shootingCooldown -= type->shootRhythm; return; } @@ -2085,16 +2085,16 @@ void Building::turretStep(Uint32 stepCounter) assert(map); // the type of target we have found - enum TargetType + enum class TargetType { - TARGETTYPE_NONE, - TARGETTYPE_BUILDING, - TARGETTYPE_WORKER, - TARGETTYPE_WARRIOR, - TARGETTYPE_EXPLORER, + NONE, + BUILDING, + WORKER, + WARRIOR, + EXPLORER, }; // The type of the best target we have found up to now - TargetType targetFound = TARGETTYPE_NONE; + TargetType targetFound = TargetType::NONE; // The score of the best target we have found up to now int bestScore = INT_MIN; // The number of ticks before the unit may move away @@ -2171,20 +2171,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) { @@ -2192,10 +2192,10 @@ void Building::turretStep(Uint32 stepCounter) bestTicks = targetTicks; bestTargetX = targetX; bestTargetY = targetY; - targetFound = TARGETTYPE_WARRIOR; + targetFound = TargetType::WARRIOR; } } - else if ((targetFound != TARGETTYPE_WARRIOR) && (testUnit->typeNum == WORKER)) + else if ((targetFound != TargetType::WARRIOR) && (testUnit->typeNum == WORKER)) { // adjust score for range int targetScore = - testUnit->hp; @@ -2206,7 +2206,7 @@ void Building::turretStep(Uint32 stepCounter) bestTicks = targetTicks; bestTargetX = targetX; bestTargetY = targetY; - targetFound = TARGETTYPE_WORKER; + targetFound = TargetType::WORKER; } } } @@ -2238,14 +2238,14 @@ void Building::turretStep(Uint32 stepCounter) bestTicks = targetTicks; bestTargetX = targetX; bestTargetY = targetY; - targetFound = TARGETTYPE_EXPLORER; + targetFound = TargetType::EXPLORER; } } } } // shoot building only if no unit is found - if (targetFound == TARGETTYPE_NONE) + if (targetFound == TargetType::NONE) { Uint16 targetGBID = map->getBuilding(targetX, targetY); if (targetGBID != NOGBID) @@ -2263,18 +2263,18 @@ void Building::turretStep(Uint32 stepCounter) bestTicks = 256; bestTargetX = targetX; bestTargetY = targetY; - targetFound = TARGETTYPE_BUILDING; + targetFound = TargetType::BUILDING; } } } } } } - if (targetFound == TARGETTYPE_EXPLORER) + if (targetFound == TargetType::EXPLORER) break;//specifying explorers as high priority } - if (targetFound != TARGETTYPE_NONE) + if (targetFound != TargetType::NONE) { shootingStep = 0; @@ -2305,7 +2305,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)); @@ -2342,9 +2342,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(); @@ -2410,7 +2410,7 @@ void Building::kill(void) { bool good=false; for (int r=0; r0) + if (resources[r]>0) { good=true; break; @@ -2495,25 +2495,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: @@ -2528,10 +2528,11 @@ 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]; + assert(totResources>0); + hp += type->hpMax/totResources; hp = std::min(hp, type->hpMax); } break; @@ -2544,10 +2545,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(); } @@ -2629,7 +2630,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) { @@ -2704,16 +2705,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; } @@ -2740,7 +2741,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 8ef22a4d..56d4dc1d 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,32 +165,32 @@ 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 + ///the function desiredNumberOfWorkers. public:void step(void); - ///This function subscribes any building that needs ressources carried to it with units. - ///It is considered greedy, hiring as many units as it needs in order of its preference + ///This function subscribes any building that needs resources carried to it by units. + ///It is considered greedy, hiring as many units as it needs in the order of its preference. ///Returns true if a unit was hired - bool subscribeToBringRessourcesStep(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 + bool subscribeToBringResourcesStep(void); + ///This function subscribes any flag that needs units. + ///It is considered greedy, hiring as many units as it needs in the order of its preference. ///Returns true if a unit was hired bool subscribeForFlagingStep(); /// Subscribes a unit to go inside the building. void subscribeUnitForInside(Unit* unit); - /// This is a step for swarms. Swarms heal themselves and create new units + /// This is a step for swarms. Swarms heal themselves and create new units. void swarmStep(void); - /// This function searches for enemies, computes the best target, and fires a bullet + /// 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 + /// changing the state and adding it to the list of buildings to be deleted. void kill(void); /// Tells whether a particular unit can work at this building. Takes into account this buildings level, @@ -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 13c8b68a..0b1f09f9 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"); @@ -172,7 +172,7 @@ void BuildingType::loadFromConfigFile(const ConfigBlock *configBlock) } } -//! Return a chcksum of all parameter that could lead to a game desynchronization +//! Return a checksum of all parameter that could lead to a game desynchronization Uint32 BuildingType::checkSum(void) { Uint32 cs = 0; @@ -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 0c701584..d3d00671 100644 --- a/src/BuildingType.h +++ b/src/BuildingType.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __BULDING_TYPE_H -#define __BULDING_TYPE_H +#ifndef __BUILDING_TYPE_H +#define __BUILDING_TYPE_H #include @@ -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 81726ee6..1e04c177 100644 --- a/src/BuildingsTypes.cpp +++ b/src/BuildingsTypes.cpp @@ -41,15 +41,15 @@ void BuildingsTypes::checkIntegrity(void) BuildingType *bt = entries[i]; assert(bt); - //Need ressource integrity: - bool needRessource=false; - for (unsigned j=0; jmaxRessource[j]) + //Need resource integrity: + bool needResource=false; + for (unsigned j=0; jmaxResource[j]) { - needRessource=true; + needResource=true; break; } - if (needRessource) + if (needResource) assert(bt->fillable || bt->foodable); //hpInc integrity: @@ -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/BuildingsTypes.h b/src/BuildingsTypes.h index 0c38a09a..7eea84bc 100644 --- a/src/BuildingsTypes.h +++ b/src/BuildingsTypes.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __BULDING_TYPES_H -#define __BULDING_TYPES_H +#ifndef __BUILDING_TYPES_H +#define __BUILDING_TYPES_H #include "BuildingType.h" diff --git a/src/Campaign.cpp b/src/Campaign.cpp index f58711af..06ce8437 100644 --- a/src/Campaign.cpp +++ b/src/Campaign.cpp @@ -100,9 +100,9 @@ bool CampaignMapEntry::isCompleted() -void CampaignMapEntry::setCompleted(bool ncompleted) +void CampaignMapEntry::setCompleted(bool completed) { - completed = ncompleted; + this->completed = completed; } @@ -114,9 +114,9 @@ const std::string& CampaignMapEntry::getDescription() const -void CampaignMapEntry::setDescription(const std::string& ndescription) +void CampaignMapEntry::setDescription(const std::string& description) { - description=ndescription; + this->description=description; } @@ -321,9 +321,9 @@ const std::string& Campaign::getPlayerName() const } -void Campaign::setDescription(const std::string& ndescription) +void Campaign::setDescription(const std::string& description) { - description = ndescription; + this->description = description; } diff --git a/src/CampaignEditor.cpp b/src/CampaignEditor.cpp index 8d910689..23cb8fee 100644 --- a/src/CampaignEditor.cpp +++ b/src/CampaignEditor.cpp @@ -33,9 +33,9 @@ CampaignEditor::CampaignEditor(const std::string& name) StringTable& table=*Toolkit::getStringTable(); title = new Text(0, 18, ALIGN_FILL, ALIGN_SCREEN_CENTERED, "menu", table.getString("[campaign editor]")); mapList = new List(10, 50, 300, 300, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard"); - addMap = new TextButton(10, 360, 145, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[add map]"), ADDMAP); - editMap = new TextButton(165, 360, 145, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[edit map]"), EDITMAP); - removeMap = new TextButton(10, 410, 145, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[remove map]"), REMOVEMAP); + addMap = new TextButton(10, 360, 145, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[add map]"), ADD_MAP); + editMap = new TextButton(165, 360, 145, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[edit map]"), EDIT_MAP); + removeMap = new TextButton(10, 410, 145, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[remove map]"), REMOVE_MAP); nameEditor = new TextInput(320, 60, 310, 25, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", campaign.getName()); ok = new TextButton(260, 430, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[ok]"), OK); cancel = new TextButton(450, 430, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", table.getString("[Cancel]"), CANCEL); @@ -71,31 +71,31 @@ void CampaignEditor::onAction(Widget *source, Action action, int par1, int par2) else if (source == addMap) { ChooseMapScreen cms("campaigns", "map", false); - int rcms=cms.execute(gfx, 40); - if(rcms==ChooseMapScreen::OK) + int rCms=cms.execute(gfx, 40); + if(rCms==ChooseMapScreen::OK) { MapHeader& mapHeader = cms.getMapHeader(); CampaignMapEntry cme(mapHeader.getMapName(), glob2NameToFilename("campaigns", mapHeader.getMapName(), "map")); - CampaignMapEntryEditor cmee(campaign, cme); - int rcmee = cmee.execute(gfx, 40); - if(rcmee==CampaignMapEntryEditor::OK) + CampaignMapEntryEditor mee(campaign, cme); + int rMee = mee.execute(gfx, 40); + if(rMee==CampaignMapEntryEditor::OK) { campaign.appendMap(cme); mapList->addText(mapHeader.getMapName()); } - else if(rcmee==CampaignMapEntryEditor::CANCEL) + else if(rMee==CampaignMapEntryEditor::CANCEL) { } - else if(rcmee == -1) + else if(rMee == -1) { endExecute(-1); } } - else if(rcms==ChooseMapScreen::CANCEL) + else if(rCms==ChooseMapScreen::CANCEL) { } - else if(rcms==-1) + else if(rCms==-1) { endExecute(-1); } @@ -106,13 +106,13 @@ void CampaignEditor::onAction(Widget *source, Action action, int par1, int par2) { if(mapList->getSelectionIndex()!=-1 && campaign.getMap(i).getMapName()==mapList->get()) { - CampaignMapEntryEditor cmee(campaign, campaign.getMap(i)); - int rcmee = cmee.execute(gfx, 40); - if(rcmee==CampaignMapEntryEditor::OK) + CampaignMapEntryEditor mee(campaign, campaign.getMap(i)); + int rMee = mee.execute(gfx, 40); + if(rMee==CampaignMapEntryEditor::OK) { mapList->setText(mapList->getSelectionIndex(), campaign.getMap(i).getMapName()); } - else if(rcmee==CampaignMapEntryEditor::CANCEL) + else if(rMee==CampaignMapEntryEditor::CANCEL) { } } diff --git a/src/CampaignEditor.h b/src/CampaignEditor.h index 23724828..c6cd4f68 100644 --- a/src/CampaignEditor.h +++ b/src/CampaignEditor.h @@ -35,9 +35,9 @@ class CampaignEditor : public Glob2Screen void onAction(Widget *source, Action action, int par1, int par2); enum { - ADDMAP, - EDITMAP, - REMOVEMAP, + ADD_MAP, + EDIT_MAP, + REMOVE_MAP, OK, CANCEL, }; @@ -55,7 +55,7 @@ class CampaignEditor : public Glob2Screen Button* addMap; /// Opens the map editor screen and edits the selected map Button* editMap; - /// Remvoes the map from the list of maps + /// Removes the map from the list of maps Button* removeMap; /// Text editor changes the name of the campaign TextInput* nameEditor; diff --git a/src/CampaignMainMenu.cpp b/src/CampaignMainMenu.cpp index f27cd8d1..40b49189 100644 --- a/src/CampaignMainMenu.cpp +++ b/src/CampaignMainMenu.cpp @@ -27,9 +27,9 @@ CampaignMainMenu::CampaignMainMenu() { - newCampaign = new TextButton(0, 70, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[start new campaign]"), NEWCAMPAIGN); + newCampaign = new TextButton(0, 70, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[start new campaign]"), NEW_CAMPAIGN); addWidget(newCampaign); - loadCampaign = new TextButton(0, 130, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[load campaign]"), LOADCAMPAIGN, 13); + loadCampaign = new TextButton(0, 130, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[load campaign]"), LOAD_CAMPAIGN, 13); addWidget(loadCampaign); cancel = new TextButton(0, 415, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[goto main menu]"), CANCEL, 27); addWidget(cancel); @@ -40,7 +40,7 @@ void CampaignMainMenu::onAction(Widget *source, Action action, int par1, int par { if ((action==BUTTON_RELEASED) || (action==BUTTON_SHORTCUT)) { - if ((par1==LOADCAMPAIGN)) + if ((par1==LOAD_CAMPAIGN)) { CampaignSelectorScreen css(true); int rc_css=css.execute(globalContainer->gfx, 40); @@ -64,7 +64,7 @@ void CampaignMainMenu::onAction(Widget *source, Action action, int par1, int par endExecute(-1); } } - else if((par1==NEWCAMPAIGN)) + else if((par1==NEW_CAMPAIGN)) { CampaignSelectorScreen css; int rc_css=css.execute(globalContainer->gfx, 40); diff --git a/src/CampaignMainMenu.h b/src/CampaignMainMenu.h index a10a959b..5f841cc9 100644 --- a/src/CampaignMainMenu.h +++ b/src/CampaignMainMenu.h @@ -30,8 +30,8 @@ class CampaignMainMenu : public Glob2Screen void onAction(Widget *source, Action action, int par1, int par2); enum { - NEWCAMPAIGN, - LOADCAMPAIGN, + NEW_CAMPAIGN, + LOAD_CAMPAIGN, CANCEL, }; private: diff --git a/src/CampaignMenuScreen.h b/src/CampaignMenuScreen.h index 9ee04ad4..27269560 100644 --- a/src/CampaignMenuScreen.h +++ b/src/CampaignMenuScreen.h @@ -47,9 +47,9 @@ class CampaignMenuScreen : public Glob2Screen /// Title of the screen Text* title; - /// The exit to menuscreen button + /// The exit to menu screen button Button* exit; - /// The "start mission" buttion + /// The "start mission" button Button* startMission; /// The box where the players name is put diff --git a/src/CampaignSelectorScreen.cpp b/src/CampaignSelectorScreen.cpp index 8c3e792c..11219a84 100644 --- a/src/CampaignSelectorScreen.cpp +++ b/src/CampaignSelectorScreen.cpp @@ -63,9 +63,9 @@ void CampaignSelectorScreen::onAction(Widget *source, Action action, int par1, i { if (fileList->getSelectionIndex()!=-1) { - Campaign toload; - toload.load(getCampaignName()); - description->setText(Toolkit::getStringTable()->getString(toload.getDescription())); + Campaign toLoad; + toLoad.load(getCampaignName()); + description->setText(Toolkit::getStringTable()->getString(toLoad.getDescription())); } else { diff --git a/src/ChooseMapScreen.cpp b/src/ChooseMapScreen.cpp index e028d3c8..de15205d 100644 --- a/src/ChooseMapScreen.cpp +++ b/src/ChooseMapScreen.cpp @@ -62,8 +62,8 @@ ChooseMapScreen::ChooseMapScreen(const char *directory, const char *extension, b type2 = REPLAY; title = new Text(0, 18, ALIGN_FILL, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[choose game]")); - //deleteMap = new TextButton(225, 380, 200, 20, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", Toolkit::getStringTable()->getString("[Delete game]"), DELETEGAME); - deleteMap = new TextButton(250, 360, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[delete]"), DELETEGAME); + //deleteMap = new TextButton(225, 380, 200, 20, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", Toolkit::getStringTable()->getString("[Delete game]"), DELETE_GAME); + deleteMap = new TextButton(250, 360, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[delete]"), DELETE_GAME); addWidget(deleteMap); } else @@ -96,7 +96,7 @@ ChooseMapScreen::ChooseMapScreen(const char *directory, const char *extension, b else if (type2 == REPLAY) alternativeTypeName = Toolkit::getStringTable()->getString("[the replays]"); else assert(false); - switchType = new TextButton(250, 420, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", alternativeTypeName.c_str(), SWITCHTYPE, 27); + switchType = new TextButton(250, 420, 180, 40, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", alternativeTypeName.c_str(), SWITCH_TYPE, 27); addWidget(switchType); alternateFileList = new Glob2FileList(20, 60, 180, 400, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", alternateDirectory, alternateExtension, alternateRecurse); @@ -167,7 +167,7 @@ void ChooseMapScreen::onAction(Widget *source, Action action, int par1, int par2 catch (std::exception &e) { // Show error message - GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONEBUTTON, Toolkit::getStringTable()->getString("[ERROR_CANT_LOAD_MAP]"), Toolkit::getStringTable()->getString("[ok]")); + GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONE_BUTTON, Toolkit::getStringTable()->getString("[ERROR_CANT_LOAD_MAP]"), Toolkit::getStringTable()->getString("[ok]")); validMapSelected = false; } @@ -274,15 +274,15 @@ 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 - validMapSelectedhandler(); + validMapSelectedHandler(); } diff --git a/src/ChooseMapScreen.h b/src/ChooseMapScreen.h index 129051b8..19242e10 100644 --- a/src/ChooseMapScreen.h +++ b/src/ChooseMapScreen.h @@ -42,7 +42,7 @@ class ChooseMapScreen : public Glob2Screen public: /// Constructor. Directory is the source of the listed files. /// extension is the file extension to show. If recurse is true, - /// subdirectoried are shown and can be opened. + /// subdirectories are shown and can be opened. ChooseMapScreen(const char *directory, const char *extension, bool recurse, const char* alternateDirectory=NULL, const char* alternateExtension=NULL, const bool alternateRecurse=false); //! Destructor virtual ~ChooseMapScreen(); @@ -62,9 +62,9 @@ class ChooseMapScreen : public Glob2Screen //! Value returned upon screen execution completion when the map/game selection is canceled CANCEL = 2, //! Value returned if screen is for games and delete button has been pressed - DELETEGAME = 3, + DELETE_GAME = 3, //! Value returned if screen if the button to switch between games and maps has been pressed - SWITCHTYPE = 4, + SWITCH_TYPE = 4, }; enum LoadableType @@ -81,7 +81,7 @@ class ChooseMapScreen : public Glob2Screen protected: /// Handle called when a valid map has been selected. /// This is to be overwritten by the derived class. - virtual void validMapSelectedhandler(void) { } + virtual void validMapSelectedHandler(void) { } /// The map header of the currently selected map MapHeader mapHeader; diff --git a/src/CreditScreen.cpp b/src/CreditScreen.cpp index b1ef3e42..2af3d914 100644 --- a/src/CreditScreen.cpp +++ b/src/CreditScreen.cpp @@ -35,8 +35,8 @@ using namespace GAGCore; // New class for an auto-scrolling credit screen. // INCLUDE part -// #ifndef __SCROLLINGTEXT_H -// #define __SCROLLINGTEXT_H +// #ifndef __SCROLLING_TEXT_H +// #define __SCROLLING_TEXT_H // // #include "GUIBase.h" // #include @@ -47,9 +47,9 @@ class ScrollingText:public RectangularWidget std::string filename; std::string font; std::vector text; - std::vector xPos; // Pre-calculated postions for text centering + std::vector xPos; // Pre-calculated positions for text centering int offset; - int imgid, imgid0; + int imgId, imgId0; // cache, recomputed on internalInit GAGCore::Font *fontPtr; @@ -79,8 +79,8 @@ ScrollingText::ScrollingText(int x, int y, int w, int h, Uint32 hAlign, Uint32 v this->vAlignFlag = vAlign; offset = 0; - imgid = 0; - imgid0 = 88; + imgId = 0; + imgId0 = 88; assert(font.size()); assert(filename.size()); @@ -112,7 +112,7 @@ void ScrollingText::internalInit(void) getScreenPos(&x, &y, &w, &h); offset = -h + 25; - // Measures all the length of all the lines of the file (usefull for centering) + // Measures all the length of all the lines of the file (useful for centering) for (size_t i = 0; i < text.size(); i++) { std::string &s = text[i]; @@ -124,7 +124,7 @@ void ScrollingText::internalInit(void) // If we can find a "<" and a ">" in this line if ((f != std::string::npos) && (l != std::string::npos)) { - // Rips off the e-mail adresses + // Rips off the e-mail addresses s.erase(f, l-f+1); } } @@ -141,7 +141,7 @@ void ScrollingText::paint() assert(parent->getSurface()); int yPos = y; - imgid = imgid0 + (offset & 0x7); + imgId = imgId0 + (offset & 0x7); for (size_t i = 0; i < text.size(); i++) { @@ -159,9 +159,9 @@ void ScrollingText::paint() Sprite *unitSprite=globalContainer->units; unitSprite->setBaseColor(128, 128, 128); - int decX = (unitSprite->getW(imgid)-32)>>1; - int decY = (unitSprite->getH(imgid)-32)>>1; - globalContainer->gfx->drawSprite(px-decX, py-decY, unitSprite, imgid); + int decX = (unitSprite->getW(imgId)-32)>>1; + int decY = (unitSprite->getH(imgId)-32)>>1; + globalContainer->gfx->drawSprite(px-decX, py-decY, unitSprite, imgId); yPos += 20; } diff --git a/src/CustomGameOtherOptions.cpp b/src/CustomGameOtherOptions.cpp index f8e80414..c8d35461 100644 --- a/src/CustomGameOtherOptions.cpp +++ b/src/CustomGameOtherOptions.cpp @@ -77,7 +77,7 @@ CustomGameOtherOptions::CustomGameOtherOptions(GameHeader& gameHeader, MapHeader addWidget(allyTeamNumbers[i]); } - teamsFixed = new OnOffButton(300, 60, 21, 21, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, gameHeader.areAllyTeamsFixed(), TEAMSFIXED); + teamsFixed = new OnOffButton(300, 60, 21, 21, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, gameHeader.areAllyTeamsFixed(), TEAMS_FIXED); addWidget(teamsFixed); teamsFixedText = new Text(325, 60, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", Toolkit::getStringTable()->getString("[Teams Fixed]")); addWidget(teamsFixedText); @@ -85,7 +85,7 @@ CustomGameOtherOptions::CustomGameOtherOptions(GameHeader& gameHeader, MapHeader teamsFixed->setClickable(false); //These are for winning conditions - prestigeWinEnabled = new OnOffButton(300, 90, 21, 21, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, true, PRESTIGEWINENABLED); + prestigeWinEnabled = new OnOffButton(300, 90, 21, 21, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, true, PRESTIGE_WIN_ENABLED); addWidget(prestigeWinEnabled); prestigeWinEnabledText = new Text(325, 90, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", Toolkit::getStringTable()->getString("[Prestige Win Enabled]")); addWidget(prestigeWinEnabledText); @@ -94,7 +94,7 @@ CustomGameOtherOptions::CustomGameOtherOptions(GameHeader& gameHeader, MapHeader prestigeWinEnabled->setClickable(false); //Map discovered. - mapDiscovered = new OnOffButton(300, 120, 21, 21, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, gameHeader.isMapDiscovered(), MAPDISCOVERED); + mapDiscovered = new OnOffButton(300, 120, 21, 21, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, gameHeader.isMapDiscovered(), MAP_DISCOVERED); addWidget(mapDiscovered); mapDiscoveredText = new Text(325, 120, ALIGN_SCREEN_CENTERED, ALIGN_SCREEN_CENTERED, "standard", Toolkit::getStringTable()->getString("[Map Discovered]")); addWidget(mapDiscoveredText); @@ -152,15 +152,15 @@ void CustomGameOtherOptions::onAction(Widget *source, Action action, int par1, i } gameHeader.setAllyTeamNumber(team, n); } - else if(par1 == TEAMSFIXED) + else if(par1 == TEAMS_FIXED) { gameHeader.setAllyTeamsFixed(teamsFixed->getState()); } - else if(par1 == PRESTIGEWINENABLED) + else if(par1 == PRESTIGE_WIN_ENABLED) { updateGameHeaderWinningConditions(); } - else if(par1 == MAPDISCOVERED) + else if(par1 == MAP_DISCOVERED) { gameHeader.setMapDiscovered(mapDiscovered->getState()); } diff --git a/src/CustomGameOtherOptions.h b/src/CustomGameOtherOptions.h index 53b29639..57590384 100644 --- a/src/CustomGameOtherOptions.h +++ b/src/CustomGameOtherOptions.h @@ -47,7 +47,7 @@ class CustomGameOtherOptions : public Glob2Screen CustomGameOtherOptions(GameHeader& gameHeader, MapHeader& mapHeader, bool readOnly); /// Destructor virtual ~CustomGameOtherOptions(); - ///Recieves an action from a widget + ///Receives an action from a widget virtual void onAction(Widget *source, Action action, int par1, int par2); ///These are the end values for this screen @@ -62,9 +62,9 @@ class CustomGameOtherOptions : public Glob2Screen { OK, CANCEL, - TEAMSFIXED, - PRESTIGEWINENABLED, - MAPDISCOVERED, + TEAMS_FIXED, + PRESTIGE_WIN_ENABLED, + MAP_DISCOVERED, }; ///"Other Options" Title @@ -78,7 +78,7 @@ class CustomGameOtherOptions : public Glob2Screen Text ** playerNames; //! Player colors ColorButton ** color; - //! Player ally temas + //! Player ally teams MultiTextButton ** allyTeamNumbers; ///Button fixing teams during the match diff --git a/src/CustomGameScreen.cpp b/src/CustomGameScreen.cpp index a1db372c..792779b1 100644 --- a/src/CustomGameScreen.cpp +++ b/src/CustomGameScreen.cpp @@ -81,7 +81,7 @@ CustomGameScreen::~CustomGameScreen() -void CustomGameScreen::validMapSelectedhandler(void) +void CustomGameScreen::validMapSelectedHandler(void) { int i; // set the correct number of colors @@ -182,9 +182,9 @@ bool CustomGameScreen::isActive(int i) -AI::ImplementitionID CustomGameScreen::getAiImplementation(int i) +AI::ImplementationID CustomGameScreen::getAiImplementation(int i) { - return (AI::ImplementitionID)aiSelector[i]->getIndex(); + return (AI::ImplementationID)aiSelector[i]->getIndex(); } @@ -213,10 +213,10 @@ void CustomGameScreen::updatePlayers() } else { - AI::ImplementitionID iid=getAiImplementation(i); - FormatableString name("%0 %1"); + AI::ImplementationID iid=getAiImplementation(i); + FormattableString name("%0 %1"); name.arg(AINames::getAIText(iid)).arg(i-1); - gameHeader.getBasePlayer(count) = BasePlayer(i, name.c_str(), teamColor, Player::playerTypeFromImplementitionID(iid)); + gameHeader.getBasePlayer(count) = BasePlayer(i, name.c_str(), teamColor, Player::playerTypeFromImplementationID(iid)); if(teamColor != humanColor) gameHeader.setAllyTeamNumber(teamColor, 2); } diff --git a/src/CustomGameScreen.h b/src/CustomGameScreen.h index b4ef8ea3..563006f1 100644 --- a/src/CustomGameScreen.h +++ b/src/CustomGameScreen.h @@ -39,7 +39,7 @@ class MapPreview; const int NumberOfPlayerSelectors=12; -//! This screen is used to setup a custom game. AI can be set. Map choosing functionnalities are inherited from ChooseMapScreen +//! This screen is used to setup a custom game. AI can be set. Map choosing functionalities are inherited from ChooseMapScreen class CustomGameScreen : public ChooseMapScreen { @@ -49,11 +49,11 @@ class CustomGameScreen : public ChooseMapScreen //! Destructor virtual ~CustomGameScreen(); virtual void onAction(Widget *source, Action action, int par1, int par2); - virtual void validMapSelectedhandler(void); + virtual void validMapSelectedHandler(void); //! Returns true if AI i is enabled bool isActive(int i); //! Returns the implementation of AI i. If AI is disabled, result is undefined - AI::ImplementitionID getAiImplementation(int i); + AI::ImplementationID getAiImplementation(int i); //! Returns the color of AI i. If AI is disabled, result is undefined int getSelectedColor(int i); diff --git a/src/DynamicClouds.cpp b/src/DynamicClouds.cpp index 4a81092b..ceab55df 100644 --- a/src/DynamicClouds.cpp +++ b/src/DynamicClouds.cpp @@ -28,11 +28,11 @@ #define INT_ROUND_RSHIFT(x,places) ( ((x)+(1<<((places)-1))) >> (places) ) -void DynamicClouds::compute(const int viewPortX, const int viewPortY, const int viewPortWdth, const int viewPortHeight, const int time) +void DynamicClouds::compute(const int viewPortX, const int viewPortY, const int viewPortWidth, const int viewPortHeight, const int time) { - if (globalContainer->gfx->getOptionFlags() & GraphicContext::USEGPU) + if (globalContainer->gfx->getOptionFlags() & GraphicContext::USE_GPU) { - //tribute to the torrodial world: the viewport must never jump by more than 31. + //tribute to the toroidal world: the viewport must never jump by more than 31. //if it does, we assume a jump in the opposite direction static int vpX=0; static int vpY=0; @@ -47,7 +47,7 @@ void DynamicClouds::compute(const int viewPortX, const int viewPortY, const int vpX += (viewPortX-vpX%64+96)%64-32; vpY += (viewPortY-vpY%64+96)%64-32; - wGrid=viewPortWdth/granularity+1; + wGrid=viewPortWidth/granularity+1; hGrid=viewPortHeight/granularity+1; alphaMap.resize(wGrid*hGrid); @@ -76,7 +76,7 @@ void DynamicClouds::compute(const int viewPortX, const int viewPortY, const int void DynamicClouds::render(DrawableSurface *dest, const int viewPortWidth, const int viewPortHeight, DynamicClouds::Layer layer) { - if (globalContainer->gfx->getOptionFlags() & GraphicContext::USEGPU) + if (globalContainer->gfx->getOptionFlags() & GraphicContext::USE_GPU) { Color c; int offsetX, offsetY, gran; @@ -97,7 +97,7 @@ void DynamicClouds::render(DrawableSurface *dest, const int viewPortWidth, const assert(false); } //magnify cloud map by cloud height in white (clouds) - //TODO: (int)(cloudheight*granularity) might round unexpectedly for + //TODO: (int)(cloudHeight*granularity) might round unexpectedly for //low granularity resulting in unpainted areas/unscaled clouds. dest->drawAlphaMap(alphaMap, wGrid, hGrid, diff --git a/src/DynamicClouds.h b/src/DynamicClouds.h index a884198d..a06032a9 100644 --- a/src/DynamicClouds.h +++ b/src/DynamicClouds.h @@ -21,8 +21,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _DYNAMICCLOUDS_H -#define _DYNAMICCLOUDS_H +#ifndef __DYNAMIC_CLOUDS_H +#define __DYNAMIC_CLOUDS_H #include "PerlinNoise.h" #include "Settings.h" @@ -107,8 +107,8 @@ class DynamicClouds * @param h height of the alphaMap * @param time time */ - void compute(const int viewPortX, const int viewPortY, const int viewPortWdth, const int viewPortHeght, const int time); + void compute(const int viewPortX, const int viewPortY, const int viewPortWidth, const int viewPortHeight, const int time); void render(DrawableSurface *dest, const int viewPortWidth, const int viewPortHeight, Layer layer); }; -#endif /* _DYNAMICCLOUDS_H */ +#endif /* __DYNAMIC_CLOUDS_H */ diff --git a/src/EditorMainMenu.cpp b/src/EditorMainMenu.cpp index d808f43e..47cf8b4f 100644 --- a/src/EditorMainMenu.cpp +++ b/src/EditorMainMenu.cpp @@ -39,10 +39,10 @@ using namespace GAGGUI; EditorMainMenu::EditorMainMenu() { - addWidget(new TextButton(0, 70, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[new map]"), NEWMAP, 13)); - addWidget(new TextButton(0, 130, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[load map]"), LOADMAP)); - addWidget(new TextButton(0, 190, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[new campaign]"), NEWCAMPAIGN)); - addWidget(new TextButton(0, 250, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[load campaign]"), LOADCAMPAIGN)); + addWidget(new TextButton(0, 70, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[new map]"), NEW_MAP, 13)); + addWidget(new TextButton(0, 130, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[load map]"), LOAD_MAP)); + addWidget(new TextButton(0, 190, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[new campaign]"), NEW_CAMPAIGN)); + addWidget(new TextButton(0, 250, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[load campaign]"), LOAD_CAMPAIGN)); addWidget(new TextButton(0, 415, 300, 40, ALIGN_CENTERED, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[goto main menu]"), CANCEL, 27)); addWidget(new Text(0, 18, ALIGN_FILL, ALIGN_SCREEN_CENTERED, "menu", Toolkit::getStringTable()->getString("[editor]"))); } @@ -51,7 +51,7 @@ void EditorMainMenu::onAction(Widget *source, Action action, int par1, int par2) { if ((action==BUTTON_RELEASED) || (action==BUTTON_SHORTCUT)) { - if (par1==NEWMAP) + if (par1==NEW_MAP) { bool retryNewMapScreen=true; while (retryNewMapScreen) @@ -65,7 +65,7 @@ void EditorMainMenu::onAction(Widget *source, Action action, int par1, int par2) setRandomSyncRandSeed(); if (generator.generateMap(mapEdit.game, newMapScreen.descriptor)) { - mapEdit.mapHasBeenModiffied(); // make all map as modified by default + mapEdit.mapHasBeenModified(); // make all map as modified by default mapEdit.regenerateGameHeader(); if (mapEdit.run()==-1) endExecute(-1); @@ -88,7 +88,7 @@ void EditorMainMenu::onAction(Widget *source, Action action, int par1, int par2) } } } - else if (par1==LOADMAP) + else if (par1==LOAD_MAP) { ChooseMapScreen chooseMapScreen("maps", "map", false, "games", "game", NULL); int rc=chooseMapScreen.execute(globalContainer->gfx, 40); @@ -103,7 +103,7 @@ void EditorMainMenu::onAction(Widget *source, Action action, int par1, int par2) else if (rc==-1) endExecute(-1); } - else if (par1==NEWCAMPAIGN) + else if (par1==NEW_CAMPAIGN) { CampaignEditor ce(""); int rc=ce.execute(globalContainer->gfx, 40); @@ -111,7 +111,7 @@ void EditorMainMenu::onAction(Widget *source, Action action, int par1, int par2) endExecute(-1); } - else if (par1==LOADCAMPAIGN) + else if (par1==LOAD_CAMPAIGN) { CampaignSelectorScreen css; int rc_css=css.execute(globalContainer->gfx, 40); diff --git a/src/EditorMainMenu.h b/src/EditorMainMenu.h index 04a67d0e..029ce333 100644 --- a/src/EditorMainMenu.h +++ b/src/EditorMainMenu.h @@ -34,11 +34,11 @@ class EditorMainMenu : public Glob2Screen public: enum { - NEWMAP = 1, - LOADMAP = 2, + NEW_MAP = 1, + LOAD_MAP = 2, CANCEL = 3, - NEWCAMPAIGN = 4, - LOADCAMPAIGN = 5, + NEW_CAMPAIGN = 4, + LOAD_CAMPAIGN = 5, }; public: diff --git a/src/EndGameScreen.cpp b/src/EndGameScreen.cpp index be825cdd..e0e7f5ad 100644 --- a/src/EndGameScreen.cpp +++ b/src/EndGameScreen.cpp @@ -91,15 +91,15 @@ void EndGameStat::paint(void) for (pos=0; posteams[team]->stats.endOfGameStats.size(); pos++) maxValue = std::max(maxValue, game->teams[team]->stats.endOfGameStats[pos].value[type]); - ///You can't draw anything if the game ended so quickly that there wheren't two recorded values to draw a line between + ///You can't draw anything if the game ended so quickly that there weren't two recorded values to draw a line between if(game->teams[0]->stats.endOfGameStats.size() >= 2) { //Calculate the number of digits used by the max value when rounded up to the nearest 10 int num=10; maxValue+=num-(maxValue%num); - std::stringstream maxstr; - maxstr<getSurface()->drawHorzLine(x+e_width-5, y+pos, 10, 255, 255, 255); @@ -140,10 +140,10 @@ void EndGameStat::paint(void) } ///Draw vertical lines to give the timescale - double time_line_seperate=double(e_width)/double(15); + double time_line_separation=double(e_width)/double(15); for(int n=1; n<16; ++n) { - int pos = int(double(x)+time_line_seperate*double(n)+0.5); + int pos = int(double(x)+time_line_separation*double(n)+0.5); int time = (time_period * n) / 15; if(n!=15) parent->getSurface()->drawVertLine(pos, y+e_height-5, 10, 255, 255, 255); @@ -201,12 +201,12 @@ void EndGameStat::paint(void) // Draw labels std::string label = Toolkit::getStringTable()->getString("[time]"); - int textwidth = globalContainer->standardFont->getStringWidth(label.c_str()); - parent->getSurface()->drawString(x - textwidth/2 + e_width/2, y+e_height-20, globalContainer->standardFont, label); + int textWidth = globalContainer->standardFont->getStringWidth(label.c_str()); + parent->getSurface()->drawString(x - textWidth/2 + e_width/2, y+e_height-20, globalContainer->standardFont, label); label = getStatLabel(); - textwidth = globalContainer->standardFont->getStringWidth(label.c_str()); - parent->getSurface()->drawString(x + e_width - textwidth - 4, y + e_height/2, globalContainer->standardFont, label); + textWidth = globalContainer->standardFont->getStringWidth(label.c_str()); + parent->getSurface()->drawString(x + e_width - textWidth - 4, y + e_height/2, globalContainer->standardFont, label); } else { @@ -355,7 +355,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 @@ -543,9 +543,9 @@ void EndGameScreen::sortAndSet(EndOfGameStat::Type type) } } -std::string replayFilenameToName(const std::string& fullfilename) +std::string replayFilenameToName(const std::string& fullFilename) { - std::string filename = fullfilename; + std::string filename = fullFilename; filename.erase(0, 8); filename.erase(filename.find(".replay")); std::replace(filename.begin(), filename.end(), '_', ' '); @@ -577,8 +577,8 @@ void EndGameScreen::saveReplay(const char *dir, const char *ext) globalContainer->gfx->drawSurface(0, 0, background); globalContainer->gfx->drawSurface(loadSaveScreen->decX, loadSaveScreen->decY, loadSaveScreen->getSurface()); globalContainer->gfx->nextFrame(); - Uint64 ntime = SDL_GetTicks64(); - SDL_Delay(std::max(0, 40ll - static_cast(ntime) + static_cast(time))); + Uint64 newTime = SDL_GetTicks64(); + SDL_Delay(std::max(0, 40ll - static_cast(newTime) + static_cast(time))); } if (loadSaveScreen->endValue==0) diff --git a/src/Engine.cpp b/src/Engine.cpp index 6e22bfdf..44089e8d 100644 --- a/src/Engine.cpp +++ b/src/Engine.cpp @@ -136,7 +136,7 @@ int Engine::initCustom(const std::string &gameName) MapHeader mapHeader = loadMapHeader(gameName); GameHeader gameHeader = loadGameHeader(gameName); - // If the game is a network saved game, we need to toogle net players to ai players: + // If the game is a network saved game, we need to toggle net players to ai players: for (int p=0; p 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); @@ -285,9 +285,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 { @@ -394,7 +394,7 @@ int Engine::run(void) // we get and push ai orders, if they are needed for this frame for (int i=0; iai && !net->orderRecieved(i)) + if (gui.game.players[i]->ai && !net->orderReceived(i)) { shared_ptr order=gui.game.players[i]->ai->getOrder(gui.gamePaused); net->pushOrder(order, i, true); @@ -417,7 +417,7 @@ int Engine::run(void) } // We proceed network: - networkReadyToExecute=net->allOrdersRecieved(); + networkReadyToExecute=net->allOrdersReceived(); if(networkReadyToExecute) @@ -514,10 +514,10 @@ int Engine::run(void) // if required, save videoshot if (!(globalContainer->videoshotName.empty()) && - !(globalContainer->gfx->getOptionFlags() & GraphicContext::USEGPU) + !(globalContainer->gfx->getOptionFlags() & GraphicContext::USE_GPU) ) { - 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()); } @@ -749,7 +749,7 @@ int Engine::initGame(MapHeader& mapHeader, GameHeader& gameHeader, bool setGameH if (!globalContainer->runNoX) { // Display an error message - GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONEBUTTON, Toolkit::getStringTable()->getString("[ERROR_CANT_LOAD_MAP]"), Toolkit::getStringTable()->getString("[ok]")); + GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONE_BUTTON, Toolkit::getStringTable()->getString("[ERROR_CANT_LOAD_MAP]"), Toolkit::getStringTable()->getString("[ok]")); } return EE_CANT_LOAD_MAP; } @@ -758,7 +758,7 @@ int Engine::initGame(MapHeader& mapHeader, GameHeader& gameHeader, bool setGameH gui.game.clearingUncontrolledTeams(); // We do some cosmetic fix - finalAdjustements(); + finalAdjustments(); // we create the net game net=new NetEngine(gui.game.gameHeader.getNumberOfPlayers(), gui.localPlayer); @@ -792,13 +792,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; @@ -880,10 +880,10 @@ GameHeader Engine::createRandomGame(int numberOfTeams) } else { - AI::ImplementitionID iid=static_cast(syncRand() % 5 + 1); - FormatableString name("%0 %1"); + AI::ImplementationID iid=static_cast(syncRand() % 5 + 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)); + gameHeader.getBasePlayer(count) = BasePlayer(i, name.c_str(), teamColor, Player::playerTypeFromImplementationID(iid)); } gameHeader.setAllyTeamNumber(teamColor, teamColor); count+=1; @@ -914,7 +914,7 @@ int Engine::loadReplay(const std::string &fileName) if (!globalContainer->runNoX) { // Display an error message - GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONEBUTTON, Toolkit::getStringTable()->getString("[ERROR_CANT_LOAD_MAP]"), Toolkit::getStringTable()->getString("[ok]")); + GAGGUI::MessageBox(globalContainer->gfx, "standard", GAGGUI::MB_ONE_BUTTON, Toolkit::getStringTable()->getString("[ERROR_CANT_LOAD_MAP]"), Toolkit::getStringTable()->getString("[ok]")); } delete globalContainer->replayReader; @@ -944,7 +944,7 @@ int Engine::loadReplay(const std::string &fileName) return EE_NO_ERROR; } -void Engine::finalAdjustements(void) +void Engine::finalAdjustments(void) { gui.adjustLocalTeam(); if (!globalContainer->runNoX) diff --git a/src/Engine.h b/src/Engine.h index b958d2cc..de96aca4 100644 --- a/src/Engine.h +++ b/src/Engine.h @@ -57,13 +57,13 @@ class Engine /// is a lone map that runs with campaign semantics int initCampaign(const std::string &mapName); - /// Displays the CustomMap dialogue, and initiates a game from the settings it recieves + /// Displays the CustomMap dialogue, and initiates a game from the settings it receives int initCustom(); /// Initiate a custom game from the provided game, without adjusting settings from the user int initCustom(const std::string &gameName); - /// Show the load/save dialoge, and use initCustom(gameName) to load the game + /// Show the load/save dialog, and use initCustom(gameName) to load the game int initLoadGame(); /// Initiate a game with the given MultiplayerGame @@ -117,8 +117,8 @@ class Engine //! Load a game. Return true on success bool loadGame(const std::string &filename); - //! Do the final adjustements, like setting local teams and viewport, rendering minimap - void finalAdjustements(void); + //! Do the final adjustments, like setting local teams and viewport, rendering minimap + void finalAdjustments(void); ///This function will choose a random map from the available maps MapHeader chooseRandomMap(); @@ -130,7 +130,7 @@ class Engine GameGUI gui; //! The netGame, take care of order queuing and dispatching NetEngine *net; - //! The MultiplayerGame, recieves orders from across a network + //! The MultiplayerGame, receives orders from across a network shared_ptr multiplayer; CPUStatisticsManager cpuStats; diff --git a/src/Fatal.cpp b/src/Fatal.cpp index f1348357..24b3f863 100644 --- a/src/Fatal.cpp +++ b/src/Fatal.cpp @@ -101,7 +101,7 @@ void installCrashHandler(void) void installCrashHandler(void) { - printf("DBG : No crash support on this plateform\n"); + printf("DBG : No crash support on this platform\n"); } void printTrace(void) diff --git a/src/FertilityCalculatorDialog.h b/src/FertilityCalculatorDialog.h index 41831b6b..d2eb280e 100644 --- a/src/FertilityCalculatorDialog.h +++ b/src/FertilityCalculatorDialog.h @@ -44,7 +44,7 @@ class FertilityCalculatorDialog:public GAGGUI::OverlayScreen ///This screen is modal, this executes it void execute(); private: - ///This proccesses an incoming event from the fertility calculator thread + ///This processes an incoming event from the fertility calculator thread void proccessIncoming(GAGCore::DrawableSurface *background); Map& map; diff --git a/src/FertilityCalculatorThread.cpp b/src/FertilityCalculatorThread.cpp index 5e62cc4d..d50c5d1a 100644 --- a/src/FertilityCalculatorThread.cpp +++ b/src/FertilityCalculatorThread.cpp @@ -31,8 +31,8 @@ FertilityCalculatorThread::FertilityCalculatorThread(Map& map, std::queue message); - ///Computes the ressources gradient - void computeRessourcesGradient(); + ///Computes the resources gradient + void computeResourcesGradient(); ///Updates the percent complete void updatePercentComplete(float percent); @@ -72,7 +72,7 @@ class FertilityCalculatorThread std::vector fertility; std::vector gradient; - Uint16 fertilitymax; + Uint16 fertilityMax; Map& map; }; diff --git a/src/GUIGlob2FileList.h b/src/GUIGlob2FileList.h index f2e25219..7dfa0782 100644 --- a/src/GUIGlob2FileList.h +++ b/src/GUIGlob2FileList.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIGLOB2FILELIST_H -#define __GUIGLOB2FILELIST_H +#ifndef __GUI_GLOB2_FILE_LIST_H +#define __GUI_GLOB2_FILE_LIST_H #include using namespace GAGGUI; diff --git a/src/GUIMapPreview.cpp b/src/GUIMapPreview.cpp index 0faa158b..21da155a 100644 --- a/src/GUIMapPreview.cpp +++ b/src/GUIMapPreview.cpp @@ -64,7 +64,7 @@ MapPreview::~MapPreview() -std::string MapPreview::getMethode(void) +std::string MapPreview::getMethod(void) { return Toolkit::getStringTable()->getString("[handmade map]"); } @@ -87,17 +87,17 @@ void MapPreview::setMapThumbnail(const std::string& mapName) -void MapPreview::setMapThumbnail(const MapThumbnail &nthumbnail) +void MapPreview::setMapThumbnail(const MapThumbnail &thumbnail) { - thumbnail = nthumbnail; + this->thumbnail = thumbnail; if(surface) { delete surface; } - if(thumbnail.isLoaded()) + if(this->thumbnail.isLoaded()) { surface = new DrawableSurface(128, 128); - thumbnail.loadIntoSurface(surface); + this->thumbnail.loadIntoSurface(surface); } else { diff --git a/src/GUIMapPreview.h b/src/GUIMapPreview.h index 48caf927..1b21ae66 100644 --- a/src/GUIMapPreview.h +++ b/src/GUIMapPreview.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GUIMAPPREVIEW_H -#define __GUIMAPPREVIEW_H +#ifndef __GUI_MAP_PREVIEW_H +#define __GUI_MAP_PREVIEW_H #include #include "MapGenerationDescriptor.h" @@ -36,15 +36,15 @@ using namespace GAGCore; //! Widget to preview map /*! This widget is used to preview map. - Each time setMapThmubnail is called a map htumbnail is loaded. + Each time setMapThumbnail is called a map thumbnail is loaded. A map thumbnail is a little image generated by the map editor. */ class MapPreview: public RectangularWidget { public: - //! Constructor, takes position, alignement and initial map name + //! Constructor, takes position, alignment and initial map name MapPreview(int x, int y, Uint32 hAlign, Uint32 vAlign); - //! Constructor, takes position, alignement, initial map name and a tooltip + //! Constructor, takes position, alignment, initial map name and a tooltip MapPreview(int x, int y, Uint32 hAlign, Uint32 vAlign, const std::string &tooltip, const std::string &tooltipFont); //! Destructor virtual ~MapPreview(); @@ -57,8 +57,8 @@ class MapPreview: public RectangularWidget int getLastWidth(void) { return thumbnail.getMapWidth(); } //! Returns last map height int getLastHeight(void) { return thumbnail.getMapHeight(); } - std::string getMethode(void); - //! Returns true if the thumbnail is laoded, false otherwise + std::string getMethod(void); + //! Returns true if the thumbnail is loaded, false otherwise bool isThumbnailLoaded(); protected: diff --git a/src/Game.cpp b/src/Game.cpp index df3dab5a..f3d9bf4b 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -61,13 +61,13 @@ #include "ReplayWriter.h" -#define BULLET_IMGID 0 +#define BULLET_IMG_ID 0 -#define MIN_MAX_PRESIGE 500 +#define MIN_MAX_PRESTIGE 500 #define TEAM_MAX_PRESTIGE 150 Game::Game(GameGUI *gui, MapEdit* edit): - mapscript(gui) + mapScript(gui) { logFile = globalContainer->logFileManager->getFile("Game.log"); @@ -177,7 +177,7 @@ void Game::setMapHeader(const MapHeader& newMapHeader) { mapHeader = newMapHeader; - // set the base team, for now the number is corect but we should check that further + // set the base team, for now the number is correct but we should check that further for (int i=0; isetBaseTeam(&newMapHeader.getBaseTeam(i)); } @@ -279,7 +279,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) for (int x=posX; xteamNumber == players[localPlayer]->teamNumber) map.localForbiddenMap.set(index, true); } @@ -320,12 +320,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->receiveResourceMask; + b->sendResourceMask=ome->sendResourceMask; if (order->sender!=localPlayer) { - b->receiveRessourceMaskLocal=b->receiveRessourceMask; - b->sendRessourceMaskLocal=b->sendRessourceMask; + b->receiveResourceMaskLocal=b->receiveResourceMask; + b->sendResourceMaskLocal=b->sendResourceMask; } b->update(); } @@ -368,10 +368,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; } } } @@ -382,8 +382,8 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { if (!isPlayerAlive) break; - boost::shared_ptr omcf=boost::static_pointer_cast(order); - Uint16 gid=omcf->gid; + boost::shared_ptr oMcf=boost::static_pointer_cast(order); + Uint16 gid=oMcf->gid; int team=Building::GIDtoTeam(gid); int id=Building::GIDtoID(gid); Building *b=teams[team]->myBuildings[id]; @@ -393,9 +393,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->clearingResources, sizeof(bool)*BASIC_COUNT); if (order->sender!=localPlayer) - memcpy(b->clearingRessourcesLocal, omcf->clearingRessources, sizeof(bool)*BASIC_COUNT); + memcpy(b->clearingResourcesLocal, oMcf->clearingResources, sizeof(bool)*BASIC_COUNT); } } break; @@ -403,9 +403,9 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) { if (!isPlayerAlive) break; - boost::shared_ptr omwf=boost::static_pointer_cast(order); - int team=Building::GIDtoTeam(omwf->gid); - int id=Building::GIDtoID(omwf->gid); + boost::shared_ptr oMwf=boost::static_pointer_cast(order); + int team=Building::GIDtoTeam(oMwf->gid); + int id=Building::GIDtoID(oMwf->gid); Building *b=teams[team]->myBuildings[id]; if (b && b->buildingState==Building::ALIVE @@ -413,7 +413,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) && (b->type->zonable[WARRIOR] || b->type->zonable[EXPLORER])) { fprintf(logFile, "ORDER_MODIFY_MIN_LEVEL_TO_FLAG"); - b->minLevelToFlag = omwf->minLevelToFlag; + b->minLevelToFlag = oMwf->minLevelToFlag; // if it was another player, update local if (order->sender != localPlayer) b->minLevelToFlagLocal = b->minLevelToFlag; @@ -465,10 +465,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; } } } @@ -481,10 +481,10 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) } } break; - case ORDER_ALTERATE_FORBIDDEN: + case ORDER_ALTER_FORBIDDEN: { - fprintf(logFile, "ORDER_ALTERATE_FORBIDDEN"); - boost::shared_ptr oaa = boost::static_pointer_cast(order); + fprintf(logFile, "ORDER_ALTER_FORBIDDEN"); + boost::shared_ptr oaa = boost::static_pointer_cast(order); if (oaa->type == BrushTool::MODE_ADD) { Uint32 teamMask = Team::teamNumberToMask(oaa->teamNumber); @@ -496,7 +496,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); @@ -515,7 +515,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); @@ -523,7 +523,7 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) orderMaskIndex++; } - // We remove, so we need to refresh the gradients, unfortunatly + // We remove, so we need to refresh the gradients, unfortunately teams[oaa->teamNumber]->dirtyGlobalGradient(); map.dirtyLocalGradient(oaa->centerX+oaa->minX-16, oaa->centerY+oaa->minY-16, oaa->maxX-oaa->minX+32, oaa->maxY-oaa->minY+32, oaa->teamNumber); } @@ -534,10 +534,10 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) map.updateClearAreasGradient(oaa->teamNumber); } break; - case ORDER_ALTERATE_GUARD_AREA: + case ORDER_ALTER_GUARD_AREA: { - fprintf(logFile, "ORDER_ALTERATE_GUARD_AREA"); - boost::shared_ptr oaa = boost::static_pointer_cast(order); + fprintf(logFile, "ORDER_ALTER_GUARD_AREA"); + boost::shared_ptr oaa = boost::static_pointer_cast(order); if (oaa->type == BrushTool::MODE_ADD) { Uint32 teamMask = Team::teamNumberToMask(oaa->teamNumber); @@ -549,7 +549,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); @@ -568,7 +568,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); @@ -581,10 +581,10 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) map.updateGuardAreasGradient(oaa->teamNumber); } break; - case ORDER_ALTERATE_CLEAR_AREA: + case ORDER_ALTER_CLEAR_AREA: { - fprintf(logFile, "ORDER_ALTERATE_CLEAR_AREA"); - boost::shared_ptr oaa = boost::static_pointer_cast(order); + fprintf(logFile, "ORDER_ALTER_CLEAR_AREA"); + boost::shared_ptr oaa = boost::static_pointer_cast(order); if (oaa->type == BrushTool::MODE_ADD) { Uint32 teamMask = Team::teamNumberToMask(oaa->teamNumber); @@ -596,7 +596,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); @@ -615,7 +615,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); @@ -747,14 +747,14 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) break; case ORDER_PLAYER_QUIT_GAME: { - boost::shared_ptr pqgo=boost::static_pointer_cast(order); + boost::shared_ptr pqgO=boost::static_pointer_cast(order); bool found = false; for(int i=0; iplayer && players[i]) + if(i!=pqgO->player && players[i]) { - if(players[i]->teamNumber == players[pqgo->player]->teamNumber) + if(players[i]->teamNumber == players[pqgO->player]->teamNumber) { found = true; } @@ -762,11 +762,11 @@ void Game::executeOrder(boost::shared_ptr order, int localPlayer) } if(! found) { - teams[players[pqgo->player]->teamNumber]->isAlive = false; + teams[players[pqgO->player]->teamNumber]->isAlive = false; } - players[pqgo->player]->makeItAI(AI::NONE); - gameHeader.getBasePlayer(pqgo->player).makeItAI(AI::NONE); + players[pqgO->player]->makeItAI(AI::NONE); + gameHeader.getBasePlayer(pqgO->player).makeItAI(AI::NONE); fprintf(logFile, "ORDER_PLAYER_QUIT_GAME"); } break; @@ -841,7 +841,7 @@ bool Game::load(GAGCore::InputStream *stream) stream->read(signature, 4, "signatureStart"); if (memcmp(signature,"GaBe", 4)!=0) { - fprintf(logFile, "Signature missmatch at Game::load begin\n"); + fprintf(logFile, "Signature mismatch at Game::load begin\n"); stream->readLeaveSection(); return false; } @@ -859,7 +859,7 @@ bool Game::load(GAGCore::InputStream *stream) stream->read(signature, 4, "signatureAfterSyncRand"); if (memcmp(signature,"GaSy", 4)!=0) { - fprintf(logFile, "Signature missmatch after Game::load sync rand\n"); + fprintf(logFile, "Signature mismatch after Game::load sync rand\n"); stream->readLeaveSection(); return false; } @@ -869,7 +869,7 @@ bool Game::load(GAGCore::InputStream *stream) stream->read(signature, 4, "signatureBeforeTeams"); if (memcmp(signature,"GaBt", 4)!=0) { - fprintf(logFile, "Signature missmatch before Game::load teams \n"); + fprintf(logFile, "Signature mismatch before Game::load teams \n"); stream->readLeaveSection(); return false; } @@ -888,7 +888,7 @@ bool Game::load(GAGCore::InputStream *stream) stream->read(signature, 4, "signatureAfterTeams"); if (memcmp(signature,"GaTe", 4)!=0) { - fprintf(logFile, "Signature missmatch after Game::load teams\n"); + fprintf(logFile, "Signature mismatch after Game::load teams\n"); stream->readLeaveSection(); return false; } @@ -896,7 +896,7 @@ bool Game::load(GAGCore::InputStream *stream) // Load the map. Team has to be saved and loaded first. if(!map.load(stream, mapHeader, this)) { - fprintf(logFile, "Signature missmatch in map\n"); + fprintf(logFile, "Signature mismatch in map\n"); stream->readLeaveSection(); return false; } @@ -904,7 +904,7 @@ bool Game::load(GAGCore::InputStream *stream) stream->read(signature, 4, "signatureAfterMap"); if (memcmp(signature,"GaMa", 4)!=0) { - fprintf(logFile, "Signature missmatch after map\n"); + fprintf(logFile, "Signature mismatch after map\n"); stream->readLeaveSection(); return false; } @@ -922,7 +922,7 @@ bool Game::load(GAGCore::InputStream *stream) stream->read(signature, 4, "signatureAfterPlayers"); if (memcmp(signature,"GaPl", 4)!=0) { - fprintf(logFile, "Signature missmatch after players\n"); + fprintf(logFile, "Signature mismatch after players\n"); stream->readLeaveSection(); return false; } @@ -947,7 +947,7 @@ bool Game::load(GAGCore::InputStream *stream) if(versionMinor >= 82) { // This is the new map script system - mapscript.decodeData(stream, mapHeader.getVersionMinor()); + mapScript.decodeData(stream, mapHeader.getVersionMinor()); } ///Load the campaign text for the game. @@ -955,7 +955,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) { @@ -1018,14 +1018,14 @@ bool Game::checkBuildingsDoNotOverlapAndHealMissing() { checkInvariant(buildings[index]==NOGBID); buildings[index] = gid; // heal missing cells - if (map.getCase(xi, yi).building != gid) + if (map.getTile(xi, yi).building != gid) { std::cerr << "Missing map cell GBID at " << xi << "," << yi << " for team " << ti << " building " << bi << " (" << building->type->type << "), healing!" << std::endl; - map.getCase(xi, yi).building = gid; + map.getTile(xi, yi).building = gid; } } } @@ -1046,7 +1046,7 @@ bool Game::integrity(void) for (int y=0; ypos ## coordH << ":" << buildingEnd ## coordH << "[, healing!" \ << std::endl; \ - map.getCase(x, y).building = NOGBID; \ + map.getTile(x, y).building = NOGBID; \ } const auto buildingEndX = building->posX + building->type->width; @@ -1164,7 +1164,7 @@ void Game::save(GAGCore::OutputStream *stream, bool fileIsAMap, const std::strin sgslScript.save(stream, this); // This is the new map script system - mapscript.encodeData(stream); + mapScript.encodeData(stream); ///Save game objectives objectives.encodeData(stream); @@ -1214,7 +1214,7 @@ void Game::buildProjectSyncStep(Sint32 localTeam) { size_t index=(x&map.wMask)+(((y&map.hMask)< >& conditions = gameHeader.getWinningConditions(); @@ -1281,7 +1281,7 @@ void Game::scriptSyncStep() { // do a script step sgslScript.syncStep(gui); - mapscript.syncStep(gui); + mapScript.syncStep(gui); } @@ -1427,7 +1427,7 @@ void Game::addTeam(int pos) for (int i=0; isetCorrectColor( ((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(); @@ -1526,7 +1526,7 @@ Unit *Game::addUnit(int x, int y, int team, Sint32 typeNum, int level, int delta if (id==-1) return NULL; - //ok, now we can safely deposite an unit. + //ok, now we can safely deposit an unit. int gid=Unit::GIDfrom(id, team); if (fly) map.setAirUnit(x, y, gid); @@ -1560,7 +1560,7 @@ Building *Game::addBuilding(int x, int y, int typeNum, int teamNumber, Sint32 un return NULL; } - //ok, now we can safely deposite an building. + //ok, now we can safely deposit an building. int gid=Building::GIDfrom(id, teamNumber); int w=globalContainer->buildingsTypes.get(typeNum)->width; @@ -1583,11 +1583,11 @@ bool Game::removeUnitAndBuildingAndFlags(int x, int y, unsigned flags) bool found=false; if (flags & DEL_GROUND_UNIT) { - Uint16 gauid=map.getAirUnit(x, y); - if (gauid!=NOGUID) + Uint16 gauId=map.getAirUnit(x, y); + if (gauId!=NOGUID) { - int id=Unit::GIDtoID(gauid); - int team=Unit::GIDtoTeam(gauid); + int id=Unit::GIDtoID(gauId); + int team=Unit::GIDtoTeam(gauId); map.setAirUnit(x, y, NOGUID); delete (teams[team]->myUnits[id]); teams[team]->myUnits[id]=NULL; @@ -1596,11 +1596,11 @@ bool Game::removeUnitAndBuildingAndFlags(int x, int y, unsigned flags) } if (flags & DEL_AIR_UNIT) { - Uint16 gguid=map.getGroundUnit(x, y); - if (gguid!=NOGUID) + Uint16 gguId=map.getGroundUnit(x, y); + if (gguId!=NOGUID) { - int id=Unit::GIDtoID(gguid); - int team=Unit::GIDtoTeam(gguid); + int id=Unit::GIDtoID(gguId); + int team=Unit::GIDtoTeam(gguId); map.setGroundUnit(x, y, NOGUID); delete (teams[team]->myUnits[id]); teams[team]->myUnits[id]=NULL; @@ -1609,11 +1609,11 @@ bool Game::removeUnitAndBuildingAndFlags(int x, int y, unsigned flags) } if (flags & DEL_BUILDING) { - Uint16 gbid=map.getBuilding(x, y); - if (gbid!=NOGBID) + Uint16 gbId=map.getBuilding(x, y); + if (gbId!=NOGBID) { - int id=Building::GIDtoID(gbid); - int team=Building::GIDtoTeam(gbid); + int id=Building::GIDtoID(gbId); + int team=Building::GIDtoTeam(gbId); Building *b=teams[team]->myBuildings[id]; if (!b->type->isVirtual) map.setBuilding(b->posX, b->posY, b->type->width, b->type->height, NOGBID); @@ -1824,10 +1824,10 @@ void Game::drawUnit(int x, int y, Uint16 gid, int viewportX, int viewportY, int if ((!map.isFOWDiscovered(x+viewportX, y+viewportY, visibleTeams))&&(!map.isFOWDiscovered(x+viewportX-dx, y+viewportY-dy, visibleTeams))) return; - int imgid; + int imgId; assert(unit->action>=0); assert(unit->actionskin->startImage[unit->action]; + imgId=unit->skin->startImage[unit->action]; int px, py; map.mapCaseToDisplayable(unit->posX, unit->posY, &px, &py, viewportX, viewportY); int deltaLeft=255-unit->delta; @@ -1849,20 +1849,20 @@ void Game::drawUnit(int x, int y, Uint16 gid, int viewportX, int viewportY, int assert(delta<256); if (dir==8) { - imgid+=8*(delta>>5); + imgId+=8*(delta>>5); } else { - imgid+=8*dir; - imgid+=(delta>>5); + imgId+=8*dir; + imgId+=(delta>>5); } // draw unit Sprite *unitSprite = unit->skin->sprite; unitSprite->setBaseColor(teams[team]->color); - int decX = (unitSprite->getW(imgid)-32)>>1; - int decY = (unitSprite->getH(imgid)-32)>>1; - globalContainer->gfx->drawSprite(px-decX, py-decY, unitSprite, imgid); + int decX = (unitSprite->getW(imgId)-32)>>1; + int decY = (unitSprite->getH(imgId)-32)>>1; + globalContainer->gfx->drawSprite(px-decX, py-decY, unitSprite, imgId); // draw selection if (unit==selectedUnit) @@ -1891,20 +1891,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); } } } @@ -1924,8 +1924,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) @@ -1942,7 +1942,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); } } @@ -1992,8 +1992,8 @@ 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; + assert(false); // Now there shouldn't be any more resources on "terrain". + sprite=globalContainer->resources; id-=272; } if ((id < 256) || (id >= 256+16)) @@ -2001,7 +2001,7 @@ inline void Game::drawMapTerrain(int left, int top, int right, int bot, int view } } -inline void Game::drawMapRessources(int left, int top, int right, int bot, int viewportX, int viewportY, int localTeam, Uint32 drawOptions) +inline void Game::drawMapResources(int left, int top, int right, int bot, int viewportX, int viewportY, int localTeam, Uint32 drawOptions) { Uint32 visibleTeams = teams[localTeam]->me; if (globalContainer->replaying) visibleTeams = globalContainer->replayVisibleTeams; @@ -2017,33 +2017,33 @@ 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); - int imgid=rt->gfxId+(variety*rt->sizesCount)+amount; + 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; + 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); assert(varietyvarietiesCount); - globalContainer->gfx->drawSprite((x<<5)-dx, (y<<5)-dy, sprite, imgid); + globalContainer->gfx->drawSprite((x<<5)-dx, (y<<5)-dy, sprite, imgId); } } } inline void Game::drawMapGroundUnits(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions) { - //Reset the mouse unit to NULL, as this time arround there may not be a unit + //Reset the mouse unit to NULL, as this time around there may not be a unit //under the mouse pointer mouseUnit=NULL; for (int y=top-1; y<=bot; y++) @@ -2116,14 +2116,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]); } } @@ -2175,7 +2175,7 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view BuildingType *type=building->type; Team *team=building->owner; - int imgid; + int imgId; if (type->crossConnectMultiImage) { int add = 0; @@ -2200,7 +2200,7 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view if ((b != NOGBID) && (Building::GIDtoTeam(b) == team->teamNumber) && (teams[Building::GIDtoTeam(b)]->myBuildings[Building::GIDtoID(b)]->type == type)) add |= (1<<0); - imgid = type->gameSpriteImage + add; + imgId = type->gameSpriteImage + add; } else { @@ -2208,7 +2208,7 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view int hp = std::min(building->hp, type->hpMax); int damageImgShift = type->gameSpriteCount - ((hp * type->gameSpriteCount) / (type->hpMax+1)) - 1; assert(damageImgShift >= 0); - imgid = type->gameSpriteImage + damageImgShift; + imgId = type->gameSpriteImage + damageImgShift; } // int x, y; int dx, dy; @@ -2217,12 +2217,12 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view // select buildings and set the team colors Sprite *buildingSprite = type->gameSpritePtr; - dx = (type->width<<5)-buildingSprite->getW(imgid); - dy = (type->height<<5)-buildingSprite->getH(imgid); + dx = (type->width<<5)-buildingSprite->getW(imgId); + dy = (type->height<<5)-buildingSprite->getH(imgId); buildingSprite->setBaseColor(team->color); // draw building - globalContainer->gfx->drawSprite(x+dx, y+dy, buildingSprite, imgid); + globalContainer->gfx->drawSprite(x+dx, y+dy, buildingSprite, imgId); if ((drawOptions & DRAW_BUILDING_RECT) != 0) { @@ -2231,13 +2231,13 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view int typeNum=building->typeNum; globalContainer->gfx->drawRect(x, y, batW, batH, 255, 255, 255, 127); - BuildingType *lastbt=globalContainer->buildingsTypes.get(typeNum); + BuildingType *lastBt=globalContainer->buildingsTypes.get(typeNum); int lastTypeNum=typeNum; int max=0; - while(lastbt->nextLevel>=0) + while(lastBt->nextLevel>=0) { - lastTypeNum=lastbt->nextLevel; - lastbt=globalContainer->buildingsTypes.get(lastTypeNum); + lastTypeNum=lastBt->nextLevel; + lastBt=globalContainer->buildingsTypes.get(lastTypeNum); if (max++>200) { printf("GameGUI: Error: nextLevelTypeNum architecture is broken.\n"); @@ -2245,10 +2245,10 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view break; } } - int exBatX=x+((lastbt->decLeft-type->decLeft)<<5); - int exBatY=y+((lastbt->decTop-type->decTop)<<5); - int exBatW=(lastbt->width)<<5; - int exBatH=(lastbt->height)<<5; + int exBatX=x+((lastBt->decLeft-type->decLeft)<<5); + int exBatY=y+((lastBt->decTop-type->decTop)<<5); + int exBatW=(lastBt->width)<<5; + int exBatH=(lastBt->height)<<5; globalContainer->gfx->drawRect(exBatX, exBatY, exBatW, exBatH, 255, 255, 255, 127); } @@ -2258,7 +2258,7 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view if (((drawOptions & DRAW_HEALTH_FOOD_BAR) != 0) && (building->owner->sharedVisionOther & visibleTeams)) { - //int unitDecx=(building->type->width*16)-((3*building->maxUnitInside)>>1); + //int unitDecX=(building->type->width*16)-((3*building->maxUnitInside)>>1); // TODO : find better color for this // health if (type->hpMax) @@ -2277,17 +2277,17 @@ inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int view actWidth=1+(int)(15.0f*hpRatio); addDec=7; } - int decy=(type->height*32); - int healDecx=(type->width-(maxWidth>>3))*16+addDec; + int decY=(type->height*32); + int healDecX=(type->width-(maxWidth>>3))*16+addDec; if (building->hp!=type->hpMax || !building->type->crossConnectMultiImage) { if (hpRatio>0.6) - drawPointBar(x+healDecx, y+decy-4, LEFT_TO_RIGHT, maxWidth, actWidth, 78, 187, 78); + drawPointBar(x+healDecX, y+decY-4, LEFT_TO_RIGHT, maxWidth, actWidth, 78, 187, 78); else if (hpRatio>0.3) - drawPointBar(x+healDecx, y+decy-4, LEFT_TO_RIGHT, maxWidth, actWidth, 255, 255, 0); + drawPointBar(x+healDecX, y+decY-4, LEFT_TO_RIGHT, maxWidth, actWidth, 255, 255, 0); else - drawPointBar(x+healDecx, y+decy-4, LEFT_TO_RIGHT, maxWidth, actWidth, 255, 0, 0); + drawPointBar(x+healDecX, y+decY-4, LEFT_TO_RIGHT, maxWidth, actWidth, 255, 0, 0); } } @@ -2303,9 +2303,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) @@ -2335,7 +2335,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); } } @@ -2393,23 +2393,23 @@ inline void Game::drawMapAreas(int left, int top, int right, int bot, int sw, in for (int y=top; ygfx->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); } } @@ -2515,7 +2515,7 @@ inline void Game::drawMapBulletsExplosionsDeathAnimations(int left, int top, int { int x=(*it)->px-(viewportX<<5); int y=(*it)->py-(viewportY<<5); - int balisticShift = 0; + int ballisticShift = 0; if (x<0) x+=mapPixW; @@ -2528,14 +2528,14 @@ inline void Game::drawMapBulletsExplosionsDeathAnimations(int left, int top, int float speedX = static_cast((*it)->speedX); float speedY = static_cast((*it)->speedX); float K = static_cast(sqrt(speedX * speedX + speedY * speedY)); - balisticShift = static_cast(K * ((-1.0f * x * x) / T + x)); + ballisticShift = static_cast(K * ((-1.0f * x * x) / T + x)); } //printf("px=(%d, %d) vp=(%d, %d)\n", (*it)->px, (*it)->py, viewportX, viewportY); if ( (x<=sw) && (y<=sh) ) { - globalContainer->gfx->drawSprite(x, y-balisticShift, bulletSprite, BULLET_IMGID); - globalContainer->gfx->drawSprite(x+(balisticShift>>1), y, bulletSprite, BULLET_IMGID+1); + globalContainer->gfx->drawSprite(x, y-ballisticShift, bulletSprite, BULLET_IMG_ID); + globalContainer->gfx->drawSprite(x+(ballisticShift>>1), y, bulletSprite, BULLET_IMG_ID+1); } } // explosions @@ -2574,7 +2574,7 @@ inline void Game::drawMapFogOfWar(int left, int top, int right, int bot, int sw, { if ((drawOptions & DRAW_WHOLE_MAP) == 0) { - // we have decrease on because we do unalign lookup + // we have decrease on because we do unaligned lookup for (int y=top-1; y<=bot; y++) for (int x=left-1; x<=right; x++) { @@ -2641,7 +2641,7 @@ inline void Game::drawMapOverlayMaps(int left, int top, int right, int bot, int overlayColor=Color(0, 0, 192); if(overlays->getOverlayType() == OverlayArea::Fertility) overlayColor=Color(0, 192, 128); - ///Both width and height have +2 to cover half-squares arround the edge of the viewport + ///Both width and height have +2 to cover half-squares around the edge of the viewport int width = (right - left) + 2; int height = (bot - top) + 2; @@ -2667,7 +2667,7 @@ inline void Game::drawMapOverlayMaps(int left, int top, int right, int bot, int } ///This is to correct OpenGL's blending not beeing offset correctly to line up with the map tiles - if(globalContainer->gfx->getOptionFlags() & GraphicContext::USEGPU) + if(globalContainer->gfx->getOptionFlags() & GraphicContext::USE_GPU) globalContainer->gfx->drawAlphaMap(overlayAlphas, width, height, -16, -16, 32, 32, overlayColor); else globalContainer->gfx->drawAlphaMap(overlayAlphas, width, height, -32, -32, 32, 32, overlayColor); @@ -2755,7 +2755,7 @@ inline void Game::drawUnitOffScreen(int sx, int sy, int sw, int sh, int viewport int i_sw = sw - 40; int i_sh = sh - 40; - // The units draw position releative to the center of the internal square + // The units draw position relative to the center of the internal square int rel_cx = px - i_sx - i_sw/2; int rel_cy = py - i_sy - i_sh/2; if(rel_cx == 0) @@ -2765,7 +2765,7 @@ inline void Game::drawUnitOffScreen(int sx, int sy, int sw, int sh, int viewport //globalContainer->gfx->drawLine(sx + sw/2, sy + sh/2, px, py, Color::white); - // Decide which edge of the screen the box is on, and compute its center cordinates + // Decide which edge of the screen the box is on, and compute its center coordinates int bx = 0; int by = 0; float slope = float(rel_cy) / float(rel_cx); @@ -2796,12 +2796,12 @@ inline void Game::drawUnitOffScreen(int sx, int sy, int sw, int sh, int viewport by -= 20; // draw unit's image - int imgid; + int imgId; UnitType *ut=unit->race->getUnitType(unit->typeNum, 0); assert(unit->action>=0); assert(unit->actionstartImage[unit->action]; + imgId=ut->startImage[unit->action]; int dir=unit->direction; int delta=unit->delta; @@ -2811,18 +2811,18 @@ inline void Game::drawUnitOffScreen(int sx, int sy, int sw, int sh, int viewport assert(delta<256); if (dir==8) { - imgid+=8*(delta>>5); + imgId+=8*(delta>>5); } else { - imgid+=8*dir; - imgid+=(delta>>5); + imgId+=8*dir; + imgId+=(delta>>5); } Sprite *unitSprite=globalContainer->units; unitSprite->setBaseColor(unit->owner->color); - int decX = (32-unitSprite->getW(imgid))>>1; - int decY = (32-unitSprite->getH(imgid))>>1; + int decX = (32-unitSprite->getW(imgId))>>1; + int decY = (32-unitSprite->getH(imgId))>>1; // Draw the code //globalContainer->gfx->drawFilledRect(bx, by, 40, 40, 0,0,0,128); @@ -2846,7 +2846,7 @@ inline void Game::drawUnitOffScreen(int sx, int sy, int sw, int sh, int viewport bx+20+cosf(angle+M_PI/6)*10, by+20+sinf(angle+M_PI/6)*10, Color::white); - globalContainer->gfx->drawSprite(bx+decX+4, by+decY+4, unitSprite, imgid, 160); + globalContainer->gfx->drawSprite(bx+decX+4, by+decY+4, unitSprite, imgId, 160); } @@ -2891,7 +2891,7 @@ void Game::drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargi time++; drawMapWater(sw, sh, viewportX, viewportY, time); drawMapTerrain(left, top, right, bot, viewportX, viewportY, localTeam, drawOptions); - drawMapRessources(left, top, right, bot, viewportX, viewportY, localTeam, drawOptions); + drawMapResources(left, top, right, bot, viewportX, viewportY, localTeam, drawOptions); drawMapGroundUnits(left, top, right, bot, sw, sh, viewportX, viewportY, localTeam, drawOptions); drawMapDebugAreas(left, top, right, bot, sw, sh, viewportX, viewportY, localTeam, drawOptions); drawMapGroundBuildings(left, top, right, bot, sw, sh, viewportX, viewportY, localTeam, drawOptions, visibleBuildings); @@ -2965,7 +2965,7 @@ void Game::drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargi int team = building->owner->teamNumber; - int imgid = type->gameSpriteImage; + int imgId = type->gameSpriteImage; int x, y; map.mapCaseToDisplayable(building->posXLocal, building->posYLocal, &x, &y, viewportX, viewportY); @@ -2973,7 +2973,7 @@ void Game::drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargi // all flags are hued: Sprite *buildingSprite = type->gameSpritePtr; buildingSprite->setBaseColor(teams[team]->color); - globalContainer->gfx->drawSprite(x, y, buildingSprite, imgid); + globalContainer->gfx->drawSprite(x, y, buildingSprite, imgId); // flag circle: if (((drawOptions & DRAW_HEALTH_FOOD_BAR) != 0) || (building==selectedBuilding)) @@ -2982,9 +2982,9 @@ void Game::drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargi // FIXME : ugly copy past if ((drawOptions & DRAW_HEALTH_FOOD_BAR) != 0) { - int decy=(type->height*32); - int healDecx=(type->width-2)*16+1; - //int unitDecx=(building->type->width*16)-((3*building->maxUnitInside)>>1); + int decY=(type->height*32); + int healDecX=(type->width-2)*16+1; + //int unitDecX=(building->type->width*16)-((3*building->maxUnitInside)>>1); // TODO : find better color for this // health @@ -2992,11 +2992,11 @@ void Game::drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargi { float hpRatio=(float)building->hp/(float)type->hpMax; if (hpRatio>0.6) - drawPointBar(x+healDecx+6, y+decy-4, LEFT_TO_RIGHT, 16, 1+(int)(15.0f*hpRatio), 78, 187, 78); + drawPointBar(x+healDecX+6, y+decY-4, LEFT_TO_RIGHT, 16, 1+(int)(15.0f*hpRatio), 78, 187, 78); else if (hpRatio>0.3) - drawPointBar(x+healDecx+6, y+decy-4, LEFT_TO_RIGHT, 16, 1+(int)(15.0f*hpRatio), 255, 255, 0); + drawPointBar(x+healDecX+6, y+decY-4, LEFT_TO_RIGHT, 16, 1+(int)(15.0f*hpRatio), 255, 255, 0); else - drawPointBar(x+healDecx+6, y+decy-4, LEFT_TO_RIGHT, 16, 1+(int)(15.0f*hpRatio), 255, 0, 0); + drawPointBar(x+healDecX+6, y+decY-4, LEFT_TO_RIGHT, 16, 1+(int)(15.0f*hpRatio), 255, 0, 0); } // units @@ -3012,9 +3012,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); } } } @@ -3025,14 +3025,14 @@ void Game::drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargi for (int y=top-1; y<=bot; y++) for (int x=left-1; x<=right; x++) for (int pi=0; piai && players[pi]->ai->implementitionID==AI::CASTOR) + if (players[pi] && players[pi]->ai && players[pi]->ai->implementationID==AI::CASTOR) { AICastor *ai=(AICastor *)players[pi]->ai->aiImplementation; //Uint8 *gradient=ai->wheatCareMap[1]; Uint8 *gradient=ai->hydratationMap; //Uint8 *gradient=ai->enemyWarriorsMap; //Uint8 *gradient=map.forbiddenGradient[1][0]; - //Uint8 *gradient=map.ressourcesGradient[0][CORN][0]; + //Uint8 *gradient=map.resourcesGradient[0][CORN][0]; assert(gradient); size_t addr=((x+viewportX)&map.wMask)+map.w*((y+viewportY)&map.hMask); diff --git a/src/Game.h b/src/Game.h index a0c423eb..b767f946 100644 --- a/src/Game.h +++ b/src/Game.h @@ -82,7 +82,7 @@ class Game DRAW_WHOLE_MAP = 0x10, DRAW_ACCESSIBILITY = 0x20, DRAW_SCRIPT_AREAS = 0x40, - DRAW_NO_RESSOURCE_GROWTH_AREAS = 0x80, + DRAW_NO_RESOURCE_GROWTH_AREAS = 0x80, DRAW_OVERLAY = 0x100, }; @@ -109,7 +109,7 @@ class Game void prestigeSyncStep(); /// Advances the Game by one tick, in reference to localTeam being the localTeam. This does all - /// internal proccessing. + /// internal processing. void syncStep(Sint32 localTeam); void dirtyWarFlagGradient(); @@ -147,7 +147,7 @@ class Game void drawUnit(int x, int y, Uint16 gid, int viewportX, int viewportY, int screenW, int screenH, int localTeam, Uint32 drawOptions); void drawMap(int sx, int sy, int sw, int sh, int rightMargin, int topMargin, int viewportX, int viewportY, int teamSelected, Uint32 drawOptions = 0, std::set *visibleBuildings = 0); - ///Sets the mask respresenting which players the game is waiting on + ///Sets the mask representing which players the game is waiting on void setWaitingOnMask(Uint32 mask); ///This dumps all data in text form to the given file @@ -176,7 +176,7 @@ class Game ///Initiates Game void init(GameGUI *gui, MapEdit* edit); - ///Clears existing game information, deleting the teams and players, in preperation of a new game. + ///Clears existing game information, deleting the teams and players, in preparation of a new game. void clearGame(); public: @@ -200,8 +200,8 @@ class Game inline void drawMapWater(int sw, int sh, int viewportX, int viewportY, int time); ///draws the terrain tiles of sand and gras inline void drawMapTerrain(int left, int top, int right, int bot, int viewportX, int viewportY, int localTeam, Uint32 drawOptions); - ///draws the resources like algues, wheat or fruit trees - inline void drawMapRessources(int left, int top, int right, int bot, int viewportX, int viewportY, int localTeam, Uint32 drawOptions); + ///draws the resources like algae, wheat or fruit trees + inline void drawMapResources(int left, int top, int right, int bot, int viewportX, int viewportY, int localTeam, Uint32 drawOptions); ///draws the ground units. up till now those are workers and warriors inline void drawMapGroundUnits(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions); ///draws debug information. switched in the code. @@ -236,7 +236,7 @@ class Game Player * players[Team::MAX_COUNT]; Map map; MapScriptSGSL sgslScript; ///< SGSL script - MapScript mapscript; ///< new script, currently USL + MapScript mapScript; ///< new script, currently USL GameObjectives objectives; GameHints gameHints; std::string missionBriefing; diff --git a/src/GameEvent.cpp b/src/GameEvent.cpp index 752d001f..718c64ab 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/GameEvent.h b/src/GameEvent.h index d98f08d3..3b3b69d5 100644 --- a/src/GameEvent.h +++ b/src/GameEvent.h @@ -40,7 +40,7 @@ enum GameEventType class GameEvent { public: - ///Constructs a GameEvent with the step and the (x,y) cordinates of the event on screen + ///Constructs a GameEvent with the step and the (x,y) coordinates of the event on screen GameEvent(Uint32 step, Sint16 x, Sint16 y); virtual ~GameEvent(); @@ -54,10 +54,10 @@ class GameEvent ///Returns the step of the event Uint32 getStep(); - ///Returns the x-cordinate + ///Returns the x-coordinate Sint16 getX(); - ///Returns the y-cordinate + ///Returns the y-coordinate Sint16 getY(); ///Returns the event type diff --git a/src/GameGUI.cpp b/src/GameGUI.cpp index 55dfd7e5..59ab6cac 100644 --- a/src/GameGUI.cpp +++ b/src/GameGUI.cpp @@ -61,31 +61,31 @@ #define TYPING_INPUT_BASE_INC 7 #define TYPING_INPUT_MAX_POS 46 -// these values are manually layouted for cuteste 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 +// these values are manually layouted for cutest perception +#define Y_POS_BASE_DEFAULT 180 +#define Y_POS_BASE_CONSTRUCTION (Y_POS_BASE_DEFAULT + 5) +#define Y_POS_BASE_FLAG (Y_POS_BASE_DEFAULT + 5) +#define Y_POS_BASE_STAT Y_POS_BASE_DEFAULT +#define Y_POS_BASE_BUILDING (Y_POS_BASE_DEFAULT + 10) +#define Y_POS_BASE_UNIT (Y_POS_BASE_DEFAULT + 10) +#define Y_POS_BASE_RESOURCE Y_POS_BASE_DEFAULT -#define YOFFSET_NAME 28 -#define YOFFSET_ICON 52 -#define YOFFSET_CARYING 34 -#define YOFFSET_BAR 32 -#define YOFFSET_INFOS 12 -#define YOFFSET_TOWER 22 +#define Y_OFFSET_NAME 28 +#define Y_OFFSET_ICON 52 +#define Y_OFFSET_CARRYING 34 +#define Y_OFFSET_BAR 32 +#define Y_OFFSET_INFOS 12 +#define Y_OFFSET_TOWER 22 -#define YOFFSET_B_SEP 6 +#define Y_OFFSET_B_SEP 6 -#define YOFFSET_TEXT_BAR 16 -#define YOFFSET_TEXT_PARA 14 -#define YOFFSET_TEXT_LINE 12 +#define Y_OFFSET_TEXT_BAR 16 +#define Y_OFFSET_TEXT_PARA 14 +#define Y_OFFSET_TEXT_LINE 12 -#define YOFFSET_PROGRESS_BAR 10 +#define Y_OFFSET_PROGRESS_BAR 10 -#define YOFFSET_BRUSH 56 +#define Y_OFFSET_BRUSH 56 // The sidebar on the right #define RIGHT_MENU_WIDTH 160 @@ -100,10 +100,10 @@ #define IGM_OBJECTIVES_ICON_Y (IGM_ICON_HEIGHT * 2) // Settings for the right sidebar in replays -#define REPLAY_PANEL_XOFFSET 25 -#define REPLAY_PANEL_YOFFSET (YPOS_BASE_STAT+10) +#define REPLAY_PANEL_X_OFFSET 25 +#define REPLAY_PANEL_Y_OFFSET (Y_POS_BASE_STAT+10) #define REPLAY_PANEL_SPACE_BETWEEN_OPTIONS 22 -#define REPLAY_PANEL_PLAYERLIST_YOFFSET (5*REPLAY_PANEL_SPACE_BETWEEN_OPTIONS+5) +#define REPLAY_PANEL_PLAYER_LIST_Y_OFFSET (5*REPLAY_PANEL_SPACE_BETWEEN_OPTIONS+5) // The actual progress bar (including buttons) #define REPLAY_PROGRESS_BAR_X_OFFSET 4 @@ -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() @@ -322,7 +322,7 @@ void GameGUI::moveFlag(int mx, int my, bool drop) { Uint16 gid=selBuild->gid; shared_ptr oms(new OrderMoveFlag(gid, posX, posY, drop)); - // First, we check if anoter move of the same flag is already in the "orderQueue". + // First, we check if another move of the same flag is already in the "orderQueue". bool found=false; for (std::list >::iterator it=orderQueue.begin(); it!=orderQueue.end(); ++it) { @@ -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--) { @@ -564,7 +564,7 @@ void GameGUI::step(void) order = toolManager.getOrder(); } - ///This shows the mission briefing at the begginning of the mission + ///This shows the mission briefing at the beginning of the mission if(game.stepCounter == 12) { if(game.missionBriefing != "") @@ -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 uncontrolled 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()) { @@ -891,7 +891,7 @@ void GameGUI::processEvent(SDL_Event *event) { //Interpret message std::string message = typingInputScreen->getText(); - Uint32 nchatMask = chatMask; + Uint32 nChatMask = chatMask; if(message[0] == '/') { std::string name; @@ -900,7 +900,7 @@ void GameGUI::processEvent(SDL_Event *event) message = message.substr(message.find(' ')+1); if(name=="a") { - nchatMask = localTeam->allies; + nChatMask = localTeam->allies; } else { @@ -908,7 +908,7 @@ void GameGUI::processEvent(SDL_Event *event) { if(name == game.gameHeader.getBasePlayer(i).name) { - nchatMask = game.gameHeader.getBasePlayer(i).teamNumberMask | localTeam->me; + nChatMask = game.gameHeader.getBasePlayer(i).teamNumberMask | localTeam->me; break; } } @@ -917,7 +917,7 @@ void GameGUI::processEvent(SDL_Event *event) if (!message.empty()) { - orderQueue.push_back(shared_ptr(new MessageOrder(nchatMask, MessageOrder::NORMAL_MESSAGE_TYPE, message.c_str()))); + orderQueue.push_back(shared_ptr(new MessageOrder(nChatMask, MessageOrder::NORMAL_MESSAGE_TYPE, message.c_str()))); typingInputScreen->setText(""); } typingInputScreenInc=-TYPING_INPUT_BASE_INC; @@ -943,29 +943,29 @@ void GameGUI::processEvent(SDL_Event *event) if (event->type == SDL_MOUSEBUTTONDOWN) { - int butx = event->button.x; - int buty = event->button.y; + int buttonX = event->button.x; + int buttonY = event->button.y; int leftEdge = globalContainer->gfx->getW() - RIGHT_MENU_WIDTH - IGM_ICON_HEIGHT/2; int rightEdge = globalContainer->gfx->getW() - RIGHT_MENU_WIDTH + IGM_ICON_HEIGHT/2; int menu = -1; if (event->button.button == SDL_BUTTON_LEFT - && (butx > leftEdge) - && (butx < rightEdge)) + && (buttonX > leftEdge) + && (buttonX < rightEdge)) { - if (buty < IGM_MAIN_MENU_ICON_Y + IGM_ICON_HEIGHT) + if (buttonY < IGM_MAIN_MENU_ICON_Y + IGM_ICON_HEIGHT) { menu = IGM_MAIN; } if (!(hiddenGUIElements & HIDABLE_ALLIANCE) - && (buty > IGM_ALLIANCE_ICON_Y) - && (buty < IGM_ALLIANCE_ICON_Y + IGM_ICON_HEIGHT)) + && (buttonY > IGM_ALLIANCE_ICON_Y) + && (buttonY < IGM_ALLIANCE_ICON_Y + IGM_ICON_HEIGHT)) { menu = IGM_ALLIANCE; } - if ((buty > IGM_OBJECTIVES_ICON_Y) - && (buty < IGM_OBJECTIVES_ICON_Y + IGM_ICON_HEIGHT)) + if ((buttonY > IGM_OBJECTIVES_ICON_Y) + && (buttonY < IGM_OBJECTIVES_ICON_Y + IGM_ICON_HEIGHT)) { menu = IGM_OBJECTIVES; } @@ -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); @@ -1754,8 +1754,8 @@ void GameGUI::handleKeyDump(SDL_KeyboardEvent key) void GameGUI::handleKeyAlways(void) { SDL_PumpEvents(); - const Uint8 *keystate = SDL_GetKeyboardState(NULL); - if (notmenu == false) + const Uint8 *keyState = SDL_GetKeyboardState(NULL); + if (notMenu == false) { SDL_Keymod modState = SDL_GetModState(); int xMotion = 1; @@ -1796,38 +1796,38 @@ void GameGUI::handleKeyAlways(void) yMotion = 0; } - if (keystate[SDL_SCANCODE_UP]) + if (keyState[SDL_SCANCODE_UP]) viewportY -= yMotion; - if (keystate[SDL_SCANCODE_KP_8]) + if (keyState[SDL_SCANCODE_KP_8]) viewportY -= yMotion; - if (keystate[SDL_SCANCODE_DOWN]) + if (keyState[SDL_SCANCODE_DOWN]) viewportY += yMotion; - if (keystate[SDL_SCANCODE_KP_2]) + if (keyState[SDL_SCANCODE_KP_2]) viewportY += yMotion; - if ((keystate[SDL_SCANCODE_LEFT]) && (typingInputScreen == NULL)) // we haave a test in handleKeyAlways, that's not very clean, but as every key check based on key states and not key events are here, it is much simpler and thus easier to understand and thus cleaner ;-) + if ((keyState[SDL_SCANCODE_LEFT]) && (typingInputScreen == NULL)) // we have a test in handleKeyAlways, that's not very clean, but as every key check based on key states and not key events are here, it is much simpler and thus easier to understand and thus cleaner ;-) viewportX -= xMotion; - if (keystate[SDL_SCANCODE_KP_4]) + if (keyState[SDL_SCANCODE_KP_4]) viewportX -= xMotion; - if ((keystate[SDL_SCANCODE_RIGHT]) && (typingInputScreen == NULL)) // we haave a test in handleKeyAlways, that's not very clean, but as every key check based on key states and not key events are here, it is much simpler and thus easier to understand and thus cleaner ;-) + if ((keyState[SDL_SCANCODE_RIGHT]) && (typingInputScreen == NULL)) // we have a test in handleKeyAlways, that's not very clean, but as every key check based on key states and not key events are here, it is much simpler and thus easier to understand and thus cleaner ;-) viewportX += xMotion; - if (keystate[SDL_SCANCODE_KP_6]) + if (keyState[SDL_SCANCODE_KP_6]) viewportX += xMotion; - if (keystate[SDL_SCANCODE_KP_7]) + if (keyState[SDL_SCANCODE_KP_7]) { viewportX -= xMotion; viewportY -= yMotion; } - if (keystate[SDL_SCANCODE_KP_9]) + if (keyState[SDL_SCANCODE_KP_9]) { viewportX += xMotion; viewportY -= yMotion; } - if (keystate[SDL_SCANCODE_KP_1]) + if (keyState[SDL_SCANCODE_KP_1]) { viewportX -= xMotion; viewportY += yMotion; } - if (keystate[SDL_SCANCODE_KP_3]) + if (keyState[SDL_SCANCODE_KP_3]) { viewportX += xMotion; viewportY += yMotion; @@ -1880,7 +1880,7 @@ void GameGUI::handleMouseMotion(int mx, int my, int button) if (panPushed) { - // handle paning + // handle panning int dx = (mx-panMouseX)>>1; int dy = (my-panMouseY)>>1; viewportX = (panViewX+dx)&game.map.getMaskW(); @@ -1905,9 +1905,9 @@ void GameGUI::handleMapClick(int mx, int my, int button) } else if (putMark) { - int markx, marky; - game.map.displayToMapCaseAligned(mx, my, &markx, &marky, viewportX, viewportY); - orderQueue.push_back(shared_ptr(new MapMarkOrder(localTeamNo, markx, marky))); + int markX, markY; + game.map.displayToMapCaseAligned(mx, my, &markX, &markY, viewportX, viewportY); + orderQueue.push_back(shared_ptr(new MapMarkOrder(localTeamNo, markX, markY))); globalContainer->gfx->cursorManager.setNextType(CursorManager::CURSOR_NORMAL); putMark = false; } @@ -1993,15 +1993,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(); } } @@ -2016,9 +2016,9 @@ void GameGUI::handleMenuClick(int mx, int my, int button) { if (putMark) { - int markx, marky; - minimapMouseToPos(globalContainer->gfx->getW() - RIGHT_MENU_WIDTH + mx, my, &markx, &marky, false); - orderQueue.push_back(shared_ptr(new MapMarkOrder(localTeamNo, markx, marky))); + int markX, markY; + minimapMouseToPos(globalContainer->gfx->getW() - RIGHT_MENU_WIDTH + mx, my, &markX, &markY, false); + orderQueue.push_back(shared_ptr(new MapMarkOrder(localTeamNo, markX, markY))); globalContainer->gfx->cursorManager.setNextType(CursorManager::CURSOR_NORMAL); putMark = false; } @@ -2032,7 +2032,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) } } // Check if one of the panel buttons has been clicked - else if (myreplaying) { @@ -2065,7 +2065,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 = Y_POS_BASE_BUILDING + Y_OFFSET_NAME + Y_OFFSET_ICON + Y_OFFSET_B_SEP; BuildingType *buildingType = selBuild->type; int lmx = mx - RIGHT_MENU_OFFSET; // local mx @@ -2073,8 +2073,8 @@ void GameGUI::handleMenuClick(int mx, int my, int button) if (selBuild->type->maxUnitWorking) { if (((selBuild->owner->allies)&(1<ypos+YOFFSET_TEXT_BAR - && myyPos+Y_OFFSET_TEXT_BAR + && mybuildingState==Building::ALIVE && lmx < 128) { @@ -2104,16 +2104,16 @@ void GameGUI::handleMenuClick(int mx, int my, int button) } } } - ypos += YOFFSET_BAR + YOFFSET_B_SEP; + yPos += Y_OFFSET_BAR + Y_OFFSET_B_SEP; } // priorities if(selBuild->type->maxUnitWorking) { - ypos += YOFFSET_B_SEP; + yPos += Y_OFFSET_B_SEP; if (((selBuild->owner->allies)&(1<ypos+16 - && myyPos+16 + && mybuildingState==Building::ALIVE) { int width = (128 - 8)/3; @@ -2134,15 +2134,15 @@ void GameGUI::handleMenuClick(int mx, int my, int button) selBuild->priorityLocal = 1; } } - ypos += YOFFSET_BAR+YOFFSET_B_SEP; + yPos += Y_OFFSET_BAR+Y_OFFSET_B_SEP; } // flag range bar if (buildingType->defaultUnitStayRange) { if (((selBuild->owner->allies)&(1<ypos+YOFFSET_TEXT_BAR) - && (myyPos+Y_OFFSET_TEXT_BAR) + && (mytype == "clearingflag") { - ypos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; + yPos+=Y_OFFSET_B_SEP+Y_OFFSET_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+=Y_OFFSET_TEXT_PARA; j++; } } if (buildingType->type == "warflag") { - ypos+=YOFFSET_B_SEP+YOFFSET_TEXT_PARA; + yPos+=Y_OFFSET_B_SEP+Y_OFFSET_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+=Y_OFFSET_TEXT_PARA; } } @@ -2219,91 +2219,91 @@ 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+=Y_OFFSET_B_SEP+Y_OFFSET_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+=Y_OFFSET_TEXT_PARA; } } } if (buildingType->armor) - ypos+=YOFFSET_TEXT_LINE; + yPos+=Y_OFFSET_TEXT_LINE; if (buildingType->maxUnitInside) - ypos += YOFFSET_INFOS; + yPos += Y_OFFSET_INFOS; if (buildingType->shootDamage) - ypos += YOFFSET_TOWER; - ypos += YOFFSET_B_SEP; + yPos += Y_OFFSET_TOWER; + yPos += Y_OFFSET_B_SEP; - //Exchannge building + //Exchange building //Exchanging as a feature is broken /* if (selBuild->type->canExchange && ((selBuild->owner->allies)&(1<startY) && (my92) && (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)) { int xNum=mx/(RIGHT_MENU_WIDTH/2); - int yNum=(my-YPOS_BASE_CONSTRUCTION)/46; + int yNum=(my-Y_POS_BASE_CONSTRUCTION)/46; int id=yNum*2+xNum; if (id<(int)buildingsChoiceName.size()) if (buildingsChoiceState[id]) @@ -2396,14 +2396,14 @@ void GameGUI::handleMenuClick(int mx, int my, int button) else if ((displayMode==FLAG_VIEW && !globalContainer->replaying)) { int dec = (RIGHT_MENU_WIDTH - 128)/2; - my -= YPOS_BASE_FLAG; + my -= Y_POS_BASE_FLAG; int nmx = mx - dec; - if (my > YOFFSET_BRUSH) + if (my > Y_OFFSET_BRUSH) { // set the selection setSelection(BRUSH_SELECTION); // change the brush type (forbidden, guard, clear) if necessary - if (my < YOFFSET_BRUSH+40) + if (my < Y_OFFSET_BRUSH+40) { if (nmx < 44) toolManager.activateZoneTool(GameGUIToolManager::Forbidden); @@ -2413,7 +2413,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) toolManager.activateZoneTool(GameGUIToolManager::Clearing); } // anyway, update the tool - brush.handleClick(mx-dec, my-YOFFSET_BRUSH-40); + brush.handleClick(mx-dec, my-Y_OFFSET_BRUSH-40); toolManager.activateZoneTool(); } else @@ -2436,7 +2436,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) if (globalContainer->replaying) inc = 15; else inc = 0; - if(my > YPOS_BASE_STAT+140+inc+64 && my < YPOS_BASE_STAT+140+inc+80) + if(my > Y_POS_BASE_STAT+140+inc+64 && my < Y_POS_BASE_STAT+140+inc+80) { showDamagedMap=false; showDefenseMap=false; @@ -2445,7 +2445,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) overlay.compute(game, OverlayArea::Starving, localTeamNo); } - if(my > YPOS_BASE_STAT+140+inc+88 && my < YPOS_BASE_STAT+140+inc+104) + if(my > Y_POS_BASE_STAT+140+inc+88 && my < Y_POS_BASE_STAT+140+inc+104) { showDamagedMap=!showDamagedMap; showStarvingMap=false; @@ -2454,7 +2454,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) overlay.compute(game, OverlayArea::Damage, localTeamNo); } - if(my > YPOS_BASE_STAT+140+inc+112 && my < YPOS_BASE_STAT+140+inc+128) + if(my > Y_POS_BASE_STAT+140+inc+112 && my < Y_POS_BASE_STAT+140+inc+128) { showDefenseMap=!showDefenseMap; showStarvingMap=false; @@ -2463,7 +2463,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) overlay.compute(game, OverlayArea::Defence, localTeamNo); } - if(my > YPOS_BASE_STAT+140+inc+136 && my < YPOS_BASE_STAT+140+inc+152) + if(my > Y_POS_BASE_STAT+140+inc+136 && my < Y_POS_BASE_STAT+140+inc+152) { showFertilityMap=!showFertilityMap; showDefenseMap=false; @@ -2475,8 +2475,8 @@ void GameGUI::handleMenuClick(int mx, int my, int button) } else if (replayDisplayMode==RDM_REPLAY_VIEW && globalContainer->replaying) { - int x = REPLAY_PANEL_XOFFSET; - int y = REPLAY_PANEL_YOFFSET; + int x = REPLAY_PANEL_X_OFFSET; + int y = REPLAY_PANEL_Y_OFFSET; int inc = REPLAY_PANEL_SPACE_BETWEEN_OPTIONS; if (mx > x && mx < x+20 && my > y+1*inc && my < y+1*inc + 20) @@ -2512,7 +2512,7 @@ void GameGUI::handleMenuClick(int mx, int my, int button) for (int i = 0; i < game.teamsCount(); i++) { - if (mx > x && mx < x+20 && my > y+REPLAY_PANEL_PLAYERLIST_YOFFSET+(i+1)*inc && my < y+REPLAY_PANEL_PLAYERLIST_YOFFSET+(i+1)*inc + 20) + if (mx > x && mx < x+20 && my > y+REPLAY_PANEL_PLAYER_LIST_Y_OFFSET+(i+1)*inc && my < y+REPLAY_PANEL_PLAYER_LIST_Y_OFFSET+(i+1)*inc + 20) { localTeamNo = i; @@ -2689,9 +2689,9 @@ void GameGUI::drawPanelButtons(int y) drawPanelButton(y, 2, RDM_NB_VIEWS, 4); } - if(hilights.find(HilightUnderMinimapIcon) != hilights.end()) + if(highlights.find(HighlightUnderMinimapIcon) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, y, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, y, 38)); } } @@ -2699,7 +2699,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) @@ -2721,34 +2721,34 @@ void GameGUI::drawChoice(int pos, std::vector &types, std::vectorbuildingsTypes.getByType(type.c_str(), 0, false); assert(bt); - int imgid = bt->miniSpriteImage; + int imgId = bt->miniSpriteImage; int x, y; x=((i % numberPerLine)*width)+globalContainer->gfx->getW()-RIGHT_MENU_WIDTH; - y=((i / numberPerLine)*46)+YPOS_BASE_BUILDING; + y=((i / numberPerLine)*46)+Y_POS_BASE_BUILDING; globalContainer->gfx->setClipRect(x, y, 64, 46); Sprite *buildingSprite; - if (imgid >= 0) + if (imgId >= 0) { buildingSprite = bt->miniSpritePtr; } else { buildingSprite = bt->gameSpritePtr; - imgid = bt->gameSpriteImage; + imgId = bt->gameSpriteImage; } - int decX = (width-buildingSprite->getW(imgid))>>1; - int decY = (46-buildingSprite->getW(imgid))>>1; + int decX = (width-buildingSprite->getW(imgId))>>1; + int decY = (46-buildingSprite->getW(imgId))>>1; buildingSprite->setBaseColor(localTeam->color); - globalContainer->gfx->drawSprite(x+decX, y+decY, buildingSprite, imgid); + globalContainer->gfx->drawSprite(x+decX, y+decY, buildingSprite, imgId); globalContainer->gfx->setClipRect(); - if(hilights.find(HilightBuildingOnPanel+IntBuildingType::shortNumberFromType(type)) != hilights.end()) + if(highlights.find(HighlightBuildingOnPanel+IntBuildingType::shortNumberFromType(type)) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(x+decX-36, y-6+decX, 38)); + arrowPositions.push_back(HighlightArrowPosition(x+decX-36, y-6+decX, 38)); } } } @@ -2761,21 +2761,21 @@ 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); int x=((sel % numberPerLine)*width)+globalContainer->gfx->getW()-RIGHT_MENU_WIDTH; - int y=((sel / numberPerLine)*46)+YPOS_BASE_BUILDING; + int y=((sel / numberPerLine)*46)+Y_POS_BASE_BUILDING; int decX = (width - sw) / 2; if (numberPerLine == 2) - globalContainer->gfx->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; @@ -2827,17 +2827,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()); } } } @@ -2848,7 +2848,7 @@ void GameGUI::drawUnitInfos(void) { Unit* selUnit=selection.unit; assert(selUnit); - int ypos = YPOS_BASE_UNIT; + int yPos = Y_POS_BASE_UNIT; Uint8 r, g, b; // draw "unit" of "player" @@ -2872,18 +2872,18 @@ void GameGUI::drawUnitInfos(void) globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, r, g, b)); int titleLen = globalContainer->littleFont->getStringWidth(title.c_str()); int titlePos = globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+((RIGHT_MENU_WIDTH-titleLen)>>1); - globalContainer->gfx->drawString(titlePos, ypos+5, globalContainer->littleFont, title.c_str()); + globalContainer->gfx->drawString(titlePos, yPos+5, globalContainer->littleFont, title.c_str()); globalContainer->littleFont->popStyle(); - ypos += YOFFSET_NAME; + yPos += Y_OFFSET_NAME; // draw unit's image Unit* unit=selUnit; - int imgid; + int imgId; UnitType *ut=unit->race->getUnitType(unit->typeNum, 0); assert(unit->action>=0); assert(unit->actionstartImage[unit->action]; + imgId=ut->startImage[unit->action]; int dir=unit->direction; int delta=unit->delta; @@ -2893,25 +2893,25 @@ void GameGUI::drawUnitInfos(void) assert(delta<256); if (dir==8) { - imgid+=8*(delta>>5); + imgId+=8*(delta>>5); } else { - imgid+=8*dir; - imgid+=(delta>>5); + imgId+=8*dir; + imgId+=(delta>>5); } Sprite *unitSprite=globalContainer->units; unitSprite->setBaseColor(unit->owner->color); - int decX = (32-unitSprite->getW(imgid))>>1; - int decY = (32-unitSprite->getH(imgid))>>1; + int decX = (32-unitSprite->getW(imgId))>>1; + int decY = (32-unitSprite->getH(imgId))>>1; 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+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; } @@ -2919,10 +2919,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+Y_OFFSET_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+Y_OFFSET_TEXT_LINE+Y_OFFSET_TEXT_PARA, globalContainer->littleFont, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[food]")).c_str()); // draw food if (selUnit->isUnitHungry()) @@ -2931,31 +2931,31 @@ 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*Y_OFFSET_TEXT_LINE+Y_OFFSET_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; + yPos += Y_OFFSET_ICON+10; - int rdec = (RIGHT_MENU_WIDTH-128)/2; + int rDec = (RIGHT_MENU_WIDTH-128)/2; 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->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->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]")); + 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 += Y_OFFSET_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()); - ypos += YOFFSET_TEXT_PARA+10; + 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 += Y_OFFSET_TEXT_PARA+10; if (selUnit->performance[ARMOR]) { @@ -2963,77 +2963,77 @@ 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; + yPos += Y_OFFSET_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()); - ypos += YOFFSET_TEXT_PARA; + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, yPos, globalContainer->littleFont, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[levels]")).c_str()); + yPos += Y_OFFSET_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()); - ypos += YOFFSET_TEXT_LINE; + 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 += Y_OFFSET_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()); - ypos += YOFFSET_TEXT_LINE; + 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 += Y_OFFSET_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()); - ypos += YOFFSET_TEXT_LINE; + 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 += Y_OFFSET_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()); - ypos += YOFFSET_TEXT_LINE; + 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 += Y_OFFSET_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()); - ypos += YOFFSET_TEXT_LINE; + 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 += Y_OFFSET_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; + yPos += Y_OFFSET_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; + yPos += Y_OFFSET_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; + yPos += Y_OFFSET_TEXT_PARA + 2; } if (selUnit->performance[ATTACK_STRENGTH] || selUnit->performance[MAGIC_ATTACK_AIR] || selUnit->performance[MAGIC_ATTACK_GROUND]) - drawXPProgressBar(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos, selUnit->experience, selUnit->getNextLevelThreshold()); + drawXPProgressBar(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, yPos, selUnit->experience, selUnit->getNextLevelThreshold()); } 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()); } -void GameGUI::drawCosts(int ressources[BASIC_COUNT], Font *font) +void GameGUI::drawCosts(int resources[BASIC_COUNT], Font *font) { for (int i=0; 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(resources[i]).c_str()); } } @@ -3053,11 +3053,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); } } @@ -3066,7 +3066,7 @@ void GameGUI::drawBuildingInfos(void) Building* selBuild = selection.building; assert(selBuild); BuildingType *buildingType = selBuild->type; - int ypos = YPOS_BASE_BUILDING; + int yPos = Y_POS_BASE_BUILDING; Uint8 r, g, b; unsigned unitInsideBarYDec = 0; @@ -3093,7 +3093,7 @@ void GameGUI::drawBuildingInfos(void) globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, r, g, b)); int titleLen = globalContainer->littleFont->getStringWidth(title.c_str()); int titlePos = globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+((RIGHT_MENU_WIDTH-titleLen)>>1); - globalContainer->gfx->drawString(titlePos, ypos, globalContainer->littleFont, title.c_str()); + globalContainer->gfx->drawString(titlePos, yPos, globalContainer->littleFont, title.c_str()); globalContainer->littleFont->popStyle(); // building text @@ -3101,7 +3101,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) { @@ -3118,37 +3118,37 @@ void GameGUI::drawBuildingInfos(void) titlePos = globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+((RIGHT_MENU_WIDTH-titleLen)>>1); globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 200, 200, 200)); - globalContainer->gfx->drawString(titlePos, ypos+YOFFSET_TEXT_PARA-1, globalContainer->littleFont, title.c_str()); + globalContainer->gfx->drawString(titlePos, yPos+Y_OFFSET_TEXT_PARA-1, globalContainer->littleFont, title.c_str()); globalContainer->littleFont->popStyle(); - ypos += YOFFSET_NAME; + yPos += Y_OFFSET_NAME; // building icon Sprite *miniSprite; - int imgid; + int imgId; if (buildingType->miniSpriteImage >= 0) { miniSprite = buildingType->miniSpritePtr; - imgid = buildingType->miniSpriteImage; + imgId = buildingType->miniSpriteImage; } else { miniSprite = buildingType->gameSpritePtr; - imgid = buildingType->gameSpriteImage; + imgId = buildingType->gameSpriteImage; } - int dx = (56-miniSprite->getW(imgid))>>1; - int dy = (46-miniSprite->getH(imgid))>>1; + int dx = (56-miniSprite->getW(imgId))>>1; + int dy = (46-miniSprite->getH(imgId))>>1; 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+dx, yPos+4+dy, miniSprite, imgId); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+ddx, yPos+4, globalContainer->gameGui, 18); // draw HP if (buildingType->hpMax) { globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 185, 195, 21)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos, globalContainer->littleFont, Toolkit::getStringTable()->getString("[hp]")); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, yPos, globalContainer->littleFont, Toolkit::getStringTable()->getString("[hp]")); globalContainer->littleFont->popStyle(); if (selBuild->hp <= buildingType->hpMax/5) @@ -3157,7 +3157,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+Y_OFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0/%1").arg(selBuild->hp).arg(buildingType->hpMax).c_str()); globalContainer->littleFont->popStyle(); } @@ -3165,21 +3165,21 @@ void GameGUI::drawBuildingInfos(void) if (buildingType->maxUnitInside && ((selBuild->owner->allies)&(1<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, Toolkit::getStringTable()->getString("[inside]")); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, yPos+Y_OFFSET_TEXT_PARA+Y_OFFSET_TEXT_LINE, globalContainer->littleFont, Toolkit::getStringTable()->getString("[inside]")); 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+Y_OFFSET_TEXT_PARA+2*Y_OFFSET_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+Y_OFFSET_TEXT_PARA+2*Y_OFFSET_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) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, ypos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, globalContainer->littleFont, + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, yPos+Y_OFFSET_TEXT_PARA+2*Y_OFFSET_TEXT_LINE, globalContainer->littleFont, Toolkit::getStringTable()->getString("[Still one]") ); } } @@ -3193,17 +3193,17 @@ 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+Y_OFFSET_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->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_HALF_WIDTH, yPos+Y_OFFSET_TEXT_PARA+Y_OFFSET_TEXT_LINE, + 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+Y_OFFSET_TEXT_PARA+2*Y_OFFSET_TEXT_LINE, globalContainer->littleFont, FormattableString("%0").arg(onSpot).c_str()); } - ypos += YOFFSET_ICON+YOFFSET_B_SEP; + yPos += Y_OFFSET_ICON+Y_OFFSET_B_SEP; // working bar if (buildingType->maxUnitWorking) @@ -3212,35 +3212,35 @@ void GameGUI::drawBuildingInfos(void) { if (selBuild->buildingState==Building::ALIVE) { - // If we're replaying, display the actual number, not the locally cached one (changable by the gui user) + // If we're replaying, display the actual number, not the locally cached one (changeable by the gui user) const int maxUnitsWorking = (globalContainer->replaying?selBuild->maxUnitWorking:selBuild->maxUnitWorkingLocal); std::string working = Toolkit::getStringTable()->getString("[working]"); const int len = globalContainer->littleFont->getStringWidth(working)+4; 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->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()); - drawScrollBox(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos+YOFFSET_TEXT_BAR, maxUnitsWorking, maxUnitsWorking, selBuild->unitsWorking.size(), MAX_UNIT_WORKING); + 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+Y_OFFSET_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) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, yPos, globalContainer->littleFont, Toolkit::getStringTable()->getString("[still one unit working]") ); } } } - if(hilights.find(HilightUnitsAssignedBar) != hilights.end()) + if(highlights.find(HighlightUnitsAssignedBar) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, ypos+6, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, yPos+6, 38)); } - ypos += YOFFSET_BAR+YOFFSET_B_SEP; + yPos += Y_OFFSET_BAR+Y_OFFSET_B_SEP; } // priority buttons @@ -3250,29 +3250,29 @@ void GameGUI::drawBuildingInfos(void) { if(selBuild->buildingState==Building::ALIVE) { - // If we're replaying, display the actual number, not the locally cached one (changable by the gui user) + // If we're replaying, display the actual number, not the locally cached one (changeable by the gui user) const int priority = (globalContainer->replaying?selBuild->priority:selBuild->priorityLocal); - ypos += YOFFSET_B_SEP; + yPos += Y_OFFSET_B_SEP; int width = 128/3; - std::string prioritystr = Toolkit::getStringTable()->getString("[priority]"); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, prioritystr); + std::string priorityStr = Toolkit::getStringTable()->getString("[priority]"); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, yPos, globalContainer->littleFont, priorityStr); - std::string lowstr = Toolkit::getStringTable()->getString("[low priority]"); - std::string medstr = Toolkit::getStringTable()->getString("[medium priority]"); - std::string highstr = Toolkit::getStringTable()->getString("[high priority]"); + std::string lowStr = Toolkit::getStringTable()->getString("[low priority]"); + std::string medStr = Toolkit::getStringTable()->getString("[medium priority]"); + std::string highStr = Toolkit::getStringTable()->getString("[high priority]"); - drawRadioButton(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos+12+4, (priority==-1)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+14, ypos+12+2, globalContainer->littleFont, lowstr); + drawRadioButton(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, yPos+12+4, (priority==-1)); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+14, yPos+12+2, globalContainer->littleFont, lowStr); - drawRadioButton(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+width, ypos+12+4, (priority==0)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+14+width, ypos+12+2, globalContainer->littleFont, medstr); + drawRadioButton(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+width, yPos+12+4, (priority==0)); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+14+width, yPos+12+2, globalContainer->littleFont, medStr); - drawRadioButton(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+width*2, ypos+12+4, (priority==1)); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+14+width*2, ypos+12+2, globalContainer->littleFont, highstr); + drawRadioButton(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+width*2, yPos+12+4, (priority==1)); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+14+width*2, yPos+12+2, globalContainer->littleFont, highStr); - ypos += YOFFSET_BAR+YOFFSET_B_SEP; + yPos += Y_OFFSET_BAR+Y_OFFSET_B_SEP; } } } @@ -3282,111 +3282,111 @@ void GameGUI::drawBuildingInfos(void) { if ((selBuild->owner->allies)&(1<replaying?selBuild->unitStayRange:selBuild->unitStayRangeLocal); std::string range = Toolkit::getStringTable()->getString("[range]"); const int len = globalContainer->littleFont->getStringWidth(range)+4; 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->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()); - drawScrollBox(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos+YOFFSET_TEXT_BAR, selBuild->unitStayRange, unitStayRange, 0, selBuild->type->maxUnitStayRange); + 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+Y_OFFSET_TEXT_BAR, selBuild->unitStayRange, unitStayRange, 0, selBuild->type->maxUnitStayRange); } - ypos += YOFFSET_BAR+YOFFSET_B_SEP; + yPos += Y_OFFSET_BAR+Y_OFFSET_B_SEP; } // flag control of team and allies if ((selBuild->owner->allies) & (1<type == "clearingflag") { - ypos += YOFFSET_B_SEP; - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, + yPos += Y_OFFSET_B_SEP; + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, yPos, globalContainer->littleFont, Toolkit::getStringTable()->getString("[Clearing:]")); - ypos += YOFFSET_TEXT_PARA; + yPos += Y_OFFSET_TEXT_PARA; int j=0; for (int i=0; igfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, ypos, globalContainer->littleFont, - getRessourceName(i)); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, yPos, globalContainer->littleFont, + 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; + yPos+=Y_OFFSET_TEXT_PARA; j++; } } // min war level for war flags: else if (buildingType->type == "warflag") { - ypos += YOFFSET_B_SEP; - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, + yPos += Y_OFFSET_B_SEP; + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, yPos, globalContainer->littleFont, Toolkit::getStringTable()->getString("[Min required level:]")); - ypos += YOFFSET_TEXT_PARA; + yPos += Y_OFFSET_TEXT_PARA; for (int i=0; i<4; i++) { - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, ypos, globalContainer->littleFont, 1+i); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, yPos, globalContainer->littleFont, 1+i); int spriteId; if (i==(globalContainer->replaying?selBuild->minLevelToFlag:selBuild->minLevelToFlagLocal)) 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; + yPos+=Y_OFFSET_TEXT_PARA; } } else if (buildingType->type == "explorationflag") { int spriteId; - ypos += YOFFSET_B_SEP; - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, ypos, globalContainer->littleFont, + yPos += Y_OFFSET_B_SEP; + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, yPos, globalContainer->littleFont, Toolkit::getStringTable()->getString("[Min required level:]")); - ypos += YOFFSET_TEXT_PARA; + yPos += Y_OFFSET_TEXT_PARA; // we use minLevelToFlag as an int which says what magic effect at minimum an explorer // must be able to do to be accepted at this flag // 0 == any explorer // 1 == must be able to attack ground - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, ypos, globalContainer->littleFont,Toolkit::getStringTable()->getString("[any explorer]")); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, yPos, globalContainer->littleFont,Toolkit::getStringTable()->getString("[any explorer]")); if ((globalContainer->replaying?selBuild->minLevelToFlag:selBuild->minLevelToFlagLocal) == 0) 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]")); + yPos += Y_OFFSET_TEXT_PARA; + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+28, yPos, globalContainer->littleFont,Toolkit::getStringTable()->getString("[ground attack]")); if ((globalContainer->replaying?selBuild->minLevelToFlag:selBuild->minLevelToFlagLocal) == 1) spriteId = 20; else spriteId = 19; - globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, ypos+2, globalContainer->gamegui, spriteId); - ypos += YOFFSET_TEXT_PARA; + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+10, yPos+2, globalContainer->gameGui, spriteId); + yPos += Y_OFFSET_TEXT_PARA; } } // 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()); - ypos+=YOFFSET_TEXT_LINE; + 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+=Y_OFFSET_TEXT_LINE; } if (buildingType->maxUnitInside) - ypos += YOFFSET_INFOS; + yPos += Y_OFFSET_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()); - ypos += YOFFSET_TOWER; + 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 += Y_OFFSET_TOWER; } // There is unit inside, show time to leave @@ -3405,7 +3405,7 @@ void GameGUI::drawBuildingInfos(void) int dec = (RIGHT_MENU_RIGHT_OFFSET-128); if (maxTimeTo) { - globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos, 128, 7, 168, 150, 90); + globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, yPos, 128, 7, 168, 150, 90); for (std::list::iterator it=selBuild->unitsInside.begin(); it!=selBuild->unitsInside.end(); ++it) { Unit *u=*it; @@ -3419,115 +3419,115 @@ void GameGUI::drawBuildingInfos(void) if (globalContainer->settings.optionFlags & GlobalContainer::OPTION_LOW_SPEED_GFX) { - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-1-dec, ypos, 7, 17, 30, 64); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-dec, ypos, 7, 63, 111, 149); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+1-dec, ypos, 7, 17, 30, 64); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-1-dec, yPos, 7, 17, 30, 64); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-dec, yPos, 7, 63, 111, 149); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+1-dec, yPos, 7, 17, 30, 64); } else { - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-2-dec, ypos, 7, 17, 30, 64, alpha); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-1-dec, ypos, 7, 17, 30, 64); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-dec, ypos, 7, 17, 30, 64); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+1-dec, ypos, 7, 17, 30, 64); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+2-dec, ypos, 7, 17, 30, 64, 255-alpha); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-2-dec, yPos, 7, 17, 30, 64, alpha); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-1-dec, yPos, 7, 17, 30, 64); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-dec, yPos, 7, 17, 30, 64); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+1-dec, yPos, 7, 17, 30, 64); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+2-dec, yPos, 7, 17, 30, 64, 255-alpha); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-1-dec, ypos, 7, 63, 111, 149, alpha); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-dec, ypos, 7, 63, 111, 149); - globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+1-dec, ypos, 7, 63, 111, 149, 255-alpha); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-1-dec, yPos, 7, 63, 111, 149, alpha); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left-dec, yPos, 7, 63, 111, 149); + globalContainer->gfx->drawVertLine(globalContainer->gfx->getW()-left+1-dec, yPos, 7, 63, 111, 149, 255-alpha); } } } - ypos += YOFFSET_PROGRESS_BAR; - unitInsideBarYDec = YOFFSET_PROGRESS_BAR; + yPos += Y_OFFSET_PROGRESS_BAR; + unitInsideBarYDec = Y_OFFSET_PROGRESS_BAR; } } - ypos += YOFFSET_B_SEP; + yPos += Y_OFFSET_B_SEP; // exchange building if (buildingType->canExchange && ((selBuild->owner->sharedVisionExchange)&(1<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->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); - ypos += YOFFSET_TEXT_PARA; + //globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-36-3, yPos+1, globalContainer->gameGui, EXCHANGE_BUILDING_ICONS); + yPos += Y_OFFSET_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; - if (selBuild->receiveRessourceMaskLocal & (1<receiveResourceMaskLocal & (1<sendRessourceMaskLocal & (1<sendResourceMaskLocal & (1<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; + yPos += Y_OFFSET_TEXT_PARA; } } if ((selBuild->owner->allies) & (1<canExchange) { - // 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]) { - 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; + 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; + yPos += 11; } - ypos+=5; + yPos+=5; } //Unit production ratios and unit production if (buildingType->unitProductionTime) // swarm { int left=(selBuild->productionTimeout*128)/buildingType->unitProductionTime; int elapsed=128-left; - globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, ypos, elapsed, 7, 100, 100, 255); - globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+elapsed, ypos, left, 7, 128, 128, 128); + globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET, yPos, elapsed, 7, 100, 100, 255); + globalContainer->gfx->drawFilledRect(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+elapsed, yPos, left, 7, 128, 128, 128); - ypos+=15; + yPos+=15; for (int i=0; ireplaying?selBuild->ratio[i]:selBuild->ratioLocal[i]); - 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)); + 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(HighlightRatioBar) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET-36, ypos-8, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET-36, yPos-8, 38)); } - ypos+=20; + yPos+=20; } } - // data on whether or not the building is recieving units + // data on whether or not the building is receiving units bool otherFailure=true; for(unsigned j=0; jgetString("[%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); - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+10, ypos, globalContainer->littleFont, s.c_str()); - ypos+=11; + 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; } } } @@ -3603,9 +3603,9 @@ void GameGUI::drawBuildingInfos(void) && mouseY>globalContainer->gfx->getH()-48 && mouseYgfx->getH()-48+16 ) { globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 200, 200, 255)); - int ressources[BASIC_COUNT]; - selBuild->getRessourceCountToRepair(ressources); - drawCosts(ressources, globalContainer->littleFont); + int resources[BASIC_COUNT]; + selBuild->getResourceCountToRepair(resources); + drawCosts(resources, globalContainer->littleFont); globalContainer->littleFont->popStyle(); } } @@ -3621,56 +3621,56 @@ void GameGUI::drawBuildingInfos(void) { globalContainer->littleFont->pushStyle(Font::Style(Font::STYLE_NORMAL, 200, 200, 255)); - // We draw the ressources cost. + // We draw the resources 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; + int blueYPos = Y_POS_BASE_BUILDING + Y_OFFSET_NAME; bt=globalContainer->buildingsTypes.get(bt->nextLevel); if (bt->hpMax) - drawValueAlignedRight(blueYpos+YOFFSET_TEXT_LINE, bt->hpMax); + drawValueAlignedRight(blueYPos+Y_OFFSET_TEXT_LINE, bt->hpMax); if (bt->maxUnitInside) - drawValueAlignedRight(blueYpos+YOFFSET_TEXT_PARA+2*YOFFSET_TEXT_LINE, bt->maxUnitInside); - blueYpos += YOFFSET_ICON+YOFFSET_B_SEP; + drawValueAlignedRight(blueYPos+Y_OFFSET_TEXT_PARA+2*Y_OFFSET_TEXT_LINE, bt->maxUnitInside); + blueYPos += Y_OFFSET_ICON+Y_OFFSET_B_SEP; if (buildingType->maxUnitWorking) - blueYpos += YOFFSET_BAR+YOFFSET_B_SEP; + blueYPos += Y_OFFSET_BAR+Y_OFFSET_B_SEP; if (bt->armor) { if (!buildingType->armor) - globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, blueYpos-1, globalContainer->littleFont, Toolkit::getStringTable()->getString("[armor]")); - drawValueAlignedRight(blueYpos-1, bt->armor); - blueYpos+=YOFFSET_TEXT_LINE; + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_RIGHT_OFFSET+4, blueYPos-1, globalContainer->littleFont, Toolkit::getStringTable()->getString("[armor]")); + drawValueAlignedRight(blueYPos-1, bt->armor); + blueYPos+=Y_OFFSET_TEXT_LINE; } if (buildingType->maxUnitInside) - blueYpos += YOFFSET_INFOS; + blueYPos += Y_OFFSET_INFOS; if (bt->shootDamage) { - drawValueAlignedRight(blueYpos+1, bt->shootDamage); - drawValueAlignedRight(blueYpos+12, bt->shootingRange); - blueYpos += YOFFSET_TOWER; + drawValueAlignedRight(blueYPos+1, bt->shootDamage); + drawValueAlignedRight(blueYPos+12, bt->shootingRange); + blueYPos += Y_OFFSET_TOWER; } - blueYpos += unitInsideBarYDec; - blueYpos += YOFFSET_B_SEP; + blueYPos += unitInsideBarYDec; + blueYPos += Y_OFFSET_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++; } } if (bt->maxBullets) { - drawValueAlignedRight(blueYpos+(j*11), bt->maxBullets); + drawValueAlignedRight(blueYPos+(j*11), bt->maxBullets); j++; } @@ -3693,34 +3693,34 @@ 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 = Y_POS_BASE_RESOURCE; if (r.type!=NO_RES_TYPE) { - // Draw ressource name - const std::string &ressourceName = getRessourceName(r.type); - int titleLen = globalContainer->littleFont->getStringWidth(ressourceName.c_str()); + // Draw resource name + const std::string &resourceName = getResourceName(r.type); + int titleLen = globalContainer->littleFont->getStringWidth(resourceName.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; + globalContainer->gfx->drawString(titlePos, yPos+(Y_OFFSET_TEXT_PARA>>1), globalContainer->littleFont, resourceName.c_str()); + yPos += 2*Y_OFFSET_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()); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-64, yPos+((32-amountSH)>>1), globalContainer->littleFont, amountS.c_str()); } } else @@ -3733,25 +3733,25 @@ void GameGUI::drawReplayPanel(void) { Font *font=globalContainer->littleFont; - int x = globalContainer->gfx->getW()-RIGHT_MENU_WIDTH + REPLAY_PANEL_XOFFSET; - int y = REPLAY_PANEL_YOFFSET; + int x = globalContainer->gfx->getW()-RIGHT_MENU_WIDTH + REPLAY_PANEL_X_OFFSET; + int y = REPLAY_PANEL_Y_OFFSET; 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_PLAYER_LIST_Y_OFFSET, font, FormattableString("%0:").arg(Toolkit::getStringTable()->getString("[players]"))); for (int i = 0; i < game.teamsCount(); i++) { // I know this is a matter of taste, but I prefer checkboxes here. Radio buttons are a totally different style - //drawRadioButton(x, y + REPLAY_PANEL_PLAYERLIST_YOFFSET + (i+1)*inc, game.teams[i]->getFirstPlayerName().c_str(), localTeamNo == i); - drawRadioButton(x + 1, y + REPLAY_PANEL_PLAYERLIST_YOFFSET + (i+1)*inc + 1, localTeamNo == i); - globalContainer->gfx->drawString(x + 20, y + REPLAY_PANEL_PLAYERLIST_YOFFSET + (i+1)*inc, font, game.teams[i]->getFirstPlayerName().c_str()); + //drawRadioButton(x, y + REPLAY_PANEL_PLAYER_LIST_Y_OFFSET + (i+1)*inc, game.teams[i]->getFirstPlayerName().c_str(), localTeamNo == i); + drawRadioButton(x + 1, y + REPLAY_PANEL_PLAYER_LIST_Y_OFFSET + (i+1)*inc + 1, localTeamNo == i); + globalContainer->gfx->drawString(x + 20, y + REPLAY_PANEL_PLAYER_LIST_Y_OFFSET + (i+1)*inc, font, game.teams[i]->getFirstPlayerName().c_str()); } } @@ -3786,20 +3786,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 @@ -3816,7 +3816,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') @@ -3829,7 +3829,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') @@ -3847,7 +3847,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); } } } @@ -3866,13 +3866,13 @@ 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(HighlightRightSidePanel) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, globalContainer->gfx->getH()/2, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36, globalContainer->gfx->getH()/2, 38)); } // draw the panel selection buttons - drawPanelButtons(YPOS_BASE_DEFAULT-32); + drawPanelButtons(Y_POS_BASE_DEFAULT-32); switch(selectionMode) { @@ -3882,8 +3882,8 @@ void GameGUI::drawPanel(void) case UNIT_SELECTION: drawUnitInfos(); break; - case RESSOURCE_SELECTION: - drawRessourceInfos(); + case RESOURCE_SELECTION: + drawResourceInfos(); break; default: if (!globalContainer->replaying) @@ -3891,20 +3891,20 @@ void GameGUI::drawPanel(void) switch(displayMode) { case CONSTRUCTION_VIEW: - drawChoice(YPOS_BASE_CONSTRUCTION, buildingsChoiceName, buildingsChoiceState); + drawChoice(Y_POS_BASE_CONSTRUCTION, buildingsChoiceName, buildingsChoiceState); break; case FLAG_VIEW: drawFlagView(); break; case STAT_TEXT_VIEW: - teamStats->drawText(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+RIGHT_MENU_OFFSET, YPOS_BASE_STAT); + teamStats->drawText(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+RIGHT_MENU_OFFSET, Y_POS_BASE_STAT); break; case STAT_GRAPH_VIEW: - teamStats->drawStat(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+RIGHT_MENU_OFFSET, YPOS_BASE_STAT); - drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+140+64, Toolkit::getStringTable()->getString("[Starving Map]"), showStarvingMap); - drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+140+88, Toolkit::getStringTable()->getString("[Damaged Map]"), showDamagedMap); - drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+140+112, Toolkit::getStringTable()->getString("[Defense Map]"), showDefenseMap); - drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+140+136, Toolkit::getStringTable()->getString("[Fertility Map]"), showFertilityMap); + teamStats->drawStat(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+RIGHT_MENU_OFFSET, Y_POS_BASE_STAT); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+140+64, Toolkit::getStringTable()->getString("[Starving Map]"), showStarvingMap); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+140+88, Toolkit::getStringTable()->getString("[Damaged Map]"), showDamagedMap); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+140+112, Toolkit::getStringTable()->getString("[Defense Map]"), showDefenseMap); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+140+136, Toolkit::getStringTable()->getString("[Fertility Map]"), showFertilityMap); break; default: std::cout << "Was not expecting displayMode" << displayMode; @@ -3919,16 +3919,16 @@ 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()); - teamStats->drawText(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+RIGHT_MENU_OFFSET, YPOS_BASE_STAT+15); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+15, Y_POS_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, Y_POS_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()); - 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); - drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+155+112, Toolkit::getStringTable()->getString("[Defense Map]"), showDefenseMap); - drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, YPOS_BASE_STAT+155+136, Toolkit::getStringTable()->getString("[Fertility Map]"), showFertilityMap); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+15, Y_POS_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, Y_POS_BASE_STAT+15); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+155+64, Toolkit::getStringTable()->getString("[Starving Map]"), showStarvingMap); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+155+88, Toolkit::getStringTable()->getString("[Damaged Map]"), showDamagedMap); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+155+112, Toolkit::getStringTable()->getString("[Defense Map]"), showDefenseMap); + drawCheckButton(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+8, Y_POS_BASE_STAT+155+136, Toolkit::getStringTable()->getString("[Fertility Map]"), showFertilityMap); break; default: std::cout << "Was not expecting replayDisplayMode" << replayDisplayMode; @@ -3942,43 +3942,43 @@ void GameGUI::drawFlagView(void) { int dec = (RIGHT_MENU_WIDTH - 128)/2; // draw flags - drawChoice(YPOS_BASE_FLAG, flagsChoiceName, flagsChoiceState, 3); + drawChoice(Y_POS_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, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH, globalContainer->gameGui, 13); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+48+dec, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH, globalContainer->gameGui, 14); + globalContainer->gfx->drawSprite(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+88+dec, Y_POS_BASE_FLAG+Y_OFFSET_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, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH, globalContainer->gameGui, 22); } - if(hilights.find(HilightForbiddenZoneOnPanel) != hilights.end()) + if(highlights.find(HighlightForbiddenZoneOnPanel) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+8+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+8+dec, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH, 38)); } - if(hilights.find(HilightGuardZoneOnPanel) != hilights.end()) + if(highlights.find(HighlightGuardZoneOnPanel) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+48+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+48+dec, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH, 38)); } - if(hilights.find(HilightClearingZoneOnPanel) != hilights.end()) + if(highlights.find(HighlightClearingZoneOnPanel) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+88+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+88+dec, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH, 38)); } // draw brush - brush.draw(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH+40); + brush.draw(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+dec, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH+40); - if(hilights.find(HilightBrushSelector) != hilights.end()) + if(highlights.find(HighlightBrushSelector) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+dec, YPOS_BASE_FLAG+YOFFSET_BRUSH+40+30, 38)); + arrowPositions.push_back(HighlightArrowPosition(globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-36+dec, Y_POS_BASE_FLAG+Y_OFFSET_BRUSH+40+30, 38)); } // draw brush help text - if ((mouseX>globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+dec) && (mouseY>YPOS_BASE_FLAG+YOFFSET_BRUSH)) + if ((mouseX>globalContainer->gfx->getW()-RIGHT_MENU_WIDTH+dec) && (mouseY>Y_POS_BASE_FLAG+Y_OFFSET_BRUSH)) { int buildingInfoStart = globalContainer->gfx->getH()-50; - if (mouseYgfx->getW() + RIGHT_MENU_WIDTH; if (panelMouseX < 44) @@ -4021,7 +4021,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); @@ -4036,36 +4036,36 @@ 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(HighlightWorkersWorkingFreeStat) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(dec+22, 32, 39)); + arrowPositions.push_back(HighlightArrowPosition(dec+22, 32, 39)); } - else if(i==WARRIOR && hilights.find(HilightExplorersWorkingFreeStat) != hilights.end()) + else if(i==WARRIOR && highlights.find(HighlightExplorersWorkingFreeStat) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(dec+22, 32, 39)); + arrowPositions.push_back(HighlightArrowPosition(dec+22, 32, 39)); } - else if(i==EXPLORER && hilights.find(HilightWarriorsWorkingFreeStat) != hilights.end()) + else if(i==EXPLORER && highlights.find(HighlightWarriorsWorkingFreeStat) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(dec+22, 32, 39)); + arrowPositions.push_back(HighlightArrowPosition(dec+22, 32, 39)); } dec += 70; } // 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; @@ -4092,11 +4092,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); } @@ -4106,7 +4106,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) ) @@ -4115,7 +4115,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 @@ -4123,11 +4123,11 @@ 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(HighlightMainMenuIcon) != highlights.end()) { - arrowPositions.push_back(HilightArrowPosition(pos-32, 32, 43)); + arrowPositions.push_back(HighlightArrowPosition(pos-32, 32, 43)); } } @@ -4175,10 +4175,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); @@ -4187,25 +4187,25 @@ void GameGUI::drawOverlayInfos(void) // draw message List if (game.anyPlayerWaited && game.maskAwayPlayer && game.anyPlayerWaitedTimeFor>2) { - int nbap=0; // Number of away players + int nBap=0; // Number of away players Uint32 pm=1; Uint32 apm=game.maskAwayPlayer; for(int pi=0; pigfx->drawFilledRect(32, 32, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64, 22+nbap*20, 0, 0, 140, 127); - globalContainer->gfx->drawRect(32, 32, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64, 22+nbap*20, 255, 255, 255); + globalContainer->gfx->drawFilledRect(32, 32, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64, 22+nBap*20, 0, 0, 140, 127); + globalContainer->gfx->drawRect(32, 32, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64, 22+nBap*20, 255, 255, 255); pm=1; int pnb=0; for(int pi2=0; pi2gfx->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; @@ -4213,8 +4213,8 @@ void GameGUI::drawOverlayInfos(void) } else { - int ymesg = 32; - int yinc = 0; + int yMsg = 32; + int yInc = 0; // TODO: die with SGSL // show script text @@ -4222,20 +4222,20 @@ void GameGUI::drawOverlayInfos(void) { std::vector lines; setMultiLine(game.sgslScript.textShown, &lines); - globalContainer->gfx->drawFilledRect(24, ymesg-8, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64+16, lines.size()*20+16, 0,0,0,128); + globalContainer->gfx->drawFilledRect(24, yMsg-8, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64+16, lines.size()*20+16, 0,0,0,128); for (unsigned i=0; igfx->drawString(32, ymesg+yinc, globalContainer->standardFont, lines[i].c_str()); - yinc += 20; + globalContainer->gfx->drawString(32, yMsg+yInc, globalContainer->standardFont, lines[i].c_str()); + yInc += 20; } if (swallowSpaceKey) { - globalContainer->gfx->drawFilledRect(24, ymesg+yinc+8, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64+16, 20, 0,0,0,128); - globalContainer->gfx->drawString(32, ymesg+yinc, globalContainer->standardFont, Toolkit::getStringTable()->getString("[press space]")); - yinc += 20; + globalContainer->gfx->drawFilledRect(24, yMsg+yInc+8, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64+16, 20, 0,0,0,128); + globalContainer->gfx->drawString(32, yMsg+yInc, globalContainer->standardFont, Toolkit::getStringTable()->getString("[press space]")); + yInc += 20; } - yinc += 8; + yInc += 8; } // show script text @@ -4243,24 +4243,24 @@ void GameGUI::drawOverlayInfos(void) { std::vector lines; setMultiLine(scriptText, &lines); - globalContainer->gfx->drawFilledRect(24, ymesg-8, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64+16, lines.size()*20+16, 0,0,0,128); + globalContainer->gfx->drawFilledRect(24, yMsg-8, globalContainer->gfx->getW()-RIGHT_MENU_WIDTH-64+16, lines.size()*20+16, 0,0,0,128); for (unsigned i=0; igfx->drawString(32, ymesg+yinc, globalContainer->standardFont, lines[i].c_str()); - yinc += 20; + globalContainer->gfx->drawString(32, yMsg+yInc, globalContainer->standardFont, lines[i].c_str()); + yInc += 20; } } // 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()); - yinc = std::max(yinc, 32); + globalContainer->gfx->drawString(globalContainer->gfx->getW()-165, yMsg, globalContainer->standardFont, FormattableString("%0").arg(game.sgslScript.getMainTimer()).c_str()); + yInc = std::max(yInc, 32); } - ymesg += yinc+2; + yMsg += yInc+2; - messageManager.drawAllGameMessages(32, ymesg); + messageManager.drawAllGameMessages(32, yMsg); } // display map mark @@ -4276,27 +4276,27 @@ void GameGUI::drawOverlayInfos(void) globalContainer->standardFont->popStyle(); } - // Draw icon if trasmitting + // Draw icon if transmitting 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; + int xInc = 42; for(int p=0; pmix->isPlayerTransmittingVoice(p)) { - if(xinc==42) + if(xInc==42) { - globalContainer->gamegui->setBaseColor(game.teams[game.players[p]->teamNumber]->color); - globalContainer->gfx->drawSprite(42, globalContainer->gfx->getH()-55, globalContainer->gamegui, 30); - xinc += 47; + 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()); globalContainer->standardFont->pushStyle(Font::Style(Font::STYLE_NORMAL, game.teams[game.players[p]->teamNumber]->color)); - globalContainer->gfx->drawString(xinc, globalContainer->gfx->getH()-35-height/2, globalContainer->standardFont, game.players[p]->name); - xinc += globalContainer->standardFont->getStringWidth(game.players[p]->name.c_str()) + 5; + globalContainer->gfx->drawString(xInc, globalContainer->gfx->getH()-35-height/2, globalContainer->standardFont, game.players[p]->name); + xInc += globalContainer->standardFont->getStringWidth(game.players[p]->name.c_str()) + 5; globalContainer->standardFont->popStyle(); } } @@ -4304,7 +4304,7 @@ void GameGUI::drawOverlayInfos(void) if(!scrollableText) messageManager.drawAllChatMessages(32, globalContainer->gfx->getH() - 165); - // Draw the bar contining number of units, CPU load, etc... + // Draw the bar continuing number of units, CPU load, etc... drawTopScreenBar(); } @@ -4388,7 +4388,7 @@ void GameGUI::drawAll(int team) ((globalContainer->replaying && !globalContainer->replayShowFog) ? Game::DRAW_WHOLE_MAP : 0) | Game::DRAW_AREA; - updateHilightInGame(); + updateHighlightInGame(); arrowPositions.clear(); if (globalContainer->settings.optionFlags & GlobalContainer::OPTION_LOW_SPEED_GFX) { @@ -4465,10 +4465,10 @@ void GameGUI::drawAll(int team) if (scrollableText) drawInGameScrollableText(); - // draw the hilight arrows + // draw the highlight 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); } } @@ -4540,21 +4540,21 @@ void GameGUI::executeOrder(boost::shared_ptr order) if (messageOrderType==MessageOrder::NORMAL_MESSAGE_TYPE) { - if (mo->recepientsMask &(1<name).arg(mo->getText()), true); + if (mo->recipientsMask &(1<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); + if (mo->recipientsMask &(1< %2").arg(Toolkit::getStringTable()->getString("[from:]")).arg(game.players[sp]->name).arg(mo->getText()), true); else if (sp==localPlayer) { - Uint32 rm=mo->recepientsMask; + Uint32 rm=mo->recipientsMask; int k; 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 @@ -4571,7 +4571,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); } @@ -4581,7 +4581,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; @@ -4662,7 +4662,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 @@ -4756,7 +4756,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; @@ -4792,17 +4792,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(); } @@ -4812,10 +4812,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(); } @@ -4862,9 +4862,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; } } @@ -5020,8 +5020,8 @@ void GameGUI::dumpUnitInformation(void) if(game.selectedUnit != NULL) { Unit* unit = game.selectedUnit; - std::cout<<"unit->posx = "<posX<posy = "<posY<posX = "<posX<posY = "<posY<gid = "<gid<medical = "<medical<activity = "<activity< *o std::string lastWord; std::string lastLine; - std::string ninput=input; - if(ninput[ninput.length()-1] != ' ') - ninput += " "; + std::string nInput=input; + if(nInput[nInput.length()-1] != ' ') + nInput += " "; - while (posstandardFont->getStringWidth(lastLine.c_str()); int actWordLength = globalContainer->standardFont->getStringWidth(lastWord.c_str()); @@ -5200,7 +5200,7 @@ void GameGUI::setMultiLine(const std::string &input, std::vector *o } else { - lastWord += ninput[pos]; + lastWord += nInput[pos]; } pos++; } @@ -5219,7 +5219,7 @@ void GameGUI::addMessage(const GAGCore::Color& color, const std::string &msgText setMultiLine(msgText, &messages); globalContainer->standardFont->popStyle(); - ///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--) { diff --git a/src/GameGUI.h b/src/GameGUI.h index b43db896..6602ac55 100644 --- a/src/GameGUI.h +++ b/src/GameGUI.h @@ -132,55 +132,55 @@ class GameGUI /// Show the dialog that says that the replay ended void showEndOfReplayScreen(); - ///This is an enum for the current hilight object. The hilighted object is shown with a large arrow. + ///This is an enum for the current highlight object. The highlighted object is shown with a large arrow. ///This is primarily for tutorials - enum HilightObject + enum HighlightObject { - ///This causes the main menu icon to be hilighted - HilightMainMenuIcon=1, - ///This causes all workers on the map to be hilighted - HilightWorkers=2, - ///This causes all explorers on the map to be hilighted - HilightExplorers=3, - ///This causes all warriors on the map to be hilighted - HilightWarriors=4, - ///This causes the right-side menu to be hilighted - HilightRightSidePanel=5, - ///This causes the minimap icons to be hilighted - HilightUnderMinimapIcon=6, - ///This causes the units working bar to be hilighted - HilightUnitsAssignedBar=7, - ///This causes the worker/explorer/warrior ratio bars on a swarm to be hilighted - HilightRatioBar=8, - ///This causes the workers working/free statistic to be hilighted - HilightWorkersWorkingFreeStat=9, - ///This causes the exploresrs working/free statistic to be hilighted - HilightExplorersWorkingFreeStat=10, - ///This causes the warriors working/free statistic to be hilighted - HilightWarriorsWorkingFreeStat=11, - ///This causes the forbidden zone to be hilighted - HilightForbiddenZoneOnPanel=12, - ///This causes the defense zone to be hilighted - HilightGuardZoneOnPanel=13, - ///This causes the clearing zone to be hilighted - HilightClearingZoneOnPanel=14, - ///This causes the brush selector to be hilighted - HilightBrushSelector=15, + ///This causes the main menu icon to be highlighted + HighlightMainMenuIcon=1, + ///This causes all workers on the map to be highlighted + HighlightWorkers=2, + ///This causes all explorers on the map to be highlighted + HighlightExplorers=3, + ///This causes all warriors on the map to be highlighted + HighlightWarriors=4, + ///This causes the right-side menu to be highlighted + HighlightRightSidePanel=5, + ///This causes the minimap icons to be highlighted + HighlightUnderMinimapIcon=6, + ///This causes the units working bar to be highlighted + HighlightUnitsAssignedBar=7, + ///This causes the worker/explorer/warrior ratio bars on a swarm to be highlighted + HighlightRatioBar=8, + ///This causes the workers working/free statistic to be highlighted + HighlightWorkersWorkingFreeStat=9, + ///This causes the explores working/free statistic to be highlighted + HighlightExplorersWorkingFreeStat=10, + ///This causes the warriors working/free statistic to be highlighted + HighlightWarriorsWorkingFreeStat=11, + ///This causes the forbidden zone to be highlighted + HighlightForbiddenZoneOnPanel=12, + ///This causes the defense zone to be highlighted + HighlightGuardZoneOnPanel=13, + ///This causes the clearing zone to be highlighted + HighlightClearingZoneOnPanel=14, + ///This causes the brush selector to be highlighted + HighlightBrushSelector=15, - ///Anything above this number causes a particular building on the right side menu to be hilighted, - ///the value is HilightBuilding+IntBuildingType - HilightBuildingOnPanel=50, - ///Anything above this number causes the particular building on the actual map to be hilighted - ///the value is HilightBuilding+IntBuildingType - HilightBuildingOnMap=100, + ///Anything above this number causes a particular building on the right side menu to be highlighted, + ///the value is HighlightBuilding+IntBuildingType + HighlightBuildingOnPanel=50, + ///Anything above this number causes the particular building on the actual map to be highlighted + ///the value is HighlightBuilding+IntBuildingType + HighlightBuildingOnMap=100, }; - ///Stores the currently hilighted elements - std::set hilights; + ///Stores the currently highlighted elements + std::set highlights; - struct HilightArrowPosition + struct HighlightArrowPosition { - HilightArrowPosition(int x, int y, int sprite) : x(x), y(y), sprite(sprite) {} + HighlightArrowPosition(int x, int y, int sprite) : x(x), y(y), sprite(sprite) {} int x; int y; int sprite; @@ -188,10 +188,10 @@ class GameGUI ///The arrows must be the last things to be drawn, ///So there positions are stored during the drawing ///proccess, and they are drawn last - std::vector arrowPositions; + std::vector arrowPositions; - ///This sends the hilight values to the Game class, setting Game::highlightBuildingType and Game::highlightUnitType - void updateHilightInGame(); + ///This sends the highlight values to the Game class, setting Game::highlightBuildingType and Game::highlightUnitType + void updateHighlightInGame(); KeyboardManager keyboardManager; public: @@ -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/GameGUIDefaultAssignManager.h b/src/GameGUIDefaultAssignManager.h index 57bcd3ce..7e402ff5 100644 --- a/src/GameGUIDefaultAssignManager.h +++ b/src/GameGUIDefaultAssignManager.h @@ -39,7 +39,7 @@ class GameGUIDefaultAssignManager ///Constructs a GameGUIDefaultAssignManager GameGUIDefaultAssignManager(); - ///Retrive the default assigned units for a given building typenum (note, not the + ///Retrieve the default assigned units for a given building typenum (note, not the ///ntBuildingType typenum, the BuildingTypes typenum) int getDefaultAssignedUnits(int typenum); diff --git a/src/GameGUIDialog.cpp b/src/GameGUIDialog.cpp index 6e2ccc15..a863f4c9 100644 --- a/src/GameGUIDialog.cpp +++ b/src/GameGUIDialog.cpp @@ -257,12 +257,12 @@ void InGameAllianceScreen::onAction(Widget *source, Action action, int par1, int -int InGameAllianceScreen::countNumberPlayersForLocalTeam(GameHeader& gameHeader, int localteam) +int InGameAllianceScreen::countNumberPlayersForLocalTeam(GameHeader& gameHeader, int localTeam) { int count = 0; for (int i=0; igfx->getW() << "x" << globalContainer->gfx->getH(); - if (globalContainer->gfx->getOptionFlags() & GraphicContext::USEGPU) + if (globalContainer->gfx->getOptionFlags() & GraphicContext::USE_GPU) oss << " GL"; else oss << " SDL"; diff --git a/src/GameGUIDialog.h b/src/GameGUIDialog.h index ddcd95e9..69082a02 100644 --- a/src/GameGUIDialog.h +++ b/src/GameGUIDialog.h @@ -94,7 +94,7 @@ class InGameAllianceScreen:public OverlayScreen InGameAllianceScreen(GameGUI *gameGUI); virtual ~InGameAllianceScreen() { } virtual void onAction(Widget *source, Action action, int par1, int par2); - int countNumberPlayersForLocalTeam(GameHeader& gameHeader, int localteam); + int countNumberPlayersForLocalTeam(GameHeader& gameHeader, int localTeam); Uint32 getAlliedMask(void); Uint32 getEnemyMask(void); Uint32 getExchangeVisionMask(void); diff --git a/src/GameGUIGhostBuildingManager.h b/src/GameGUIGhostBuildingManager.h index c06a5b22..4a9fb34b 100644 --- a/src/GameGUIGhostBuildingManager.h +++ b/src/GameGUIGhostBuildingManager.h @@ -26,7 +26,7 @@ class Game; ///GameGUIGhostBuildingManager causes 'ghosts' of buildings to be drawn on the map in -///the time inbetween when the user clicks the button to construct a building, and when +///the time in between when the user clicks the button to construct a building, and when ///the building is actually constructed. This time is 0 for local games, but for online ///games it can be as high as 2 seconds with bad connections. class GameGUIGhostBuildingManager diff --git a/src/GameGUIKeyActions.h b/src/GameGUIKeyActions.h index 3bf5d54c..d0c2fb2c 100644 --- a/src/GameGUIKeyActions.h +++ b/src/GameGUIKeyActions.h @@ -16,8 +16,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GAMEGUI_KEY_ACTIONS_H -#define __GAMEGUI_KEY_ACTIONS_H +#ifndef __GAME_GUI_KEY_ACTIONS_H +#define __GAME_GUI_KEY_ACTIONS_H #include "SDL.h" #include diff --git a/src/GameGUIMessageManager.h b/src/GameGUIMessageManager.h index 9e3efd0b..594a94ae 100644 --- a/src/GameGUIMessageManager.h +++ b/src/GameGUIMessageManager.h @@ -46,7 +46,7 @@ class InGameMessage std::string getText() const; protected: friend class GameGUIMessageManager; - ///This draws the message at the given x,y pixel cordinates, and updates the timer + ///This draws the message at the given x,y pixel coordinates, and updates the timer void draw(int x, int y); int timeLeft; private: diff --git a/src/GameGUIToolManager.cpp b/src/GameGUIToolManager.cpp index 4074a709..ffef79e9 100644 --- a/src/GameGUIToolManager.cpp +++ b/src/GameGUIToolManager.cpp @@ -35,7 +35,7 @@ using namespace GAGCore; GameGUIToolManager::GameGUIToolManager(Game& game, BrushTool& brush, GameGUIDefaultAssignManager& defaultAssign, GameGUIGhostBuildingManager& ghostManager) : game(game), brush(brush), defaultAssign(defaultAssign), ghostManager(ghostManager) { - hilightStrength = 0; + highlightStrength = 0; mode = NoTool; zoneType = Forbidden; firstPlacementX=-1; @@ -44,10 +44,10 @@ GameGUIToolManager::GameGUIToolManager(Game& game, BrushTool& brush, GameGUIDefa -void GameGUIToolManager::activateBuildingTool(const std::string& nbuilding) +void GameGUIToolManager::activateBuildingTool(const std::string& building) { mode = PlaceBuilding; - building = nbuilding; + this->building = building; firstPlacementX = -1; firstPlacementY = -1; } @@ -85,7 +85,7 @@ void GameGUIToolManager::deactivateTool() -void GameGUIToolManager::drawTool(int mouseX, int mouseY, int localteam, int viewportX, int viewportY) +void GameGUIToolManager::drawTool(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY) { if(mode == PlaceBuilding) { @@ -102,17 +102,17 @@ void GameGUIToolManager::drawTool(int mouseX, int mouseY, int localteam, int vie SDL_Keymod modState = SDL_GetModState(); if(!(modState & KMOD_CTRL || modState & KMOD_SHIFT) || firstPlacementX==-1) { - drawBuildingAt(mapX, mapY, localteam, viewportX, viewportY); + drawBuildingAt(mapX, mapY, localTeam, viewportX, viewportY); } ///This allows the drag-placing of walls else if(modState & KMOD_CTRL) { - computeBuildingLine(firstPlacementX, firstPlacementY, mapX, mapY, localteam, viewportX, viewportY, 1); + computeBuildingLine(firstPlacementX, firstPlacementY, mapX, mapY, localTeam, viewportX, viewportY, 1); } ///This allows the placing of a square of buildings else if(modState & KMOD_SHIFT) { - computeBuildingBox(firstPlacementX, firstPlacementY, mapX, mapY, localteam, viewportX, viewportY, 1); + computeBuildingBox(firstPlacementX, firstPlacementY, mapX, mapY, localTeam, viewportX, viewportY, 1); } } else if(mode == PlaceZone) @@ -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) @@ -170,7 +170,7 @@ GameGUIToolManager::ZoneType GameGUIToolManager::getZoneType() const -void GameGUIToolManager::handleMouseDown(int mouseX, int mouseY, int localteam, int viewportX, int viewportY) +void GameGUIToolManager::handleMouseDown(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY) { if(mode == PlaceBuilding) { @@ -206,17 +206,17 @@ void GameGUIToolManager::handleMouseDown(int mouseX, int mouseY, int localteam, brushAccumulator.firstY=mapY; } - handleZonePlacement(mouseX, mouseY, localteam, viewportX, viewportY); + handleZonePlacement(mouseX, mouseY, localTeam, viewportX, viewportY); } } -void GameGUIToolManager::handleMouseUp(int mouseX, int mouseY, int localteam, int viewportX, int viewportY) +void GameGUIToolManager::handleMouseUp(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY) { if(mode == PlaceZone) { - flushBrushOrders(localteam); + flushBrushOrders(localTeam); } if(mode == PlaceBuilding) { @@ -238,17 +238,17 @@ void GameGUIToolManager::handleMouseUp(int mouseX, int mouseY, int localteam, in SDL_Keymod modState = SDL_GetModState(); if(!(modState & KMOD_CTRL || modState & KMOD_SHIFT) || firstPlacementX==-1) { - placeBuildingAt(mapX, mapY, localteam); + placeBuildingAt(mapX, mapY, localTeam); } ///This allows the placing of a line of buildings else if(modState & KMOD_CTRL) { - computeBuildingLine(firstPlacementX, firstPlacementY, mapX, mapY, localteam, viewportX, viewportY, 2); + computeBuildingLine(firstPlacementX, firstPlacementY, mapX, mapY, localTeam, viewportX, viewportY, 2); } ///This allows the placing of a square of buildings else if(modState & KMOD_SHIFT) { - computeBuildingBox(firstPlacementX, firstPlacementY, mapX, mapY, localteam, viewportX, viewportY, 2); + computeBuildingBox(firstPlacementX, firstPlacementY, mapX, mapY, localTeam, viewportX, viewportY, 2); } } firstPlacementX=-1; @@ -257,11 +257,11 @@ void GameGUIToolManager::handleMouseUp(int mouseX, int mouseY, int localteam, in -void GameGUIToolManager::handleMouseDrag(int mouseX, int mouseY, int localteam, int viewportX, int viewportY) +void GameGUIToolManager::handleMouseDrag(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY) { if(mode == PlaceZone) { - handleZonePlacement(mouseX, mouseY, localteam, viewportX, viewportY); + handleZonePlacement(mouseX, mouseY, localTeam, viewportX, viewportY); } } @@ -280,7 +280,7 @@ boost::shared_ptr GameGUIToolManager::getOrder() -void GameGUIToolManager::handleZonePlacement(int mouseX, int mouseY, int localteam, int viewportX, int viewportY) +void GameGUIToolManager::handleZonePlacement(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY) { // we add brush to accumulator int mapX, mapY; @@ -334,27 +334,27 @@ void GameGUIToolManager::handleZonePlacement(int mouseX, int mouseY, int localte // if we have an area over 32x32, which mean over 128 bytes, send it if (brushAccumulator.getAreaSurface() > 32*32) { - flushBrushOrders(localteam); + flushBrushOrders(localTeam); } } -void GameGUIToolManager::flushBrushOrders(int localteam) +void GameGUIToolManager::flushBrushOrders(int localTeam) { if (brushAccumulator.getApplicationCount() > 0) { if (zoneType == Forbidden) { - orders.push(boost::shared_ptr(new OrderAlterateForbidden(localteam, brush.getType(), &brushAccumulator, &game.map))); + orders.push(boost::shared_ptr(new OrderAlterForbidden(localTeam, brush.getType(), &brushAccumulator, &game.map))); } else if (zoneType == Guard) { - orders.push(boost::shared_ptr(new OrderAlterateGuardArea(localteam, brush.getType(), &brushAccumulator, &game.map))); + orders.push(boost::shared_ptr(new OrderAlterGuardArea(localTeam, brush.getType(), &brushAccumulator, &game.map))); } else if (zoneType == Clearing) { - orders.push(boost::shared_ptr(new OrderAlterateClearArea(localteam, brush.getType(), &brushAccumulator, &game.map))); + orders.push(boost::shared_ptr(new OrderAlterClearArea(localTeam, brush.getType(), &brushAccumulator, &game.map))); } else assert(false); @@ -364,10 +364,10 @@ void GameGUIToolManager::flushBrushOrders(int localteam) -void GameGUIToolManager::placeBuildingAt(int mapX, int mapY, int localteam) +void GameGUIToolManager::placeBuildingAt(int mapX, int mapY, int localTeam) { // Count down whether a building site can be placed - if (game.teams[localteam]->noMoreBuildingSitesCountdown==0) + if (game.teams[localTeam]->noMoreBuildingSitesCountdown==0) { // we get the type of building // try to get the building site, if it doesn't exists, get the finished building (for flags) @@ -384,7 +384,7 @@ void GameGUIToolManager::placeBuildingAt(int mapX, int mapY, int localteam) int tempX = mapX, tempY = mapY; bool isRoom; if (bt->isVirtual) - isRoom=game.checkRoomForBuilding(tempX, tempY, bt, &mapX, &mapY, localteam); + isRoom=game.checkRoomForBuilding(tempX, tempY, bt, &mapX, &mapY, localTeam); else isRoom=game.checkHardRoomForBuilding(tempX, tempY, bt, &mapX, &mapY); @@ -401,14 +401,14 @@ void GameGUIToolManager::placeBuildingAt(int mapX, int mapY, int localteam) if(bt->isVirtual) r = globalContainer->settings.defaultFlagRadius[bt->shortTypeNum - IntBuildingType::EXPLORATION_FLAG]; ghostManager.addBuilding(building, mapX, mapY); - orders.push(boost::shared_ptr(new OrderCreate(localteam, mapX, mapY, typeNum, unitWorking, unitWorkingFuture, r))); + orders.push(boost::shared_ptr(new OrderCreate(localTeam, mapX, mapY, typeNum, unitWorking, unitWorkingFuture, r))); } } } -void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int viewportX, int viewportY) +void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localTeam, int viewportX, int viewportY) { // Get the type and sprite int typeNum = globalContainer->buildingsTypes.getTypeNum(building, 0, false); @@ -418,7 +418,7 @@ void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int v int tempX = mapX, tempY = mapY; bool isRoom; if (bt->isVirtual) - isRoom=game.checkRoomForBuilding(mapX, mapY, bt, &tempX, &tempY, localteam); + isRoom=game.checkRoomForBuilding(mapX, mapY, bt, &tempX, &tempY, localTeam); else isRoom=game.checkHardRoomForBuilding(mapX, mapY, bt, &tempX, &tempY); @@ -426,11 +426,11 @@ void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int v if(ghostManager.isGhostBuilding(tempX, tempY, bt->width, bt->height)) isRoom = false; - // Increase/Decrease hilight strength, given whether there is room or not + // Increase/Decrease highlight strength, given whether there is room or not if (isRoom) - hilightStrength = std::min(hilightStrength + 0.1f, 1.0f); + highlightStrength = std::min(highlightStrength + 0.1f, 1.0f); else - hilightStrength = std::max(hilightStrength - 0.1f, 0.0f); + highlightStrength = std::max(highlightStrength - 0.1f, 0.0f); // we get the screen dimensions of the building int batW = (bt->width) * 32; @@ -439,26 +439,26 @@ void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int v int batY = (((tempY-viewportY)&(game.map.hMask)) * 32)-(batH-(bt->height * 32)); // Draw the building - sprite->setBaseColor(game.teams[localteam]->color); - int spriteIntensity = 127+static_cast(128.0f*splineInterpolation(1.f, 0.f, 1.f, hilightStrength)); + sprite->setBaseColor(game.teams[localTeam]->color); + int spriteIntensity = 127+static_cast(128.0f*splineInterpolation(1.f, 0.f, 1.f, highlightStrength)); globalContainer->gfx->drawSprite(batX, batY, sprite, bt->gameSpriteImage, spriteIntensity); if (!bt->isVirtual) { // Count down whether a building site can be placed - if (game.teams[localteam]->noMoreBuildingSitesCountdown>0) + if (game.teams[localTeam]->noMoreBuildingSitesCountdown>0) { globalContainer->gfx->drawRect(batX, batY, batW, batH, 255, 0, 0, 127); globalContainer->gfx->drawLine(batX, batY, batX+batW-1, batY+batH-1, 255, 0, 0, 127); 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 { - // Draw the square arround the building, denoting its size when upgraded + // Draw the square around the building, denoting its size when upgraded if (isRoom) globalContainer->gfx->drawRect(batX, batY, batW, batH, 255, 255, 255, 127); else @@ -466,13 +466,13 @@ void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int v // We look for its maximum extension size // we find last's level type num: - BuildingType *lastbt=globalContainer->buildingsTypes.get(typeNum); + BuildingType *lastBt=globalContainer->buildingsTypes.get(typeNum); int lastTypeNum=typeNum; int max=0; - while (lastbt->nextLevel>=0) + while (lastBt->nextLevel>=0) { - lastTypeNum=lastbt->nextLevel; - lastbt=globalContainer->buildingsTypes.get(lastTypeNum); + lastTypeNum=lastBt->nextLevel; + lastBt=globalContainer->buildingsTypes.get(lastTypeNum); if (max++>200) { printf("GameGUI: Error: nextLevel architecture is broken.\n"); @@ -482,11 +482,11 @@ void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int v } int exMapX, exMapY; // ex prefix means EXtended building; the last level building type. - bool isExtendedRoom = game.checkHardRoomForBuilding(mapX, mapY, lastbt, &exMapX, &exMapY); + bool isExtendedRoom = game.checkHardRoomForBuilding(mapX, mapY, lastBt, &exMapX, &exMapY); int exBatX=((exMapX-viewportX)&(game.map.wMask)) * 32; int exBatY=((exMapY-viewportY)&(game.map.hMask)) * 32; - int exBatW=(lastbt->width) * 32; - int exBatH=(lastbt->height) * 32; + int exBatW=(lastBt->width) * 32; + int exBatH=(lastBt->height) * 32; if (isRoom && isExtendedRoom) globalContainer->gfx->drawRect(exBatX-1, exBatY-1, exBatW+2, exBatH+2, 255, 255, 255, 127); @@ -496,45 +496,45 @@ void GameGUIToolManager::drawBuildingAt(int mapX, int mapY, int localteam, int v } } -void GameGUIToolManager::computeBuildingLine(int sx, int sy, int ex, int ey, int localteam, int viewportX, int viewportY, int mode) +void GameGUIToolManager::computeBuildingLine(int sx, int sy, int ex, int ey, int localTeam, int viewportX, int viewportY, int mode) { // Get the type and sprite int typeNum = globalContainer->buildingsTypes.getTypeNum(building, 0, false); BuildingType *bt = globalContainer->buildingsTypes.get(typeNum); - int startx = sx; - int endx = ex; - int starty = sy; - int endy = ey; + int startX = sx; + int endX = ex; + int startY = sy; + int endY = ey; - int dirx = (endx > startx ? 1 : -1); - int distx = std::abs(endx - startx); - if(distx > game.map.getW()/2) + int dirX = (endX > startX ? 1 : -1); + int distX = std::abs(endX - startX); + if(distX > game.map.getW()/2) { - dirx = -dirx; - distx = game.map.getW() - distx; + dirX = -dirX; + distX = game.map.getW() - distX; } - int diry = (endy > starty ? 1 : -1); - int disty = std::abs(endy - starty); - if(disty > game.map.getH()/2) + int dirY = (endY > startY ? 1 : -1); + int distY = std::abs(endY - startY); + if(distY > game.map.getH()/2) { - diry = -diry; - disty = game.map.getH() - disty; + dirY = -dirY; + distY = game.map.getH() - distY; } int bw = 0; int bh = 0; - if(distx > disty) + if(distX > distY) { int px = 0; int py = 0; - int y = starty; + int y = startY; bool didBuilding=false; bool finishing=false; - for(int x=startx; (!finishing && x!=endx) || !didBuilding;) + for(int x=startX; (!finishing && x!=endX) || !didBuilding;) { - if(x == endx) + if(x == endX) finishing=true; didBuilding=false; bw-=1; @@ -542,42 +542,42 @@ void GameGUIToolManager::computeBuildingLine(int sx, int sy, int ex, int ey, int if(bw <= 0) { if(mode == 1) - drawBuildingAt(x, y, localteam, viewportX, viewportY); + drawBuildingAt(x, y, localTeam, viewportX, viewportY); else if(mode == 2) - placeBuildingAt(x, y, localteam); + placeBuildingAt(x, y, localTeam); bw = bt->width; bh = bt->height; didBuilding=true; } - if(std::abs(px * disty - py * distx) > std::abs(px * disty - (py+1) * distx)) + if(std::abs(px * distY - py * distX) > std::abs(px * distY - (py+1) * distX)) { - y=game.map.normalizeY(y+diry); + y=game.map.normalizeY(y+dirY); bh-=1; py+=1; if(bh <= 0) { if(mode == 1) - drawBuildingAt(x, y, localteam, viewportX, viewportY); + drawBuildingAt(x, y, localTeam, viewportX, viewportY); else if(mode == 2) - placeBuildingAt(x, y, localteam); + placeBuildingAt(x, y, localTeam); bw = bt->width; bh = bt->height; didBuilding=true; } } - x=game.map.normalizeX(x+dirx); + x=game.map.normalizeX(x+dirX); } } else { int px = 0; int py = 0; - int x = startx; + int x = startX; bool didBuilding=false; bool finishing=false; - for(int y=starty; (!finishing && y!=endy) || !didBuilding;) + for(int y=startY; (!finishing && y!=endY) || !didBuilding;) { - if(y == endy) + if(y == endY) finishing=true; didBuilding=false; bh-=1; @@ -585,97 +585,97 @@ void GameGUIToolManager::computeBuildingLine(int sx, int sy, int ex, int ey, int if(bh <= 0) { if(mode == 1) - drawBuildingAt(x, y, localteam, viewportX, viewportY); + drawBuildingAt(x, y, localTeam, viewportX, viewportY); else if(mode == 2) - placeBuildingAt(x, y, localteam); + placeBuildingAt(x, y, localTeam); bw = bt->width; bh = bt->height; didBuilding=true; } - if(std::abs(py * distx - px * disty) > std::abs(py * distx - (px+1) * disty)) + if(std::abs(py * distX - px * distY) > std::abs(py * distX - (px+1) * distY)) { - x=game.map.normalizeX(x+dirx); + x=game.map.normalizeX(x+dirX); bw-=1; px+=1; if(bw <= 0) { if(mode == 1) - drawBuildingAt(x, y, localteam, viewportX, viewportY); + drawBuildingAt(x, y, localTeam, viewportX, viewportY); else if(mode == 2) - placeBuildingAt(x, y, localteam); + placeBuildingAt(x, y, localTeam); bw = bt->width; bh = bt->height; didBuilding=true; } } - y=game.map.normalizeY(y+diry); + y=game.map.normalizeY(y+dirY); } } if(bt->width == 1 && bt->height==1) { if(mode == 1) { - drawBuildingAt(endx, endy, localteam, viewportX, viewportY); + drawBuildingAt(endX, endY, localTeam, viewportX, viewportY); } else if(mode == 2) { - placeBuildingAt(endx, endy, localteam); + placeBuildingAt(endX, endY, localTeam); } } } -void GameGUIToolManager::computeBuildingBox(int sx, int sy, int ex, int ey, int localteam, int viewportX, int viewportY, int mode) +void GameGUIToolManager::computeBuildingBox(int sx, int sy, int ex, int ey, int localTeam, int viewportX, int viewportY, int mode) { // Get the type and sprite int typeNum = globalContainer->buildingsTypes.getTypeNum(building, 0, false); BuildingType *bt = globalContainer->buildingsTypes.get(typeNum); - int startx = sx; - int endx = ex; - int starty = sy; - int endy = ey; + int startX = sx; + int endX = ex; + int startY = sy; + int endY = ey; - int dirx = (endx > startx ? 1 : -1); - int distx = std::abs(endx - startx); - if(distx > game.map.getW()/2) + int dirX = (endX > startX ? 1 : -1); + int distX = std::abs(endX - startX); + if(distX > game.map.getW()/2) { - dirx = -dirx; - distx = game.map.getW() - distx; + dirX = -dirX; + distX = game.map.getW() - distX; } - int diry = (endy > starty ? 1 : -1); - int disty = std::abs(endy - starty); - if(disty > game.map.getH()/2) + int dirY = (endY > startY ? 1 : -1); + int distY = std::abs(endY - startY); + if(distY > game.map.getH()/2) { - diry = -diry; - disty = game.map.getH() - disty; + dirY = -dirY; + distY = game.map.getH() - distY; } - endx = game.map.normalizeX(endx + (distx % bt->width + 1) * dirx); - endy = game.map.normalizeY(endy + (disty % bt->height + 1) * diry); + endX = game.map.normalizeX(endX + (distX % bt->width + 1) * dirX); + endY = game.map.normalizeY(endY + (distY % bt->height + 1) * dirY); int bx=0; - for(int x=startx; x!=endx;) + for(int x=startX; x!=endX;) { bx-=1; if(bx <= 0) { int by=0; - for(int y=starty; y!=endy;) + for(int y=startY; y!=endY;) { by -= 1; if(by <= 0) { if(mode == 1) - drawBuildingAt(x, y, localteam, viewportX, viewportY); + drawBuildingAt(x, y, localTeam, viewportX, viewportY); else if(mode == 2) - placeBuildingAt(x, y, localteam); + placeBuildingAt(x, y, localTeam); by = bt->height; } - y=game.map.normalizeY(y+diry); + y=game.map.normalizeY(y+dirY); } bx = bt->width; } - x=game.map.normalizeX(x+dirx); + x=game.map.normalizeX(x+dirX); } } diff --git a/src/GameGUIToolManager.h b/src/GameGUIToolManager.h index 498f427e..4d4cbe1d 100644 --- a/src/GameGUIToolManager.h +++ b/src/GameGUIToolManager.h @@ -68,7 +68,7 @@ class GameGUIToolManager void deactivateTool(); ///Draws the tool on the map - void drawTool(int mouseX, int mouseY, int localteam, int viewportX, int viewportY); + void drawTool(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY); ///Returns the name of the current building std::string getBuildingName() const; @@ -77,32 +77,32 @@ class GameGUIToolManager ZoneType getZoneType() const; ///Handles a mouse down - void handleMouseDown(int mouseX, int mouseY, int localteam, int viewportX, int viewportY); + void handleMouseDown(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY); ///Handles a mouse up - void handleMouseUp(int mouseX, int mouseY, int localteam, int viewportX, int viewportY); + void handleMouseUp(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY); ///Handles the dragging of the mouse - void handleMouseDrag(int mouseX, int mouseY, int localteam, int viewportX, int viewportY); + void handleMouseDrag(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY); ///Returns an order, or shared_ptr() if there are none boost::shared_ptr getOrder(); private: ///Handles placing a zone on the map - void handleZonePlacement(int mouseX, int mouseY, int localteam, int viewportX, int viewportY); + void handleZonePlacement(int mouseX, int mouseY, int localTeam, int viewportX, int viewportY); ///Flushes an order for the current brush accumulator - void flushBrushOrders(int localteam); + void flushBrushOrders(int localTeam); ///Places a building at pos x,y - void placeBuildingAt(int mapx, int mapy, int localteam); + void placeBuildingAt(int mapX, int mapY, int localTeam); ///Draws a building at pos x,y - void drawBuildingAt(int mapx, int mapy, int localteam, int viewportX, int viewportY); + void drawBuildingAt(int mapX, int mapY, int localTeam, int viewportX, int viewportY); ///Computes a line going from sx,sy to ex,ey of the current building ///if mode is 1, it will draw the buildings, if mode is 2, it will place them - void computeBuildingLine(int sx, int sy, int ex, int ey, int localteam, int viewportX, int viewportY, int mode); + void computeBuildingLine(int sx, int sy, int ex, int ey, int localTeam, int viewportX, int viewportY, int mode); ///Computes a box going from sx,sy to ex,ey of the current building ///if mode is 1, it will draw the buildings, if mode is 2, it will place them - void computeBuildingBox(int sx, int sy, int ex, int ey, int localteam, int viewportX, int viewportY, int mode); + void computeBuildingBox(int sx, int sy, int ex, int ey, int localTeam, int viewportX, int viewportY, int mode); int firstPlacementX; @@ -119,9 +119,9 @@ class GameGUIToolManager std::string building; ///The type of zone when placing zones ZoneType zoneType; - ///Used to indicate the stength of hilight, because it blends during the draw - float hilightStrength; - ///Queues up orderws for this manager + ///Used to indicate the strength of highlight, because it blends during the draw + float highlightStrength; + ///Queues up orders for this manager std::queue > orders; }; diff --git a/src/GameHeader.h b/src/GameHeader.h index 28c5c970..a43dc239 100644 --- a/src/GameHeader.h +++ b/src/GameHeader.h @@ -16,8 +16,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GAMEHEADER_H -#define __GAMEHEADER_H +#ifndef __GAME_HEADER_H +#define __GAME_HEADER_H #include "BasePlayer.h" #include "Stream.h" @@ -132,7 +132,7 @@ class GameHeader ///Represents the ally team numbers Uint8 allyTeamNumbers[Team::MAX_COUNT]; - ///Represents whether the ally-teams are fixed for the whole game, so no allying/unallying can take place + ///Represents whether the ally-teams are fixed for the whole game, so no allying/un-allying can take place bool allyTeamsFixed; ///Represents the winning conditions of the game. diff --git a/src/GameHints.cpp b/src/GameHints.cpp index 84874753..e7f92910 100644 --- a/src/GameHints.cpp +++ b/src/GameHints.cpp @@ -34,10 +34,10 @@ int GameHints::getNumberOfHints() -void GameHints::addNewHint(const std::string& hint, bool nhidden, int scriptNumber) +void GameHints::addNewHint(const std::string& hint, bool nHidden, int scriptNumber) { texts.push_back(hint); - hidden.push_back(nhidden); + hidden.push_back(nHidden); scriptNumbers.push_back(scriptNumber); } diff --git a/src/GameObjectives.cpp b/src/GameObjectives.cpp index 710c003b..2e467a16 100644 --- a/src/GameObjectives.cpp +++ b/src/GameObjectives.cpp @@ -42,12 +42,12 @@ int GameObjectives::getNumberOfObjectives() -void GameObjectives::addNewObjective(const std::string& objective, bool ishidden, bool complete, bool nfailed, GameObjectiveType type, int scriptNumber) +void GameObjectives::addNewObjective(const std::string& objective, bool isHidden, bool complete, bool nFailed, GameObjectiveType type, int scriptNumber) { texts.push_back(objective); - hidden.push_back(ishidden); + hidden.push_back(isHidden); completed.push_back(complete); - failed.push_back(nfailed); + failed.push_back(nFailed); types.push_back(type); scriptNumbers.push_back(scriptNumber); } diff --git a/src/GameUtilities.cpp b/src/GameUtilities.cpp index 480b6c3b..78d5e909 100644 --- a/src/GameUtilities.cpp +++ b/src/GameUtilities.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2004 Stephane Magnenat & Luc-Olivier de Charrière + Copyright (C) 2001-2004 Stephane Magnenat & Luc-Olivier de Charrière for any question or comment contact us at or This program is free software; you can redistribute it and/or modify diff --git a/src/GameUtilities.h b/src/GameUtilities.h index 81058ac1..a0260d55 100644 --- a/src/GameUtilities.h +++ b/src/GameUtilities.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2004 Stephane Magnenat & Luc-Olivier de Charrière + Copyright (C) 2001-2004 Stephane Magnenat & Luc-Olivier de Charrière for any question or comment contact us at or This program is free software; you can redistribute it and/or modify diff --git a/src/Glob2.cpp b/src/Glob2.cpp index 3d982214..a3931099 100644 --- a/src/Glob2.cpp +++ b/src/Glob2.cpp @@ -109,7 +109,7 @@ void Glob2::drawYOGSplashScreen(void) globalContainer->gfx->nextFrame(); } -void Glob2::mutiplayerYOG(void) +void Glob2::multiplayerYOG(void) { if (verbose) printf("Glob2:: starting YOGLoginScreen...\n"); @@ -177,7 +177,7 @@ int Glob2::runTestMapGeneration() int oldBeach = (syncRand() % 4); - descriptor.methode = static_cast(type); + descriptor.method = static_cast(type); descriptor.nbTeams = teams; descriptor.wDec=wDec; descriptor.hDec=hDec; @@ -294,8 +294,8 @@ int Glob2::run(int argc, char *argv[]) case MainMenuScreen::CAMPAIGN: { CampaignMainMenu ccs; - int rccs=ccs.execute(globalContainer->gfx, 40); - if(rccs == -1) + int rCcs=ccs.execute(globalContainer->gfx, 40); + if(rCcs == -1) { isRunning = false; } @@ -359,14 +359,14 @@ int Glob2::run(int argc, char *argv[]) break; case MainMenuScreen::MULTIPLAYERS_YOG: { - mutiplayerYOG(); + multiplayerYOG(); } break; case MainMenuScreen::MULTIPLAYERS_LAN: { - LANMenuScreen lanms; - int rc_lms = lanms.execute(globalContainer->gfx, 40); - if(rc_lms == -1) + LANMenuScreen screen; + int rc = screen.execute(globalContainer->gfx, 40); + if(rc == -1) isRunning=false; } break; @@ -407,7 +407,7 @@ int Glob2::run(int argc, char *argv[]) } } - // This is for the textshot code + // This is for the text shot code GAGCore::DrawableSurface::printFinishingText(); delete globalContainer; diff --git a/src/Glob2.h b/src/Glob2.h index 44feec14..44510757 100644 --- a/src/Glob2.h +++ b/src/Glob2.h @@ -30,7 +30,7 @@ class Glob2 public: void drawYOGSplashScreen(); - void mutiplayerYOG(); + void multiplayerYOG(); int runNoX(); ///Runs random games non stop until the game crashes int runTestGames(); diff --git a/src/Glob2Style.cpp b/src/Glob2Style.cpp index 7af9219a..26b81af2 100644 --- a/src/Glob2Style.cpp +++ b/src/Glob2Style.cpp @@ -55,7 +55,7 @@ void Glob2Style::drawTextButtonBackground(GAGCore::DrawableSurface *target, int target->drawSprite(x+w-20, y, sprite, 4); - // hightlight of buttons + // highlight of buttons if (highlight > 0) { target->drawSprite(x, y, sprite, 1, highlight); @@ -85,7 +85,7 @@ void Glob2Style::drawTextButtonBackground(GAGCore::DrawableSurface *target, int target->drawSprite(x+w-10, y, sprite, 10); - // hightlight of buttons + // highlight of buttons if (highlight > 0) { target->drawSprite(x, y, sprite, 7, highlight); @@ -120,7 +120,7 @@ void Glob2Style::drawFrame(DrawableSurface *target, int x, int y, int w, int h, Height of sprites 17, 18 and 19 must be the same */ - // save cliprect + // save clip rect int ocrX, ocrY, ocrW, ocrH; target->getClipRect(&ocrX, &ocrY, &ocrW, &ocrH); @@ -144,7 +144,7 @@ void Glob2Style::drawFrame(DrawableSurface *target, int x, int y, int w, int h, target->drawSprite(x + w - sprite->getW(16), contentY + i, sprite, 16); } - // reset cliprect + // reset clip rect target->setClipRect(ocrX, ocrY, ocrW, ocrH); // corners @@ -163,7 +163,7 @@ void Glob2Style::drawScrollBar(GAGCore::DrawableSurface *target, int x, int y, i target->drawSprite(x, y, sprite, 20); target->drawSprite(x, y + h - sprite->getH(22), sprite, 22); - // save cliprect + // save clip rect int ocrX, ocrY, ocrW, ocrH; target->getClipRect(&ocrX, &ocrY, &ocrW, &ocrH); @@ -181,7 +181,7 @@ void Glob2Style::drawScrollBar(GAGCore::DrawableSurface *target, int x, int y, i for (int i = 0; i < barForegroundHeight; i += sprite->getH(23)) target->drawSprite(x + (sprite->getW(21) - sprite->getW(23)) / 2, barForegroundY + i, sprite, 23); - // reset cliprect + // reset clip rect target->setClipRect(ocrX, ocrY, ocrW, ocrH); } @@ -198,14 +198,14 @@ void Glob2Style::drawProgressBar(GAGCore::DrawableSurface *target, int x, int y, target->drawFilledRect(x, y, w, h, Color(168, 150, 90)); - // save cliprect + // save clip rect int ocrX, ocrY, ocrW, ocrH; target->getClipRect(&ocrX, &ocrY, &ocrW, &ocrH); target->setClipRect(x, y, len, h); for (int i = 0; i < len; i += sprite->getW(24)) target->drawSprite(x + i, y, sprite, 24); - // reset cliprect + // reset clip rect target->setClipRect(ocrX, ocrY, ocrW, ocrH); } diff --git a/src/GlobalContainer.cpp b/src/GlobalContainer.cpp index a44e2cd5..83ebc98d 100644 --- a/src/GlobalContainer.cpp +++ b/src/GlobalContainer.cpp @@ -110,7 +110,7 @@ GlobalContainer::GlobalContainer(void) terrain = NULL; terrainShader = NULL; terrainBlack = NULL; - ressources = NULL; + resources = NULL; units = NULL; unitsSkins = NULL; @@ -283,20 +283,20 @@ void GlobalContainer::parseArgs(int argc, char *argv[]) } else if (strcmp(argv[i], "-f")==0) { - settings.screenFlags |= GraphicContext::FULLSCREEN; + settings.screenFlags |= GraphicContext::FULL_SCREEN; } else if (strcmp(argv[i], "-F")==0) { - settings.screenFlags &= ~GraphicContext::FULLSCREEN; + settings.screenFlags &= ~GraphicContext::FULL_SCREEN; } else if (strcmp(argv[i], "-c")==0) { - settings.screenFlags |= GraphicContext::CUSTOMCURSOR; + settings.screenFlags |= GraphicContext::CUSTOM_CURSOR; } else if (strcmp(argv[i], "-C")==0) { - settings.screenFlags &= ~GraphicContext::CUSTOMCURSOR; + settings.screenFlags &= ~GraphicContext::CUSTOM_CURSOR; } else if (strcmp(argv[i], "-r")==0) @@ -319,11 +319,11 @@ void GlobalContainer::parseArgs(int argc, char *argv[]) else if (strcmp(argv[i], "-g")==0) { - settings.screenFlags |= GraphicContext::USEGPU; + settings.screenFlags |= GraphicContext::USE_GPU; } else if (strcmp(argv[i], "-G")==0) { - settings.screenFlags &= ~GraphicContext::USEGPU; + settings.screenFlags &= ~GraphicContext::USE_GPU; } else if (strcmp(argv[i], "-l")==0) @@ -369,8 +369,8 @@ void GlobalContainer::parseArgs(int argc, char *argv[]) i++; const char *resStr=&(argv[i][0]); int ix, iy; - int nscaned = sscanf(resStr, "%dx%dx", &ix, &iy); - if (nscaned == 2) + int nScanned = sscanf(resStr, "%dx%dx", &ix, &iy); + if (nScanned == 2) { if (ix!=0 && iy!=0) { @@ -566,11 +566,11 @@ void GlobalContainer::loadClient(void) updateLoadProgressScreen(40); // load fonts - std::string fontfile = "data/fonts/"; - fontfile+=+PRIMARY_FONT; - Toolkit::loadFont(fontfile.c_str(), 20, "menu"); - Toolkit::loadFont(fontfile.c_str(), 13, "standard"); - Toolkit::loadFont(fontfile.c_str(), 10, "little"); + std::string fontFile = "data/fonts/"; + fontFile+=+PRIMARY_FONT; + Toolkit::loadFont(fontFile.c_str(), 20, "menu"); + Toolkit::loadFont(fontFile.c_str(), 13, "standard"); + Toolkit::loadFont(fontFile.c_str(), 10, "little"); menuFont = Toolkit::getFont("menu"); menuFont->setStyle(Font::Style(Font::STYLE_NORMAL, GAGGUI::Style::style->textColor)); standardFont = Toolkit::getFont("standard"); @@ -592,8 +592,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"); @@ -608,10 +608,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 @@ -643,7 +643,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 resources #ifndef YOG_SERVER_ONLY loadClient(); @@ -662,7 +662,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 cd0ed9de..74583b36 100644 --- a/src/GlobalContainer.h +++ b/src/GlobalContainer.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __GLOBALCONTAINER_H -#define __GLOBALCONTAINER_H +#ifndef __GLOBAL_CONTAINER_H +#define __GLOBAL_CONTAINER_H #include "BuildingsTypes.h" #include "RessourcesTypes.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 493bd8ee..f029b436 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; @@ -171,7 +171,7 @@ template Uint8 BuildingGradientMethodowner->allies)) return 0; } diff --git a/src/HeightMapGenerator.cpp b/src/HeightMapGenerator.cpp index 54269e9a..d64a97af 100644 --- a/src/HeightMapGenerator.cpp +++ b/src/HeightMapGenerator.cpp @@ -27,7 +27,7 @@ #include #include "PerlinNoise.h" -/// these faders are factors to be applieable to heightfields. they map (0,0)-(w,h) to [0..1] +/// these faders are factors to be applicable to height fields. they map (0,0)-(w,h) to [0..1] inline float faderCenter (int x, int y, int w, int h) /// to have zero at the borders and 1 in the center { @@ -88,7 +88,7 @@ inline void HeightMap::lower(unsigned int coordX, unsigned int coordY) { static unsigned int oldX=(unsigned int)-1; static unsigned int oldY=(unsigned int)-1; - if((coordX!=oldX) || (coordY!=oldY)) //don't stamp the same spot again. if stamp is moved like in rivermaps this saves a lot of time + if((coordX!=oldX) || (coordY!=oldY)) //don't stamp the same spot again. if stamp is moved like in river maps this saves a lot of time { assert(_stamp); for(unsigned int x=0; x<2*_r+1;x++) @@ -110,7 +110,7 @@ inline void HeightMap::maxRise(unsigned int coordX, unsigned int coordY) { static unsigned int oldX=(unsigned int)-1; static unsigned int oldY=(unsigned int)-1; - if((coordX!=oldX) || (coordY!=oldY)) //don't stamp the same spot again. if stamp is moved like in rivermaps this saves a lot of time + if((coordX!=oldX) || (coordY!=oldY)) //don't stamp the same spot again. if stamp is moved like in river maps this saves a lot of time { assert(_stamp); for(unsigned int x=0; x<2*_r+1;x++) @@ -131,7 +131,7 @@ inline void HeightMap::differenceStamp(unsigned int coordX, unsigned int coordY) { static unsigned int oldX=(unsigned int)-1; static unsigned int oldY=(unsigned int)-1; - if((coordX!=oldX) || (coordY!=oldY)) //don't stamp the same spot again. if stamp is moved like in rivermaps this saves a lot of time + if((coordX!=oldX) || (coordY!=oldY)) //don't stamp the same spot again. if stamp is moved like in river maps this saves a lot of time { assert(_stamp); for(unsigned int x=0; x<2*_r+1;x++) @@ -171,9 +171,9 @@ void HeightMap::makeIslands(unsigned int count, float smoothingFactor) pn.reseed(); int * centerX = new int[count]; int * centerY = new int[count]; - float mindist=sqrt(_w*_h/count)/2.0; - assert(mindist>0); - makeStamp((unsigned int)(mindist*2)); + float minDist=sqrt(_w*_h/count)/2.0; + assert(minDist>0); + makeStamp((unsigned int)(minDist*2)); centerX[0]=rand()%_w;centerY[0]=rand()%_h; /// find spots with distance>min. distance for (unsigned int i=1; i0?_w:0); - targetPointY=startingPointY+_h-(tmprand%2)*_h; + unsigned int tmpRand=rand()%3; + targetPointX=startingPointX+(tmpRand>0?_w:0); + targetPointY=startingPointY+_h-(tmpRand%2)*_h; } else if (_w>_h) { diff --git a/src/HeightMapGenerator.h b/src/HeightMapGenerator.h index 99d908a6..27f4938f 100644 --- a/src/HeightMapGenerator.h +++ b/src/HeightMapGenerator.h @@ -22,18 +22,18 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _HEIGHTMAPGENERATOR_H -#define _HEIGHTMAPGENERATOR_H +#ifndef __HEIGHT_MAP_GENERATOR_H +#define __HEIGHT_MAP_GENERATOR_H #include "PerlinNoise.h" -class HeightMap /// class to generate heightmaps to decide where to put resources, water, sand and grass later +class HeightMap /// class to generate height maps to decide where to put resources, water, sand and grass later { float * _map; /// height values are always [0,1]. unsigned int _w, _h; /// map size float * _stamp; /// smooth 0 to 1 gradient lookup to generate craters, islands and rivers unsigned int _r; /// radius of the _stamp - PerlinNoise _pn;/// to get reproducable corellated random numbers + PerlinNoise _pn;/// to get reproducible correlated random numbers public: enum kindOfMap {SWAMP=0,ISLANDS=1,RIVER=2,CRATERS=3,RANDOM=4}; @@ -75,4 +75,4 @@ class HeightMap /// class to generate heightmaps to decide where to put resource void normalize(); /// fits the values of _map to [0, 1] }; -#endif /* _HEIGHTMAPGENERATOR_H */ +#endif /* __HEIGHT_MAP_GENERATOR_H */ diff --git a/src/IRC.cpp b/src/IRC.cpp index fd1fb23a..8c32bc55 100644 --- a/src/IRC.cpp +++ b/src/IRC.cpp @@ -110,7 +110,7 @@ void IRC::forceDisconnect(void) } } -void IRC::interpreteIRCMessage(const std::string &message) +void IRC::interpretIRCMessage(const std::string &message) { char tempMessage[IRC_MESSAGE_SIZE]; char *prefix; @@ -289,9 +289,9 @@ void IRC::interpreteIRCMessage(const std::string &message) else { - const std::string &nicktaken = Toolkit::getStringTable()->getString("[nick taken]"); + const std::string &nickTaken = Toolkit::getStringTable()->getString("[nick taken]"); const std::string &ok = Toolkit::getStringTable()->getString("[ok]"); - int res = (int)MessageBox(globalContainer->gfx, "standard", MB_ONEBUTTON, nicktaken.c_str(), ok.c_str()); + int res = (int)MessageBox(globalContainer->gfx, "standard", MB_ONE_BUTTON, nickTaken.c_str(), ok.c_str()); if (res != 0 ) { @@ -321,7 +321,7 @@ void IRC::step(void) { if (verbose) printf("YOG (IRC) has received [%s]\n", data); - interpreteIRCMessage(data); + interpretIRCMessage(data); } else { diff --git a/src/IRC.h b/src/IRC.h index 99ac598f..c561b97b 100644 --- a/src/IRC.h +++ b/src/IRC.h @@ -107,8 +107,8 @@ class IRC std::string nick; protected: - //! Interprete a message from IRC; do parsing etc - void interpreteIRCMessage(const std::string &message); + //! Interpret a message from IRC; do parsing etc + void interpretIRCMessage(const std::string &message); //! Force disconnect (kill socket) void forceDisconnect(void); @@ -119,9 +119,9 @@ class IRC virtual ~IRC(); // CONNECTION - //! Connect to YOG server (IRC network), return true on sucess + //! Connect to YOG server (IRC network), return true on success bool connect(const std::string &serverName, int serverPort, const std::string &nick); - //! Try to disconnect from server in a cleany way + //! Try to disconnect from server in a cleanly way bool disconnect(void); // RUN diff --git a/src/IRCTextMessageHandler.cpp b/src/IRCTextMessageHandler.cpp index 66884135..d9cea6b1 100644 --- a/src/IRCTextMessageHandler.cpp +++ b/src/IRCTextMessageHandler.cpp @@ -51,12 +51,12 @@ IRCTextMessageHandler::~IRCTextMessageHandler() void IRCTextMessageHandler::startIRC(const std::string& username) { - std::string nusername = username; - while(nusername.find(" ") != std::string::npos) + std::string nUsername = username; + while(nUsername.find(" ") != std::string::npos) { - nusername.replace(nusername.find(" "), 1, "_"); + nUsername.replace(nUsername.find(" "), 1, "_"); } - boost::shared_ptr message1(new ITConnect(IRC_SERVER, nusername, 6667)); + boost::shared_ptr message1(new ITConnect(IRC_SERVER, nUsername, 6667)); boost::shared_ptr message2(new ITJoinChannel(IRC_CHAN)); irc.sendMessage(message1); @@ -83,9 +83,9 @@ void IRCTextMessageHandler::update() Uint8 type = message->getMessageType(); switch(type) { - case ITMRecieveMessage: + case ITMReceiveMessage: { - boost::shared_ptr info = static_pointer_cast(message); + boost::shared_ptr info = static_pointer_cast(message); sendToAllListeners(info->getMessage()); } break; diff --git a/src/IRCThread.cpp b/src/IRCThread.cpp index 93615406..2266aa37 100644 --- a/src/IRCThread.cpp +++ b/src/IRCThread.cpp @@ -107,7 +107,7 @@ void IRCThread::operator()() message+=irc.getChatMessageSource(); message+=">"; message+=irc.getChatMessage(); - boost::shared_ptr m(new ITRecieveMessage(message)); + boost::shared_ptr m(new ITReceiveMessage(message)); sendToMainThread(m); irc.freeChatMessage(); } @@ -157,7 +157,7 @@ void IRCThread::operator()() message += " : "; message += irc.getInfoMessageText(); } - boost::shared_ptr m(new ITRecieveMessage(message)); + boost::shared_ptr m(new ITReceiveMessage(message)); sendToMainThread(m); irc.freeInfoMessage(); } diff --git a/src/IRCThreadMessage.cpp b/src/IRCThreadMessage.cpp index 24ceb9db..bee2b330 100644 --- a/src/IRCThreadMessage.cpp +++ b/src/IRCThreadMessage.cpp @@ -185,34 +185,34 @@ bool ITDisconnected::operator==(const IRCThreadMessage& rhs) const } -ITRecieveMessage::ITRecieveMessage(std::string message) +ITReceiveMessage::ITReceiveMessage(std::string message) : message(message) { } -Uint8 ITRecieveMessage::getMessageType() const +Uint8 ITReceiveMessage::getMessageType() const { - return ITMRecieveMessage; + return ITMReceiveMessage; } -std::string ITRecieveMessage::format() const +std::string ITReceiveMessage::format() const { std::ostringstream s; - s<<"ITRecieveMessage("<<"message="<(rhs); + const ITReceiveMessage& r = dynamic_cast(rhs); if(r.message == message) return true; } @@ -220,7 +220,7 @@ bool ITRecieveMessage::operator==(const IRCThreadMessage& rhs) const } -std::string ITRecieveMessage::getMessage() const +std::string ITReceiveMessage::getMessage() const { return message; } diff --git a/src/IRCThreadMessage.h b/src/IRCThreadMessage.h index 4b88b232..aa720540 100644 --- a/src/IRCThreadMessage.h +++ b/src/IRCThreadMessage.h @@ -29,7 +29,7 @@ enum IRCThreadMessageType ITMDisconnect, ITMSendMessage, ITMDisconnected, - ITMRecieveMessage, + ITMReceiveMessage, ITMJoinChannel, ITMExitThread, ITMUserListModified, @@ -153,14 +153,14 @@ class ITDisconnected : public IRCThreadMessage -///ITRecieveMessage -class ITRecieveMessage : public IRCThreadMessage +///ITReceiveMessage +class ITReceiveMessage : public IRCThreadMessage { public: - ///Creates a ITRecieveMessage event - ITRecieveMessage(std::string message); + ///Creates a ITReceiveMessage event + ITReceiveMessage(std::string message); - ///Returns ITMRecieve + ///Returns ITMReceive Uint8 getMessageType() const; ///Returns a formatted version of the event diff --git a/src/KeyboardManager.cpp b/src/KeyboardManager.cpp index d7fa6f88..1d93005b 100644 --- a/src/KeyboardManager.cpp +++ b/src/KeyboardManager.cpp @@ -78,7 +78,7 @@ void KeyboardShortcut::interpret(const std::string& as, ShortcutMode mode) left=left.substr(end+2, std::string::npos); } - //Add the key that isn't seperated by a - + //Add the key that isn't separated by a - KeyPress kp; kp.interpret(left); keys.push_back(kp); @@ -129,9 +129,9 @@ KeyPress KeyboardShortcut::getKeyPress(size_t n) const -void KeyboardShortcut::setAction(Uint32 naction) +void KeyboardShortcut::setAction(Uint32 action) { - action = naction; + this->action = action; } @@ -177,7 +177,7 @@ KeyboardManager::KeyboardManager(ShortcutMode mode) Uint32 KeyboardManager::getAction(const KeyPress& key) { - //This is to solve a bug due to the system recieving the key-up event + //This is to solve a bug due to the system receiving the key-up event //which is not included in multiple-key sequences if(key.getPressed() || lastPresses.empty()) lastPresses.push_back(key); diff --git a/src/KeyboardManager.h b/src/KeyboardManager.h index 4916fb9d..e0500ba1 100644 --- a/src/KeyboardManager.h +++ b/src/KeyboardManager.h @@ -33,7 +33,7 @@ enum ShortcutMode //Steps to add a keyboard shortcut: //1) Identify where it goes (either GameGUIKeyboardActions or MapEditorKeyboardActions) -//2) Add the action to the enum there, and give it an approppriette name in the init function +//2) Add the action to the enum there, and give it an appropriate name in the init function //3) Find the handleKey function in either GameGUI or MapEdit and add the code for the action //4) Add the name you provided to the translation files, as [name], and at the bare minimum, give it an English translation @@ -53,7 +53,7 @@ class KeyboardShortcut ///Interprets a keyboard shortcut from a string void interpret(const std::string& s, ShortcutMode mode); - ///Formats a translated version, not for serializtaion + ///Formats a translated version, not for serialization std::string formatTranslated(ShortcutMode mode) const; ///Counts how many key presses there is @@ -62,10 +62,10 @@ class KeyboardShortcut ///Returns the n'th key press KeyPress getKeyPress(size_t n) const; - ///Sets the action accossiatted with this shortcut + ///Sets the action associated with this shortcut void setAction(Uint32 action); - ///Returns the action accossiatted with this shortcut + ///Returns the action associated with this shortcut Uint32 getAction() const; ///Returns whether this shortcut is valid. Shortcuts are invalid if any of the @@ -84,13 +84,13 @@ class KeyboardManager ///Constructs a keyboard manager, either to use the MapEdit shortcuts or the GameGUI shortcuts KeyboardManager(ShortcutMode mode); - ///Returns the integer action accossiatted with the provided key. + ///Returns the integer action associated with the provided key. Uint32 getAction(const KeyPress& key); ///Saves the keyboard layout void saveKeyboardLayout() const; - ///Loads the keyboard layout, returns false in unsuccessfull + ///Loads the keyboard layout, returns false in unsuccessful bool loadKeyboardLayout(const std::string& file); ///Clears all current shortcuts and loads the defaults diff --git a/src/LANFindScreen.cpp b/src/LANFindScreen.cpp index ad0150d3..8aec7175 100644 --- a/src/LANFindScreen.cpp +++ b/src/LANFindScreen.cpp @@ -110,7 +110,7 @@ void LANFindScreen::onAction(Widget *source, Action action, int par1, int par2) if(!client->isConnected()) { - MessageBox(globalContainer->gfx, "standard", MB_ONEBUTTON, Toolkit::getStringTable()->getString("[Can't connect, can't find host]"), Toolkit::getStringTable()->getString("[ok]")); + MessageBox(globalContainer->gfx, "standard", MB_ONE_BUTTON, Toolkit::getStringTable()->getString("[Can't connect, can't find host]"), Toolkit::getStringTable()->getString("[ok]")); return; } while(client->getConnectionState() != YOGClient::WaitingForLoginInformation) @@ -127,7 +127,7 @@ void LANFindScreen::onAction(Widget *source, Action action, int par1, int par2) if((*client->getGameListManager()->getGameList().begin()).getGameState()==YOGGameInfo::GameRunning) { - MessageBox(globalContainer->gfx, "standard", MB_ONEBUTTON, Toolkit::getStringTable()->getString("[Can't join game, game has started]"), Toolkit::getStringTable()->getString("[ok]")); + MessageBox(globalContainer->gfx, "standard", MB_ONE_BUTTON, Toolkit::getStringTable()->getString("[Can't join game, game has started]"), Toolkit::getStringTable()->getString("[ok]")); return; } diff --git a/src/LANMenuScreen.cpp b/src/LANMenuScreen.cpp index 598e4935..df690165 100644 --- a/src/LANMenuScreen.cpp +++ b/src/LANMenuScreen.cpp @@ -55,8 +55,8 @@ void LANMenuScreen::onAction(Widget *source, Action action, int par1, int par2) { if(par1 == JOIN) { - LANFindScreen lanfs; - int rc = lanfs.execute(globalContainer->gfx, 40); + LANFindScreen lanFs; + int rc = lanFs.execute(globalContainer->gfx, 40); if(rc==-1) endExecute(-1); else @@ -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_ONE_BUTTON, 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/LogFileManager.cpp b/src/LogFileManager.cpp index eabde9cb..408e7161 100644 --- a/src/LogFileManager.cpp +++ b/src/LogFileManager.cpp @@ -40,7 +40,7 @@ LogFileManager::~LogFileManager() FILE *LogFileManager::getFile(const std::string fileName) { - // FIXME: This is a hack to temporarilly disable log files + // FIXME: This is a hack to temporarily disable log files // // According to Bradley, logging causes crashes without this hack. // A major cleanup is required prior to switching logging back on. diff --git a/src/LogFileManager.h b/src/LogFileManager.h index d0697fd1..9c5362d9 100644 --- a/src/LogFileManager.h +++ b/src/LogFileManager.h @@ -30,18 +30,18 @@ namespace GAGCore } using namespace GAGCore; -///This is a hack to temporarilly disable log files +///This is a hack to temporarily disable log files #define fprintf if(false)fprintf /** * The LogFileManager is an utility class. It's designed to have only one - * instance per programm. Simply call the class method "getFile()" like you + * instance per program. Simply call the class method "getFile()" like you * would call the C function "fopen()". * The returned "FILE*" is writeable, and stored in a place chosen by the * "FileManager*" policy. - * The name of the file is the concathenation of the user name and the + * The name of the file is the concatenation of the user name and the * "const std::string filename" argument. - * This is usefull when you have to test multiple users on the same account + * This is useful when you have to test multiple users on the same account * while debugging multiplayers games. * * If you request the same file name more than once, the LogFileManager will diff --git a/src/MainMenuScreen.cpp b/src/MainMenuScreen.cpp index 75ebde61..7facf890 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 0a1630d4..4d45fde7 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) @@ -4165,9 +4165,9 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * pathToBuildingCountClose++; int lx=(x-bx+15+32)&31; int ly=(y-by+15+32)&31; - Uint8 currentg=gradient[lx+(ly<<5)]; + Uint8 currentG=gradient[lx+(ly<<5)]; - if (!building->dirtyLocalGradient[canSwim] && currentg==255) + if (!building->dirtyLocalGradient[canSwim] && currentG==255) { *dx=0; *dy=0; @@ -4177,9 +4177,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) @@ -4198,10 +4198,10 @@ bool Map::pathfindBuilding(Building *building, bool canSwim, int x, int y, int * return false; } - currentg=gradient[lx+ly*32]; - if (currentg>1) + currentG=gradient[lx+ly*32]; + 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) @@ -4214,7 +4214,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) @@ -4229,7 +4229,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++; @@ -4238,7 +4238,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) @@ -4247,7 +4247,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) @@ -4262,7 +4262,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 { @@ -4282,10 +4282,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) @@ -4304,7 +4304,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); @@ -4312,24 +4312,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. @@ -4340,31 +4340,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)) { @@ -4379,46 +4379,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)) { @@ -4433,35 +4433,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; } } @@ -4475,7 +4475,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; } } } @@ -4507,7 +4507,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]; @@ -4537,13 +4537,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++; @@ -4569,7 +4569,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; } @@ -4652,22 +4652,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; } @@ -4687,29 +4687,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; } @@ -4747,7 +4747,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) @@ -4761,8 +4761,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 } @@ -4818,12 +4818,12 @@ template void Map::updateGuardAreasGradient(int teamNumber, bool Uint32 teamMask = Team::teamNumberToMask(teamNumber); for (size_t i=0; iteams[teamNumber]->allies)) gradient[i] = 0; @@ -4874,17 +4874,17 @@ template void Map::updateClearAreasGradient(int teamNumber, bool Uint32 teamMask = Team::teamNumberToMask(teamNumber); for (size_t i=0; i