More warning cleanup (type to type conversion warnings).

This commit is contained in:
wrenczes@gmail.com
2011-06-02 06:14:28 +00:00
parent 4018d17370
commit 90b1058ad5
13 changed files with 26 additions and 18 deletions

View File

@@ -370,7 +370,7 @@ public:
~GameSettings();
int save();
SimplePad * keypadStart(string input, string * _dest = NULL, bool _cancel=true, bool _numpad=false, int _x = SCREEN_WIDTH/2, int _y = SCREEN_HEIGHT/2);
SimplePad * keypadStart(string input, string * _dest = NULL, bool _cancel = true, bool _numpad = false, float _x = SCREEN_WIDTH_F / 2, float _y = SCREEN_HEIGHT_F / 2);
string keypadFinish();
void keypadShutdown();
void keypadTitle(string set);

View File

@@ -45,7 +45,7 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
}
if (damage->target == player)
{
stat->value += multiplier * STATS_PLAYER_MULTIPLIER * damage->damage;
stat->value += static_cast<int>(multiplier * STATS_PLAYER_MULTIPLIER * damage->damage);
}
else if (damage->target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
{
@@ -53,7 +53,7 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
if (target->controller() == player && !target->isInPlay())
{
//One of my creatures got lethal damage...
stat->value += multiplier * STATS_CREATURE_MULTIPLIER * damage->damage;
stat->value += static_cast<int>(multiplier * STATS_CREATURE_MULTIPLIER * damage->damage);
}
}
}
@@ -157,7 +157,7 @@ void AIStats::load(char * filename)
std::getline(file, s);
int value = atoi(s.c_str());
std::getline(file, s);
int direct = atoi(s.c_str());
bool direct = atoi(s.c_str()) > 0;
AIStat * stat = NEW AIStat(cardid, value, 1, direct);
stats.push_back(stat);
}

View File

@@ -936,7 +936,7 @@ void ActionStack::Update(float dt)
extraTime = 1;//we never want this int to be 0.
if (timer < 0)
timer = options[Options::INTERRUPT_SECONDS].number * extraTime;
timer = static_cast<float>(options[Options::INTERRUPT_SECONDS].number * extraTime);
timer -= dt;
if (timer < 0)
cancelInterruptOffer();

View File

