Not logged inOpenClonk Forum
Up Topic Liquid container branch

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Sven2

> * The warnings in the unit test probably cannot be avoided, maybe by overloading the barrel for the test or not translating the string if the barrel does not support the liquid: I fill lava into it, it is looking for the string "MaterialLava" in its StringTblXX.txt, but obviously it cannot find that, because the barrel cannot carry lava. How else can I test a liquid that the barrel is not supposed to hold?


For example, you can just make them locals:

local BarrelNames = {
  Lava = "$LavaBarrel$",
  Water = "$WaterBarrel$",
};


and then, in a function:

func GetNameForBarrel(string material)
{
  var name = BarrelNames[material]; // Name known?
  if (!name) name = "$FilledBarrel$" // Otherwise, return a standard name
  return name;
}


Of course we could also add a failsafe-parameter for translate. But I don't like that too much, because it makes code paths dependent on the loaded language pack.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill