Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre committed Mar 16, 2013
1 parent e66aa90 commit a510d8f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mudnames.php
Expand Up @@ -81,10 +81,6 @@ public function opened_dictionnary($name) {
*/
public function open_dictionnary($name='random') {

if (self::opened_dictionnary($name)) {
return $this->_dictionnaries_instance[$name];
}

switch ($name) {
case '':
case 'random':
Expand All @@ -95,6 +91,11 @@ public function open_dictionnary($name='random') {
throw new UnexpectedValueException("Dictionnary '$name' doesn't exists.");
}
}

if (self::opened_dictionnary($name)) {
return $this->_dictionnaries_instance[$name];
}

$this->_dictionnaries_instance[$name] = new Mudnames_Dictionnary($this->_dictionnaries[$name]);

$this->_actions['dictionnaries'][$name]['capabilities'] = $this->_dictionnaries_instance[$name]->get_file_capability_list();
Expand Down Expand Up @@ -277,8 +278,9 @@ function force_capability($cap) {
* Sélectionne une association de capacité de façons aléatoire et la retourne.
*/
public function select_capability() {

self::check_cap_file();
if($this->forced_capability == null) { //Not necessary to check file everytime
self::check_cap_file();
}

// If a forced capability exists, we apply it.
if (!empty($this->forced_capability)) {
Expand Down

0 comments on commit a510d8f

Please sign in to comment.