Classes | |
| class | Singleton |
| Used for transforming a standard class into a singleton class. More... | |
| class | ustring |
| Implements unicode strings with uint16 as the character type. More... | |
Functions | |
| template<class T> | |
| void | DataToString (std::string &s, const T &data) |
| Converts data to string. | |
| float | FloorToFloatMultiple (const float value, const float multiple) |
| Rounds down a float to a multiple of another float. | |
| bool | IsFloatInRange (float value, float lower, float upper) |
| Determines if a floating point number is within a range of two numbers. | |
| bool | IsOddNumber (uint32 x) |
| Determines if an integer is an odd number or not. | |
| bool | IsPowerOfTwo (uint32 x) |
| Determines if an unsigned integer is a power of two or not. | |
| bool | IsStringNumeric (const string &text) |
| ustring | MakeUnicodeString (const string &text) |
| template<typename T, size_t N> | |
| size_t | NumberElementsArray (T(&)[N]) |
| A template function that returns the number of elements in an array. | |
| uint32 | RoundUpPow2 (uint32 x) |
| Rounds an unsigned integer up to the nearest power of two. | |
Directory and File Manipulation Functions | |
| bool | CleanDirectory (const std::string &dir_name) |
| Removes all files present in a directory. | |
| bool | DoesFileExist (const std::string &file_name) |
| Checks if a file exists on the system or not. | |
| bool | MakeDirectory (const std::string &dir_name) |
| Creates a directory relative to the path of the running application. | |
| bool | MoveFile (const std::string &source_name, const std::string &destination_name) |
| Moves a file from one location to another. | |
| bool | RemoveDirectory (const std::string &dir_name) |
| Deletes a directory, as well as any files the directory may contain. | |
Random Variable Genreator Fucntions | |
| int32 | GaussianRandomValue (int32 mean, float std_dev=10.0f, bool positive_value=true) |
| Returns a Gaussian random value with specified mean and standard deviation. | |
| bool | Probability (uint32 chance) |
| Returns true/false depending on the chance. | |
| int32 | RandomBoundedInteger (int32 lower_bound, int32 upper_bound) |
| Returns a random interger value uniformally distributed between two inclusive bounds. | |
| float | RandomFloat () |
| Creates a uniformly distributed random floating point number. | |
Version Checking Functions | |
| string | GetLatestVersion () |
| Gets newest version. | |
| bool | IsLatestVersion () |
| Checks version against a remote server. | |
Sorting Functions | |
| template<typename T> | |
| void | InsertionSort (std::vector< T > &swap_vec) |
| Performs an insertion sort on a vector of elements. | |
String Utility Functions | |
| bool | IsStringNumeric (const std::string &text) |
| Determines if a string is a valid numeric string. | |
| string | MakeStandardString (const hoa_utils::ustring &text) |
| Creates an starndard string from a ustring. | |
| hoa_utils::ustring | MakeUnicodeString (const std::string &text) |
| Creates a ustring from a standard string. | |
| template<typename T> | |
| std::string | NumberToString (const T t) |
| Converts an integer type into a standard string. | |
Variables | |
| static std::string | temp_version_str |
| bool | UTILS_DEBUG |
| Determines whether the code in the hoa_utils namespace should print debug statements or not. | |
| bool | UTILS_DEBUG = false |
| Determines whether the code in the hoa_utils namespace should print debug statements or not. | |
| bool | UTILS_DEBUG |
Multiples of Pi constants | |
PI and multiples of PI. Used in various math calculations such as interpolations.
These constants are mostly used in the video engine. | |
| const float | UTILS_2PI = 6.283185307f |
| const float | UTILS_HALF_PI = 1.570796326f |
| const float | UTILS_PI = 3.141592653f |
| const float | UTILS_QUARTER_PI = 0.785398163f |
| bool hoa_utils::CleanDirectory | ( | const std::string & | dir_name | ) |
Removes all files present in a directory.
| dir_name | The name of the directory to clean (e.g. "img/screnshots") |
Definition at line 417 of file utils.cpp.
Referenced by hoa_video::GameVideo::_DeleteTempTextures(), and RemoveDirectory().
| void hoa_utils::DataToString | ( | std::string & | s, | |
| const T & | data | |||
| ) |
Converts data to string.
Thi function convers ata to string, if it has the sstring::operator<< implementated
| s | String to be filled | |
| data | Data to convert to string |
Definition at line 159 of file utils.h.
Referenced by hoa_video::GameVideo::_LoadMultiImage().
| bool hoa_utils::DoesFileExist | ( | const std::string & | file_name | ) |
Checks if a file exists on the system or not.
| file_name | The name of the file to check (e.g. "dat/saved_game.lua") |
Definition at line 375 of file utils.cpp.
Referenced by hoa_boot::BootMode::_OnLoadGame().
| float hoa_utils::FloorToFloatMultiple | ( | const float | value, | |
| const float | multiple | |||
| ) |
Rounds down a float to a multiple of another float.
| value | Number to be rounded | |
| multiple | Multiple to be considered when rounding |
Definition at line 70 of file utils.cpp.
Referenced by hoa_map::MapMode::_CalculateDrawInfo().
| int32 hoa_utils::GaussianRandomValue | ( | int32 | mean, | |
| float | std_dev = 10.0f, |
|||
| bool | positive_value = true | |||
| ) |
Returns a Gaussian random value with specified mean and standard deviation.
| mean | ||
| std_dev | The standard deviation of the Gaussian function (optional, default is 10.0f) | |
| positive_value | If true the function will not return a negative result (optional, default is true) |
Definition at line 325 of file utils.cpp.
References RandomFloat().
Referenced by hoa_global::GlobalEnemy::Initialize().
Here is the call graph for this function:

