diff --git a/projects/mtg/include/MenuItem.h b/projects/mtg/include/MenuItem.h index 6c6db400a..21d12b7b3 100644 --- a/projects/mtg/include/MenuItem.h +++ b/projects/mtg/include/MenuItem.h @@ -39,7 +39,7 @@ class MenuItem: public JGuiObject virtual void Entering(); virtual bool Leaving(JButton key); virtual bool ButtonPressed(); - virtual bool getTopLeft(int& top, int& left) {top = mY; left = mX; return true;}; + virtual bool getTopLeft(float& top, float& left) {top = mY; left = mX; return true;}; virtual ostream& toString(ostream& out) const; }; diff --git a/projects/mtg/include/SimpleMenuItem.h b/projects/mtg/include/SimpleMenuItem.h index cced5fa58..e99545952 100644 --- a/projects/mtg/include/SimpleMenuItem.h +++ b/projects/mtg/include/SimpleMenuItem.h @@ -41,7 +41,7 @@ class SimpleMenuItem: public JGuiObject virtual bool Leaving(JButton key); virtual bool ButtonPressed(); virtual ostream& toString(ostream& out) const; - virtual bool getTopLeft(int& top, int& left) {top = mY; left = mX; return true;}; + virtual bool getTopLeft(float& top, float& left) {top = mY; left = mX; return true;}; }; #endif diff --git a/projects/mtg/src/CardSelector.cpp b/projects/mtg/src/CardSelector.cpp index 47a0d3c5f..ab0d6cea6 100644 --- a/projects/mtg/src/CardSelector.cpp +++ b/projects/mtg/src/CardSelector.cpp @@ -198,7 +198,7 @@ bool CardSelector::CheckUserInput(int x, int y) return true; } Target* oldactive = active; - active = closest(cards, limitor, x, y); + active = closest(cards, limitor, static_cast(x), static_cast(y)); if (active != oldactive) { CardView::SelectorZone oldowner, owner; diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index 49a34e993..dad74b50f 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -390,7 +390,7 @@ void GameStateShop::Update(float dt) if (menu && menu->closed) SAFE_DELETE(menu); srcCards->Update(dt); - alphaChange = (500 - (int)((rand() % 1000)) * dt); + alphaChange = static_cast(500 - (int)((rand() % 1000)) * dt); lightAlpha+= alphaChange; if (lightAlpha < 0) lightAlpha = 0; if (lightAlpha > 50) lightAlpha = 50; @@ -589,7 +589,7 @@ void GameStateShop::Render() if( bListCards || elp > LIST_FADEIN){ int alpha = 200; if(!bListCards && elp < LIST_FADEIN+.25){ - alpha = 800 *(elp-LIST_FADEIN); + alpha = static_cast(800 *(elp-LIST_FADEIN)); } r->FillRoundRect(300,10, 160, SHOP_SLOTS * 20 + 15,5,ARGB(alpha,0,0,0)); alpha += 55; @@ -602,7 +602,7 @@ void GameStateShop::Render() string s = descPurchase(i,true); sprintf(buffer, "%s", s.c_str()); float x = 310; - float y = 25 + 20*i; + float y = static_cast(25 + 20*i); mFont->DrawString(buffer,x,y); } } @@ -616,7 +616,7 @@ void GameStateShop::Render() mFont->SetColor(ARGB(255,255,255,255)); mFont->DrawString(c, 5, SCREEN_HEIGHT - 12); sprintf(c, "%s", _("[]:other cards").c_str()); - unsigned int len = 4 + mFont->GetStringWidth(c); + float len = 4 + mFont->GetStringWidth(c); mFont->DrawString(c,SCREEN_WIDTH-len,SCREEN_HEIGHT-14); mFont->SetColor(ARGB(255,255,255,0)); diff --git a/projects/mtg/src/GuiHand.cpp b/projects/mtg/src/GuiHand.cpp index 73f3c7a69..8ccd53604 100644 --- a/projects/mtg/src/GuiHand.cpp +++ b/projects/mtg/src/GuiHand.cpp @@ -109,19 +109,19 @@ void GuiHandSelf::Repos() if (OptionHandDirection::HORIZONTAL == options[Options::HANDDIRECTION].number) { y = SCREEN_WIDTH - 30; - float dist = 240.0 / cards.size(); if (dist > 30) dist = 30; else y = SCREEN_WIDTH - 15; + float dist = 240.0f / cards.size(); if (dist > 30) dist = 30; else y = SCREEN_WIDTH - 15; for (vector::reverse_iterator it = cards.rbegin(); it != cards.rend(); ++it) { (*it)->x = y; (*it)->y = SCREEN_HEIGHT - 30; y -= dist; - (*it)->alpha = (q ? 0 : 255); + (*it)->alpha = static_cast(q ? 0 : 255); } backpos.x = y + SCREEN_HEIGHT - 14; } else { - float dist = 224.0 / ((cards.size() + 1) / 2); if (dist > 65) dist = 65; + float dist = 224.0f / ((cards.size() + 1) / 2); if (dist > 65) dist = 65; bool flip = false; for (vector::iterator it = cards.begin(); it != cards.end(); ++it) { @@ -129,7 +129,7 @@ void GuiHandSelf::Repos() (*it)->y = y; if (flip) y += dist; flip = !flip; - (*it)->alpha = (q ? 0 : 255); + (*it)->alpha = static_cast(q ? 0 : 255); } } } diff --git a/projects/mtg/src/GuiPlay.cpp b/projects/mtg/src/GuiPlay.cpp index 0ac3e4129..e6499d637 100644 --- a/projects/mtg/src/GuiPlay.cpp +++ b/projects/mtg/src/GuiPlay.cpp @@ -103,7 +103,7 @@ void GuiPlay::BattleField::Update(float dt) height += 10 * dt * (HEIGHT - height); if (colorFlow){ - red+= colorFlow * 300 * dt; + red+= static_cast(colorFlow * 300 * dt); if (red < 0) red = 0; if (red > 70) red = 70; } diff --git a/projects/mtg/src/GuiStatic.cpp b/projects/mtg/src/GuiStatic.cpp index c61fd8957..9cd39aa16 100644 --- a/projects/mtg/src/GuiStatic.cpp +++ b/projects/mtg/src/GuiStatic.cpp @@ -14,7 +14,7 @@ bool GuiStatic::Leaving(JButton key) return false; } -GuiAvatar::GuiAvatar(float x, float y, bool hasFocus, Player * player, Corner corner, GuiAvatars* parent) : GuiStatic(GuiAvatar::Height, x, y, hasFocus, parent), avatarRed(255), currentLife(player->life),currentpoisonCount(player->poisonCount), corner(corner), player(player) { +GuiAvatar::GuiAvatar(float x, float y, bool hasFocus, Player * player, Corner corner, GuiAvatars* parent) : GuiStatic(static_cast(GuiAvatar::Height), x, y, hasFocus, parent), avatarRed(255), currentLife(player->life),currentpoisonCount(player->poisonCount), corner(corner), player(player) { type = GUI_AVATAR; } @@ -203,8 +203,8 @@ void GuiGameZone::Update(float dt){ } } -GuiGameZone::GuiGameZone(float x, float y, bool hasFocus, MTGGameZone* zone, GuiAvatars* parent): GuiStatic(GuiGameZone::Height, x, y, hasFocus, parent), zone(zone){ - cd = NEW CardDisplay(0, GameObserver::GetInstance(), x, y, this); +GuiGameZone::GuiGameZone(float x, float y, bool hasFocus, MTGGameZone* zone, GuiAvatars* parent): GuiStatic(static_cast(GuiGameZone::Height), x, y, hasFocus, parent), zone(zone){ + cd = NEW CardDisplay(0, GameObserver::GetInstance(), static_cast(x), static_cast(y), this); cd->zone = zone; showCards = 0; } @@ -236,7 +236,7 @@ int GuiGraveyard::receiveEventPlus(WEvent* e) t = NEW CardView(CardView::nullZone, event->card, *(event->card->view)); else t = NEW CardView(CardView::nullZone, event->card, x, y); - t->x = x + Width / 2; t->y = y + Height / 2; t->zoom = 0.6; t->alpha = 0; + t->x = x + Width / 2; t->y = y + Height / 2; t->zoom = 0.6f; t->alpha = 0; cards.push_back(t); return 1; } @@ -279,7 +279,7 @@ int GuiOpponentHand::receiveEventPlus(WEvent* e) t = NEW CardView(CardView::nullZone, event->card, *(event->card->view)); else t = NEW CardView(CardView::nullZone, event->card, x, y); - t->x = x + Width / 2; t->y = y + Height / 2; t->zoom = 0.6; t->alpha = 0; + t->x = x + Width / 2; t->y = y + Height / 2; t->zoom = 0.6f; t->alpha = 0; cards.push_back(t); return 1; } diff --git a/projects/mtg/src/PriceList.cpp b/projects/mtg/src/PriceList.cpp index af720b038..1874b5fad 100644 --- a/projects/mtg/src/PriceList.cpp +++ b/projects/mtg/src/PriceList.cpp @@ -95,12 +95,12 @@ float PriceList::difficultyScalar(float price, int cardid){ return (price + price * badluck); } int PriceList::getPurchasePrice(int cardid){ - float p = difficultyScalar(getPrice(cardid),cardid); + float p = difficultyScalar((float)getPrice(cardid),cardid); if(p < 2) p = 2; //Prevents "Sell for 0 credits" return (int)p; } int PriceList::getOtherPrice(int amt){ - float p = difficultyScalar(amt,0); + float p = difficultyScalar((float)amt,0); if(p < 2) p = 2; return (int)p; } diff --git a/projects/mtg/src/Tasks.cpp b/projects/mtg/src/Tasks.cpp index ac71b1239..46ff4c66f 100644 --- a/projects/mtg/src/Tasks.cpp +++ b/projects/mtg/src/Tasks.cpp @@ -361,8 +361,8 @@ void TaskList::Start(){ mState = TASKS_IN; if(!mBgTex){ mBgTex = resources.RetrieveTexture("taskboard.png", RETRIEVE_LOCK); - float unitH = mBgTex->mHeight / 4; - float unitW = mBgTex->mWidth / 4; + float unitH = static_cast(mBgTex->mHeight / 4); + float unitW = static_cast(mBgTex->mWidth / 4); if(unitH == 0 || unitW == 0) return; for(int i=0;i<9;i++) @@ -470,7 +470,7 @@ void TaskList::Render() { char buffer[300]; string title = _("Task Board"); - f3->DrawString(title.c_str(), (SCREEN_WIDTH-20)/2 - title.length()*4, posY); + f3->DrawString(title.c_str(), static_cast((SCREEN_WIDTH-20)/2 - title.length()*4), posY); posY += 30; if (0 == tasks.size()) { @@ -696,7 +696,7 @@ void TaskDelay::storeCustomAttribs() { void TaskDelay::restoreCustomAttribs() { turn = atoi(persistentAttribs[COMMON_ATTRIBS_COUNT].c_str()); if (persistentAttribs.size() > COMMON_ATTRIBS_COUNT + 1) { - afterTurn = atoi(persistentAttribs[COMMON_ATTRIBS_COUNT+1].c_str()); + afterTurn = static_cast(atoi(persistentAttribs[COMMON_ATTRIBS_COUNT+1].c_str())); } } diff --git a/projects/mtg/src/WCachedResource.cpp b/projects/mtg/src/WCachedResource.cpp index 7dc02f411..cfc301e71 100644 --- a/projects/mtg/src/WCachedResource.cpp +++ b/projects/mtg/src/WCachedResource.cpp @@ -131,10 +131,10 @@ WTrackedQuad * WCachedTexture::GetTrackedQuad(float offX, float offY, float widt vector::iterator it; - if(width == 0.0f || width > texture->mWidth) - width = texture->mWidth; - if(height == 0.0f || height > texture->mHeight) - height = texture->mHeight; + if(width == 0.0f || width > static_cast(texture->mWidth)) + width = static_cast(texture->mWidth); + if(height == 0.0f || height > static_cast(texture->mHeight)) + height = static_cast(texture->mHeight); for(it = trackedQuads.begin();it!=trackedQuads.end();it++){ if((*it) && (*it)->resname == resname){ @@ -203,7 +203,7 @@ JQuad * WCachedTexture::GetQuad(string resname){ JQuad * WCachedTexture::GetCard(float offX, float offY, float width, float height, string resname){ JQuad * jq = GetQuad(offX,offY,width,height,resname); if(jq) - jq->SetHotSpot(jq->mTex->mWidth / 2, jq->mTex->mHeight / 2); + jq->SetHotSpot(static_cast(jq->mTex->mWidth / 2), static_cast(jq->mTex->mHeight / 2)); return jq; }