Can we display the upgrade multiplier a research item gives on the hover-over menu? I think it would be a very attractive feature to players if they knew exactly what they were getting before choosing to research it.
So when hovering over the first MG upgrade in the research menu it would read:
Hardened MG Bullets
Cost: 18
MG Damage: 25%
It's at line 4033 in hci.cpp and I tried playing around with it for an hour but I'm not familiar with C++. Is this easy to implement? Not all research items have an upgrade multiplier so I don't know how that would work.
Display the upgrade each research item gives
Re: Display the upgrade each research item gives
There seems to be something like that in data/mp/messages/resmessages1.json, but that seems to only be shown after research is complete.
Would it make sense to show all that in the tooltip? It might be a bit verbose, but maybe it's ok, not sure.
If not, maybe data/mp/stats/research.json could have something like this:.
Would it make sense to show all that in the tooltip? It might be a bit verbose, but maybe it's ok, not sure.
If not, maybe data/mp/stats/research.json could have something like this:
Code: Select all
"name": "Hardened MG Bullets",
"text": [
"Machinegun damage +25%"
]
Re: Display the upgrade each research item gives
I can't comment on how one would go about implementing this, I'm not familiar with C++ or software architecture. I'm essentially trying to display the upgrade multiplier just below the cost which is outputted at line 4033 in hci.cpp.Cyp wrote:There seems to be something like that in data/mp/messages/resmessages1.json, but that seems to only be shown after research is complete.
Would it make sense to show all that in the tooltip? It might be a bit verbose, but maybe it's ok, not sure.
If not, maybe data/mp/stats/research.json could have something like this:.Code: Select all
"name": "Hardened MG Bullets", "text": [ "Machinegun damage +25%" ]
4033| tipString.append(QString::fromUtf8(_("\nCost: %1")).arg(powerCost));
My intuition is to trace the initialization of powerCost and mimic it using a variable named upgradeValue to display the upgrade multiplier instead of cost.
I copied the above and replaced references to power with research value variables:hci.cpp
4033| tipString.append(QString::fromUtf8(_("\nCost: %1")).arg(powerCost));
3974| powerCost = ((RESEARCH *)Stat)->researchPower;
3916| unsigned powerCost = 0;
researchdef.h
52| UDWORD researchPower; /* Power cost to research */
research.cpp
224| unsigned int resPower = ini.value("researchPower", 0).toUInt();
225| ASSERT_OR_RETURN(false, resPower <= UWORD_MAX, "Research Power too high for research topic - '%s' ", getName(&research));
226| research.researchPower = resPower;
but I wasn't successful in displaying the upgrade multiplier value. I just managed to compile WZ for the first time yesterdayhci.cpp
4034| tipString.append(QString::fromUtf8(_("\nCost: %1")).arg(upgradeValue));
3975| upgradeValue = ((RESEARCH *)Stat)->researchValue;
3916| unsigned upgradeValue = 0;
researchdef.h
53| UDWORD researchValue; /* Upgrade value of research */
research.cpp
228| unsigned int resValue = ini.value("researchValue", 0).toUInt();
229| ASSERT_OR_RETURN(false, resValue <= UWORD_MAX, "Testing, not sure what to put here - '%s' ", getName(&research));
230| research.researchValue = resValue;
Re: Display the upgrade each research item gives
I'm thinking it would be hard to generate the right string automatically. If an upgrade gives +15% tank and cyborg armour, should it say "+15% tank and cyborg armour" or just "+15% armour", or even "+15% tanks and cyborg armour and +15% tank and cyborg HP", or perhaps "Important, prerequisite of research upgrade"? Think it would depend on the mod, since some mods might have upgrades more separate than others.