Currently Online

Latest Posts

Topic: Question to ship names

MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 20:06
Posts: 324
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2020-02-25, 23:02

Why are the names of the ships actually defined in the lua file of the tribe and not in the init.lua of the ship themselves? The background to the question is the idea of giving the ships and ferries names from different pools of names.


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 17:07
Posts: 1954
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-02-26, 05:59

This is an implementation detail: Two players of the same tribe can each have a ship with the same name. When the players are created at gamestart, each player creates a list with all not-yet-taken shipnames. Whenever he gets a new ship, a random name from the list is assigned to it and removed from the list.

At player creation time, the player has access only to the appropriate TribeDescr object but not to the tribe's ShipDescr (especially after https://github.com/widelands/widelands/pull/3693 is merged). Therefore this should stay in Tribe code.

Besides, what would you want to give ferries names for?


Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 20:06
Posts: 324
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2020-02-27, 03:21

Little mistake on my part. I thought you would have created the ferries like the ships as controllable individual units. They seem to function more like carriers, then of course an individual choice of name makes little sense.


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote