static void movePlayer(OBJECT *passage) { printf("%s", passage->textGo); if (passage->destination != NULL) { player->location = passage->destination; printf("\n"); executeLook("around"); } }
void executeGo(const char *noun) { OBJECT *obj = getVisible("where you want to go", noun); if (obj == NULL) { // already handled by getVisible } else if (obj->location == NULL && obj != player->location) { printf("OK.\n"); player->location = obj; executeLook("around"); } else { printf("You can't get much closer than this.\n"); } }
bool AgentTravel::execute( ActionTravel* p_action, Result& io_result ) { bool executed = false; Verb target = p_action->getTarget(); unsigned idTarget = target.getId(); /* Treat special-case motion-verbs: */ switch( idTarget ) { case VerbIdsMotion_LOOK: executed = executeLook(); break; default: executed = executeTravel( p_action, io_result ); break; } // The location is printing whether or not the travel was successful. io_result.setSummary(ResFormater::FormatLocation( (*m_ad), m_ad->map[ m_ad->adventurer.getIdLocation() ] )); return executed; }
void executeGo(const char *noun) { unsigned i; for (i = 0; i < numberOfLocations; i++) { if (noun != NULL && strcmp(noun, locs[i].tag) == 0) { if (i == locationOfPlayer) { printf("You can't get much closer than this.\n"); } else { printf("OK.\n"); locationOfPlayer = i; executeLook("around"); } return; } } printf("I don't understand where you want to go.\n"); }