alketii / violetland

Automatically exported from code.google.com/p/violetland
0 stars 0 forks source link

Minor error with adding new weapons #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I encountered this problem when I tried to add a new weapon. The weapon I
added newer dropped from a monster, instead the "PM" now dropped from
monsters. 

I found the problem was in the line:

"int weaponIndex = (rand() % (weaponManager->Weapons.size() - 1));"

So if we have 5 weapons only the first 4 will be dropped randomly.

I easily fixed this problem with adding:

for(int i=0;i<(int) weapons.size();i++){
    if(weapons.at(i).compare("PM")==0){
        weapons.at(i)=weapons.back();
        weapons.back()="PM";
        fprintf(stdout, "EDIT: Putting PM to the end of list!\n");
        break;
    }
}

in "WeaponManager.cpp" after line 18.

With PM listed last it will newer be a drop but any new weapons added will be.

By the way... I'm using violetland-v0.2.9 on Ubuntu 9.10

I recommend adding this solution to the official version.

P.S.: sorry for the bad English 

Original issue reported on code.google.com by janez.po...@gmail.com on 30 Mar 2010 at 9:59

GoogleCodeExporter commented 9 years ago
I noticed now that this problem was already reported... but still... I like this
solution more because it prevents the PM to drop.

Original comment by janez.po...@gmail.com on 30 Mar 2010 at 10:17

GoogleCodeExporter commented 9 years ago
I will create new gameplay option "allow PM drop". If it will enabled PM will 
dropped
(and PM will give to Violet more probability to kick some bonuses from 
monsters, for
example). If it will disabled, your case will used.

Original comment by 5253...@gmail.com on 1 Apr 2010 at 5:45

GoogleCodeExporter commented 9 years ago

Original comment by 5253...@gmail.com on 28 Apr 2010 at 6:49