Skip to content

Commit

Permalink
update card count calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
purerosefallen committed Jun 5, 2018
1 parent ff45380 commit 896bfa2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions gframe/client_card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void ClientCard::UpdateInfo(char* buf) {
link_marker = pdata;
}
}
mainGame->dField.RefreshCardCountDisplay();
}
void ClientCard::ClearTarget() {
for(auto cit = cardTarget.begin(); cit != cardTarget.end(); ++cit) {
Expand Down
14 changes: 11 additions & 3 deletions gframe/client_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ void ClientField::UpdateFieldCard(int controler, int location, char* data) {
(*cit)->UpdateInfo(data);
data += len - 4;
}
RefreshCardCountDisplay();
}
void ClientField::ClearCommandFlag() {
for(auto cit = activatable_cards.begin(); cit != activatable_cards.end(); ++cit)
Expand Down Expand Up @@ -1463,14 +1464,21 @@ void ClientField::UpdateDeclarableCode(bool enter) {
UpdateDeclarableCodeOpcode(enter);
}
void ClientField::RefreshCardCountDisplay() {
ClientCard* pcard;
for(int p = 0; p < 2; ++p) {
mainGame->dInfo.card_count[p] = hand[p].size();
for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) {
if(*it)
mainGame->dInfo.card_count[p]++;
pcard = *it;
if(pcard) {
if(pcard->type & TYPE_LINK && pcard->link)
mainGame->dInfo.card_count[p] += pcard->link;
else
mainGame->dInfo.card_count[p]++;
}
}
for(auto it = szone[p].begin(); it != szone[p].end(); ++it) {
if(*it)
pcard = *it;
if(pcard)
mainGame->dInfo.card_count[p]++;
}
myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]);
Expand Down

0 comments on commit 896bfa2

Please sign in to comment.