Currently Online

Latest Posts

Topic: Question to ship names

MarkMcWire
Avatar
Joined: 2017-02-08, 21:06
Posts: 126
Ranking
At home in WL-forums
Posted at: 2020-02-26, 00: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.


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1001
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-02-26, 06: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
Joined: 2017-02-08, 21:06
Posts: 126
Ranking
At home in WL-forums
Posted at: 2020-02-27, 04: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.


Top Quote