misc/wrapper.c
author Wuzzy <Wuzzy2@mail.ru>
Sat, 06 Jun 2020 15:40:51 +0200
changeset 15597 6e72bd61002e
parent 4930 5d59bb58c365
permissions -rw-r--r--
Disable gfMoreWind for land objects on turn end only after a fixed-time delay 15s sounds much, but it's the average amount for gfMineStrike mines to settle naturally. And it would be very confusing to see falling mines suddenly not caring about gfMoreWind for no apparent reason. Note this whole thing is a giant hack anyway, to prevent a turn being blocked by infinitely bouncing mines. The better solution would be to help gfMoreWind-affected land objects settle naturally more reliably even under extreme wind. But this commit is "good enough" for now. If you don't like the delay, you can always tweak the constant.

/*
 This is an experimental main to use with hwLibary
 - create the library with `cmake . -DBUILD_ENGINE_LIBRARY=1' and `make hwengine'
 - compile this file with `gcc libhwLibrary.dylib libSDLmain.a wrapper.c -o wrapper -framework Cocoa -framework SDL'
   (in Mac OS X, but this command line shouldn't be much different in other OSes; make sure to set the correct files/paths)
 - this executable expect a save file "Save.hws" and the data folder "Data" to be in the same launching directory
 */

#include <stdlib.h>

extern void Game (const char **);

int SDL_main (int argc, const char **argv)
{
    // Note: if you get a segfault or other unexpected crashes on startup
    // make sure that these arguments are up-to-date with the ones actual needed

    const char **gameArgs = (const char**) malloc(sizeof(char *) * 11);

    gameArgs[ 0] = "0";          //ipcPort
    gameArgs[ 1] = "1024";       //cScreenWidth
    gameArgs[ 2] = "768";        //cScreenHeight
    gameArgs[ 3] = "0";          //cReducedQuality
    gameArgs[ 4] = "en.txt";     //cLocaleFName
    gameArgs[ 5] = "wrapper";    //UserNick
    gameArgs[ 6] = "1";          //isSoundEnabled
    gameArgs[ 7] = "1";          //isMusicEnabled
    gameArgs[ 8] = "1";          //cAltDamage
    gameArgs[ 9] = "0.0";        //rotationQt
    gameArgs[10] = "Save.hws";   //recordFileName

    Game(gameArgs);
    free(gameArgs);

    return 0;
}