More type conversion warning cleanup.

This commit is contained in:
wrenczes@gmail.com
2010-11-07 12:00:23 +00:00
parent 5d907f5abe
commit a053c0d59e
10 changed files with 28 additions and 28 deletions

View File

@@ -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;
};

View File

@@ -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

View File

@@ -198,7 +198,7 @@ bool CardSelector::CheckUserInput(int x, int y)
return true;
}
Target* oldactive = active;
active = closest<True>(cards, limitor, x, y);
active = closest<True>(cards, limitor, static_cast<float>(x), static_cast<float>(y));
if (active != oldactive) {
CardView::SelectorZone oldowner, owner;

View File

@@ -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<int>(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<int>(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<float>(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));

View File

@@ -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<CardView*>::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<float>(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<CardView*>::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<float>(q ? 0 : 255);
}
}
}

View File

@@ -103,7 +103,7 @@ void GuiPlay::BattleField::Update(float dt)
height += 10 * dt * (HEIGHT - height);
if (colorFlow){
red+= colorFlow * 300 * dt;
red+= static_cast<int>(colorFlow * 300 * dt);
if (red < 0) red = 0;
if (red > 70) red = 70;
}

View File

@@ -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<float>(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<float>(GuiGameZone::Height), x, y, hasFocus, parent), zone(zone){
cd = NEW CardDisplay(0, GameObserver::GetInstance(), static_cast<int>(x), static_cast<int>(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;
}

View File

@@ -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;
}

View File

@@ -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<float>(mBgTex->mHeight / 4);
float unitW = static_cast<float>(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<float>((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<bool>(atoi(persistentAttribs[COMMON_ATTRIBS_COUNT+1].c_str()));
}
}

View File

@@ -131,10 +131,10 @@ WTrackedQuad * WCachedTexture::GetTrackedQuad(float offX, float offY, float widt
vector<WTrackedQuad*>::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<float>(texture->mWidth))
width = static_cast<float>(texture->mWidth);
if(height == 0.0f || height > static_cast<float>(texture->mHeight))
height = static_cast<float>(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<float>(jq->mTex->mWidth / 2), static_cast<float>(jq->mTex->mHeight / 2));
return jq;
}