project-navigation
Personal tools

Author Topic: Encumbrance/TU penalty  (Read 15958 times)

Offline Kildor

  • Project Artist
  • Captain
  • ***
  • Posts: 757
  • Project mapper and some other stuff`er
    • View Profile
    • http://ufoai.nx0.ru
Re: Encumbrance/TU penalty
« Reply #15 on: September 01, 2010, 03:36:57 pm »
cheater, cheater!!

Offline Thrashard96

  • Squad Leader
  • ****
  • Posts: 260
    • View Profile
Re: Encumbrance/TU penalty
« Reply #16 on: September 01, 2010, 03:38:09 pm »
;D good one, have you read my signature below?
« Last Edit: September 01, 2010, 03:39:42 pm by PAUL1UZ5 »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Encumbrance/TU penalty
« Reply #17 on: September 01, 2010, 07:50:46 pm »
Do you think you can provide a little patch that makes auto placing call onChange ?
Well, Itried a little to work that out but it didn't work quite as expected, so I ended calling the update function right there, at least for now
Still that might be something worth checking as I'm not sure it was *only* an error on my side, as it seemed to work for all container nodes besides the backpack (where it crashed the game), will look at it later -- I'm in my other PC right now
Quote

Do you think you found all the events ?
Not yet, I'm aware of at least a couple situations that will throw things out of sync...

Quote
@keybounce:
DarkRain's implementation will apply the penalties in the most gradual way possible. So it's not like overloaded ? TUs -= 20%.
That's right I'm using an exponential function to calculate the penalty so it will progress slowly -- at the begining -- but if you seriously overload your soldiers they might end crushed under the weight of their equipment (but I'm talking of something like the double or more than they should carry) ;D
« Last Edit: September 01, 2010, 10:41:19 pm by DarkRain »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Encumbrance/TU penalty
« Reply #18 on: September 06, 2010, 01:04:08 am »
Do you think you can provide a little patch that makes auto placing call onChange ?
Maybe something like the attached patch could do the trick -- not very elegant tough.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: Encumbrance/TU penalty
« Reply #19 on: September 06, 2010, 11:06:39 am »
Hi, i dont read the problematic, and i dont have the full code here, anyway.

Some comments:

* please move assignation like "target = csi.idHolster" outside of param. (cause i dislike interleave like that (to me, it is hard to read, i prefer more lines, its the same for assignation inside if...).

* move UI_GetContainerNodeByContainerID to ui_node_container.c and .h

* first UI_GetContainerNodeByContainerID param should be a parent node (or a window node). UI_GetContainerNodeByContainerID (const uiNode_t* const parent... then u can use it like that UI_GetNode(parent, "holster"), and like that UI_GetContainerNodeByContainerID(node->parent, ...). We assume all containers have the same parent, it can be a panel (not only a window). Anyway it can be a deeper search, cause we dont call a lot this function.

* use a switch instead of the "if"s for UI_GetContainerNodeByContainerID. Better, check UI_ContainerNodeLoaded, we should use something like INVSH_GetInventoryDefinitionByID (namebyid, this name is hard coded somewhere (or in a script), we should not hardcode it another time). Also, "equip" is a little special (see UI_ContainerNodeLoaded), but battlescape only only use "equip" without sufix ATM. See the last note.

* Just a note, baseinventory is only used outside battlescape. And ATM only "equip_" is used outside the battlescape.

Anyway, sorry, the container code is very very bad ATM, and hard to clean.
« Last Edit: September 06, 2010, 05:24:21 pm by bayo »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: onChange for autoplace
« Reply #20 on: September 06, 2010, 10:40:55 pm »
Here's a new update on the onChange subject (wich I'm plannig to use for the encumbrance/TU penalty), this is a bit better than before

Anyway, sorry, the container code is very very bad ATM, and hard to clean.
Well when I said
Quote
not very elegant tough.
it was an understatment ;D

edit: forgot to attach diff and changed subject
« Last Edit: September 06, 2010, 10:48:10 pm by DarkRain »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: Encumbrance/TU penalty
« Reply #21 on: September 07, 2010, 11:35:56 am »
ammoNode = UI_GetNode(node->root, "equip_ammo")
i think ammoNode can be null. In this case it will crash. We also should protect null targetNode.

I can apply this current patch, and rework it a little. I dislike the way it work with "equip_ammo", anyway its greater than the previous code. Thanks a lot anyway, it's a good improvment for behaviour consistency.

One more time, i only talk about the node container code. Cause, the onChange event and everything from the UI script should not manage rules like that. That's the job of the inventory code (and all the crappy thing around, which anyway need, IMO, a deep refactoring).

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: Encumbrance/TU penalty
« Reply #22 on: September 07, 2010, 07:31:06 pm »
How should i credit you? any name and mail?

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Encumbrance/TU penalty
« Reply #23 on: September 07, 2010, 08:31:44 pm »
spamtome [dot] 10 [at] gmail [dot] com


not really needed to credit me you know
« Last Edit: July 30, 2011, 04:09:56 pm by DarkRain »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: Encumbrance/TU penalty
« Reply #24 on: September 07, 2010, 09:34:34 pm »
I apply it to the master. Thanks again for your contribution.

Offline Duke

  • Administrator
  • PHALANX veteran
  • *****
  • Posts: 1037
    • View Profile
Re: Encumbrance/TU penalty
« Reply #25 on: September 13, 2010, 10:19:07 pm »
I apply it to the master. Thanks again for your contribution.
Yeah thx, but I suppose that's just the *beginning* of DarkRain's contributions ;)

@DarkRain:
Did you already manage to jump on the GIT train ?

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Encumbrance/TU penalty
« Reply #26 on: September 14, 2010, 03:37:17 am »
@DarkRain:
Did you already manage to jump on the GIT train ?

Yes I did -- it took me the whole day but I managed it
(my internet conection has been limited to 512kbps since it failed -- more than two weeks ago now -- and the company just said 'We will investigate the case, if you dont receive an answer in one month please call again' when the report about the conection speed was filed)

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Encumbrance/TU penalty
« Reply #27 on: October 13, 2010, 05:30:05 am »
It's been a while, I had some tech problems and then my internet connection died again. . .

Just so nobody thinks I just forgot about this I will attach here the output of 'git diff master encumbrance_work' in my local repo clone, it might take a while before I can get back to it tough. . .

Thing here untested as that was the next step before continuing with this