Deutsches Simutransforum

Normale Version: function is_tool_allowed
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
nightly r6302

In der scenario_base.nut steht in Ziele 29 an erster Stelle tool_add_city.
Die ganze Liste wird mit der Funktion is_tool_allowed abgefragt. Im Szenario Script muss ich aber rules.forbid_tool(pl, tool_add_city ) extra einbauen damit man nicht via Taste "C" eine neue Stadt bauen kann.

Dwachs

bitte die scneario_base aus r6305 nehmen Smile oder alternativ folgende Zeilen rein bauen:

Code:
function is_tool_allowed(pl, tool_id, wt)
{
    if (pl == 1) return true
    return scenario.forbidden_tools.find( tool_id )==null; // null => not found => allowed
}

Das Problem war, dass find(tool_add_city) 0 zurueck gab, man muss aber auf 'null' testen ...
Klappt! Aber ohne Semikolon ";"