Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Haltestellen eindeutig im script bestimmen
#3
Ich bin squirrel-Anfänger. Versuch mal angehängten Patch EDIT: bzw. die angehängte api_halt.cc Falls es geht wird das auch gleich für Convois und Linien hinzugefügt, schließlich muss man die auch vergleichen können.

Code:
Index: trunk/script/api/api_halt.cc =================================================================== --- trunk/script/api/api_halt.cc (revision 7340) +++ trunk/script/api/api_halt.cc (working copy) @@ -76,6 +76,13 @@ } +// compare two halts to find out if they are the same +SQInteger halt_compare(halthandle_t a, halthandle_t b) +{ + return (SQInteger)a.get_id() - (SQInteger)b.get_id(); +} + + void export_halt(HSQUIRRELVM vm) { /** @@ -119,6 +126,13 @@ register_method(vm, &haltestelle_t::get_besitzer, "get_owner"); /** + * compare classes using metamethods + * @param halt the other halt + * @returns difference in the unique id of the halthandle + */ + register_method(vm, &halt_compare, "_cmp", true); + + /** * Quick check if there is connection for certain freight to the other halt. * @param halt the other halt * @param freight_type freight type


Angehängte Dateien
.zip   api_halt.zip (Größe: 1,84 KB / Downloads: 919)
Zitieren


Nachrichten in diesem Thema
Haltestellen eindeutig im script bestimmen - von ny911 - 14-10-2014, Tuesday-13:53:50
[Kein Betreff] - von prissi - 14-10-2014, Tuesday-20:09:12
[Kein Betreff] - von prissi - 15-10-2014, Wednesday-00:32:21
[Kein Betreff] - von ny911 - 16-10-2014, Thursday-00:30:11
[Kein Betreff] - von ny911 - 20-10-2014, Monday-12:28:55
[Kein Betreff] - von Dwachs - 22-10-2014, Wednesday-22:16:33
[Kein Betreff] - von ny911 - 23-10-2014, Thursday-00:32:55
[Kein Betreff] - von Dwachs - 23-10-2014, Thursday-09:00:17
[Kein Betreff] - von ny911 - 23-10-2014, Thursday-21:57:58
[Kein Betreff] - von Dwachs - 24-10-2014, Friday-17:53:22
[Kein Betreff] - von ny911 - 25-10-2014, Saturday-15:49:44

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 2 Gast/Gäste