Reversing displayed Order

phungus420

Deity
Joined
Mar 1, 2003
Messages
6,296
This code is from PieceOfMind's Advanced Combat Mod component.
What I am trying to do is reverse the order of the end of combat Unit HP statistical distribution. Right now, it starts at the 100HP outcome, and ends with 1hit left to survive. This works, but it would be a tighter curve, and fit the distribution better if it went from almost dead to full HP (as it follows the attacks distribution).

Here is the code:
Code:
                   //START DEFENDER DETAIL HP HERE
                    if (iDetail > 2)//everything detail
                    {


                        for (int n_D = 0; n_D < iNeededRoundsAttacker; n_D++)
                        {

                            float prob = 100.0f*(getCombatOddsSpecific(pAttacker,pDefender,iNeededRoundsDefender,n_D)+(getCombatOddsSpecific(pAttacker,pDefender,iNeededRoundsDefender-1,n_D)));
                            szTempBuffer.Format(SETCOLR L"%dHP" ENDCOLR L" %.2f%%",
                                                TEXT_COLOR("COLOR_NEGATIVE_TEXT"),((pDefender->currHitPoints()) - n_D*iDamageToDefender),prob);
                            szString.append(NEWLINE);
                            int pixels = (int)(Scaling_Factor*prob + 0.5)+2;  // 1% per pixel
                            int fullBlocks = (pixels-2) / 10;
                            int lastBlock = (pixels-2) % 10;
                            //if(pixels>=2)
                            //{
                                szString.append(L"<img=Art/ACO/red_bar_left_end.dds>");
                                for (int iI = 0; iI < fullBlocks; ++iI)
                                {
                                    szString.append(L"<img=Art/ACO/red_bar_10.dds>");
                                }
                                if (lastBlock > 0)
                                {
                                    szTempBuffer2.Format(L"<img=Art/ACO/red_bar_%d.dds>", lastBlock);
                                    szString.append(szTempBuffer2);
                                }
                                szString.append(L"<img=Art/ACO/red_bar_right_end.dds>");
                            //}
                            szString.append(L" ");
                            szString.append(szTempBuffer.GetCString());

                        }
                    }
                    //END DEFENDER DETAIL HP HERE
Any ideas of how to go about this? I just want to reverse the order it is displayed, but I really don't know C++ at all, and it's not intuitively understandable for me how to get it to reverse the display.
 
Nevermind, got some help from irc, it works now.
 
Top Bottom