Skip to content

Commit

Permalink
Easier options for the NMR-policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleepcap committed Aug 18, 2012
1 parent 24bd5da commit d989dc5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
1 change: 1 addition & 0 deletions gamecreate.php
Expand Up @@ -149,6 +149,7 @@

$input['specialCDturn'] = (int)$input['specialCDturn'];
if ( $input['specialCDturn'] < 0 ) $input['specialCDturn'] = 0;

$input['specialCDcount'] = (int)$input['specialCDcount'];
if ( $input['specialCDcount'] < 0 ) $input['specialCDcount'] = 0;

Expand Down
17 changes: 14 additions & 3 deletions gamepanel/game.php
Expand Up @@ -260,10 +260,21 @@ function gameVariants() {
if( $this->anon=='Yes' )
$alternatives[]='Anon';
if( $this->potType=='Winner-takes-all' )
$alternatives[]='WTA';
if( $this->specialCDturn >= $this->turn)
$alternatives[]='NMR:'.$this->specialCDturn.'/'.$this->specialCDcount;
$alternatives[]='WTA';

// The NMR-policy defaults
if( $this->specialCDturn != Config::$specialCDturnsDefault && $this->specialCDcount != Config::$specialCDcountDefault && $this->specialCDturn >= $this->turn)
{
if ( $this->specialCDturn == 0 && $this->specialCDcount == 0 )
$alternatives[]='NMR: Off';
elseif( $this->specialCDturn == 5 && $this->specialCDcount == 2 )
$alternatives[]='NMR: Committed';
elseif( $this->specialCDturn == 99 && $this->specialCDcount == 5 )
$alternatives[]='NMR: Serious';
else
$alternatives[]='NMR:'.$this->specialCDturn.'/'.$this->specialCDcount;
}

// Show the end of the game in the options if set.
if(( $this->targetSCs > 0) && ($this->maxTurns > 0))
$alternatives[]='EoG: '.$this->targetSCs.' SCs or "'.$this->Variant->turnAsDate($this->maxTurns -1).'"';
Expand Down
20 changes: 16 additions & 4 deletions locales/English/gamecreate.php
Expand Up @@ -318,13 +318,25 @@ function changeMinPhases(i){
<li class="formlisttitle">
NMR policy:
</li>
<li class="formlistfield">
<b>How many turns: </b><input type="text" name="newGame[specialCDturn]" size="4" value="<?php print Config::$specialCDturnsDefault;?>" /> (0 = feature off / <?php print Config::$specialCDturnsDefault;?> = default)<br>
<b>How many extends: </b><input type="text" name="newGame[specialCDcount]" size="4" value="<?php print Config::$specialCDcountDefault;?>" /> (0 = extend till a replacement is found / <?php print Config::$specialCDcountDefault;?> = default)
<li class="formlistfield">
<select id="NMRpolicy" name="newGame[NMRpolicy]"
onChange="
opt = this.value.split('/');
document.getElementById('specialCDturn').value = opt[0];
document.getElementById('specialCDcount').value = opt[1];">
<option value="0/0">Off</option>
<option value="<?php print Config::$specialCDturnsDefault;?>/<?php print Config::$specialCDcountDefault;?>" selected>Default</option>
<option value="5/2">Committed</option>
<option value="99/5">Serious</option>
<option value="0/0">Custom</option>
</select>
- Turns: </b><input type="text" id="specialCDturn" onChange="document.getElementById('NMRpolicy').selectedIndex = 4;" name="newGame[specialCDturn]" size="2" value="<?php print Config::$specialCDturnsDefault;?>">
- Delay: </b><input type="text" id="specialCDcount" onChange="document.getElementById('NMRpolicy').selectedIndex = 4;" name="newGame[specialCDcount]" size="2" value="<?php print Config::$specialCDcountDefault;?>">
</li>
<li class="formlistdesc">
This special rule sends a country in civil disorder (CD) if it does not enter an order (NMR) and extend the phase so a replacement can be found.
This works on all phases of a turn (diplomacy, retreat, build).
This works for the given number of turns on all phases (diplomacy, retreat, build). If a replacement is not found till the phase expires again it
the processing will be pushed back again for the given number of delays.
<br /><br /><strong>Default:</strong> <?php print Config::$specialCDturnsDefault;?> / <?php print Config::$specialCDcountDefault;?>
</li>

Expand Down

0 comments on commit d989dc5

Please sign in to comment.