| std::string hoa_utils::GetLatestVersion | ( | ) |
Gets newest version.
Definition at line 563 of file utils.cpp.
References temp_version_str.
Referenced by hoa_boot::BootMode::BootMode(), and hoa_main::ParseProgramOptions().
| void hoa_utils::InsertionSort | ( | std::vector< T > & | swap_vec | ) |
Performs an insertion sort on a vector of elements.
| swap_vec | The vector of elements to be sorted. |
Do not invoke this function with a vector of pointers to class-type objects, as it will cause a compilation error.
| bool hoa_utils::IsFloatInRange | ( | float | value, | |
| float | lower, | |||
| float | upper | |||
| ) |
Determines if a floating point number is within a range of two numbers.
| value | The floating point value to compare. | |
| lower | The minimum bound (inclusive). | |
| upper | The maximum bound (inclusive). |
Definition at line 65 of file utils.cpp.
Referenced by hoa_map::MapMode::_CalculateDrawInfo().
| bool hoa_utils::IsLatestVersion | ( | ) |
Checks version against a remote server.
Definition at line 523 of file utils.cpp.
References ALLACROST_MAJOR_VERSION, ALLACROST_MINOR_VERSION, ALLACROST_PATCH, hoa_socket::Socket::Connect(), hoa_socket::Socket::Disconnect(), hoa_socket::Socket::IsConnected(), hoa_socket::Socket::IsQueued(), hoa_socket::Socket::ScanLine(), temp_version_str, VERSION_HOST, VERSION_PATH, and hoa_socket::Socket::Write().
Referenced by hoa_main::ParseProgramOptions().
Here is the call graph for this function:

| bool hoa_utils::IsOddNumber | ( | uint32 | x | ) |
Determines if an integer is an odd number or not.
| x | The unsigned integer to examine. |
Definition at line 58 of file utils.cpp.
Referenced by hoa_map::MapMode::_CalculateDrawInfo().
| bool hoa_utils::IsPowerOfTwo | ( | uint32 | x | ) |
Determines if an unsigned integer is a power of two or not.
| x | The number to examine. |
Definition at line 52 of file utils.cpp.
Referenced by hoa_video::GameVideo::_CreateTexSheet().
| bool hoa_utils::IsStringNumeric | ( | const std::string & | text | ) |
Determines if a string is a valid numeric string.
| text | The string to check |
Referenced by hoa_video::OptionBox::_ConstructOption().
| bool hoa_utils::MakeDirectory | ( | const std::string & | dir_name | ) |
| std::string hoa_utils::MakeStandardString | ( | const hoa_utils::ustring & | text | ) |
Creates an starndard string from a ustring.
| text | The ustring to create the equivalent standard string for |
Definition at line 276 of file utils.cpp.
References hoa_utils::ustring::length().
Referenced by hoa_video::OptionBox::_ConstructOption(), hoa_menu::private_menu::InventoryWindow::_UpdateItemText(), hoa_menu::private_menu::SkillsWindow::_UpdateSkillList(), and hoa_video::GameVideo::RenderText().
Here is the call graph for this function:

| hoa_utils::ustring hoa_utils::MakeUnicodeString | ( | const std::string & | text | ) |
Creates a ustring from a standard string.
| text | The standard string to create the ustring equivalent for |
Referenced by hoa_battle::private_battle::ActionWindow::_ConstructActionSelectionList(), hoa_battle::private_battle::ActionWindow::_DrawActionInformation(), hoa_battle::private_battle::ActionWindow::_DrawActionSelection(), hoa_menu::MenuMode::_DrawBottomMenu(), hoa_battle::private_battle::ActionWindow::_DrawTargetSelection(), hoa_menu::private_menu::InventoryWindow::_InitCategory(), hoa_menu::private_menu::EquipWindow::_InitCharSelect(), hoa_menu::private_menu::SkillsWindow::_InitCharSelect(), hoa_menu::private_menu::StatusWindow::_InitCharSelect(), hoa_menu::private_menu::InventoryWindow::_InitCharSelect(), hoa_menu::private_menu::SkillsWindow::_InitSkillsCategories(), hoa_map::MapMode::_Load(), hoa_global::GlobalAttackPoint::_LoadData(), hoa_boot::BootMode::_OnMenuDebug(), hoa_boot::BootMode::_SetupAudioOptionsMenu(), hoa_menu::MenuMode::_SetupEquipOptionBox(), hoa_menu::MenuMode::_SetupInventoryOptionBox(), hoa_boot::BootMode::_SetupJoySetttingsMenu(), hoa_boot::BootMode::_SetupKeySetttingsMenu(), hoa_boot::BootMode::_SetupMainMenu(), hoa_menu::MenuMode::_SetupMainOptionBox(), hoa_boot::BootMode::_SetupOptionsMenu(), hoa_menu::MenuMode::_SetupOptionsOptionBox(), hoa_boot::BootMode::_SetupResolutionMenu(), hoa_menu::MenuMode::_SetupSaveOptionBox(), hoa_menu::MenuMode::_SetupSkillsOptionBox(), hoa_menu::MenuMode::_SetupStatusOptionBox(), hoa_boot::BootMode::_SetupVideoOptionsMenu(), hoa_boot::BootMode::_UpdateAudioOptions(), hoa_menu::private_menu::InventoryWindow::_UpdateItemText(), hoa_boot::BootMode::_UpdateJoySettings(), hoa_boot::BootMode::_UpdateKeySettings(), hoa_menu::private_menu::SkillsWindow::_UpdateSkillList(), hoa_boot::BootMode::_UpdateVideoOptions(), hoa_battle::private_battle::ActionWindow::ActionWindow(), hoa_shop::private_shop::ObjectSellListWindow::AddEntry(), hoa_shop::private_shop::ObjectListWindow::AddEntry(), hoa_map::private_map::MapDialogue::AddText(), hoa_shop::private_shop::ConfirmWindow::ConfirmWindow(), hoa_menu::private_menu::EquipWindow::Draw(), hoa_menu::private_menu::StatusWindow::Draw(), hoa_menu::private_menu::CharacterWindow::Draw(), hoa_battle::private_battle::FinishWindow::Draw(), hoa_battle::private_battle::BattleEnemyActor::DrawStatus(), hoa_battle::private_battle::FinishWindow::FinishWindow(), hoa_global::GlobalArmor::GlobalArmor(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), hoa_global::GlobalWeapon::GlobalWeapon(), hoa_quit::QuitMode::QuitMode(), hoa_shop::private_shop::ShopActionWindow::ShopActionWindow(), hoa_boot::WelcomeScreen::Show(), hoa_boot::CreditsScreen::Show(), hoa_shop::private_shop::ObjectListWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::UpdateFinanceText().
| ustring hoa_utils::MakeUnicodeString | ( | const string & | text | ) |
Definition at line 259 of file utils.cpp.
Referenced by hoa_script::ReadScriptDescriptor::ReadUString(), and hoa_map::private_map::MapSprite::SetName().
| bool hoa_utils::MoveFile | ( | const std::string & | source_name, | |
| const std::string & | destination_name | |||
| ) |
Moves a file from one location to another.
| source_name | The name of the file that is to be moved | |
| destination_name | The location name to where the file should be moved to |
Definition at line 385 of file utils.cpp.
Referenced by hoa_script::ModifyScriptDescriptor::CommitChanges().
| size_t hoa_utils::NumberElementsArray | ( | T(&) | [N] | ) |
| std::string hoa_utils::NumberToString | ( | const T | t | ) |
Converts an integer type into a standard string.
| T | The integer type to convert to a string |
Definition at line 339 of file utils.h.
Referenced by hoa_battle::private_battle::ActionWindow::_ConstructActionSelectionList(), hoa_battle::private_battle::ActionWindow::_DrawActionInformation(), hoa_menu::MenuMode::_DrawBottomMenu(), hoa_global::GameGlobal::_SaveCharacter(), hoa_global::GameGlobal::_SaveEvents(), hoa_global::GameGlobal::_SaveInventory(), hoa_menu::private_menu::InventoryWindow::_UpdateItemText(), hoa_boot::BootMode::_UpdateJoySettings(), hoa_menu::private_menu::SkillsWindow::_UpdateSkillList(), hoa_boot::BootMode::_UpdateVideoOptions(), hoa_shop::private_shop::ObjectSellListWindow::AddEntry(), hoa_shop::private_shop::ObjectListWindow::AddEntry(), hoa_battle::private_battle::FinishWindow::Draw(), hoa_battle::private_battle::BattleEnemyActor::DrawSprite(), hoa_battle::private_battle::BattleCharacterActor::DrawSprite(), hoa_battle::private_battle::BattleCharacterActor::DrawStatus(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_shop::private_shop::ObjectInfoWindow::SetObject(), hoa_shop::private_shop::ObjectListWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::UpdateFinanceText().
| bool hoa_utils::Probability | ( | uint32 | chance | ) |
Returns true/false depending on the chance.
| chance | Value between 0..100. 0 will always return false and >=100 will always return true. |
Definition at line 363 of file utils.cpp.
References RandomBoundedInteger().
Here is the call graph for this function:

Returns a random interger value uniformally distributed between two inclusive bounds.
| lower_bound | The lower inclusive bound | |
| upper_bound | The upper inclusive bound |
Definition at line 307 of file utils.cpp.
References RandomFloat(), and UTILS_DEBUG.
Referenced by hoa_map::private_map::MapZone::_RandomPosition(), Probability(), hoa_map::private_map::VirtualSprite::SetRandomDirection(), hoa_battle::private_battle::BattleActor::TakeDamage(), and hoa_map::private_map::EnemySprite::Update().
Here is the call graph for this function:

| float hoa_utils::RandomFloat | ( | ) |
Creates a uniformly distributed random floating point number.
Definition at line 301 of file utils.cpp.
Referenced by hoa_defs::BindEngineToLua(), GaussianRandomValue(), and RandomBoundedInteger().
| bool hoa_utils::RemoveDirectory | ( | const std::string & | dir_name | ) |
Deletes a directory, as well as any files the directory may contain.
| dir_name | The name of the directory to remove (e.g. "img/screnshots") |
Definition at line 493 of file utils.cpp.
References CleanDirectory().
Here is the call graph for this function:

Rounds an unsigned integer up to the nearest power of two.
| x | The number to round up. |
Definition at line 40 of file utils.cpp.
Referenced by hoa_video::GameVideo::_CacheGlyphs(), hoa_video::GameVideo::_GenTexLine(), hoa_video::GameVideo::_InsertImageInTexSheet(), and hoa_video::GameVideo::CaptureScreen().
std::string hoa_utils::temp_version_str [static] |
| const float hoa_utils::UTILS_2PI = 6.283185307f |
Definition at line 108 of file utils.h.
Referenced by hoa_video::Interpolator::_EaseTransform(), and hoa_video::private_video::ParticleSystem::_RespawnParticle().
| bool hoa_utils::UTILS_DEBUG = false |
Definition at line 34 of file utils.cpp.
Referenced by hoa_main::EnableDebugging(), RandomBoundedInteger(), hoa_utils::Singleton< hoa_mode_manager::GameModeManager >::SingletonCreate(), and hoa_utils::Singleton< hoa_mode_manager::GameModeManager >::SingletonDestroy().
| const float hoa_utils::UTILS_HALF_PI = 1.570796326f |
Definition at line 106 of file utils.h.
Referenced by hoa_video::private_video::ParticleSystem::Draw().
| const float hoa_utils::UTILS_PI = 3.141592653f |
| const float hoa_utils::UTILS_QUARTER_PI = 0.785398163f |
1.5.1