UFO: Alien Invasion Issue Tracker
UFO: Alien Invasion
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png UFO: Alien Invasion / Closed Bug report #3312 maxHP is not updated
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "Not determined".
Issue basics
  • Type of issue
    Bug report
  • Category
    General
  • Targetted for
    Not determined
  • Status
    Closed
  • Priority
    2. Low
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
  • Estimated time
    Not estimated
Issue details
  • Resolution
    Not determined
  • Reproducability
    Not determined
  • Severity
    Not determined
  • Complexity
    Not determined
  • Platform
    Not determined
  • Architecture
    Not determined
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description
[http://sourceforge.net/p/ufoai/bugs/3312 Item 3312] imported from sourceforge.net tracker on 2013-01-28 20:08:16

Project: ufoai 2.5-dev

Information about maxHP is not updated after a mission. There is information about rise maxHP (skill #9) in console after completing mission, but soldier has only initial maxHP. Information about maxHP is not send via function

G_SendCharacterData

There is only information about experience used for computing new maxHP value. Let count this new maxHP parameter in function

CP_ParseCharacterData

after memcpy block.

working example:

memcpy(chr->score.kills, c->chrscore.kills, sizeof(chr->score.kills));
memcpy(chr->score.stuns, c->chrscore.stuns, sizeof(chr->score.stuns));
chr->score.assignedMissions = c->chrscore.assignedMissions;

++ /* count MaxHP */
++ chr->maxHP = chr->score.initialSkills[SKILL_NUM_TYPES] + (int) (pow((float) (chr->score.experience[SKILL_NUM_TYPES]) / 100, 0.6f));
++ /* end of count MaxHP */
}
LIST_Delete(&updateCharacters);

There is a diff file in attachment.
===== Comments Ported from Sourceforge =====

====== preema (2012-06-18 23:32:41) ======


====== tlh2000 (2012-06-19 09:43:29) ======

i don't think the maxhp should be changed - at least it's implemented in G_SendCharacterData like this. otherwise this should maybe not be stored in initialSkills (this is kind of const) but in skills.
====== preema (2012-06-19 17:32:25) ======

Function G_SendCharacterData doesn't implement transfer maxhp parameter from campaign part to geoscape part of game. There are transfered only this parameters:

ent->chr.ucn
ent->HP
ent->STUN
ent->morale

as single values and these parameters as arrays:

ent->chr.score.experience
ent->chr.score.skills
ent->chr.score.kills
ent->chr.score.stuns

but parameter maxHP is in

ent->chr.maxHP

Function G_UpdateCharacterSkills update this parameter, but function G_SendCharacterData send only experiences points of this parameter (last value of array experience) and information about maxHP is lost. It newer rise up. After some campaign there is information about rise of this parameter in console log, but in game and savegame file is only original (initial) maxHP.
Attached diff file only contain correction for restore maxHP value in function CP_ParseCharacterData.

====== darkrainx (2012-06-19 20:09:04) ======

I don't know if this is the best way to go about fixing it, but the bug is valid: the max HP never rises during the campaign, although experience does, max HP can't be stored in skills -it's out of range- that's the reason of chr->maxHP, so it must be either sent over the NET (like GAME_NetSendCharacter() -> G_ClientReadCharacter do in the inverse case) or recalculated client-side as preema is doing.

Also this bug affects 2.4 as well.
====== tlh2000 (2012-06-20 12:25:25) ======

if the max hp should rise, only the server should do it, and it should get send over the net.

the client should not recalc this on its own.

i don't like the array size handling for skills anyway.
====== preema (2012-06-21 20:33:31) ======


====== preema (2012-06-21 20:38:45) ======

Ok. There is a new diff file (maxHP_from_server_to_client.diff). Parameter maxHP is now send from server to client. Is this correct?
====== tlh2000 (2012-06-22 10:06:41) ======

i will check it asap
====== tlh2000 (2012-06-24 12:32:25) ======


====== tlh2000 (2012-06-24 12:33:02) ======

applied for testing in 5df9d293f34b30aa800e9e51f93ce67428664c29
====== tlh2000 (2012-06-24 12:34:31) ======

i've also increased the protocol version
====== aduke1 (2012-09-25 23:00:58.751000) ======

- **status**: pending --> closed
Steps to reproduce this issue
Nothing entered.
Todos (0 / 0)
Issue created
footer_logo.png The Bug Genie 4.3.1 | Support | Feedback spinning_16.gif