コード例 #1
0
ファイル: gen_evaluate.c プロジェクト: Wysaat/pyter
void *list_comprehension_gen_evaluate(list_comprehension *structure, environment *env) {
    environment *local_env = environment_init(env);
    execute(structure->_suite, local_env, 0);
    list *ptr;
    for (ptr = local_env->val_dict; ptr; ptr = ptr->next) {
        val_dict_entry *entry = (val_dict_entry *)ptr->content;
        if (!entry->id)
            return entry->value;
    }
}
コード例 #2
0
int main(int argc, const char * argv[])
{
    /*
     * Main function, this is what the OS calls when the
     * program execution is requested (and on some systems
     * after the signature is verified and a sandbox is set
     * up). This sets everything up for the game to be playable.
     * After everything is set up, it forwards its args to the 
     * game function and all is good.
     */
    //if (streamlib_version != GLOBAL_STREAMLIB_VERSION)
    if (!check_version_compadible()) //better method
    {
        cout << "Error! Streamlib error" << endl;
        exit(-1);
    }
    resizeterm(181, 48);
    environment_init(env);
    long seed = time(0);
    /* BEGIN DEVELOPER MODE CHECK */
    if (argc > 1)
    {
        if (strcmp(argv[1], "developer-mode") == 0)
        {
            env.developer_mode = true;
            devsettings();
            if (argc > 2)
            {
                seed = atol(argv[2]);
            }
        }
        else
        {
            seed = atol(argv[1]);
        }
    }
    /* END DEVELOPER MODE CHECK */
    //clear();
    int selection = -1;
    while (selection == -1)
        selection = displaylauncher(seed);
    extern int playernum;
    extern char * hostname;
    //env.allow_refresh = false;
    if (selection == 1)
    {
        //nothing here... idk why i added this
    }
    if (selection == 2)
    {
        env.music = false;
    }
    if (selection == 1 || selection == 2)
    {
        int difficulty_selection = 1; //patch for difficulty selections
        //while (difficulty_selection < 1 || difficulty_selection > 2)
        {
            selectdifficulty();
            /*cout << "Please select a difficulty:" << endl
                << "1. Normal (1x damage and strength)" << endl
                << "2. Hard   (2x damage and strength)" << endl
                << "--> Hard also has around 2.5x more enemies" << endl;
            cin >> difficulty_selection;*/
        }
        env.difficulty = (character::difficulty)(difficulty_selection);
    }
    if (selection == 3)
    {
        multiplayer = true;
        cout << "Which player are you? (1/2) ";
        int player;
        cin >> player;
        playernum = player;
        strcpy(hostname, "localhost");
    }