Skip to content

Commit

Permalink
- Cleaning verbose printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
nadrino committed Aug 30, 2020
1 parent aaedebe commit 685bdc7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions kse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ sub What { #called by BrowseCmd
if ($tree->info('exists',$parm1."#")) { #first time opening node
$tree->delete('entry',$parm1."#");

print "Levels: $#levels\n";
# print "Levels: $#levels\n";
#my $gameversion=shift @levels; #should be 1 or 2 for KotOR1 or KotOR2
my $gameversion=$levels[0];
if ($#levels == 1) {
Expand Down Expand Up @@ -2179,6 +2179,8 @@ sub Populate_AreaContainer{
my $containerType = $treeLevels[3];
my $registeredPath = GetRegisteredPath($gameVersion);

print "Populating ".$containerType."...";

# Getting back the save data
my $treeRoot = '#'.$treeLevels[0].'#'.$treeLevels[1];
my $dataHash = $tree->entrycget($treeRoot,-data);
Expand All @@ -2199,19 +2201,19 @@ sub Populate_AreaContainer{
$containerList = $git_gff->{Main}{Fields}[$git_gff->{Main}->get_field_ix_by_label('Door List')]{Value};
}
else{
print "\n";
return;
}

my $nbContainers = scalar @$containerList;
print "Number of $containerType in the current module: ".$nbContainers."\n";
print " ".$nbContainers." containers have been found.\n";

my $iContainer = 0;
foreach(@$containerList) {

# my $container = $containerList->[$iContainer]; # Does not work

my $containerTag = $containerList->[$iContainer]{Fields}[$containerList->[$iContainer]->get_field_ix_by_label('Tag')]{Value};
print "-> $containerTag\n";

my $containerStrref;
if( $containerType eq 'Creatures' ){
Expand All @@ -2231,13 +2233,15 @@ sub Populate_AreaContainer{

my $itemList = $containerList->[$iContainer]{Fields}[$containerList->[$iContainer]->get_field_ix_by_label('ItemList')]{Value};

print " ".$containerDisplayTitle."\n";
$tree->add(
$treeItem."#".$iContainer."_".$containerTag,
-text=>$containerDisplayTitle,
-data=>'can modify'
);

my $iItem=0;
# for my $item (sort @items){
foreach(@$itemList){

if( $containerType eq 'Creatures'
Expand All @@ -2246,11 +2250,8 @@ sub Populate_AreaContainer{
next;
}


# my $item = $itemList->[$iItem];
my $itemStrref = $itemList->[$iItem]{Fields}[$itemList->[$iItem]->get_field_ix_by_label('LocalizedName')]{Value}{StringRef};

print $itemStrref."\n";
my $itemName;
if( $itemStrref == -1 ) {
$itemName = $itemList->[$iItem]{Fields}[$itemList->[$iItem]->get_field_ix_by_label('LocalizedName')]{Value}{Substrings}[0]{Value};
Expand All @@ -2263,7 +2264,7 @@ sub Populate_AreaContainer{
my $itemStack = $itemList->[$iItem]{Fields}[$itemList->[$iItem]->get_field_ix_by_label('StackSize')]{Value};
my $itemTitle = sprintf( "%-32s%s [%d]", $itemTag, $itemName, $itemStack );

print $itemTitle."\n";
print " ".$itemTitle."\n";
$tree->add($treeItem."#".$iContainer."_".$containerTag."#".$itemTag, -text=>$itemTitle, -data=>'can modify');
$tree->hide('entry',$treeItem."#".$iContainer."_".$containerTag."#".$itemTag);
$iItem++;
Expand Down Expand Up @@ -2471,6 +2472,8 @@ sub CommitChanges {
my $gv;
my $gm;

print "Committing changes...\n";

my @parms = split /#/, $treeitem;
# print join /\n/, @parms;

Expand Down Expand Up @@ -2757,6 +2760,9 @@ sub CommitChanges {

$mw->Dialog(-title=>'Save Successful',-text=>"File $registered_path\\$gamedir\\savegame.sav saved successfully.",-font=>['MS Sans Serif','8'],-buttons=>['Ok'])->Show();
# exec($^X, $0, @ARGV);

print "Commit changes has been done.\n";

}


Expand Down

0 comments on commit 685bdc7

Please sign in to comment.