void Popup::OnButtonReleased( const GUIButton* apButton ) { switch( m_type ) { case PT_QUESTION: { if( apButton->m_Hash == IwHashString( "popup_yes" ) ) { m_buttonStatus = PB_RELEASED; m_questionResult = PQ_YES; } if( apButton->m_Hash == IwHashString( "popup_no" ) ) { m_buttonStatus = PB_RELEASED; m_questionResult = PQ_NO; } } break; case PT_OK: { if( apButton->m_Hash == IwHashString( "popup_ok" ) ) { m_buttonStatus = PB_RELEASED; } } break; } }
CIwGameString& CIwGameString::operator+= (const CIwGameString &op) { int len1 = GetLength(); int len2 = op.GetLength(); if (Data == NULL) { allocString(len1 + len2); strcpy(Data, op.c_str()); } else { if ((len1 + len2) >= Size) reallocString(len1 + len2); memcpy(Data + len1, op.c_str(), len2); Data[len1 + len2] = 0; } Length = len1 + len2; if (AutoHash) DataHash = IwHashString(Data); return *this; }
CIwGameString& CIwGameString::operator+= (int nNum) { char str[32]; snprintf(str, 32, "%d", nNum); int len1 = GetLength(); int len2 = (int)strlen(str); if (Data == NULL) { allocString(len1 + len2); strcpy(Data, str); } else { if ((len1 + len2) >= Size) reallocString(len1 + len2); memcpy(Data + len1, str, len2); Data[len1 + len2] = 0; } Length = len1 + len2; if (AutoHash) DataHash = IwHashString(Data); return *this; }
unsigned int CIwGameString::CalculateHash(const char* pString) { if (pString == NULL) return 0; return IwHashString(pString); }
CIwGameString& CIwGameString::operator= (const char *op) { Length = (int)strlen(op); if (Data == NULL) { allocString(Length); } else { if (Length >= Size) reallocString(Length); } if (op == NULL) { Data[0] = 0; return *this; } strcpy(Data, op); if (AutoHash) DataHash = IwHashString(Data); return *this; }
CIwGameString& CIwGameString::operator+= (const char *op) { if (op == NULL) return *this; int len1 = GetLength(); int len2 = (int)strlen(op); if (Data == NULL) { allocString(len1 + len2); strcpy(Data, op); } else { if ((len1 + len2) >= Size) reallocString(len1 + len2); memcpy(Data + len1, op, len2); Data[len1 + len2] = 0; } Length = len1 + len2; if (AutoHash) DataHash = IwHashString(Data); return *this; }
Leader::Leader(Player* owner, CIwFVec2 position, Game* game) : Unit(1000.0f, 0.0f, owner, position, game) { numFrames = 3; scale = 0.5f; framesUntilUpdate = 0; texture_names.push_back(IwHashString("leader_sprite_sheet")); }
Thrower::Thrower(Player* owner, CIwFVec2 position, Game* game) : AttackingUnit(200.0f, 300.0f, 8.0f, owner, position, game) { numFrames = 8; scale = 0.5f; texture_names.push_back(IwHashString("thrower_walk_sprite_sheet")); }
/**************************************function Find********************************************* * Summary - Returns the searched scene * * @param name - the name of the scene * @return - scene, but null if it fails *************************************************************************************************/ Scene* SceneManager::Find(const char* name) { unsigned int name_hash = IwHashString(name); for (std::list<Scene*>::iterator it = m_Scenes.begin(); it != m_Scenes.end(); ++it) { if ((*it)->GetNameHash() == name_hash) return *it; } return 0; }
bool AudioSound::Load(const char* filename) { m_NameHash = IwHashString(filename); m_SoundData = CIwSoundWAV::Create(filename, 0, 0); if (m_SoundData == 0) return false; m_SoundSpec = new CIwSoundSpec(); m_SoundSpec->SetData(m_SoundData); return true; }
Timer* TimerManager::Find(const char* name) { unsigned int name_hash = IwHashString(name); for (std::list<Timer*>::iterator it = m_Timers.begin(); it != m_Timers.end(); ++it) { if ((*it)->getNameHash() == name_hash) return *it; } return NULL; }
Thrower::Thrower(Player* owner, Game* game, float x, float y) : Unit(200.0f, 300.0f, 0.0f, 8.0f, 20.0f, 60.0f, 80.0f, 0.0f, 0.0f, owner, game) { spriteSize = 256; numFrames = 8; curFrame = 0; scale = 0.5f; setPosition(x, y); texture_names.push_back(IwHashString("thrower_walk_sprite_sheet")); framesUntilUpdate = 0; }
Spreader::Spreader(Player* owner, Game* game, float x, float y) : Unit(250.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, 7.0f, 5.0f, owner, game){ spriteSize = 256; numFrames = 11; curFrame = 0; scale = 0.25f; amountSpread = 1; spreadDelay = 0; setPosition(x, y); worldRad = game->getWorldRadius(); texture_names.push_back(IwHashString("spreader_sprite_sheet")); }
void CIwGameString::setAutoHash(bool enable) { AutoHash = enable; if (enable) { if (Data != NULL) DataHash = IwHashString(Data); } else { DataHash = 0; } }
bool MenuLanguages::OnButtonReleased( const GUIButton* apButton ) { if( apButton->m_Hash == IwHashString( "ml_flag_en_button" ) ) { m_currentLanguage = Config::CLC_ENGLISH; OnLanguageChanged(); return true; } if( apButton->m_Hash == IwHashString( "ml_flag_ru_button" ) ) { m_currentLanguage = Config::CLC_RUSSIAN; OnLanguageChanged(); return true; } if( apButton->m_Hash == IwHashString( "ml_flag_fr_button" ) ) { m_currentLanguage = Config::CLC_FRENCH; OnLanguageChanged(); return true; } if( apButton->m_Hash == IwHashString( "ml_flag_ge_button" ) ) { m_currentLanguage = Config::CLC_GERMAN; OnLanguageChanged(); return true; } if( apButton->m_Hash == IwHashString( "ml_flag_it_button" ) ) { m_currentLanguage = Config::CLC_ITALIAN; OnLanguageChanged(); return true; } if( apButton->m_Hash == IwHashString( "ml_flag_sp_button" ) ) { m_currentLanguage = Config::CLC_SPAINISH; OnLanguageChanged(); return true; } if( apButton->m_Hash == IwHashString( "ml_back_button" ) ) { m_soundManager->PlaySFXUiSelect(); m_menuManager->PopMenu(); return true; } return false; }
AudioSound* Audio::PreloadSound(const char* filename) { AudioSound* sound = findSound(IwHashString(filename)); if (sound == 0) { sound = new AudioSound(); if (!sound->Load(filename)) { delete sound; return 0; } m_Sounds.push_back(sound); } return sound; }
CIwGameString::CIwGameString(int nNum) { FindIndex = 0; Data = NULL; AutoHash = true; char str[32]; snprintf(str, 32, "%d", nNum); int len = (int)strlen(str); allocString(len); Length = len; strcpy(Data, str); if (AutoHash) DataHash = IwHashString(Data); }
CIwGameString& CIwGameString::operator= (int nNum) { char str[32]; snprintf(str, 32, "%d", nNum); int len = (int)strlen(str); if (len >= Size) reallocString(len); strcpy(Data, str); Length = len; if (AutoHash) DataHash = IwHashString(Data); return *this; }
void CIwGameString::setString(const char *str) { if (str == NULL) { if (Data != NULL) delete Data; Data = NULL; Size = 0; Length = 0; return; } int len = strlen(str); allocString(len); strcpy(Data, str); Length = len; if (AutoHash) DataHash = IwHashString(Data); }
void CIwGameString::setString(const char *str, int len) { if (str == NULL) { if (Data != NULL) delete Data; Data = NULL; Size = 0; Length = 0; return; } allocString(len); memcpy(Data, str, len); Data[len] = 0; Length = len; if (AutoHash) DataHash = IwHashString(Data); }
void CIwGameString::Copy(const char* pString, int start, int count) { if (Data == NULL) { allocString(count); } else { if (count >= Size) reallocString(count); } memcpy(Data, pString + start, count); Length = count; Data[count] = 0; if (AutoHash) DataHash = IwHashString(Data); }
CIwGameString::CIwGameString(const CIwGameString &string) { FindIndex = 0; Data = NULL; AutoHash = true; if (string.c_str() == NULL) { Length = 0; Size = 0; } else { int len = (int)strlen(string.c_str()); allocString(len); Length = len; strcpy(Data, string.c_str()); if (AutoHash) DataHash = IwHashString(Data); } }
CIwGameString::CIwGameString(const char *pString) { FindIndex = 0; Data = NULL; AutoHash = true; if (pString == NULL) { Length = 0; Size = 0; } else { int len = (int)strlen(pString); allocString(len); Length = len; strcpy(Data, pString); if (AutoHash) DataHash = IwHashString(Data); } }
CIwGameString::CIwGameString(const char *pString, int start, int num_chars) { FindIndex = 0; Data = NULL; AutoHash = true; if (pString == NULL) { Length = 0; Size = 0; } else { int len = num_chars; allocString(len); Length = len; memcpy(Data, pString + start, num_chars); Data[len] = 0; if (AutoHash) DataHash = IwHashString(Data); } }
static void Register(const char *pClassName, const char* pBaseName) { strcpy(s_ClassName, pClassName); s_BaseHash = IwHashString(pBaseName); // Create a base object and find its v-table CIwManaged* pObj = (CIwManaged*) IwClassFactoryCreate(s_BaseHash); if (!pObj) { IwAssertMsg(UI, false, ("Custom class %s base %s not recognised by class factory", pClassName, pBaseName)); return; } intptr_t* vtable = *(intptr_t**)pObj; // RTTI information stored in -1 slot --vtable; // Copy base objects v-table int i = 0; int num = sizeof(s_VTable) / sizeof(s_VTable[0]); while (*vtable && i < num) { s_VTable[i++] = *vtable++; } // Replace GetClassName function CNameChanger temp; int index = temp.GetIndexOfGetClassName(); s_VTable[index+1] = (*(intptr_t**)&temp)[index]; // Register class factory uint32 baseClassSize = IwClassFactoryGetSize(s_BaseHash); IwClassFactoryAdd(s_ClassName, Create, baseClassSize); delete pObj; }
CIwGameString::CIwGameString(bool value) { FindIndex = 0; Data = NULL; AutoHash = true; int len; if (value) len = 4; else len = 5; allocString(len); Length = len; if (value) strcpy(Data, "true"); else strcpy(Data, "false"); if (AutoHash) DataHash = IwHashString(Data); }
void CIwGameString::ReplaceHTMLCodes() { if (!ContainsSpecialCharacters()) return; char* str = Data; char* nstr = str; // Replace all instances of special tags with ascii codes int len = Length; for (int t = 0; t < len; t++) { char c = *str++; if (c == '&') { if (t < len - 3) { if (*str == 'l' && *(str + 1) == 't' && *(str + 2) == ';') { *nstr++ = '<'; str += 3; t += 3; } else if (*str == 'g' && *(str + 1) == 't' && *(str + 2) == ';') { *nstr++ = '>'; str += 3; t += 3; } else if (t < len - 4) { if (*str == 'a' && *(str + 1) == 'm' && *(str + 2) == 'p' && *(str + 3) == ';') { *nstr++ = '&'; str += 4; t += 4; } else if (t < len - 4) { if (*str == 'q' && *(str + 1) == 'u' && *(str + 2) == 'o' && *(str + 3) == 't' && *(str + 4) == ';') { *nstr++ = '"'; str += 5; t += 5; } else if (*str == 'a' && *(str + 1) == 'p' && *(str + 2) == 'o' && *(str + 3) == 's' && *(str + 4) == ';') { *nstr++ = '\''; str += 5; t += 5; } else *nstr++ = c; } else *nstr++ = c; } else *nstr++ = c; } else *nstr++ = c; } else *nstr++ = c; } *nstr = 0; Length = (int)nstr - (int)Data; if (AutoHash) DataHash = IwHashString(Data); }
static int HashString(const char* s) { return (int)IwHashString(s); }
void CIwGameString::setName(char *name) { if (name == NULL) return; NameHash = IwHashString(name); }
737, // Web OS text 659, // Windows Mobile banner 788, // Windows Mobile text 1041, // Mobile web banner 1042, // Mobile web text }; // // // Server response codes // unsigned int CIwGameAds::ResponseCodes[] = { IwHashString("OK"), IwHashString("House Ad"), IwHashString("Internal Error"), IwHashString("Invalid Input"), IwHashString("Unknown App Id"), IwHashString("noAD"), }; CIwGameAd* CIwGameAd::getCopy() { if (Image == NULL) return NULL; if (Image->getImage2D() == NULL || LinkURI.IsEmpty()) return NULL;