BUG: Bases sell categories instead of things [SOLVED]

For collaboration on developing the mod capabilities of VS; request new features, report bugs, or suggest improvements

Moderator: Mod Contributor

Post Reply
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

BUG: Bases sell categories instead of things [SOLVED]

Post by chuck_starchaser »

I just finished fixing all the categories for items for PU, in master_parts_list.csv.
Say, for instance, Wood was under category Wood; now it's under Raw_Materials, as it should be.

However, it seems it's all for nothing, due to a bug: It appears that bases sell categories instead of items. Nothing appears in the commodities rooms, anymore, at any bases.

I look at units.csv, and in the Cargo column for bases, the second row reads,

Code: Select all

{file;Category;price;quant;mass;volume;functionality;maxfunctionality;description;missionBOOL}
What it should say is "Item"; --NOT "Category":

Code: Select all

{file;Item;price;quant;mass;volume;functionality;maxfunctionality;description;missionBOOL}
And the code should follow the correct nomenclature. That is, it should look up the Item, in column A of master parts list; --NOT a category (column B).
A car salesman sells you "a Mustang"; not "automobiles"; nor "automobiles/mustang" as a category.
A concrete item.
Seems like categories have to be redundant with items in all mods, just because of a nomenclature mistake that was committed to code.
Any chance we could get a quick fix?
Last edited by chuck_starchaser on Sun Oct 12, 2008 12:15 am, edited 3 times in total.
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Post by jackS »

Quick clarifying question - the cargo, or the cargo_import column ? the two are quite different.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Cargo. I haven't even looked at the cargo_import column, yet.
I posted that from work, and just got home now.
Okay, before I hit [Submit], let me check cargo_import...
Both. Same thing.
Cargo Imports lists the individual Items or Products that are bought, and the prices paid.
"Iron" is NOT a "category"; it is an Item in the Raw Materials category.
What's the point in having columns A and B in master parts lists, if column B has to duplicate column A for things to work?, --i.e. if every item has to have its own unique category?
If you want to specify categories for bases, then that calls for a separate format; --one which would not list prices, among other things.
But right now, the way things stand, what the cargo import and cargo columns list are items; not "categories".
And the code might as well change to look them up in the A column of master parts list; not the B column.
Then we'll be able to have real categories, and get rid of the duplication.
Same goes for upgrades, I believe.
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Post by jackS »

Either something seems amiss with your current data definitions, or I am not correctly understanding your descriptions, as there is no requirement that each item have its own category.

You would only need a 1:1 correspondance between items and categories if you want to control the availability rates of every item individually, as availability is determined at a category level.

in

Code: Select all

 {filename(string);Category(string);price(credits);quant(int);mass(metric Tons);volume(meters*meters*meters);functionality(percentage);maxfunctionality(percentage);description(string);missionCargo(bool)}

(e.g) {Iron_Ore;Raw_Materials/Ores;0;4;1;2;1;1;;0}
"filename" is the name of the item, corresponding to the name of the item specified in the "file" column in master_part_list.csv

"Filename" as the name for the column is a holdover from when each unit (and hence each cargo item) required its own separate file.

Cargo specifies particular items. These items are defined to be currently present on a given unit. It is not used to specify what that unit sells. You could place this in the cargo field of a mining ship such that, if destroyed, there could be containers of iron ore left behind in the wreckage. At present, though I have longstanding plans to change this, upgrades are just special-cased cargo.

Cargo_import deals specifically in categories, such as this entry from a VS mining base:

Code: Select all

{Cat(string);price(percentage);pricestddev(percentage);quant(percentage);quantstddev(percentage)}

(e.g.){Industrially_Manufactured_Goods/Construction;1.2;.1;1;1}
This will pull in some number of random items from the Industrially_Manufactured_Goods/Construction category and make them available for sale at the mining base every time the for-sale set of items is refreshed.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re:

Post by chuck_starchaser »

Damn! Now I'm starting to understand. Probably what's happening here is that Mamiya Otaru or someone after him indeed wanted to control prices and availabilities of individual items at every base.
My apologies. I totally assumed that prices were controlled by item (filename) at every base by the engine; didn't even occur to me that "category" in the cargo columns might actually mean what it does.
I think I'm going to take a step to the right and relax the price controls, then.

EDIT:
Well, being that VS only allows to specify prices per-category, then we need a way to have hidden categories, or a separate way to control what categories are shown versus the ones that control prices.
We've asked before to be just rid of categories on the interface, but never get it. It can't be that difficult...
If the VS engine only allows specifying prices per category, then PU needs a lot of categories; but that should not imply that we MUST see those categories in the buy and sell interface.
The problem is that PU players are sick of clicking on category folders; and I am too. Why does it have to be this way? This is probably the most recurrent complaint after the AI. Just wasting the player's time; and one of these days someone's going to sue us for causing them carpal tunnel syndrome... :roll:
We NEED to define categories for like basic-to-advanced repair robots, for example; because advanced repair bots should only be available at places like Perry and New Detroit.
But that shouldn't IMPLY that those categories ought to be on the player's face all the time.
In fact, I don't see why we should have ANY categories showing in the commodities interface.
I'd be infinitely happier with just a plain, linear list of items.
Could we please get some attention to this issue? I've asked many times how to be rid of the categories, but now
I understand why everything breaks every time we try. We need to be able to control prices and availabilities; what
we don't need is a gazillion folders to click on.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: Re:

