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

Statistics and same building names, but different sizes #372

Open
StingMcRay opened this issue Nov 21, 2021 · 12 comments
Open

Statistics and same building names, but different sizes #372

StingMcRay opened this issue Nov 21, 2021 · 12 comments
Labels
enhancement New feature or request main window features or issues affecting the main window preset tree-view features or issues affecting the preset tree view

Comments

@StingMcRay
Copy link
Contributor

StingMcRay commented Nov 21, 2021

Since we changed / remove the Building vs Preset checker, the statics still divide building with the same name, but different sizes (see picture)
afbeelding

To avoid confusions we could add a feature (optional or always enabled) to set the size after the building name if there is counted more then twice of the same building name

(see discord msg https://discord.com/channels/571011757317947406/571011757317947410/911887964739633163 and down)

@StingMcRay
Copy link
Contributor Author

StingMcRay commented Nov 21, 2021

As i check the saved.ad file it seams that is it still something on the checker of 9.1

{
	"Identifier": "Farmer Residence",
	"Label": "",
	"Position": "1,1",
	"Size": "6,6",
	"Icon": "A7_resident",
	"Template": "Farmer Residence",
	"Color": {
		"A": 255,
		"R": 32,
		"G": 178,
		"B": 170
	},
	"Borderless": false,
	"Road": false,
	"Radius": 0.0,
	"InfluenceRange": 0.0,
	"PavedStreet": true
},
{
	"Identifier": "Residence_Old_World",
	"Label": "",
	"Position": "7,14",
	"Size": "3,3",
	"Icon": "A7_resident",
	"Template": "ResidenceBuilding",
	"Color": {
		"A": 255,
		"R": 32,
		"G": 178,
		"B": 170
	},
	"Borderless": false,
	"Road": false,
	"Radius": 0.0,
	"InfluenceRange": 0.0,
	"PavedStreet": true
}

the Identifier will be adjusted when something is changed on the building settings
I will when i have more time check this part again, if i need to see if we not already changed this in the prebuild of 9.2

@StingMcRay StingMcRay added enhancement New feature or request main window features or issues affecting the main window preset tree-view features or issues affecting the preset tree view labels Nov 21, 2021
@FroggieFrog FroggieFrog changed the title Statics and same building names Statistics and same building names, but different sizes Nov 23, 2021
@FroggieFrog
Copy link
Collaborator

Did I understand this correctly?

  • It is correct that there are 2 different entries in the statistics panel
  • It would be good to understand why there are 2 entries

Based on that I would suggest to add an option to show the building size after the building name e.g. 4 x Farmer Residence (6x6).

@StingMcRay
Copy link
Contributor Author

Yes, as i thought we spoke that on Discord, in the example it should be showed as :
4 x Farmer Residence (6x6)
2 x Farmer Residence (3x3)

But only if the name is double in the statics list, so, if i put only the 3x3's on the canvas, then
2 x Farmer Residence

@FroggieFrog
Copy link
Collaborator

In the given example: How do you identify that those 2 buildings are the same?

  • the Identifier is different
  • the Template is different

@StingMcRay
Copy link
Contributor Author

StingMcRay commented Dec 6, 2021

As we know, when you change things on the Building Settings, the checker will change the identifier and template to what the label is, so, it will never get the same identifier/template. But translation wise (that is in stats) you will see both names as the same....
What i can do, is that when the checker sees changes, i will add the measurement too it, in that case the identifier becomes "Label name (size[0] x size[1])"
On the example above it will become
4 x Farmer Residence (6x6)
2 x Farmer Residence

@StingMcRay
Copy link
Contributor Author

StingMcRay commented Dec 6, 2021

Additional info about that:
It will be done on all objects that are changed and i will try to exclude the field objects then

@FroggieFrog
Copy link
Collaborator

Wouldn't it be better (or make more sense) to define a set of actions/modifications that do not alter the Identifier?

Like why has the Identifier to change when you add a label to a building?

Nevertheless your suggestion could work as a (kind of dirty) quick fix.

@StingMcRay
Copy link
Contributor Author

StingMcRay commented Dec 6, 2021

I will let my mind think about other solutions about the changes...
If the identifier is not changed, then you get that all farm residences will count as 1 object, even they are different sizes so in the example then you get
6 x Farmer Residence

The change for the template was for the other checker, that we "disabled" (the not in preset tree building), i did not took it out when we did that

@FroggieFrog
Copy link
Collaborator

FroggieFrog commented Dec 6, 2021

There could be a 2 staged grouping logic for the statistics:

  1. Group by Identifier
  2. Group by Size

So the buildings could have the same Identifier (which is used for localization etc.) but could still have different Templates and be displayed with different sizes.

That way the Identifieris the only "source of truth" for localization and checking if it is a known building.

In contrast to that a changed Size could also justify that it is a new/different building which neeeds a new Identifier.

So it has to be defined what the way forward should look like.

@StingMcRay
Copy link
Contributor Author

Oke that would be a good one then, i will adjust the checker too, that only if the "label text" != ojb.label then the identifier will changed to that new name, as users must have the option to make own objects (as in 9.1)

@FroggieFrog
Copy link
Collaborator

Current logic

To note the current logic of MainViewModel.ApplyCurrentObject as I understand it:

  • The method is called when the user clicks on Place building in the Building Settings.
  • The method is called when the user double-clicks on a building in the Presets tree.
  1. create a new object with properties from Building Settings
  2. use temporary variable (objIconFileName) with the name of the selected icon
  3. check Size and Radius of new object
    • exit method and throw new Exception("Invalid building configuration.") if not valid
  4. find the first building in the presets that has the same objIconFileName
    1. a preset building was found
      1. copy info of BlockedArea to object
      2. Check if the user entered a Label. If so use the Label for Identifier and Template
    2. no preset building was found
      1. Check if the user entered a Label. If so use the Label for Identifier and Template.
      2. User entered no Label. Set Identifier to "UnknownObject".

(Maybe) desired logic

In general: Use Identifier instead of Icon to find a building in the presets.
4.1.2 - Just adjust Label and leave Identifier and Template as they are
4.2.1 - Just adjust Label and leave Identifier and Template as they are

@StingMcRay
Copy link
Contributor Author

StingMcRay commented Dec 6, 2021

Problem on the Adjusting Label, if Enable Label is not selected, labels will not be saved with a value into the AD files, as most users not use that, it is hard to adjust it... or:
we make a "showlabel" into the presets with 0 as default, and show the label if this value = 1 (this will be set to 1 if Enable Label is selected)
if we do above then we need to change the "Show labels" proc for that too
and we will always save the label value to the ad files (keep in mind THIS is the translated text of all objects, in the users language....)
Thats why i chosen for the Identifier to change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main window features or issues affecting the main window preset tree-view features or issues affecting the preset tree view
Projects
None yet
Development

No branches or pull requests

2 participants