Opened 11 years ago

Last modified 4 years ago

#2128 new enhancement

[PATCH] Let structures deploy units without any cost directly after being built

Reported by: Palantius Owned by:
Priority: If Time Permits Milestone: Backlog
Component: Simulation Keywords:
Cc: Patch:

Description (last modified by Stan)

The idea is to allow structures to deploy units directly after being built. It should not require more resources.

Example of xml:

<ProductionQueue>
  <BatchTimeModifier>1.0</BatchTimeModifier>
  <Entities datatype="tokens">
    units/{civ}_support_female_citizen_house
  </Entities>
  <Technologies datatype="tokens">
    unlock_females_house
  </Technologies>
  <DirectDeployUnit datatype="tokens">
    units/{civ}_support_female_citizen_house
  </DirectDeployUnit>
  <DirectDeployCount>20</DirectDeployCount>
</ProductionQueue>

Attachments (2)

diffDirectDeploy (5.1 KB ) - added by Palantius 11 years ago.
DirectDeploy.diff (5.1 KB ) - added by Palantius 11 years ago.

Download all attachments as: .zip

Change History (7)

by Palantius, 11 years ago

Attachment: diffDirectDeploy added

by Palantius, 11 years ago

Attachment: DirectDeploy.diff added

comment:1 by Palantius, 11 years ago

Summary: [PATCH] Let structures deploy units directly without any cost directly after being built[PATCH] Let structures deploy units without any cost directly after being built

comment:2 by sanderd17, 11 years ago

Code-wise it looks rather good, there's still a bit of copy-paste around lines 270. You could make the object to pass on beforehand, add the specific things, and then push it.

Something like (in pseudocode)

var queueElement = {
    id = this.nextID++
    ...
};

if (type == unit)
{
   queueElement.cost = cost;
   ...
}
else if (type == deploy)
{
    queueElement.cost = [];
    ...
}
this.queue.push(queueElement);

Also, I'm not sure if a unit shouldn't cost population. I think it shouldn't. When the unit dies, it would free a population slot, so there's a chance the population ends up negative.

Last edited 11 years ago by sanderd17 (previous) (diff)

comment:3 by FeXoR, 10 years ago

Just referring to the negative population limit: This seams rather like a bug in the way population is counted...

comment:4 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:5 by Stan, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.