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;
	}
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
unsigned int	CIwGameString::CalculateHash(const char* pString)
{
	if (pString == NULL)
		return 0;
		
	return IwHashString(pString);
}
Exemplo n.º 5
0
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;
}
Exemplo n.º 6
0
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;
}
Exemplo n.º 7
0
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"));
}
Exemplo n.º 8
0
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"));
}
Exemplo n.º 9
0
/**************************************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;
}
Exemplo n.º 10
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;
}
Exemplo n.º 11
0
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;
}
Exemplo n.º 12
0
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;
}
Exemplo n.º 13
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"));
}
Exemplo n.º 14
0
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;
}
Exemplo n.º 16
0
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;
}
Exemplo n.º 17
0
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);
}
Exemplo n.º 18
0
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;
}
Exemplo n.º 19
0
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);
}
Exemplo n.º 20
0
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);
}
Exemplo n.º 21
0
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);
}
Exemplo n.º 22
0
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);
	}
}
Exemplo n.º 23
0
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);
	}
}
Exemplo n.º 24
0
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);
	}
}
Exemplo n.º 25
0
    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;
    }
Exemplo n.º 26
0
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);
}
Exemplo n.º 27
0
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);
}
Exemplo n.º 28
0
		static int HashString(const char* s)
		{
			return (int)IwHashString(s);
		}
Exemplo n.º 29
0
void CIwGameString::setName(char *name)
{
	if (name == NULL)
		return;
	NameHash = IwHashString(name);
}
Exemplo n.º 30
0
	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;