Freeciv
Advertisement
Forums: Index > Development > RiverNative


I am playing around with rulesets (on 2.4-beta). Because I want boats to be able to travel on rivers, too, I have added the RiverNative flag to unitclass_sea, but it simply doesn't work.

I have another experimental class of weak land units that connot move into desert, mountains or swamps. Here, the RiverNative works perfectly and my troops can cross deserts if there is a river.


Is this a bug?

77.3.154.140 15:36, January 13, 2013 (UTC)


OK, not a bug, I've found the code:

    } else if (uc->move_type == UMT_SEA) {
      /* Explicitly given SEA_MOVING */
      if (uclass_has_flag(uc, UCF_RIVER_NATIVE)) {
        log_error("\"%s\" unit_class \"%s\": cannot give RiverNative "
                  "flag to sea moving unit",
                  filename, uclass_rule_name(uc));
        BV_CLR(uc->flags, UCF_RIVER_NATIVE);
      }
      if (uclass_has_flag(uc, UCF_ROAD_NATIVE)) {
        log_error("\"%s\" unit_class \"%s\": cannot give RoadNative "
                  "flag to sea moving unit",
                  filename, uclass_rule_name(uc));
        BV_CLR(uc->flags, UCF_ROAD_NATIVE);
      }

But what ist the intention behind that? Boats can move on rivers. 77.3.154.140 17:03, January 13, 2013 (UTC)


move_type = "Sea" means that unit can be on Oceanic tiles only, and River's are on land tiles. You have to allow unit to be on land tiles too by setting move_type to "Both".

--Cazfi (talk) 11:30, January 19, 2013 (UTC)

No, that would allow my boats to climb mountains and to sail through desterts.

I solved the problem by adding a new unitclass

[unitclass_boat]
name          = _("?unitclass:Boat")
min_speed     = 2
hp_loss_pct   = 0
flags         = "TerrainSpeed", "DamageSlows", "RiverNative"

It works, but come to think about it, I really don't know how freeciv makes the guess that these units move on Sea (coast adjacent only), too.

--93.132.175.59 20:13, January 19, 2013 (UTC)

Your unit is getting implicit move_type = "Both" if it is both able to be in some oceanic tiles (native_to) and rivers (RiverNative). Just making it move_type "Both" doesn't mean it could be in every land tile - that's controlled by terrains native_to. Trust me, I've implemented all the related code.

If you want to make them coast-adjacent only, give them "Trireme" flag. --Cazfi (talk) 20:24, January 19, 2013 (UTC)

OK, thanks, that spares me from code inspecion. The units already have the "Trireme" flag, and move (somehow) as desired; albeit I did not understand why. And I don't want all seagoing units to paddle up rivers.

There are some unintendid features, though. Those boats can cross over land, from river to river or from river to city (and reverse). Generally, when 2 ocean tiles and 2 land tiles are aranged that hey touch diagonally, there is always some point on how sea units as well as land units can cross.. I like to think about it the way that there is a narrow strait of water that sea units can use, but also land units can cross, like they cross a river. So I think my boats are just carried from one river tile to the other over a short distance of land, as if they where pulled upon ab very long shore.

I did try to make these aspects of the behaviour optional, but my patch stalled at not-quite-working. See GNA#16383. -- JTN (talk) 12:20, February 2, 2013 (UTC)

Another more serious point is that those units move 3 tiles on river for each 1 tile they can manage by sea, and worse, with no respect if it is up- or downstream.


93.132.175.59 21:05, January 19, 2013 (UTC)


How about removing "TerrainSpeed" flag from them so they would pay move_cost of 1 everywhere, not terrain related cost like river speed bonus. Cazfi (talk) 21:11, January 19, 2013 (UTC)


Yes, this is so obvious that I wasn't able to think of it myself! Thanks! 93.132.175.59

Advertisement