Per wrote:Hello all who can code,
Things are busy for me at the moment, but I am trying to squeeze in some time to make stats a bit more flexible and make more things editable by mods. I have started yet another stats editor, this time in Qt, and it is holed up in tools/statsedit. It is very bare-bones at the moment (just displaying .ini file stats), and I would love for someone to take up this project and take it further. It is a very easy place to start for a new coder wanting to get into Warzone coding.
Let me know if you want to get started, or just start creating patches

Once apon a time I have started develop my editor. (wz 2.9)
It was local server (python-django).
It loads files to database (sqlite)
Allow edit it in you browser
And dump back it to game format.
I will check it how it lives and send you demo if you wish.
PS. WTF?
Code: Select all
model.setData(model.index(i, 1, QModelIndex()), ini.value("buildPower").toString(), Qt::DisplayRole);
model.setData(model.index(i, 2, QModelIndex()), ini.value("buildPoints").toString(), Qt::DisplayRole);
model.setData(model.index(i, 3, QModelIndex()), ini.value("weight").toString(), Qt::DisplayRole);
model.setData(model.index(i, 4, QModelIndex()), ini.value("hitpoints").toString(), Qt::DisplayRole);
model.setData(model.index(i, 5, QModelIndex()), ini.value("model").toString(), Qt::DisplayRole);
model.setData(model.index(i, 6, QModelIndex()), ini.value("type").toString(), Qt::DisplayRole);
model.setData(model.index(i, 7, QModelIndex()), ini.value("speed").toString(), Qt::DisplayRole);
model.setData(model.index(i, 8, QModelIndex()), ini.value("designable", false).toString(), Qt::DisplayRole);
model.setData(model.index(i, 9, QModelIndex()), ini.value("skidDeceleration", 600).toString(), Qt::DisplayRole);
model.setData(model.index(i, 10, QModelIndex()), ini.value("spinSpeed", 8192/45*3/4).toString(), Qt::DisplayRole);
model.setData(model.index(i, 11, QModelIndex()), ini.value("turnSpeed", 8192/45/3).toString(), Qt::DisplayRole);
model.setData(model.index(i, 12, QModelIndex()), ini.value("Acceleration", 250).toString(), Qt::DisplayRole);
model.setData(model.index(i, 13, QModelIndex()), ini.value("Deceleration", 800).toString(), Qt::DisplayRole);
model.setData(model.index(i, 14, QModelIndex()), ini.value("spinAngle", 180).toString(), Qt::DisplayRole);
Do you here about DRY (Dont repeat youself)?
Why you call almost same function so many times?
IMHO
creating "structure" fields = [(name, default), (name, default), ]
And using cycle over it will add more readability. (+2 lines of code, - 80 chars from 15 lines)
IMHO2 If you create ini scheme to game (just file what describes which fields are used, has it default value or reqired, what max, min or choose values it has) You will generate this views by it. And can use it in game code to load data.
Same for stats.cpp:
most stats function do same thing:
get ini file, make some checks, return filled structure.
My view on it: it must be function that get 2 args:
file with template (field_name, default, required, max, min, [choices])
file with data
At current time you make double work.
You describe in
game code each field you use and its
default value.
You describe in
editor code each field you use and its
default value.
You editor does not check if body size is in body_list. But stats check it.