Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Save/Load issue #71

Open
mace666 opened this issue Feb 4, 2016 · 4 comments
Open

JSON Save/Load issue #71

mace666 opened this issue Feb 4, 2016 · 4 comments

Comments

@mace666
Copy link
Contributor

mace666 commented Feb 4, 2016

Every time I load a saved character from .json file and and save it again the content of the "groupsArray" in the skills section (EPSkill.php) gets duplicated. This continues until JSON string gets to long to be loaded.
I tried to fix the issue but right now I do not fully understand the usage of the "groupsArray" and how it should be filled correctly.

I testet with the actual version of master branch (2 Feb 2016) and in the virtual environment you provided. The browser used was Firefox 44.0

@mace666
Copy link
Contributor Author

mace666 commented Feb 4, 2016

A fix might be (EPSkill.php):
function loadSavePack($savePack,$cc = null){
parent::loadSavePack($savePack);

$this->skillType = $savePack['skillType'];
$this->prefix = $savePack['prefix'];  
$this->baseValue = $savePack['baseValue'];
$this->morphMod = $savePack['morphMod'];
$this->traitMod = $savePack['traitMod'];
$this->backgroundMod = $savePack['backgroundMod'];
$this->factionMod = $savePack['factionMod'];
$this->softgearMod = $savePack['softgearMod'];
$this->psyMod = $savePack['psyMod'];
$this->defaultable = $savePack['defaultable'];
$this->tempSkill = $savePack['tempSkill']; 
$this->specialization = $savePack['specialization'];
$this->isNativeTongue = $savePack['isNativeTongue'];
$this->nativeTongueBonus = $savePack['nativeTongueBonus'];  

# this is the new code:   
   if(isset($savePack['groupsArray'])){
   $this->groups = $savePack['groupsArray'];
    }
# it replaces this part:
#        if(isset($savePack['groupsArray'])){ 
#                foreach($savePack['groupsArray'] as $m){
#                    array_push($this->groups, $m);
#                } 
#            } 
       $this->maxValue = $savePack['maxValue'];  
       $this->maxValueMorphMod = $savePack['maxValueMorphMod'];
       $this->maxValueTraitMod = $savePack['maxValueTraitMod'];
       $this->maxValueFactionMod = $savePack['maxValueFactionMod'];
       $this->maxValueBackgroundMod = $savePack['maxValueBackgroundMod'];
       $this->maxValuePsyMod = $savePack['maxValuePsyMod'];
       $this->maxValueSoftgearMod = $savePack['maxValueSoftgearMod'];   

@mace666
Copy link
Contributor Author

mace666 commented Feb 9, 2016

The effect described in this issue ( #65 ) may beconnected with the problem described above.
If there is a problem with the json string, loading seems to last forever.

@mace666
Copy link
Contributor Author

mace666 commented Jun 8, 2016

The duplication of the Groups array leads to awfully long JSON strings. And I think at some time the JSON parser reaches a maximum number of chars and fails.

@mace666
Copy link
Contributor Author

mace666 commented Nov 25, 2016

I just noticed my code post above was not displayed correctly. I changed that. Now you can see what I modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant