User Name
Password

Go Back   Planetarion Forums > Planetarion Related Forums > Strategic Discussions

Reply
Thread Tools Display Modes
Unread 19 Jan 2006, 17:58   #1
Doorsdown
Aria's TeddyBear :p
 
Doorsdown's Avatar
 
Join Date: Apr 2002
Location: Rhode Island, USA
Posts: 516
Doorsdown is just really niceDoorsdown is just really niceDoorsdown is just really niceDoorsdown is just really nice
for the bcalc

http://bcalc.e-illuminati.com/stats.cpp

i have put this up so you don't have to go though the process of making the new stats up by hand as i already did.

Enjoy
__________________
Proud to be have been Fyre, NewDawn, NoS - The Illuminati, [1up]

R3 [Acid] peon
R4 - R7 [Fyre] HC
R7 - R8 [ND] HC
R8 - R13 [NoS] MC
R14 - R16 [1up] MO
R17 Retired
Doorsdown is offline   Reply With Quote
Unread 19 Jan 2006, 20:25   #2
Banned
Banned
 
Banned's Avatar
 
Join Date: Jul 2003
Location: ******
Posts: 2,326
Banned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so little
Re: for the bcalc

Quote:
Originally Posted by Doorsdown
http://bcalc.e-illuminati.com/stats.cpp

i have put this up so you don't have to go though the process of making the new stats up by hand as i already did.

Enjoy
You haven't found statsparser.cpp then? ;p
Banned is offline   Reply With Quote
Unread 19 Jan 2006, 20:34   #3
Stifler
Registered User
 
Join Date: Apr 2003
Location: Swansea
Posts: 798
Stifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond reputeStifler has a reputation beyond repute
Re: for the bcalc

/* Standalone minimal/buggy stats parser (in statsparser.cpp) 'helps' generate these lines */

its got a comment about it as well
__________________
In Elysium till the end.

Former [1up]

Current [Spore]

Returned under the IRC nick BenSwansea
Stifler is offline   Reply With Quote
Unread 19 Jan 2006, 21:25   #4
Banned
Banned
 
Banned's Avatar
 
Join Date: Jul 2003
Location: ******
Posts: 2,326
Banned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so littleBanned contributes so much and asks for so little
Re: for the bcalc

Incidentally, I needed to change a line in it when I stopped using the word 'Sub' in my stats.

On line 29:
Code:
if(fireType == "Sub") fireType = "Subvert";
Change "Sub" to "Steal" for the Excel sheets to parse. There's probably a few more changes that need doing for it to parse the normal ingame stats, I'm afraid.

Edit: Also, the salvage in the linked stats.cpp is incorrect.

Code:
DefenceSalvageFromDefence(0.3),// What fraction of Defence's losses is available as salvage (for the defence)
DefenceSalvageFromAttack(0.1),// What fraction of Attack's losses is available as salvage (for the defence)
Should be:

Code:
DefenceSalvageFromDefence(0.20),        // What fraction of Defence's losses is available as salvage (for the defence)
DefenceSalvageFromAttack(0.15), // What fraction of Attack's losses is available as salvage (for the defence)

Last edited by Banned; 19 Jan 2006 at 21:31.
Banned is offline   Reply With Quote
Unread 20 Jan 2006, 07:14   #5
Doorsdown
Aria's TeddyBear :p
 
Doorsdown's Avatar
 
Join Date: Apr 2002
Location: Rhode Island, USA
Posts: 516
Doorsdown is just really niceDoorsdown is just really niceDoorsdown is just really niceDoorsdown is just really nice
Re: for the bcalc

Quote:
Originally Posted by Banned
You haven't found statsparser.cpp then? ;p
i knew there had to be a easier way :/
__________________
Proud to be have been Fyre, NewDawn, NoS - The Illuminati, [1up]

R3 [Acid] peon
R4 - R7 [Fyre] HC
R7 - R8 [ND] HC
R8 - R13 [NoS] MC
R14 - R16 [1up] MO
R17 Retired
Doorsdown is offline   Reply With Quote
Unread 20 Jan 2006, 12:58   #6
SpaceMonkey
Warden
Reactor Champion
 
SpaceMonkey's Avatar
 
Join Date: Jul 2005
Location: The Far Side
Posts: 137
SpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to behold
Re: for the bcalc

Although I don't use the same code base, use only ANSI C, and parse the stats with every calc; if anyone is interested I can post the dirty routines I use to update the stats every week from http://manual.planetarion.com/stats.pl
SpaceMonkey is offline   Reply With Quote
Unread 7 Feb 2006, 16:13   #7
MrLobster
Commander in Briefs!
 
MrLobster's Avatar
 
Join Date: Dec 2000
Location: UK
Posts: 783
MrLobster has much to be proud ofMrLobster has much to be proud ofMrLobster has much to be proud ofMrLobster has much to be proud ofMrLobster has much to be proud ofMrLobster has much to be proud ofMrLobster has much to be proud ofMrLobster has much to be proud ofMrLobster has much to be proud of
Re: for the bcalc

