blob: 253ef943c410e237db7d94b1c05d443ae5f72b76 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// transport.c -- Basisklasse fuer Schiffe und aehnliche Transporter
4//
5// $Id: transport.c 9400 2015-12-11 21:56:14Z Zesstra $
Zesstra@Morgengrauen2315aa12016-10-30 22:36:26 +01006#pragma strong_types,rtt_checks
MG Mud User88f12472016-06-24 23:31:02 +02007#pragma range_check
8#pragma no_clone
9#pragma pedantic
10
11inherit "/std/thing/moving";
12inherit "/std/room";
13
14#include <properties.h>
15#include <moving.h>
16#include <defines.h>
17#include <language.h>
18#include <transport.h>
19#include <regexp.h>
Zesstra179db0d2016-11-26 13:13:41 +010020#include <hook.h>
21
MG Mud User88f12472016-06-24 23:31:02 +020022
23/* transport.c
24 *
25 * Ueberarbeitete und
26 * erweiterte Version : Tilly@MorgenGrauen, 10.01.02
27 * Basierend auf : transport.c@SilberLand (Woody@SilberLand), 05.12.99
28 * Basierend auf : Hates und Rumatas generisches Transport Objekt
29 * MorgenGrauen 15.02.93
30 */
31
32/*
33 ********************* Variablen *********************
34 */
35
36// TODO: langfristig waer ja private schoen...
37//
38// Datenstruktur von 'route' (bei HP_ROOM)
39// 0 ({string ID, : HP_ROOM
40// 1 string room, : Dateiname Zielraum
41// 2 int stay, : Dauer Haltezeit
42// 3 int next, : Dauer naechste Fahrtzeit
43// 4 string code, : Haltestellenname fuer QueryArrived
44// 5 mixed dest, : Haltestellen-IDs fuer HasRoute (reise nach)
45// 6 mixed deststr }): unbenutzt.
46//
47// Datenstruktur von 'route' (bei HP_MSG, HP_FUN)
48// 0 ({string ID, : HP_MSG
49// 1 string message, : Meldung oder string fun : Funktionsname
50// 2 int next}) : Dauer bis zum naechsten Ereignis
51nosave mixed *route; /* Liste der Haltepunkte. */
52nosave int rpos; /* Momentane Position in obiger Liste. */
53nosave string roomCode; /* Code des aktuellen Raumes (oder 0). */
Zesstrae805e3a2018-02-12 19:48:06 +010054// Letzter Spielerkontakt. Das muss != 0 sein (sonst funktioniert der
55// Mechanismus zum Fortsetzen der Route nach einer Pause nicht ordentlich,
56// daher wird es auf 1 initialisiert.
57nosave int meet_last_player = 1;
Zesstra7842b8e2019-07-04 21:55:39 +020058// Dauer der Route
59nosave int route_time;
Zesstra179db0d2016-11-26 13:13:41 +010060
61private void unsubscribe_init();
62private int subscribe_init();
Zesstra72843372018-02-12 21:34:49 +010063void changeHp();
MG Mud User88f12472016-06-24 23:31:02 +020064
65/*
66 ********** Management der builtin-properties **********
67 */
68
69string _query_short()
70{
71 if (roomCode) return Query(P_SHORT);
72 return 0;
73}
74
75mixed _query_transparent()
76{
77 if (roomCode) return Query(P_TRANSPARENT);
78 return 0;
79}
80
Zesstra179db0d2016-11-26 13:13:41 +010081static mixed *_set_route(mixed *r) { return route = r; }
82static mixed *_query_route() { return route; }
83static int _query_mnpc_last_meet() { return meet_last_player; }
MG Mud User88f12472016-06-24 23:31:02 +020084
85/*
86 **************** Zugriffsfunktionen ***************
87 */
88
Zesstra179db0d2016-11-26 13:13:41 +010089public void Halt()
MG Mud User88f12472016-06-24 23:31:02 +020090{
Zesstra179db0d2016-11-26 13:13:41 +010091 // stop, but keep rpos counter.
MG Mud User88f12472016-06-24 23:31:02 +020092 while (remove_call_out( "changeHp" )>-1);
93 while (remove_call_out( "disconnect" )>-1);
94}
95
96// Aktualisiert/Setzt die Route im TravelD, wenn erlaubt (d.h. kein
97// P_NO_TRAVELING)
98private void ReportRoute()
99{
100 if(!QueryProp(P_NO_TRAVELING))
101 {
102 mixed tmp = filter(route, function int (mixed arr)
103 {
104 return arr[0] == HP_ROOM;
105 } );
106 string *route = map(tmp, function string (mixed arr)
107 { return arr[1]; }
108 );
109 TRAVELD->AddRoute(object_name(this_object()),route);
110 }
111}
112
Zesstra179db0d2016-11-26 13:13:41 +0100113public varargs void Start(int pos)
MG Mud User88f12472016-06-24 23:31:02 +0200114{
115 Halt();
Zesstra5d2ace02017-06-20 23:21:36 +0200116 // negative pos sind ein Fehler
117 if (pos<0)
118 raise_error(sprintf("Start(): Positionszaehler < 0: %d\n",pos));
119
120 // wenn pos zu gross fuer die Route ist, rpos auf Ende der Route setzen
121 // (i.e. sizeof(route)-1), damit bei der naechsten Bewegung am Anfang der
122 // Route begonnen wird.
123 rpos = min(pos, sizeof(route)-1);
124
MG Mud User88f12472016-06-24 23:31:02 +0200125 // Tell TRAVELD our current route
126 ReportRoute();
Zesstrac786fee2018-02-12 20:31:29 +0100127 // changeHp() inkrementiert zu Beginn rpos um 1. D.h. damit wir keinen
128 // Haltepunkt ueberspringen, muss dieses vorweg kompensiert werden. Da dies
129 // wiederum den Transporter aber ggf. buggen laesst (rpos<0), darf das
130 // changeHp() hier nicht asynchron per call_out gerufen werden.
131 --rpos;
132 changeHp();
MG Mud User88f12472016-06-24 23:31:02 +0200133}
134
Zesstra179db0d2016-11-26 13:13:41 +0100135// continues the current route at the point we stopped.
136public int Continue()
137{
138 if (find_call_out("changeHp") == -1
139 && find_call_out("disconnect") == -1)
140 {
Zesstra019987a2017-10-24 22:36:08 +0200141 // Nach einer Pause wird die Route am aktuellen Haltepunkt fortgesetzt
142 // (im Regelfall also am Ende der Route). Am Routenende wird auch
143 // geprueft, wann der letzte Spielerkontakt war. Das darf nach einem
144 // Continue() aber nicht passieren, sonst wuerde der Transporter ggf.
145 // sofort wieder anhalten.
146 meet_last_player*=-1; // neg. vorzeichen als Markierung
Zesstra179db0d2016-11-26 13:13:41 +0100147 unsubscribe_init();
148 Start(rpos);
149 return 1;
150 }
151 return 0;
152}
153
154// pauses the transporter temporarily in a way that it continues along its
155// route as soon as a living enters one of the stop points. If that is not
156// possible, we do nothing.
157public int Pause()
158{
159 // ok, stop
160 if (subscribe_init() == 1)
161 {
162 Halt();
163 return 1;
164 }
165 return 0;
166}
167
MG Mud User88f12472016-06-24 23:31:02 +0200168void SetTravelCmds()
169{
170 if (pointerp(QueryProp(P_LEAVECMDS)))
171 AddCmd(QueryProp(P_LEAVECMDS),"GoOutside");
172 if (pointerp(QueryProp(P_ENTERCMDS)))
173 AddCmd(QueryProp(P_ENTERCMDS),"GoInside");
174 if (pointerp(QueryProp(P_TRAVEL_CMDS)))
175 AddCmd(QueryProp(P_TRAVEL_CMDS),"GoInAndOutside");
176 return;
177}
178
179mixed HasRoute(mixed dest)
180{
181 int i,s,z;
182 string str;
183 object ob;
184 mixed harb;
185
186 s = sizeof(route);
187
188 for (i = rpos;i <= rpos+s-1;i++)
189 {
190 if (route[i%s][0] == HP_ROOM)
191 {
192 if (member(route[i%s][5],dest) != -1 &&
193 objectp(ob=load_object(route[i%s][1])) &&
194 pointerp(harb=ob->QueryProp(P_HARBOUR)) &&
195 sizeof(harb))
196 {
197 return ({ route[i%s][1], harb[0] });
198 }
199 }
200 }
201 return 0;
202}
203
204public varargs void AddRoute(string room, int stay, int next,
205 string harbour_desc, string|string* dest_ids, string deststr)
206{
207 // Daten aus dem Zielanleger abfragen.
208 <string|string*>* harbour = room->QueryProp(P_HARBOUR)||({});
209 string* harbour_ids = ({});
210
211 // IDs des Zielanlegers fuer Syntaxpruefung
212 if ( sizeof(harbour)==2 )
213 {
214 if ( pointerp(harbour[1]) )
215 harbour_ids = harbour[1];
216 else
217 harbour_ids = ({harbour[1]});
218 }
219
220 // <dest_ids> in ein Array umwandeln, ist dann ggf. leer
221 if ( !dest_ids )
222 {
223 dest_ids = ({});
224 }
225 if ( stringp(dest_ids) )
226 {
227 dest_ids = ({dest_ids});
228 }
229
230 // explizit angegebene IDs stehen jetzt in <dest_ids>, die IDs des
231 // Zielhafens aus P_HARBOUR werden addiert.
232 dest_ids += harbour_ids;
233
234 // Ist <dest> immer noch leer, versuchen wir, aus <harbour_desc> ein paar
235 // Stichwoerter zu erzeugen, die man als Zielangabe in der Syntax
236 // "reise nach <ziel>" verwenden kann.
237 if ( !sizeof(dest_ids) )
238 {
239 // Grossgeschriebene Begriffe in <harbour_desc> in <dest> eintragen. Dazu:
240 // 1) <code> erstmal so zerschneiden, dass alle ueblichen Satzzeichen
241 // rausfliegen (es gibt Transporter, die sowas in <harbour_desc>
242 // uebergeben).
243 dest_ids = regexplode(harbour_desc, "[(),.;:&\+_ ]",
244 RE_OMIT_DELIM|RE_GLOBAL);
245 // 2a) So filtern, dass nur grossgeschriebene Woerter uebrig bleiben,
246 // von 1) uebriggebliebene Leerstrings gleich mit wegwerfen.
247 // 2b) Ergebnis kleinschreiben, damit die Syntaxpruefung damit arbeiten
248 // kann.
249 dest_ids = map( filter(dest_ids, function int (string key) {
250 return (key!="" && key[0]>='A' && key[0]<='Z');
251 }), #'lower_case);
252 }
253 // Sollte <dest> jetzt immer noch leer sein, wurde an allen drei Stellen
254 // nichts oder nur Muell uebergeben.
255 if ( !sizeof(dest_ids) )
256 {
257 raise_error("Transporterfehlfunktion in AddRoute(): Identifikations"
258 "matrix unzureichend definiert. Transporter unbenutzbar fuer "
259 "Spieler. Bitte mindestens eine Ziel-ID via P_HARBOUR oder als "
260 "Argument to AddRoute().");
261 }
262 route += ({ ({ HP_ROOM, room, stay, next, harbour_desc, dest_ids,
263 deststr }) });
Zesstra7842b8e2019-07-04 21:55:39 +0200264 route_time += stay + next;
MG Mud User88f12472016-06-24 23:31:02 +0200265}
266
Zesstra7842b8e2019-07-04 21:55:39 +0200267varargs void AddMsg(string msg, int next)
MG Mud User88f12472016-06-24 23:31:02 +0200268{
Zesstra7842b8e2019-07-04 21:55:39 +0200269 route += ({ ({ HP_MSG, msg, next }) });
270 route_time += next;
MG Mud User88f12472016-06-24 23:31:02 +0200271}
272
Zesstra7842b8e2019-07-04 21:55:39 +0200273void AddFun(string fun, int next)
274{
275 route += ({ ({ HP_FUN, fun, next }) });
276 route_time += next;
277}
MG Mud User88f12472016-06-24 23:31:02 +0200278
279string QueryArrived() { return roomCode; }
280
281mixed* QueryPosition()
282{
283 return ({ route[rpos][1],route[(rpos+1)<sizeof(route)?(rpos+1):0][1] });
284}
285
286object* QueryPassengers()
287{
288 return filter(all_inventory(),#'query_once_interactive);
289}
290
291varargs string *QueryHarbours(int textflag)
292{
293 string *ret = ({});
294
295 foreach( mixed* entry : route )
296 {
297 if ( entry[0] == HP_ROOM )
298 {
299 if ( textflag )
300 {
301 string *hp_ids = entry[1]->QueryProp(P_HARBOUR)[1];
302 if (pointerp(hp_ids) && sizeof(hp_ids))
303 {
304 string *h = map( explode(hp_ids[0]," "), #'capitalize);
305 ret += ({ implode(h, " ") });
306 }
307 }
308 else
309 {
310 ret += ({ entry[1] });
311 }
312 }
313 }
314 return ret;
315}
316
317// beim zerstoeren sollte auch die route und der Transporter aus dem traveld
318// abgemeldet werden.
319public varargs int remove(int silent)
320{
321 TRAVELD->RemoveTransporter(this_object());
322 return ::remove(silent);
323}
324
325void RemoveRoute()
326{
327 Halt();
328 route = ({ });
329 rpos = 0;
Zesstra7842b8e2019-07-04 21:55:39 +0200330 route_time = 0;
MG Mud User88f12472016-06-24 23:31:02 +0200331 TRAVELD->RemoveTransporter(this_object());
332}
333
334varargs int Enter(object who)
335{
336 string *emsg;
337 mixed efail;
338
339 if (!objectp(who)) who = this_player();
340 if (environment(who) == this_object())
341 {
342 tell_object(who,"Da bist Du doch bereits, schon vergessen?\n");
343 return 1;
344 }
345 if (!QueryArrived()) return 0;
346 if (QueryProp(P_MAX_PASSENGERS) &&
347 (sizeof(QueryPassengers()) >= QueryProp(P_MAX_PASSENGERS)))
348 {
349 if (pointerp(efail=QueryProp(P_ENTERFAIL)))
350 {
351 if (sizeof(efail) == 2)
352 tell_room(this_object(),who->Name(WER,2)+" "+process_string(efail[1])+
353 ".\n",({who}));
354 tell_object(who,process_string(efail[0])+".\n");
355 }
356 else if (stringp(efail))
357 tell_object(who,process_string(efail)+".\n");
358 else if (closurep(efail)) funcall(efail);
359 return 1;
360 }
361
362 tell_object(who,"Du betrittst "+name(WEN,1)+".\n");
363 if (pointerp(emsg=QueryProp(P_ENTERMSG)) && sizeof(emsg) == 2)
364 return who->move(this_object(),M_GO,"",process_string(emsg[0]),
365 process_string(emsg[1]));
366 return who->move(this_object(),M_GO,
367 name(WEN,1),"betritt","kommt herein");
368}
369
370varargs int Leave(object who)
371{
372 string *lmsg;
373 mixed lfail;
374
375 if (!objectp(who)) who = this_player();
376 if (environment(who) != this_object())
377 {
378 if (QueryArrived())
379 {
380 tell_object(who,"Dafuer muesstest Du erstmal dort sein.\n");
381 return 1;
382 }
383 return 0;
384 }
385 if (!QueryArrived())
386 {
387 if (lfail=QueryProp(P_LEAVEFAIL))
388 {
389 if (pointerp(lfail) && sizeof(lfail))
390 {
391 if (sizeof(lfail) == 2)
392 tell_room(this_object(),who->Name(WER,2)+" "+process_string(
393 lfail[1])+".\n",({who}));
394 tell_object(who,process_string(lfail[0])+".\n");
395 }
396 else if (stringp(lfail))
397 tell_object(who,process_string(lfail)+".\n");
398 else if (closurep(lfail)) funcall(lfail);
399 return 1;
400 }
401 tell_object(who,"Fehler beim Verlassen des Transporters.\n"
402 "Bitte zustaendigen Magier verstaendigen.\n");
403 return 1;
404 }
405
406 if (who->QueryProp(P_TRAVEL_INFO)) who->SetProp(P_TRAVEL_INFO,0);
407 tell_object(who,"Du verlaesst "+name(WEN,1)+".\n");
408 if (pointerp(lmsg=QueryProp(P_LEAVEMSG)) && sizeof(lmsg) == 2)
409 return who->move(environment(),M_GO,"",process_string(lmsg[0]),
410 process_string(lmsg[1]));
411 return who->move(environment(),M_GO,
412 name(WEN,1),"verlaesst","kommt herein");
413}
414
415/*
416 ****************** Internal Functions ******************
417 */
418
419static int GoInside(string str)
420{
421 _notify_fail("Was moechtest Du denn genau?\n");
422 if (stringp(str) && id(str)) {
423 Enter();
424 return 1;
425 }
426 return 0;
427}
428
429static int GoOutside(string str)
430{
431 _notify_fail("Was moechtest Du denn genau?\n");
432 if (stringp(str) && id(str)) {
433 Leave();
434 return 1;
435 }
436 return 0;
437}
438
439static int GoInAndOutside(string str)
440{
441 string to;
442
443 _notify_fail("Was moechtest Du denn genau?\n");
444 if (!sizeof(str)) return 0;
445 if ((sscanf(str,"auf %s",to) == 1 || sscanf(str,"in %s",to) == 1) && id(to))
446 return Enter(),1;
447 if ((sscanf(str,"von %s",to) == 1 || sscanf(str,"aus %s",to) == 1) && id(to))
448 return Leave(),1;
449 return 0;
450}
451
452protected void create()
453{
454 ::create();
455
456 route = ({});
457
458 SetProp(P_LEAVEFAIL,"Das ist momentan viel zu gefaehrlich");
459 SetProp(P_ENTERFAIL,"Dort ist kein Platz mehr fuer Dich");
460 SetProp(P_TRANSPARENT,1);
461
462 AddId("Transporter");
Zesstra179db0d2016-11-26 13:13:41 +0100463
MG Mud User88f12472016-06-24 23:31:02 +0200464 call_out("SetTravelCmds",1);
465}
466
467static varargs void disconnect(int change, int change_time)
468{
469 object room;
470 mixed *departmsg;
471
472 departmsg = QueryProp(P_DEPARTMSG);
473
474 if ((room = environment()) && pointerp(departmsg))
475 {
476 tell_room(this_object(),process_string(departmsg[0]));
477 tell_room(room,process_string(departmsg[1]));
478 }
479
480 roomCode = 0;
481
482 if (change) call_out("changeHp",change_time);
483}
484
485static varargs void connect(string room, string code)
486{
487 mixed *arrivemsg, *t;
488 object *trav, ob;
489 string *trs, *msgs;
490 int i;
491
492 if (roomCode) disconnect();
493
494 roomCode = code?code:"";
495
496 if (catch(move(room,M_SILENT|M_NOCHECK);publish))
497 {
498 roomCode = 0;
499 return;
500 }
501
502 arrivemsg = QueryProp(P_ARRIVEMSG);
503
504 if (pointerp(arrivemsg))
505 {
506 tell_room(this_object(),process_string(arrivemsg[0]));
507 tell_room(room,process_string(arrivemsg[1]));
508 }
509
510 trav = filter(all_inventory(this_object()),#'living);
511
512 i = sizeof(trav);
513 while(i--)
514 {
515 if (pointerp(t = trav[i]->QueryProp(P_TRAVEL_INFO))&&
516 t[0]==this_object()&&t[2]==room)
517 {
518 if (trav[i]->InFight())
519 tell_object(trav[i],break_string("Du solltest Deinen Kampf "
520 "schnell beenden,denn eigentlich wolltest Du hier "
521 "aussteigen.",78));
522 else
523 Leave(trav[i]);
524 if (environment(trav[i])!=this_object())
525 trav[i]->SetProp(P_TRAVEL_INFO,0);
526 }
527 }
528 trav = filter(all_inventory(find_object(room))-trav,#'living);
529 i=sizeof(trav);
530 while(i--)
531 {
532 if (objectp(trav[i]) && pointerp(t = trav[i]->QueryProp(P_TRAVEL_INFO))&&
533 t[0] == environment(trav[i]) && t[1] == this_object())
534 {
535 if ( trav[i]->InFight() )
536 tell_object(trav[i],
537 break_string("Du solltest Deinen Kampf schnell beenden, denn "
538 "eigentlich wolltest Du mit "+name(WEM,1)+
539 " reisen.",78));
540 else
541 Enter(trav[i]);
542 if (environment(trav[i]) == this_object())
543 {
544 t[0] = this_object();
545 trav[i]->SetProp(P_TRAVEL_INFO,t);
546 }
547 }
548 }
549}
550
551// this object never performs any clean-up, the driver should not call it
552// again.
553int clean_up(int arg) { return 0; }
554
Zesstra5b71ebb2018-03-07 20:50:35 +0100555public varargs void init(object origin)
Zesstra179db0d2016-11-26 13:13:41 +0100556{
Zesstra5b71ebb2018-03-07 20:50:35 +0100557 "*"::init(origin);
Zesstra179db0d2016-11-26 13:13:41 +0100558 // if we have player contact (even if the player is just in the same
559 // environment), we update the time.
560 if (this_player() && query_once_interactive(this_player()))
Bugfix4df578b2019-03-13 18:36:59 +0100561 {
562 meet_last_player = time();
563 // Wenn jemand in uns ist, auch falls noetig die Route fortsetzen,
564 // denn wir haben natuerlich nicht H_HOOK_INIT in uns selbst abonniert.
565 if(environment(PL)==ME)
566 Continue();
567 }
Zesstra179db0d2016-11-26 13:13:41 +0100568}
569
570// we try to continue our route once some living triggers init.
571private mixed InitHookCallback(object source, int hookid, mixed hookdata)
572{
573 if (hookid == H_HOOK_INIT && previous_object() == source)
574 Continue();
575
576 return ({H_NO_MOD, hookdata});
577}
578
579// subscribes to H_HOOK_INIT in all rooms along the route
Zesstra658871d2019-07-04 21:34:02 +0200580// == 1 for success, < -1 if not (at least one hook failed, all registration
581// were already subscribed).
Zesstra179db0d2016-11-26 13:13:41 +0100582private int subscribe_init()
583{
584 // subscribe to the H_HOOK_INIT of all rooms in the route...
Zesstra179db0d2016-11-26 13:13:41 +0100585 foreach(mixed* arr : route)
586 {
587 if (arr[0] == HP_ROOM)
588 {
589 if (arr[1]->HRegisterToHook(H_HOOK_INIT, #'InitHookCallback,
590 H_HOOK_LIBPRIO(1), H_LISTENER,
591 0) <= 0)
Zesstra658871d2019-07-04 21:34:02 +0200592 {
593 // von allen H_HOOK_INIT wieder abmelden...
594 unsubscribe_init();
595 return -1;
596 }
Zesstra179db0d2016-11-26 13:13:41 +0100597 }
598 }
Zesstra658871d2019-07-04 21:34:02 +0200599 return 1;
Zesstra179db0d2016-11-26 13:13:41 +0100600}
601
602// unsubscribes from all the H_HOOK_INIT.
603private void unsubscribe_init()
604{
605 foreach(mixed* arr : route)
606 {
607 if (arr[0] == HP_ROOM)
608 arr[1]->HUnregisterFromHook(H_HOOK_INIT, #'InitHookCallback);
609 }
610}
611
612private int maybe_pause()
613{
Zesstra7842b8e2019-07-04 21:55:39 +0200614 // we check for time of last player contact. If we did not meet any players
615 // for 2 round-trips, we try to pause.
616 if (meet_last_player < time() - (2*route_time) )
Zesstra179db0d2016-11-26 13:13:41 +0100617 {
Zesstra677b5722019-07-04 22:10:01 +0200618 // we don't stop if players are currently at one of our stops
619 foreach(mixed* arr : route)
620 {
621 if (arr[0] == HP_ROOM)
622 {
623 object room = find_object(arr[1]);
624 if(room &&
625 sizeof(filter(all_inventory(room), #'interactive)))
626 return 0; // no pause
627 }
628 }
629 // and we don't stop if players currently are in the transporter.
630 if (sizeof(filter(all_inventory(this_object()), #'interactive)))
631 return 0;
632 // ok, pause machen
633 return Pause();
Zesstra179db0d2016-11-26 13:13:41 +0100634 }
635 return 0;
636}
637
MG Mud User88f12472016-06-24 23:31:02 +0200638void changeHp()
639{
Zesstrafffd2a82017-10-24 22:03:27 +0200640 // Nicht am Ende der Route? Eins weiter.
641 if (rpos < sizeof(route) - 1)
642 ++rpos;
643 else
MG Mud User88f12472016-06-24 23:31:02 +0200644 {
Zesstra019987a2017-10-24 22:36:08 +0200645 // Routenende
646 // Nach einem expliziten Continue() ist meet_last_player < 0. Dann wird
647 // nicht geprueft, ob wir sofort wieder anhalten. Auch muss dann die Route
648 // nicht uebermittelt werden (hat Start() schon gemacht).
649 if (meet_last_player >= 0)
650 {
651 // TRAVELD die aktuelle Route uebermitteln
652 ReportRoute();
653 // everytime, we pass the end of our route, we check if we should
654 // pause our service.
655 if (maybe_pause())
656 return;
657 }
658 else
659 // Wieder pruefen im naechsten Durchlauf.
660 meet_last_player=abs(meet_last_player);
661
Zesstrafffd2a82017-10-24 22:03:27 +0200662 // wenn keine Pause, wieder zum Anfang der Route bewegen.
663 rpos = 0;
MG Mud User88f12472016-06-24 23:31:02 +0200664 }
Zesstrafffd2a82017-10-24 22:03:27 +0200665
MG Mud User88f12472016-06-24 23:31:02 +0200666 if (route[rpos][0] == HP_MSG)
667 {
668 call_out("changeHp",route[rpos][2]);
669 tell_room(this_object(),route[rpos][1]);
670 }
671 else if (route[rpos][0] == HP_FUN)
672 {
673 call_out("changeHp",route[rpos][2]);
674 call_other(this_object(),route[rpos][1]);
675 }
676 else
677 {
678 call_out("disconnect",route[rpos][2],1,route[rpos][3]);
679 connect(route[rpos][1],route[rpos][4]);
680 }
681}
682