Sleepcap / vDiplomacy

Fork of the original webdip code with many variants and some dev tools
http://www.vdiplomacy.com/
GNU Affero General Public License v3.0
24 stars 13 forks source link

[Variant creation] Changing country names can create duplicates in adjudicatorPreGame file #31

Open gkykc opened 6 years ago

gkykc commented 6 years ago

When working on the variant World Diplomacy X, I changed the country name "Kenya" to "Japan" and "Near-East" to "Near East". After these changes, the following code still existed in the /classes/adjudicatorPreGame.php file, while it should have been deleted:

'Kenya' => array('Kenya' =>'Army' , 'Uganda' =>'Army' , 'Tanzania' =>'Fleet'), 'Near-East' => array('Iraq' =>'Army' , 'Saudi Arabia' =>'Army' , 'Syria' =>'Army' ),

But Japan and Near-East were added as countries in this file, too.

This is the only place where the duplicates emerged; in all other places, "Kenya" and "Near-East" were not recognized as powers anymore.

It is noteworthy here that I have changed multiple different country names, and that didn't cause duplicates to emerge. I don't know why the duplicates emerged in some cases while they didn't in others.

gkykc commented 6 years ago

It has happened again. I changed the country name 'Pacific-Russia' to 'Siberia' and the following code kept existing in the /classes/adjudicatorPreGame.php file:

'Pacific-Russia' => array('East Siberia' => 'Army','Kamchatka' => 'Fleet','Yakutsk' => 'Army'),

Interestingly, moments before I changed the country name 'Pacific-Russia' to 'Siberia', I changed the province name 'East Siberia' to 'Norilsk'. Hence, between the moment that I changed the province name of East Siberia and I changed the country name of Pacific-Russia, the code SHOULD have read the following:

'Pacific-Russia' => array('Norilsk' => 'Army','Kamchatka' => 'Fleet','Yakutsk' => 'Army'),

But that is not the line of code that kept existing after the change in the country name of Pacific-Russia. That is curious. Maybe this will help you to identify what exactly is the problem.

Sleepcap commented 6 years ago

The dev/units.php needs a rewrite. adjucatorPregame.php has the units hardcoded by countryname and not by countryID. The complete tool is more a "hack", as writing a adjucatorPregame.php for new variants is really easy, but not very save to allow on a life-install used by many players. I will change this once I have some time.

gkykc commented 6 years ago

Interestingly, the bug disappeared by itself after I gave Siberia units. Or did you solve it?