Quote:
Originally Posted by SpaceMonkey
Although I don't use the same code base, use only ANSI C, and parse the stats with every calc; if anyone is interested I can post the dirty routines I use to update the stats every week from http://manual.planetarion.com/stats.pl
Well i'm interested...
__________________
<Kila> WHAT HAVE YOU DONE WITH MY PRECIOUS FORUMS
<Zeyi> 24h forum closure
<Zeyi> all posts recalled

"he's got a proven track record when it comes to showy art composition" - Tommy

<Sigi> Light: can I ask u how many open internet-windows u always have?
<MrLobster|PM> i have 2, the pa page, and the website for naked light pictures
<Ave> both has bad gfx
MrLobster is offline   Reply With Quote
Unread 14 Feb 2006, 22:42   #8
SpaceMonkey
Warden
Reactor Champion
 
SpaceMonkey's Avatar
 
Join Date: Jul 2005
Location: The Far Side
Posts: 137
SpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to beholdSpaceMonkey is a splendid one to behold
Re: for the bcalc

It's quite long and very dirty but here it is:

Code:
/*
    GetShipStats

    Returns list of ships
    UTY_List is an implementation of a double linked list
*/
UTY_List *GetShipStats()
{
    int time_to_collect = FALSE;
    char *s_web_page = NULL,
         *s_url = NULL;
    FILE *p_datefile = NULL;
    UTY_List *p_ships_in_order = NULL;
    time_t thetime;
    struct tm *p_now = malloc(sizeof(struct tm)),
              *p_then = malloc(sizeof(struct tm));
    ship_t *p_ship = NULL;

    /* If we haven't for a while, get the ship stats manual page */
    p_datefile = fopen("date.bin", "rb+");
    fread(&thetime, sizeof(time_t), 1, p_datefile);
    memcpy(p_then, gmtime(&thetime), sizeof(struct tm));
    thetime = time(NULL);
    memcpy(p_now, gmtime(&thetime), sizeof(struct tm));

    /* Write the current date back out */
    fseek(p_datefile, 0, SEEK_SET);
    fwrite(&thetime, sizeof(time_t), 1, p_datefile);
    fclose(p_datefile);
    p_datefile = NULL;

    /* Get manual page on the first calc after sunday */
    if(p_now->tm_wday != 0 && p_then->tm_wday == 0) {
        FILE *p_webfile = NULL;

        time_to_collect = TRUE;
        s_url = malloc(strlen(WEB_ADDR) + 1);
        if(NULL == s_url) {
            fprintf(stderr, "ERROR: Unable to malloc memory for URL\n");

            return NULL;
        }

        strcpy(s_url, WEB_ADDR);
        s_web_page = GetWebPage(s_url);
        free(s_url);
        s_url = NULL;

        /* Write it out for later */
        p_webfile = fopen("stats.html", "w+");
        fwrite(s_web_page, strlen(s_web_page), 1, p_webfile);
        fclose(p_webfile);

        /* Save the time it was last updated */
        p_datefile = fopen("updated.bin", "w+");
        fwrite(&thetime, sizeof(time_t), 1, p_datefile);
        fclose(p_datefile);
        p_datefile = NULL;
    }

    if(NULL == s_web_page || !time_to_collect) {
        FILE *p_webfile = NULL;

        p_webfile = fopen("stats.html", "r");
        if(NULL == p_webfile) {
            fprintf(stderr, "ERROR: Cannot fopen stats page\n");

            return NULL;
        }

        s_web_page = malloc(102400);
        if(NULL == s_web_page) {
            fprintf(stderr, "ERROR: Unable to malloc memory for manual page\n");

            return NULL;
        }

        fread(s_web_page, 102400, 1, p_webfile);
        fclose(p_webfile);
    }

    /* ManualPageShip() parses the stats and returns a list of ships 
       in the order they appear in the stats*/
    p_ships_in_order = ManualPageShip(s_web_page);
    free(s_web_page);
    s_web_page = NULL;

    /* Make a new ship that is a roid */
    p_ship = malloc(sizeof(ship_t));
    memset(p_ship, 0, sizeof(ship_t));
    p_ship->armour = 50;
    p_ship->type = ROID;
    p_ship->init = 99;
    p_ship->reset_me = 1;
    strcpy(p_ship->name, "ROID");
    UTY_ListAppend(p_ships_in_order, p_ship);

    /* Make a new ship that is a struct */
    p_ship = malloc(sizeof(ship_t));
    memset(p_ship, 0, sizeof(ship_t));
    p_ship->armour = 500;
    p_ship->type = STRUCT;
    p_ship->init = 99;
    p_ship->reset_me = 1;
    strcpy(p_ship->name, "STRUCT");
    UTY_ListAppend(p_ships_in_order, p_ship);

    /* Update the main page if we collected new stats */
    if(time_to_collect) {
        GenerateResultsPage(p_ships_in_order, 0);
    }

    return p_ships_in_order;
}
SpaceMonkey is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 12:31.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018