Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 41482 Details for
Bug 66718
atanks patches
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
money overflow patch
limit.patch (text/plain), 2.41 KB, created by
basic
on 2004-10-10 13:18:02 UTC
(
hide
)
Description:
money overflow patch
Filename:
MIME Type:
Creator:
basic
Created:
2004-10-10 13:18:02 UTC
Size:
2.41 KB
patch
obsolete
>Index: src/tank.cc >=================================================================== >RCS file: /cvsroot/atanks/atanks/src/tank.cc,v >retrieving revision 1.20 >diff -u -r1.20 tank.cc >--- src/tank.cc 1 Feb 2004 23:29:28 -0000 1.20 >+++ src/tank.cc 10 Oct 2004 20:13:18 -0000 >@@ -171,7 +171,8 @@ > sh -= (int)damage; > if (creditTo) { > if (player != creditTo) { //enemy hit ++ >- creditTo->money += (int)(damage * _global->scoreHitUnit); >+ double money = damage * _global->scoreHitUnit; >+ creditTo->money += (money < LONG_MAX ? (int)money : LONG_MAX); > if ((int)player->type != HUMAN_PLAYER) { > if (player->revenge == creditTo) { > player->annoyanceFactor += damage; >Index: src/atanks.cc >=================================================================== >RCS file: /cvsroot/atanks/atanks/src/atanks.cc,v >retrieving revision 1.57 >diff -u -r1.57 atanks.cc >--- src/atanks.cc 4 Feb 2004 23:34:33 -0000 1.57 >+++ src/atanks.cc 10 Oct 2004 20:13:18 -0000 >@@ -1574,7 +1574,8 @@ > fi = global->stopwindow = updatename = scroll = 1; > if (global->currentround != global->rounds) { > for (z = 0; z < global->numPlayers; z++) { >- global->players[z]->money = (long int) (global->players[z]->money * global->interest); >+ double money = global->players[z]->money * global->interest; >+ global->players[z]->money = (money < LONG_MAX ? (long int) money : LONG_MAX); > } > } > >@@ -2764,9 +2765,11 @@ > ltank->explode (); > if (ltank->creditTo) { > if (ltank->player != ltank->creditTo) { //enemy destroyed >- ltank->creditTo->money += (int)global->scoreUnitDestroyBonus; >+ double money = ltank->creditTo->money + global->scoreUnitDestroyBonus; >+ ltank->creditTo->money = (money < LONG_MAX ? (long int)money : LONG_MAX); > } else { //self destroy - ugh foolish one :)) > ltank->creditTo->money -= (int)global->scoreUnitSelfDestroy; >+ if (ltank->creditTo->money < 0) ltank->creditTo->money = 0; > } > ltank->creditTo = NULL; > } >@@ -2808,7 +2811,8 @@ > if (winner >= 0) { > global->players[winner]->score++; > global->players[winner]->won++; >- global->players[winner]->money += (long int)global->scoreRoundWinBonus; >+ double money = global->players[winner]->money + global->scoreRoundWinBonus; >+ global->players[winner]->money = (money < LONG_MAX ? (long int) money : LONG_MAX); > } > bCount = 0; > global->updateMenu = 1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 66718
:
41333
|
41334
|
41481
| 41482