Follow-up Comment #21, patch #5306 (project freeciv):
_If (2) you can't expel the *unit* > Ok... Enslave? Imprison? Murder?
Hostage?_
Not sure what you meant. Are you talking about do_expel_unit()? Let the actor
player know. Do nothing else.
Maybe you should add a hard coded requirement in actions.c that a city to
expel the unit to is found? That would create a small info leak (that should
be mentioned in the comments) if the actor doesn't know if the target has a
city to flee to.
_Settler (the most annoying unit in the game),_
In that case I have an idea to make your testing a more enjoyable experience:
Enable "Expel Unit" for foreign Settler targets in you test ruleset. (Or was
that the first thing you did?)
_What do you think?_
That it is up to the ruleset author. Allowing military units to expel foreign
Spy and Diplomat units will probably be popular. Maybe expanded to expel all
civilian units. But ruleset authors are creative. Don't assume anything about
the actor or target's unit type in the code. Don't assume anything about what
other actions the ruleset may enable at the same time.
_interesting ideas_
Adding more actions doesn't belong in this patch. If you have an idea for an
action check if it exists in our patch tracker. If it doesn't feel free to add
your idea. Describe what you idea does in English. Correct way: "Destroys the
target unit and transfers its population to the actor unit's home city." Wrong
way: "Do what $action_name from $game does" (It is OK to mention that $game
has $action)
If you go looking for ideas: Please don't read the source code of any Civ
games that aren't Free (/ Open Source) Software. Lawyers can claim that you
copied the code that you read. Last time I checked it was possible to obtain
the Call to Power II source code but it isn't Free (/Open Soure) Software.
(Don't panic. What you linked to looks like documentation for modders, not the
source code it self)
_Expel Failed > Expel Suffered
Expel Succeeded > Expel Accomplished_
Please rename E_UNIT_LOST_EXPEL. It looks like the unit died.
E_UNIT_WAS_EXPELLED?
+ Expel all the units using actor.
You expel a singe unit.
+static void do_expel_unit(struct player *pplayer,
+ struct unit *actor,
+ struct unit *target)
Coding style (doc/CodingStyle) violation. The parameters below should be
aligned with the first parameter. (Not sure if you prefer to fix coding style
issues as they are discovered or all at once in a later revision)
+ /* find closest city capital for expel target and where a
+ * diplomat will flee to */
The target unit is expelled. He doesn't flee. He doesn't care if the city is a
capital or not. (you used find_closest_city)
+ if (pcity == NULL) {
Good.
+ /* N.B: unit_link() always returns the same pointer. */
+ sz_strlcpy(target_link, unit_link(target));
Belongs after, not inside, the then block.
+ /* Notify. */
+ notify_player(uplayer, target_tile, E_UNIT_LOST_EXPEL, ftc_server,
+ /* TRANS: <unit> ... <Poles> */
+ _("You didn't have expelled %s."),
+ unit_link(actor));
This is where you should use a unit action failed event. As I said before: if
no such event exists just define a new one.
+ }
Please add a return statement at the end of the then block. No city to expel
to -> do_expel_unit() is over.
+ if (pcity) {
If statement not needed. You should have returned if pcity was missing.
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?5306>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev