Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: code/missionui/missiondebrief.cpp
- ===================================================================
- --- code/missionui/missiondebrief.cpp (revision 11197)
- +++ code/missionui/missiondebrief.cpp (working copy)
- @@ -493,7 +493,7 @@
- } else if (!stricmp(str, NOX("@Badge"))) {
- if (Badge_bitmap >= 0){
- - return Medals[Player->stats.m_badge_earned].name;
- + return Medals[Player->stats.m_badge_earned.back()].name;
- }
- }
- @@ -1021,8 +1021,8 @@
- // handle badge earned
- // only grant badge if earned and allowed. (no_promotion really means no promotion and no badges)
- - if ( Player->stats.m_badge_earned != -1 ) {
- - debrief_choose_medal_variant(buf, Player->stats.m_badge_earned, Player->stats.medal_counts[Player->stats.m_badge_earned] - 1);
- + if ( Player->stats.m_badge_earned.size() ) {
- + debrief_choose_medal_variant(buf, Player->stats.m_badge_earned.back(), Player->stats.medal_counts[Player->stats.m_badge_earned.back()] - 1);
- Badge_bitmap = bm_load(buf);
- // see if we have a persona
- @@ -1029,17 +1029,17 @@
- int persona_index = debrief_find_persona_index();
- // use persona-specific badge text if it exists; otherwise, use default
- - if (Medals[Player->stats.m_badge_earned].promotion_text.find(persona_index) != Medals[Player->stats.m_badge_earned].promotion_text.end()) {
- - Badge_stage.text = Medals[Player->stats.m_badge_earned].promotion_text[persona_index];
- + if (Medals[Player->stats.m_badge_earned.back()].promotion_text.find(persona_index) != Medals[Player->stats.m_badge_earned.back()].promotion_text.end()) {
- + Badge_stage.text = Medals[Player->stats.m_badge_earned.back()].promotion_text[persona_index];
- } else {
- - Badge_stage.text = Medals[Player->stats.m_badge_earned].promotion_text[-1];
- + Badge_stage.text = Medals[Player->stats.m_badge_earned.back()].promotion_text[-1];
- }
- Badge_stage.recommendation_text = "";
- // choose appropriate badge voice for this mission
- - debrief_choose_voice(Badge_stage.voice, Medals[Player->stats.m_badge_earned].voice_base, persona_index);
- + debrief_choose_voice(Badge_stage.voice, Medals[Player->stats.m_badge_earned.back()].voice_base, persona_index);
- - debrief_add_award_text(Medals[Player->stats.m_badge_earned].name);
- + debrief_add_award_text(Medals[Player->stats.m_badge_earned.back()].name);
- }
- if ((Rank_bitmap >= 0) || (Medal_bitmap >= 0) || (Badge_bitmap >= 0)) {
- Index: code/pilotfile/pilotfile.cpp
- ===================================================================
- --- code/pilotfile/pilotfile.cpp (revision 11197)
- +++ code/pilotfile/pilotfile.cpp (working copy)
- @@ -130,26 +130,28 @@
- p_stats->missions_flown++;
- // badges
- - if (stats->m_badge_earned >= 0) {
- + if (stats->m_badge_earned.size()) {
- list_size = (int)p_stats->medals_earned.size();
- + for (size_t medal = 0; medal < stats->m_badge_earned.size(); medal++) {
- + j = -1;
- - j = -1;
- -
- - for (idx = 0; idx < list_size; idx++) {
- - if ( p_stats->medals_earned[idx].name.compare(Medals[stats->m_badge_earned].name) == 0 ) {
- - j = idx;
- - break;
- + for (idx = 0; idx < list_size; idx++) {
- + if ( p_stats->medals_earned[idx].name.compare(Medals[stats->m_badge_earned[medal]].name) == 0 ) {
- + j = idx;
- + break;
- + }
- }
- - }
- - if (j >= 0) {
- - p_stats->medals_earned[j].val = 1;
- - } else {
- - ilist.name = Medals[stats->m_badge_earned].name;
- - ilist.index = stats->m_badge_earned;
- - ilist.val = 1;
- + if (j >= 0) {
- + p_stats->medals_earned[j].val = 1;
- + } else {
- + ilist.name = Medals[stats->m_badge_earned[medal]].name;
- + ilist.index = stats->m_badge_earned[medal];
- + ilist.val = 1;
- - p_stats->medals_earned.push_back(ilist);
- + p_stats->medals_earned.push_back(ilist);
- + list_size++;
- + }
- }
- }
- @@ -250,23 +252,24 @@
- }
- // badges
- - if (stats->m_badge_earned >= 0) {
- + if (stats->m_badge_earned.size()) {
- list_size = p_stats->medals_earned.size();
- + for (size_t medal = 0; medal < stats->m_badge_earned.size(); medal++) {
- + j = -1;
- - j = -1;
- + for (idx = 0; idx < list_size; idx++) {
- + if ( p_stats->medals_earned[idx].name.compare(Medals[stats->m_badge_earned[medal]].name) == 0 ) {
- + j = idx;
- + break;
- + }
- + }
- - for (idx = 0; idx < list_size; idx++) {
- - if ( p_stats->medals_earned[idx].name.compare(Medals[stats->m_badge_earned].name) == 0 ) {
- - j = idx;
- - break;
- + if (j >= 0) {
- + p_stats->medals_earned[j].val = 0;
- + } else {
- + Assertion (false, "Badge '%s' not found, should have been added by pilotfile::update_stats.", Medals[stats->m_badge_earned[medal]].name);
- }
- }
- -
- - if (j >= 0) {
- - p_stats->medals_earned[j].val = 0;
- - } else {
- - Assertion (false, "Badge '%s' not found, should have been added by pilotfile::update_stats.", Medals[stats->m_badge_earned].name);
- - }
- }
- // ship kills
- Index: code/stats/scoring.cpp
- ===================================================================
- --- code/stats/scoring.cpp (revision 11197)
- +++ code/stats/scoring.cpp (working copy)
- @@ -146,7 +146,7 @@
- m_medal_earned = -1; // hasn't earned a medal yet
- m_promotion_earned = -1;
- - m_badge_earned = -1;
- + m_badge_earned.clear();
- m_score = 0;
- memset(m_kills, 0, MAX_SHIP_CLASSES * sizeof(int));
- @@ -221,7 +221,7 @@
- {
- scp->m_medal_earned = -1; // hasn't earned a medal yet
- scp->m_promotion_earned = -1;
- - scp->m_badge_earned = -1;
- + scp->m_badge_earned.clear();
- scp->m_score = 0;
- scp->m_assists = 0;
- scp->mp_shots_fired = 0;
- @@ -305,8 +305,7 @@
- }
- // total_kills should now reflect the number of kills on hostile fighters/bombers. Check this number
- - // against badge kill numbers, and return the badge index if we would get a new one.
- - int badge = -1;
- + // against badge kill numbers, and award the appropriate badges as neccessary.
- int last_badge_kills = 0;
- for (i = 0; i < Num_medals; i++ ) {
- if ( total_kills >= Medals[i].kills_needed
- @@ -314,16 +313,12 @@
- && Medals[i].kills_needed > 0 )
- {
- last_badge_kills = Medals[i].kills_needed;
- - badge = i;
- + if (sc->medal_counts[i] < 1) {
- + sc->medal_counts[i] = 1;
- + sc->m_badge_earned.push_back(i);
- + }
- }
- }
- -
- - // if player could have a badge based on kills, and doesn't currently have this badge, then
- - // return the badge id.
- - if ( (badge != -1 ) && (sc->medal_counts[badge] < 1) ) {
- - sc->medal_counts[badge] = 1;
- - sc->m_badge_earned = badge;
- - }
- }
- // central point for dealing with accepting the score for a misison.
- @@ -381,8 +376,10 @@
- int idx;
- // if a badge was earned, take it back
- - if ( score->m_badge_earned != -1){
- - score->medal_counts[score->m_badge_earned] = 0;
- + if ( score->m_badge_earned.size() ){
- + for (size_t medal = 0; medal < score->m_badge_earned.size(); medal++) {
- + score->medal_counts[score->m_badge_earned[medal]] = 0;
- + }
- }
- // return when in training mission. We can grant a medal in training, but don't
- @@ -473,9 +470,11 @@
- }
- // if a badge was earned, take it back
- - if ( Player->stats.m_badge_earned != -1){
- - Player->stats.medal_counts[Player->stats.m_badge_earned] = 0;
- - Player->stats.m_badge_earned = -1;
- + if ( Player->stats.m_badge_earned.size() ){
- + for (size_t medal = 0; medal < Player->stats.m_badge_earned.size(); medal++) {
- + Player->stats.medal_counts[Player->stats.m_badge_earned[medal]] = 0;
- + }
- + Player->stats.m_badge_earned.clear();
- }
- }
- Index: code/stats/scoring.h
- ===================================================================
- --- code/stats/scoring.h (revision 11197)
- +++ code/stats/scoring.h (working copy)
- @@ -104,7 +104,7 @@
- // Mission total
- int m_medal_earned; // which medal (if any) earned this mission
- - int m_badge_earned; // which badge was earned. Calculated after mission is over
- + SCP_vector<int> m_badge_earned; // which badge(s) was(/were) earned. Calculated after mission is over
- int m_promotion_earned; // was a promotion earned. Calculated after mission is over
- int m_score;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement