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
+1 -1
View File
@@ -39,7 +39,7 @@ class MenuItem: public JGuiObject
virtual void Entering(); virtual void Entering();
virtual bool Leaving(JButton key); virtual bool Leaving(JButton key);
virtual bool ButtonPressed(); 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; virtual ostream& toString(ostream& out) const;
}; };
+1 -1
View File
@@ -41,7 +41,7 @@ class SimpleMenuItem: public JGuiObject
virtual bool Leaving(JButton key); virtual bool Leaving(JButton key);
virtual bool ButtonPressed(); virtual bool ButtonPressed();
virtual ostream& toString(ostream& out) const; 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 #endif
+1 -1
View File
@@ -198,7 +198,7 @@ bool CardSelector::CheckUserInput(int x, int y)
return true; return true;
} }
Target* oldactive = active; 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) { if (active != oldactive) {
CardView::SelectorZone oldowner, owner; CardView::SelectorZone oldowner, owner;
+4 -4
View File
@@ -390,7 +390,7 @@ void GameStateShop::Update(float dt)
if (menu && menu->closed) if (menu && menu->closed)
SAFE_DELETE(menu); SAFE_DELETE(menu);
srcCards->Update(dt); srcCards->Update(dt);
alphaChange = (500 - (int)((rand() % 1000)) * dt); alphaChange = static_cast<int>(500 - (int)((rand() % 1000)) * dt);
lightAlpha+= alphaChange; lightAlpha+= alphaChange;
if (lightAlpha < 0) lightAlpha = 0; if (lightAlpha < 0) lightAlpha = 0;
if (lightAlpha > 50) lightAlpha = 50; if (lightAlpha > 50) lightAlpha = 50;
@@ -589,7 +589,7 @@ void GameStateShop::Render()
if( bListCards || elp > LIST_FADEIN){ if( bListCards || elp > LIST_FADEIN){
int alpha = 200; int alpha = 200;
if(!bListCards && elp < LIST_FADEIN+.25){ 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)); r->FillRoundRect(300,10, 160, SHOP_SLOTS * 20 + 15,5,ARGB(alpha,0,0,0));
alpha += 55; alpha += 55;
@@ -602,7 +602,7 @@ void GameStateShop::Render()
string s = descPurchase(i,true); string s = descPurchase(i,true);
sprintf(buffer, "%s", s.c_str()); sprintf(buffer, "%s", s.c_str());
float x = 310; float x = 310;
float y = 25 + 20*i; float y = static_cast<float>(25 + 20*i);
mFont->DrawString(buffer,x,y); mFont->DrawString(buffer,x,y);
} }
} }
@@ -616,7 +616,7 @@ void GameStateShop::Render()
mFont->SetColor(ARGB(255,255,255,255)); mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(c, 5, SCREEN_HEIGHT - 12); mFont->DrawString(c, 5, SCREEN_HEIGHT - 12);
sprintf(c, "%s", _("[]:other cards").c_str()); 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->DrawString(c,SCREEN_WIDTH-len,SCREEN_HEIGHT-14);
mFont->SetColor(ARGB(255,255,255,0)); mFont->SetColor(ARGB(255,255,255,0));
+4 -4
View File
@@ -109,19 +109,19 @@ void GuiHandSelf::Repos()
if (OptionHandDirection::HORIZONTAL == options[Options::HANDDIRECTION].number) if (OptionHandDirection::HORIZONTAL == options[Options::HANDDIRECTION].number)
{ {
y = SCREEN_WIDTH - 30; 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) for (vector<CardView*>::reverse_iterator it = cards.rbegin(); it != cards.rend(); ++it)
{ {
(*it)->x = y; (*it)->x = y;
(*it)->y = SCREEN_HEIGHT - 30; (*it)->y = SCREEN_HEIGHT - 30;
y -= dist; y -= dist;
(*it)->alpha = (q ? 0 : 255); (*it)->alpha = static_cast<float>(q ? 0 : 255);
} }
backpos.x = y + SCREEN_HEIGHT - 14; backpos.x = y + SCREEN_HEIGHT - 14;
} }
else 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; bool flip = false;
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it) for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
{ {
@@ -129,7 +129,7 @@ void GuiHandSelf::Repos()
(*it)->y = y; (*it)->y = y;
if (flip) y += dist; if (flip) y += dist;
flip = !flip; flip = !flip;
(*it)->alpha = (q ? 0 : 255); (*it)->alpha = static_cast<float>(q ? 0 : 255);
} }
} }
} }
+1 -1
View File
@@ -103,7 +103,7 @@ void GuiPlay::BattleField::Update(float dt)
height += 10 * dt * (HEIGHT - height); height += 10 * dt * (HEIGHT - height);
if (colorFlow){ if (colorFlow){
red+= colorFlow * 300 * dt; red+= static_cast<int>(colorFlow * 300 * dt);
if (red < 0) red = 0; if (red < 0) red = 0;
if (red > 70) red = 70; if (red > 70) red = 70;
} }
+5 -5
View File
@@ -14,7 +14,7 @@ bool GuiStatic::Leaving(JButton key)
return false; 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; 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){ 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(), x, y, this); cd = NEW CardDisplay(0, GameObserver::GetInstance(), static_cast<int>(x), static_cast<int>(y), this);
cd->zone = zone; cd->zone = zone;
showCards = 0; showCards = 0;
} }
@@ -236,7 +236,7 @@ int GuiGraveyard::receiveEventPlus(WEvent* e)
t = NEW CardView(CardView::nullZone, event->card, *(event->card->view)); t = NEW CardView(CardView::nullZone, event->card, *(event->card->view));
else else
t = NEW CardView(CardView::nullZone, event->card, x, y); 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); cards.push_back(t);
return 1; return 1;
} }
@@ -279,7 +279,7 @@ int GuiOpponentHand::receiveEventPlus(WEvent* e)
t = NEW CardView(CardView::nullZone, event->card, *(event->card->view)); t = NEW CardView(CardView::nullZone, event->card, *(event->card->view));
else else
t = NEW CardView(CardView::nullZone, event->card, x, y); 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); cards.push_back(t);
return 1; return 1;
} }
+2 -2
View File
@@ -95,12 +95,12 @@ float PriceList::difficultyScalar(float price, int cardid){
return (price + price * badluck); return (price + price * badluck);
} }
int PriceList::getPurchasePrice(int cardid){ 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" if(p < 2) p = 2; //Prevents "Sell for 0 credits"
return (int)p; return (int)p;
} }
int PriceList::getOtherPrice(int amt){ int PriceList::getOtherPrice(int amt){
float p = difficultyScalar(amt,0); float p = difficultyScalar((float)amt,0);
if(p < 2) p = 2; if(p < 2) p = 2;
return (int)p; return (int)p;
} }
+4 -4
View File
@@ -361,8 +361,8 @@ void TaskList::Start(){
mState = TASKS_IN; mState = TASKS_IN;
if(!mBgTex){ if(!mBgTex){
mBgTex = resources.RetrieveTexture("taskboard.png", RETRIEVE_LOCK); mBgTex = resources.RetrieveTexture("taskboard.png", RETRIEVE_LOCK);
float unitH = mBgTex->mHeight / 4; float unitH = static_cast<float>(mBgTex->mHeight / 4);
float unitW = mBgTex->mWidth / 4; float unitW = static_cast<float>(mBgTex->mWidth / 4);
if(unitH == 0 || unitW == 0) return; if(unitH == 0 || unitW == 0) return;
for(int i=0;i<9;i++) for(int i=0;i<9;i++)
@@ -470,7 +470,7 @@ void TaskList::Render() {
char buffer[300]; char buffer[300];
string title = _("Task Board"); 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; posY += 30;
if (0 == tasks.size()) { if (0 == tasks.size()) {
@@ -696,7 +696,7 @@ void TaskDelay::storeCustomAttribs() {
void TaskDelay::restoreCustomAttribs() { void TaskDelay::restoreCustomAttribs() {
turn = atoi(persistentAttribs[COMMON_ATTRIBS_COUNT].c_str()); turn = atoi(persistentAttribs[COMMON_ATTRIBS_COUNT].c_str());
if (persistentAttribs.size() > COMMON_ATTRIBS_COUNT + 1) { 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()));
} }
} }
+5 -5
View File
@@ -131,10 +131,10 @@ WTrackedQuad * WCachedTexture::GetTrackedQuad(float offX, float offY, float widt
vector<WTrackedQuad*>::iterator it; vector<WTrackedQuad*>::iterator it;
if(width == 0.0f || width > texture->mWidth) if(width == 0.0f || width > static_cast<float>(texture->mWidth))
width = texture->mWidth; width = static_cast<float>(texture->mWidth);
if(height == 0.0f || height > texture->mHeight) if(height == 0.0f || height > static_cast<float>(texture->mHeight))
height = texture->mHeight; height = static_cast<float>(texture->mHeight);
for(it = trackedQuads.begin();it!=trackedQuads.end();it++){ for(it = trackedQuads.begin();it!=trackedQuads.end();it++){
if((*it) && (*it)->resname == resname){ 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 * WCachedTexture::GetCard(float offX, float offY, float width, float height, string resname){
JQuad * jq = GetQuad(offX,offY,width,height,resname); JQuad * jq = GetQuad(offX,offY,width,height,resname);
if(jq) 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; return jq;
} }