예제 #1
0
void TransitionArea::Update( )
{
	// See if we should do a transition.
	if( m_bRequestTransition )
	{
		// Clear the request.
		m_bRequestTransition = false;
		HandleTransition( );
	}
}
예제 #2
0
void HandleRequest() {
    char* token;
    short keep_processing = 1;
    int offset;

    DebugPrint("Received request %s" _C_ recv_buffer);
    token = FirstToken();
    while (token != 0 && keep_processing) {
        switch (to_request(token)) {
            case ACTIVITY:
                HandleActivity();
                break;
            case COMMAND: // COMMAND
                HandleCommand();
                break;
            case EXIT: // EXIT
                HandleQuit();
                break;
            case GET: // GET
                HandleGet();
                break;
            case KILL:
                HandleKill();
                break;
            case LISPGET: // LISPGET {STATE | GAMEINFO | MAPINFO}
                HandleLispGet();
                break;
            case MAP: // Load new map
                if (HandleNewMap()) {
                    LastPausedCycle = 0;
                    keep_processing = 0;
                }
                break;
            case PING: // PING
                HandlePing();
                break;
            case QUIT: // QUIT
                HandleQuit();
                break;
            case RESTART: // RESTART / RESET
                HandleRestart();
                LastPausedCycle = 0;
                keep_processing = 0;
                break;
            case SPEED: // SPEED
                HandleSpeed();
                break;
            case TRANSITION: // TRANSITION
                HandleTransition();
                keep_processing = 0;
                break;
            case VIDEO: // VIDEO
                HandleVideo();
                break;
            case WRITE:
                HandleWrite();
                break;
            case CYCLE:
                HandleGetCycle();
                break;
            case Z:
                HandleRandomSeed();
                break;
            default:
                SendResponseMessage("Unknown command.\n", 3);
        }
        token = NextToken();
    }

    // Bring pending commands to the front of recv_buffer
    if (token != 0) {
        offset = token + strlen(token) - temp_buffer;
        temp_buffer[offset] = recv_buffer[offset];
        strcpy(recv_buffer, token);
    } else
        memset(recv_buffer, 0, RECV_BUFFER_SIZE); // Clear the command buffer
}