how simulate with xconq the units limitÃÂ model of games like warcraft
Juan Francisco Oteros Garcia
garcia.oteros@wanadoo.fr
Wed Mar 12 22:31:00 GMT 2003
I want to simulate with xconq the units limit model of games like
warcraft, starcraft, tzar, ... where before building a new unit a test
is made to ensure that there are housing capacity for this unit.
Those games force the build of a type of unit building or facility where
the only use is to add to treasury some material, this material is
consumed from the treasury by the unit's creation process and stocked
into the unit.
If the unit dies, is disbanded or change of side the materiel stocked
inside is returned to the treasury
I want to begin contributing to the development of xconq little by
little but it is not simple.
So I have decided to make litle changes that not requires many
skils.xconq7@sources.redhat.com.
I do not understand why the modification in the function init_supply
of file init.c do not work, I have not errors, nor warnings during
compilation but the kernel ignores the else part???
These modification should give to the treasury (if defined for the
material) the initial materials, for which the unit has not capacite of
storage.
If anyone saw why that does not work... Thanks!
for example:
(game-module "habitat"
(blurb "Testing habitat game")
)
(terrain-type plains (char "+"))
(unit-type person (image-name "person") (char "@")
(start-with 1)
(acp-per-turn 4)
)
(unit-type house (image-name "camp") (help "where persons lives"))
(material-type habitat (help "every unit in game must have a place to
live"))
(add habitat treasury true)
(add habitat initial-treasury 10) ;;enables begining the game without
buildings
(table gives-to-treasury
(person habitat true)
(house habitat true))
(table takes-from-treasury
(house habitat true))
(table acp-to-build
(house person 1));; where persons are born
(table unit-initial-supply
(person habitat 1) ;; transfert du material habitat from treasury to
person
(house habitat 15));; enables the building of 15 units type person
(table consumption-on-creation
(person habitat 1)) ;; one person born one habitat taken from treasury
(table unit-storage-x
(person habitat 1)) ; stock habitat material
(table recycleable-material
(person habitat 1)) ; if a unit type person is disbanded it gives
habitat material to the treasury
;; I think that this table should be used by kernel anywhere when the
side looses the control of the unit forever
--
Juan Francisco Oteros Garcia <garcia.oteros@wanadoo.fr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourceware.org/pipermail/xconq7/attachments/20030312/f51c3d36/attachment.htm>
-------------- next part --------------
/* Give to the unit the declared initial materials at creation time of the unit */
/*
void
init_supply(Unit *unit)
{
int m, u = unit->type;
for_all_material_types(m) {
if(um_storage_x(u, m)>0)
unit->supply[m] = min(um_storage_x(u, m), um_initial(u, m));
else
if (side_has_treasury(unit->side, m) && um_gives_to_treasury(u, m))
unit->side->treasury[m] += um_initial(u, m);
}
}
More information about the Xconq7
mailing list