Post by chuck_starchaser »

IOW, all we need, --but really need--, is a config variable, "ShowCategories" that we can turn off.
Would this be difficult to do?
Which are the source files involved?
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Re: BUG: Bases sell categories instead of things

Post by jackS »

If the VS engine only allows specifying prices per category, then PU needs a lot of categories; but that should not imply that we MUST see those categories in the buy and sell interface.
Two things:
1) The category that the item is in and the category displayed can already be specified independently.
2) Just to be clear - base prices are specified per item, in the MPL. Price modifiers and spreads are specified per-category at the point of sale, as is availability.

Categories are not going away in the foreseeable future. You can already, however, easily reduce the number of categories displayed and their depth to minimum. Each item in the MPL has a description field. That field can contain two optional subfields, the @....@ delimited image subfield, and the <.....> delimited display-category subfield. An example:

Code: Select all

"Home_Furnishings","Consumer_and_Commercial_Goods/Domestic",140,25,75,"@cargo/home_furnishings.image@Whether filling a multi-room dwelling with creature comforts, or just a rug to avoid standing on cold metal in a stateroom, all sentients prefer furnishings to make a house their home."
would appear in Consumer_and_Commercial_Goods/Domestic

but

Code: Select all

"Home_Furnishings","Consumer_and_Commercial_Goods/Domestic",140,25,75,"@cargo/home_furnishings.image@<Contraband>Whether filling a multi-room dwelling with creature comforts, or just a rug to avoid standing on cold metal in a stateroom, all sentients prefer furnishings to make a house their home."
Would appear in category Contraband.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: BUG: Bases sell categories instead of things

Post by chuck_starchaser »

THANKS A MILLION!, JackS. The <catname> trick works like a charm. What a relief! FINALLY! :D :D :D :D :D :D :D

EDIT:
The one last thing that would be awsome would be a config switch to make categories auto-expanded by default,
so that they show merely as headings, rather than as folders one has click to open.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: BUG: Bases sell categories instead of things [SOLVED]

Post by chuck_starchaser »

While adding <> display categories worked for commodities, they don't seem to work for upgrades, for some reason.
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Re: BUG: Bases sell categories instead of things [SOLVED]

Post by jackS »

At work ATM, so don't have time to delve into this deeper, but a quick glance over basecomputer.cpp would seem to indicate that there's a presumption that all upgrades will be in subcategories of the "upgrades" category and that the first category name (the presumed "upgrades" part of upgrades/whatever) is being chopped off. I don't myself know what happens when you end up with a null string as a category name, but I'm betting that you've just found out :).
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Re: BUG: Bases sell categories instead of things [SOLVED]

Post by ace123 »

Indeed, it strips out the first category of any upgrades or ships. However, in theory you can set that first category to whatever since it looks at the real category, not the display category, to determine if it is a ship.
That way, if you wanted to buy a ship or upgrade as cargo for some reason, it will use the first category of whatever you set for that reason.

As to making them open by default, go to line 2600 of basecomputer.cpp

Code: Select all

    SimplePickerCell* parentCell = static_cast<SimplePickerCell*>(cells.cellAt(cells.count()-1));   // Last cell in list.
    static bool showDefault = XMLSupport::parse_bool(vs_config->getVariable("graphics","open_picker_categories","false"));
    parentCell->setHideChildren(!showDefault);
    ...
EDIT: Just committed this change to svn.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: BUG: Bases sell categories instead of things [SOLVED]

Post by chuck_starchaser »

Excellent! Thanks a million!
I'm leaving for work but I'll see if I can get this to work tonight.
We don't have anybody with a windows compiler, so, for the expanded categories I'll have to wait for a new binary;
but no rush; I'm hoping to upgrade the engine for PU once there's support for cubemaps, which safemode's working on.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: BUG: Bases sell categories instead of things [SOLVED]

Post by chuck_starchaser »

Ship and upgrades categories working like a charm, now :D
Can't wait to the next executable upgrade.
Only one little glitch: While the ships sold at the commodities acquired the new categories, the ones sold at the shipdealer still use the other categories; not the <> ones. Ironically, we've been wanting to get rid of ships sold as cargo --just don't know how to do it-- so it doesn't help much that those are working well :) :roll:
loki1950
The Shepherd
Posts: 5799
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Re: BUG: Bases sell categories instead of things [SOLVED]

Post by loki1950 »

Part of that svn commit of ace's is a config file variable to control the behaviour.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Post Reply