where to discuss possible changes and current code

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
Post Reply
eldritch_cookie
Posts: 22
Joined: Sat Mar 05, 2022 6:41 pm

where to discuss possible changes and current code

Post by eldritch_cookie »

i am working on allowing a ruleset defined number of user actions, i frequently have questions about the code base or uncertainty of what to change.
for instance, i don't know if i change actions_iterate to iterate over the size of the action speclist which i will be adding in the game global object and add 2 dummy actions in the middle of the list separating the ruleset defined actions from the hardcoded actions(so that i don't need to change the actions id enum) or if i change every instance of use of a action id , to use a pointer to a action struct (thus obsoleting action_iterate)? i think that to unhardcode actions it would be better to do the second but it is significantly more work to do than the first. which can't be separated in multiple patches as it almost certainly wouldn't compile in a intermediate state, actually that makes the second inviable, i can't just submit a patch with 10000 line changes.
where to discuss things like these? is the forum a appropriate place to these kind of discussions or is there a better place, preferably more active?
cazfi
Elite
Posts: 3104
Joined: Tue Jan 29, 2013 6:54 pm

Re: where to discuss possible changes and current code

Post by cazfi »

Do you want me to create a (proposal) meta-ticket, and subtickets, of how I think the roadmap of this development to go? Similar to what I did for counters development in https://osdn.net/projects/freeciv/ticket/41119

Discussion about the details should take place in its ticket.
eldritch_cookie
Posts: 22
Joined: Sat Mar 05, 2022 6:41 pm

Re: where to discuss possible changes and current code

Post by eldritch_cookie »

cazfi wrote:Do you want me to create a (proposal) meta-ticket, and subtickets, of how I think the roadmap of this development to go? Similar to what I did for counters development in https://osdn.net/projects/freeciv/ticket/41119

Discussion about the details should take place in its ticket.
i must have not clicked the submit button, but yes a ticket would be useful, i don't know if in there i could ask questions like "i have changed the internal representation of actions, but it should behave as before as i have changed most functions and macros, however for some reason it is seing the wrong action enablers , are speclists 1 indexed(as in first element is index 1 instead of the expected 0)or were the actions[array] 1 indexed for some reason(ie spec enum.gen starts with number other than 0) "
cazfi
Elite
Posts: 3104
Joined: Tue Jan 29, 2013 6:54 pm

Re: where to discuss possible changes and current code

Post by cazfi »

I'll try to get to creating that plan soonish.

Meanwhile I think this could be the very first preparatory change: https://osdn.net/projects/freeciv/ticket/44103
eldritch_cookie
Posts: 22
Joined: Sat Mar 05, 2022 6:41 pm

Re: where to discuss possible changes and current code

Post by eldritch_cookie »

I am returning to complete my patch, i had a lot of tests so i was swamped with college work. in my patch i am changing the internal representation of actions from a array to a linked list(specifically a speclist from speclist.h), i did that and it compiles.
However i get a lot of error messages saying all action enablers for action must x, that is for the civ2civ3 ruleset which shouldn't behave any different from my changes, given that i properly changed actions iterate to iterate over all actions and action_enabler_iterate to iterate over all actions enablers per action, is there a action result iterate that should be changed?
the only thing i think could be causing this is if the specenum_gen.h generates a enum which starts on one(my list is assuming first id is position 0 but that may be wrong) and there also is some hardcoding on actionid of action results. can you confirm to me if the enums generated by spec_enum.h start on one?
Also there are a lot of instances where NUM_ACTIONS and MAX_NUM_ACTIONS are used (i searched with ripgrep) when action iterate should be used should i change all instances? I am leaning on changing all of them to use action_iterate as then in the future if actions need to be changed again it would be only a few lines which should be changed instead of 10 spots scattered across multiple files. i went to check and specenum_gen.h starts at 0 as expected.
i changed action iterate to
#define action_iterate(_act_) \
{ \
action_id _act_; \
for (_act_ = 0; _act_ < action_list_size(game.actions); _act_++) { \
if ((_act_ == ACTION_ANY )||(_act_ == ACTION_NONE)){ \
continue; \
}
but when debugging, it iterates over 114 and 115 which are ACTION_ANY and ACTION_NONE.do you have any idea what could be causing this?

actually when debugging it calls any list a incomplete type and it doesn't recognize the functions on speclist so i can't inspect them.if i could i would already have resolved this problem. any GDB debugging tips?
Post Reply