Page 3 of 5

Re: need help reading .ini file

Posted: 05 Jun 2013, 23:33
by Duha
https://github.com/Warzone2100/warzone2 ... ts/ecm.ini
"body" should be "bodyPoints"?

https://github.com/Warzone2100/warzone2 ... ulsion.ini
"hitpoints" should be "bodyPoints"?

Merge propulsionsounds.ini to propulsions.ini?

may be we can merge propulsiontype.ini to propulsions.ini
+ simple strucure
+ easy to adjust each propulsions settings
- can`t change all type at once

https://github.com/Warzone2100/warzone2 ... s.ini#L247
"LightWorld" should be "lightWorld" or "highlightArea"
"body" should be "bodyPoints"

https://github.com/Warzone2100/warzone2 ... ucture.ini
some fields missed in header comments:
powerPoints, productionPoint, rearmPoints, repairPoints, researchPoints
baseWidth, baseBreadth => width, breadth (as in features.ini)


different name styles in structures and templates:

Code: Select all

"name": "sensorID",
"name": "compSensor",


May be we can simplify structures.ini:

We have some field that depends from type:
productionPoints, rearmPoints, repairPoints

I suggest to replace them all with one field power.

If type == REPAIR FACILITY then power means repairPoints
If type == GENERATOR then power means poewrPoints
etc.

PS.
Looks like I finished researching stats.
current docs example.: https://googledrive.com/host/0B12sy1FQt ... hWUFQzSzA/

Re: need help reading .ini file

Posted: 04 Sep 2013, 20:27
by Ezio
Per, current body.ini use CyborgLightBody and CyborgHeavyBody while names.txt has nothing about them (it still use old names while guide parser needs it). is it going to be updated?, currently i used hack so cyborg would be generated in guide..

Re: need help reading .ini file

Posted: 04 Sep 2013, 20:32
by Per
Most names are now read from the .ini files, not names.txt. I am hoping that names.txt will soon be obsoleted.

I have made a note to look at your other suggestions later.

Re: need help reading .ini file

Posted: 04 Sep 2013, 22:07
by Ezio
Per wrote:Most names are now read from the .ini files, not names.txt. I am hoping that names.txt will soon be obsoleted.

I have made a note to look at your other suggestions later.
1. Ok, currently only templates.inc which still use data from names.txt.
2. about accuracy, according to .ini only mortar variant (indirect weapon) which have a longHit and shortHit (i use them for % accuracy) direct like machine gun would have a 0/0% accuracy. is there a default accuracy if not set? :hmm:
3. we need an image for hardcrete gate and nexus link turret :)

Re: need help reading .ini file

Posted: 04 Sep 2013, 23:25
by Per
There is no shortHit anymore in 3.2. longHit is used for all ranges.

Re: need help reading .ini file

Posted: 01 Oct 2013, 22:47
by Duha
Hi, I am successfully cloned wz repo(my internet connection became better :)) and can make some pull requests.

https://github.com/Warzone2100/warzone2100/pull/36

Things I can do with stats:
1. rename bodyPoint and hitppoints fields to body in all files (that name used in stats.cpp: psStats->body)

2. rename width and breadth in structures to baseWidth and baseBreadth (that name used in features.cpp: p->baseBreadth)

Re: need help reading .ini file

Posted: 01 Oct 2013, 23:29
by crab_
Duha wrote:1. rename bodyPoint and hitppoints fields to body in all files (that name used in stats.cpp: psStats->body)
Plese do not do that.
"body" is bad name for property, it's obvious.
We have Body object already, so we cannot use object name as name of property.
Droid.body = Body.body? :)

Re: need help reading .ini file

Posted: 01 Oct 2013, 23:52
by Duha
crab_ wrote:
Duha wrote:1. rename bodyPoint and hitppoints fields to body in all files (that name used in stats.cpp: psStats->body)
Plese do not do that.
"body" is bad name for property, it's obvious.
We have Body object already, so we cannot use object name as name of property.
Droid.body = Body.body? :)
All "body", "hitpoints" and "bodyPoints" must have same name in ini files.
In C++ code this property called "body".
IMHO body is not best name, but for integrity with other code it is OK. I like hitpoint more.

Re: need help reading .ini file

Posted: 01 Oct 2013, 23:56
by crab_
Duha wrote: All "body", "hitpoints" and "bodyPoints" must have same name in ini files.
In C++ code this property called "body".
IMHO body is not best name, but for integrity with other code it is OK. I like hitpoint more.
Why not just rename "->body" in low-level c-code?
I think it is even more simplier because compiler will help with renaming.
so please rename body to hitPoints or something similar (Health, LifePoints?)

C++ code should be should not be considered as "god written" code XD

Re: need help reading .ini file

Posted: 02 Oct 2013, 00:15
by Duha
crab_ wrote:
Duha wrote: All "body", "hitpoints" and "bodyPoints" must have same name in ini files.
In C++ code this property called "body".
IMHO body is not best name, but for integrity with other code it is OK. I like hitpoint more.
Why not just rename "->body" in low-level c-code?
I think it is even more simplier because compiler will help with renaming.
so please rename body to hitPoints or something similar (Health, LifePoints?)

C++ code should be should not be considered as "god written" code XD
I have some trouble with compilers: I don`t like them and my windows don`t want to work with them properly

May be you know what will happen with this code if "maxDroids" is not specified in ini section.

Code: Select all

psStats->maxDroids = ini.value("maxDroids").toInt();
https://github.com/Warzone2100/warzone2 ... s.cpp#L582

ini example: https://github.com/Warzone2100/warzone2 ... /brain.ini

Re: need help reading .ini file

Posted: 02 Oct 2013, 05:36
by NoQ
Duha wrote: May be you know what will happen with this code if "maxDroids" is not specified in ini section.

Code: Select all

psStats->maxDroids = ini.value("maxDroids").toInt();
value returns invalid QVariant. If you give value an optional second parameter, it will be returned instead. Proof link. Then toInt returns 0, indicating "not ok" (false) in its optional bool* parameter. Proof link. (checked the last part of it just in case).

Re: need help reading .ini file

Posted: 02 Oct 2013, 15:09
by crab_
Duha wrote: I have some trouble with compilers: I don`t like them and my windows don`t want to work with them properly
Did you tried Visual Studio as compiler for Warzone?
I have troubles with compiling Warzone in Visual Studio after i re-installed windows, but i believe if i spend some days i will be able to compile warzone :)
Duha wrote:May be you know what will happen with this code if "maxDroids" is not specified in ini section.
As far i understand each parameter has "default value" (as NoQ said above)

Re: need help reading .ini file

Posted: 02 Oct 2013, 16:51
by Duha
crab_ wrote:
Duha wrote: I have some trouble with compilers: I don`t like them and my windows don`t want to work with them properly
Did you tried Visual Studio as compiler for Warzone?
I have troubles with compiling Warzone in Visual Studio after i re-installed windows, but i believe if i spend some days i will be able to compile warzone :)
I tied to install compiler to compile PIL form python packages (gcc and some from visual studio)
As far i understand each parameter has "default value" (as NoQ said above)
Both values has default = 0, little inconsistency in code style.

Code: Select all

psStats->weight = ini.value("weight", 0).toInt();
psStats->maxDroids = ini.value("maxDroids").toInt();

Re: need help reading .ini file

Posted: 02 Oct 2013, 20:46
by Per
I've been trying to slowly convert 'body' meaning 'how much damage something can take' to 'hitpoints', because, really, nobody understands 'body' to mean that. Patches to complete the transition are welcome.

Re: need help reading .ini file

Posted: 02 Oct 2013, 21:37
by Duha
baseWidth in structures and "width" in features handled in different way is it OK?


Structures:

Code: Select all

psStats->baseWidth = ini.value("baseWidth", 0).toUInt();
		ASSERT_OR_RETURN(false, psStats->baseWidth <= 100, "Invalid baseWidth '%d' for structure '%s'", psStats->baseWidth, getID(psStats));
Features:

Code: Select all

p->baseWidth = ini.value("width", 1).toInt();