@@ -109,7 +109,7 @@ bool CardDisplay::CheckUserInput(int x, int y)
float top, left;
if (mObjects[i]->getTopLeft(top, left))
{
distance2 = (top - y) * (top - y) + (left - x) * (left - x);
distance2 = static_cast<unsigned int>((top - y) * (top - y) + (left - x) * (left - x));
if (distance2 < minDistance2)
{
minDistance2 = distance2;

View File

@@ -221,7 +221,12 @@ JQuadPtr Credits::GetUnlockedQuad(string textureName)
JTexture * unlockedTex = WResourceManager::Instance()->RetrieveTexture(textureName);
if (!unlockedTex) return JQuadPtr();
return WResourceManager::Instance()->RetrieveQuad(unlockedTextureName, 2, 2, unlockedTex->mWidth - 4, unlockedTex->mHeight - 4);
return WResourceManager::Instance()->RetrieveQuad(
unlockedTextureName,
2.0f,
2.0f,
static_cast<float>(unlockedTex->mWidth - 4),
static_cast<float>(unlockedTex->mHeight - 4));
}

View File

@@ -776,12 +776,14 @@ void GameSettings::createUsersFirstDeck(int setId)
mCollection->save();
SAFE_DELETE(mCollection);
}
void GameSettings::keypadTitle(string set)
{
if (keypad != NULL)
keypad->title = set;
}
SimplePad * GameSettings::keypadStart(string input, string * _dest, bool _cancel, bool _numpad, int _x, int _y)
SimplePad * GameSettings::keypadStart(string input, string * _dest, bool _cancel, bool _numpad, float _x, float _y)
{
if (keypad == NULL)
keypad = NEW SimplePad();

View File

@@ -478,7 +478,7 @@ void GameStateDeckViewer::Update(float dt)
{
for(int i=0; i < CARDS_DISPLAYED; i++)
{
distance2 = (cardsCoordinates[i].second - y) * (cardsCoordinates[i].second - y) + (cardsCoordinates[i].first - x) * (cardsCoordinates[i].first - x);
distance2 = static_cast<unsigned int>((cardsCoordinates[i].second - y) * (cardsCoordinates[i].second - y) + (cardsCoordinates[i].first - x) * (cardsCoordinates[i].first - x));
if (distance2 < minDistance2)
{
minDistance2 = distance2;

View File

@@ -219,7 +219,8 @@ void GameStateDuel::loadPlayer(int playerId, int decknb, bool isAI, bool isNetwo
void GameStateDuel::initRand(unsigned int seed)
{
if (!seed) seed = time(0);
if (!seed)
seed = static_cast<unsigned int>(time(0));
srand(seed);
}

View File

@@ -486,7 +486,7 @@ void GameStateMenu::Update(float dt)
MTGCollection()->load(primitives[primitivesLoadCounter].c_str());
#if _DEBUG
int endTime = JGEGetTime();
float elapsedTime = (endTime - startTime);
int elapsedTime = (endTime - startTime);
DebugTrace("Time elapsed while loading " << primitives[primitivesLoadCounter] << " : " << elapsedTime << " ms");
#endif

View File

@@ -154,7 +154,7 @@ void GuiAvatars::Render()
}
else if (self == active)
{
r->FillRect(self->actX - w * self->actZ -4.5, self->actY - h * self->actZ, w * self->actZ, h * self->actZ, ARGB(200,0,0,0));
r->FillRect(self->actX - w * self->actZ - 4.5f, self->actY - h * self->actZ, w * self->actZ, h * self->actZ, ARGB(200,0,0,0));
}
GuiLayer::Render();

View File

@@ -188,7 +188,7 @@ void ModRulesGame::parse(TiXmlElement* element)
{
int value = ModRules::getValueAsInt(element, "canInterrupt");
if (value != -1)
mCanInterrupt = value;
mCanInterrupt = value > 0;
}
@@ -203,11 +203,11 @@ void ModRulesGeneral::parse(TiXmlElement* element)
{
int value = ModRules::getValueAsInt(element, "hasDeckEditor");
if (value != -1)
mHasDeckEditor = value;
mHasDeckEditor = value > 0;
value = ModRules::getValueAsInt(element, "hasShop");
if (value != -1)
mHasShop = value;
mHasShop = value > 0;
}

View File

@@ -819,7 +819,7 @@ void TaskDelay::restoreCustomAttribs()
turn = atoi(persistentAttribs[COMMON_ATTRIBS_COUNT].c_str());
if (persistentAttribs.size() > COMMON_ATTRIBS_COUNT + 1)
{
afterTurn = static_cast<bool> (atoi(persistentAttribs[COMMON_ATTRIBS_COUNT + 1].c_str()));
afterTurn = atoi(persistentAttribs[COMMON_ATTRIBS_COUNT + 1].c_str()) > 0;
}
}

View File

@@ -897,10 +897,10 @@ bool WGuiMenu::CheckUserInput(JButton key)
int n = currentItem;
unsigned int distance2;
unsigned int minDistance2 = -1;
for(size_t k=0; k < items.size(); k++)
for(size_t k = 0; k < items.size(); k++)
{
WGuiItem* pItem = (WGuiItem*)items[k];
distance2 = (pItem-> getY() - j) * (pItem-> getY() - j) + (pItem-> getX() - i) * (pItem-> getX() - i);
distance2 = static_cast<unsigned int>((pItem->getY() - j) * (pItem->getY() - j) + (pItem->getX() - i) * (pItem->getX() - i));
if (distance2 < minDistance2)
{
minDistance2 = distance2;