Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Autres questions


Index du Forum » Autres questions » Problèmes SDK divers et variés
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Problèmes SDK divers et variés

Posté le 26/10/2013 11:00

Salut j'ai fait un petit programme mais je comprends pas pourquoi la fonction Print ne veut pas afficher la chaine que je lui demande ...

Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "stdio.h"

unsigned int key;
int caractere, caractere2;
char chaine[21];
char ident[21];
char domaine[30];
char mdp[30];
char destinataire[40];
char sujet[30];
char corps[50];


int AddIn_main(int isAppli, unsigned short OptionNum){
    Bdisp_AllClr_DDVRAM();
    demmarage();
    identif();
    
    return 1;
}

demmarage(){
    int key;
    Bdisp_AllClr_DDVRAM();
    PrintMini(80,58,"Version 1.0",0);
    Bdisp_DrawLineVRAM(10,10,10,50);
    Bdisp_DrawLineVRAM(10,50,117,50);
    Bdisp_DrawLineVRAM(117,50,117,10);
    Bdisp_DrawLineVRAM(10,10,117,10);
    Bdisp_DrawLineVRAM(10,10,63,25);
    Bdisp_DrawLineVRAM(117,10,63,25);
    locate(7,5);
    Print("Messagerie");
    do{
        GetKey(&key);
    } while(key != 30004);
    
    Bdisp_AllClr_DDVRAM();
}

identif(){
    Bdisp_AllClr_DDVRAM();
    locate(1,1);
    Print("Identifiant:");
    locate(1,2);
    Print("+------------------+");
    locate(1,3);
    Print("|                  |");
    locate(1,4);
    Print("+------------------+");
    remplichaine();
    
    caractere2=0;
    do{
        caractere2++;
        ident[caractere2] = chaine[caractere2];
    } while(caractere2+1 != caractere);
    ========================== > ICI < ========
    locate(2,3);
    Print(ident);
    do{
        GetKey(&key);
    } while(key != 30004);
    
}

remplichaine(){
    caractere=0;
    do{
        caractere++;
    ======================= > ET ICI < ========
        locate(2,3);
        Print(chaine);
        GetKey(&key);
        //==========Conversion==========
        if (key==48)key= 71;
        if (key==46)key= 61;
        if (key==15)key= 51;
        if (key==135)key= 41;
        if (key==30004)key= 31;
        if (key==49)key= 72;
        if (key==50)key= 62;
        if (key==51)key= 52;
        if (key==137)key= 42;
        if (key==153)key= 32;
        if (key==52)key= 73;
        if (key==53)key= 63;
        if (key==54)key= 53;
        if (key==169)key= 43;
        if (key==185)key= 33;
        if (key==55)key= 74;
        if (key==56)key= 64;
        if (key==57)key= 54;
        if (key==30025)key= 44;
        if (key==30015)key= 34;
        if (key==187)key= 75;
        if (key==30046)key= 65;
        if (key==40)key= 55;
        if (key==41)key= 45;
        if (key==44)key= 35;
        if (key==14)key= 25;
        if (key==30001)key= 76;
        if (key==149)key= 66;
        if (key==133)key= 56;
        if (key==129)key= 46;
        if (key==130)key= 36;
        if (key==131)key= 26;
        if (key==30007)key= 77;
        if (key==205)key= 67;
        if (key==168)key= 57;
        if (key==30002)key= 47;
        if (key==30023)key= 37;
        if (key==30021)key= 27;
        if (key==30006)key= 78;
        if (key==30008)key= 68;
        if (key==30016)key= 58;
        if (key==30020)key= 38;
        if (key==30018)key= 28;
        if (key==30009)key= 79;
        if (key==30010)key= 69;
        if (key==30011)key= 59;
        if (key==30012)key= 49;
        if (key==30013)key= 39;
        if (key==30014)key= 29;
        //==============================
        if(key==31)caractere=19;
        if(key==76)chaine[caractere]='a';
        if(key==66)chaine[caractere]='b';
        if(key==56)chaine[caractere]='c';
        if(key==46)chaine[caractere]='d';
        if(key==36)chaine[caractere]='e';
        if(key==26)chaine[caractere]='f';
        if(key==75)chaine[caractere]='g';
        if(key==65)chaine[caractere]='h';
        if(key==55)chaine[caractere]='i';
        if(key==45)chaine[caractere]='j';
        if(key==35)chaine[caractere]='k';
        if(key==25)chaine[caractere]='l';
        if(key==74)chaine[caractere]='m';
        if(key==64)chaine[caractere]='n';
        if(key==54)chaine[caractere]='o';
        if(key==73)chaine[caractere]='p';
        if(key==63)chaine[caractere]='q';
        if(key==53)chaine[caractere]='r';
        if(key==43)chaine[caractere]='s';
        if(key==33)chaine[caractere]='t';
        if(key==72)chaine[caractere]='u';
        if(key==62)chaine[caractere]='v';
        if(key==52)chaine[caractere]='w';
        if(key==42)chaine[caractere]='x';
        if(key==32)chaine[caractere]='y';
        if(key==71)chaine[caractere]='z';
        if(key==61)chaine[caractere]='.';
        if(key==57)chaine[caractere]='@';
    } while(caractere!=19);
    
    if(key==31)chaine[caractere]='\0';
    if(key!=31)chaine[caractere+1]='\0';
}


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum){return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section


la chaine ident fait 21 caracteres


Précédente 1, 2, 3 ··· 10, 11, 12, 13, 14, 15, 16 ··· 20, 21, 22, 23 Suivante
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 16:28 | #


subsidiaire: hé oh j'ai eu 7 en français moi
Ensuite tu ne charges qu'une partie des données: ben en soit c'est pas trop grave vu que c'est juste la lecture non ?
Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 16:29 | #


Ben là, oui.
Mais le problème, c'est que quand tu vas écrire à nouveau dans le fichier, tu vas devoir le supprimer. Du coup, tu perds toutes les données que tu n'auras pas chargées.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 16:41 | #


Mais pour écrire j'ai l'autre fonction qui sauvegarde tout avant de tout réécrire.
La voila mais j'ai un petit soucis avec l'enregistrement du tableau, j'ai pas compris ce que t'as expliqué dans l'autre topic.
void modif_fichier(char *nom, unsigned int valeur, int argument) // VOIR SI OPTIMISER
{
    unsigned char nouv_fichier[200];
    unsigned char sauv_fichier[200];
    unsigned char nom_fichier[30];
    unsigned int sauv_valeurs[30];
    int handle, i, taille_fich;
    
    argument--;
    sprintf(nom_fichier,"\\\\fls0\\FOURMIZ\\%s", nom);
    
    // SAUVEGARDE DU FICHIER
        handle = memory_openfile(nom_fichier,_OPENMODE_READ);
        taille_fich = memory_filesize(handle);
        memory_readfile(handle,sauv_fichier, taille_fich,-1);
        memory_closefile(handle);
    
    // TRAITEMENT
        for(i=0; i<taille_fich/sizeof(unsigned int); i++){
            sauv_valeurs[i] = lire_fichier(nom, i+1);
        }
        sauv_valeurs[argument] += valeur;
        
        
    // ENREGISTREMENT
        memory_deletefile(nom_fichier);
        memory_createfile(nom_fichier,taille_fich);
        handle = memory_openfile(nom_fichier,_OPENMODE_WRITE);
        memory_writefile(handle,sauv_valeur,sizeof(f)); // probleme
        memory_closefile(handle);
}

Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 16:56 | #


Ça va pas du tout, tu gères ça n'importe comment.
Ce que tu devrais avoir, c'est :
→ En RAM, de la mémoire pour charger toutes les données ;
→ Une fonction appelée une fois au début du programme qui alloue la mémoire dans la RAM ;
→ Une fonction Save() qui sauvegarde les données de la RAM dans les fichiers
→ Une fonction Read() qui charge le contenu des fichiers dans la RAM.

Par exemple, tu aurais un tableau d'int par fichier, le tout dans un double tableau alloué dynamiquement. Par exemple ;
int **data;
// Nombre d'int dans chaque fichier
const int datal[NB_FICHIERS] = { 4, 5 /* , ... */ };

void Alloc()
{
  data = calloc(NB_FICHIERS,sizeof(int *));
  data[0] = calloc(datal[0],sizeof(int));
  data[1] = calloc(datal[1],sizeof(int));
  // ...
}


Du coup, tu aurais par exemple pour la fonction Save() :
void Save()
{
  const char *adresses[NB_FICHIERS] = { "\\\\fls0\\FIC1.txt", "\\\\fls0\\FIC2.txt" /* , ... */ };
  int i;

  for(i=0;i<NB_FICHIERS;i++)
    memory_save(adresse[i],data[i],datal[i]*sizeof(int));
}


Ça suffirait.
Après, tu aurais Read() sur le même modèle.
Au final, il te suffirait de modifier les données comme suit :
data[indexFichier][indexValeur] = val;

Et de tout sauvegarder chaque fois que tu le souhaite.
Save();

Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 17:11 | #


Je crois que je commence a comprendre...
Donc j'ai le tableau data en global qui est un pointeur sur le pointeur du tableau de chaque fichiers, j’appelle Alloc en même temps que l'add-in démarre, puis Read(), et si je modifie des valeurs, un simple appel a Save() sauvegarde tout. Pour acceder a une valeur je fais val = data[indexFichier][indexValeur] et l'inverse pour la modifier.
Merci je voyais pas du tout ca comme ca
Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 17:21 | #


Ça fonctionne comme ça pour quasiment tous les programmes.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 17:54 | #


void Read()
{
    const char *adresses[NB_FICHIERS] = {
        "\\\\fls0\\FOURMIZ\\glob.txt",
        "\\\\fls0\\FOURMIZ\\labo.txt",
        "\\\\fls0\\FOURMIZ\\constru.txt",
        "\\\\fls0\\FOURMIZ\\ouvri.txt",
        "\\\\fls0\\FOURMIZ\\arme.txt",
        "\\\\fls0\\FOURMIZ\\temps.txt",
        "\\\\fls0\\FOURMIZ\\chasse.txt"
    };
    int i,j, handle;
    
    for(i=0;i<NB_FICHIERS;i++){
        handle = memory_openfile(adresses[i],_OPENMODE_READ);
        for(j=0; j<datal[i]; j++)
            memory_readfile(handle,(void *)data[i][j],sizeof(int),-1);
        memory_closefile(handle);
    }
}


Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 17:57 | #


Nope. Tu devrais lire tout le fichier d'un coup.
void Read()
{
  const char *adresses[NB_FICHIERS] = {
    "\\\\fls0\\FOURMIZ\\glob.txt",
    "\\\\fls0\\FOURMIZ\\labo.txt",
    "\\\\fls0\\FOURMIZ\\constru.txt",
    "\\\\fls0\\FOURMIZ\\ouvri.txt",
    "\\\\fls0\\FOURMIZ\\arme.txt",
    "\\\\fls0\\FOURMIZ\\temps.txt",
    "\\\\fls0\\FOURMIZ\\chasse.txt"
  };
  int i,j, handle;
  
  for(i=0;i<NB_FICHIERS;i++)
  {
    handle = memory_openfile(adresses[i],_OPENMODE_READ);
    memory_readfile(handle,(void *)data[i],datal[i]*sizeof(int),0);
    memory_closefile(handle);
  }
}

Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 19:05 | #


au fait, je m'y connait pas trop en allocation dynamique, mais du coup a la fin faut que je libère la mémoire non ?
Drac0300 Hors ligne Membre Points: 839 Défis: 39 Message

Citer : Posté le 09/07/2014 20:15 | #


Ben si tu as alloué dynamiquement, oui, il vaudrait mieux ! Ça se fait avec free(void* pointeurSurLaValeurALiberer);
Dans Z/1Z, 42==666
Coïncidence ? Je ne pense pas.
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 20:50 | # | Fichier joint


J'ai fait ceci
void Free()
{
    int i;
    
    data = calloc(NB_FICHIERS,sizeof(int *));
    for(i=0; i<NB_FICHIERS; i++)
        free(data[i]);
    free(data);
}

Mais sinon il y a un problème de lecture je pense. Il me ressort des 0 partout lors de la réouverture de l'add-in (pas de création donc je penche pour un probleme de lecture).
L'add-in est en fichier joint.
Le code
Cliquer pour enrouler
#include "fxlib.h"
#include "memory.h"
#include "MonochromeLib.h"
#include "FOURMIZ.h"
#include <stdio.h>
#include <stdlib.h>

unsigned int **data;
const int datal[NB_FICHIERS] = { 3, 11, 14, 4, 14, 6, 4};

int AddIn_main(int isAppli, unsigned short OptionNum)
{
    Alloc();
    demmarage();
    menu_principal();
    Free();
}

void demmarage()
{
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0x80,0x60,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x84,0x56,0x23,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0xca,0x65,0x55,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0xa8,0x44,0x53,
        0x1,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0xa6,0x44,0x21,
        0x1,0xc0,0x0,0x0,0x0,0x0,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,
        0x0,0xe0,0x0,0x0,0x0,0x0,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x70,0x0,0x0,0x0,0x1,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x38,0x0,0x0,0x0,0x3,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1f,0x0,0x0,0x0,0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x7,0x80,0x0,0x0,0x1e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3,0xe0,0x0,0x1,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0xf0,0x0,0x1f,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x78,0x0,0x3f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x3c,0x0,0x78,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0xe,0x0,0x70,0x0,0xfe,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x7,0x0,0xe0,0xf,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x7,0x80,0xe0,0x1f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3f,0x3,0xc0,0xc0,0x78,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0xff,0xc1,0xe0,0xc1,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x3,0xff,0xf0,0xe1,0xc7,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x7,0xff,0xf8,0xf1,0xfe,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xf,0xff,0xfc,0xf1,0xfe,0x7e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xf,0xff,0xff,0xff,0xfe,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1f,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1f,0xff,0xff,0xff,0xff,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1f,0xff,0xff,0xff,0xff,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1f,0xff,0xff,0xff,0xff,0xff,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1f,0xff,0xff,0xff,0xff,0x9f,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1f,0xff,0xff,0xff,0xfd,0x8f,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xf,0xff,0xf8,0xff,0xfc,0xcf,0xf0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xf,0xff,0xf0,0xf3,0xbc,0xff,0xb0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x7,0xff,0xc1,0xe3,0x9c,0x7f,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x3,0xff,0x83,0x81,0x8e,0x1e,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0xfe,0xf,0x1,0x8f,0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x3c,0x1,0x87,0x87,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1,0xf8,0x1,0xc3,0xc3,0x8f,0xf0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3,0xc0,0x0,0xc1,0xe0,0xf,0xf0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3,0x0,0x0,0xc0,0x70,0xf,0xf0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x6,0x0,0x0,0xe0,0x38,0xe,0x0,0x0,0x0,0x0,0x6,0x0,0x0,0x0,0x0,
        0x0,0xe,0x0,0x0,0x60,0x1c,0xe,0x0,0x0,0x0,0x0,0x6,0x0,0x0,0x0,0x0,
        0x0,0x1c,0x0,0x0,0x70,0xe,0xe,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x18,0x0,0x0,0x78,0x7,0xf,0xc1,0xe6,0x6f,0x98,0x36,0xff,0x7f,0xbf,0xc0,
        0x0,0x38,0x0,0x0,0x3c,0x3,0x8f,0xc3,0xf6,0x6f,0xdc,0x76,0xff,0x7f,0xbf,0xc0,
        0x0,0x70,0x0,0x0,0x1e,0x1,0xef,0xc3,0x36,0x6c,0xde,0xf6,0xe,0x7,0x3,0x80,
        0x0,0xe0,0x0,0x0,0x7,0x80,0x6e,0x3,0x36,0x6f,0xdf,0xf6,0x1c,0xe,0x7,0x0,
        0x3,0xc0,0x0,0x0,0x3,0xc0,0xe,0x3,0x36,0x6f,0x9b,0xb6,0x38,0x1c,0xe,0x0,
        0x7,0x80,0x0,0x0,0x1,0xe0,0xe,0x3,0x36,0x6c,0xd9,0x36,0x70,0x38,0x1c,0x0,
        0xe,0x0,0x0,0x0,0x0,0x60,0xe,0x3,0xf7,0xec,0xd8,0x36,0xff,0x7f,0xbf,0xc0,
        0x0,0x0,0x0,0x0,0x0,0x70,0xe,0x1,0xe3,0xcc,0xd8,0x36,0xff,0x7f,0xbf,0xc0,
        0x0,0x0,0x0,0x0,0x0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x38,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xcc,0x40,0x22,0x20,0x32,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xa4,0x2a,0x57,0x50,0x41,0x44,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xc4,0x6d,0x72,0x77,0x43,0x21,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x84,0xa9,0x42,0x40,0x45,0x15,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8e,0x69,0x31,0x30,0x33,0x64,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    int i;
    unsigned char creation[6]={0};
    
    // IMAGE DE DEMARRAGE
        ML_clear_vram();
        ML_bmp_or(fond, 0, 0, 128, 64);
        PrintMini(110,59,"0.01",0);
        ML_display_vram();
        ML_clear_vram();
    
    // GESTION DES FICHIERS
        memory_createdir("\\\\fls0\\FOURMIZ");
        // GLOBAL        0
        if(!memory_exists("\\\\fls0\\FOURMIZ\\glob.txt")){
            creation[0]=1;
            memory_createfile("\\\\fls0\\FOURMIZ\\glob.txt", datal[0]*sizeof(int));
            // TDC - ENTREPOT POMME - ENTREPOT BOIS
            data[0][0] = 50;
            data[0][1] = 100;
            data[0][2] = 300;
        }
        // LABO            1
        if(!memory_exists("\\\\fls0\\FOURMIZ\\labo.txt")){
            creation[1] = 1;
            memory_createfile("\\\\fls0\\FOURMIZ\\labo.txt",datal[1]*sizeof(int));
            // en cours - tech ponte - bouc thorac - armes - archi - commu - vdc - vda - gene - acide - poison +
            for(i=0; i<datal[1]; i++)
                data[1][i] = 0;
        }
        // CONSTRU        2
        if(!memory_exists("\\\\fls0\\FOURMIZ\\constru.txt")){
            creation[2] = 1;
            memory_createfile("\\\\fls0\\FOURMIZ\\constru.txt",datal[2]*sizeof(int));
            // en cours - Champi - EtrepotN - EtrepotB - Couv - Solar - Labo - SalleD'ana - SalledeComb - Caserne - Dome - Loge - EtablePuce - EtableCoco +
            for(i=0; i<datal[2]; i++)
                data[2][i] = 0;
        }
        // OUVRIERES    3
        if(!memory_exists("\\\\fls0\\FOURMIZ\\ouvri.txt")){
            creation[3] = 1;
            memory_createfile("\\\\fls0\\FOURMIZ\\ouvri.txt",datal[3]*sizeof(int));
            // total - materiaux - nourriture - convoi +
            data[3][0] = 5;
            for(i=1; i<datal[3]; i++)
                data[3][i] = 0;
        }
        // ARMEE        4
        if(!memory_exists("\\\\fls0\\FOURMIZ\\arme.txt")){
            creation[4] = 1;
            memory_createfile("\\\\fls0\\FOURMIZ\\arme.txt",datal[4]*sizeof(int));
            // nbr - type - JSN - SN - NE - JS - S - C - A - AE - SE - T - Tu - TuE+        /!\ Ouvriere = -1 ?  conso JSN = 2.3 ?
            for(i=0; i<datal[4]; i++)
                data[4][i] = 0;
        }
        // TEMPS        5
        if(!memory_exists("\\\\fls0\\FOURMIZ\\temps.txt")){
            creation[5] = 1;
            memory_createfile("\\\\fls0\\FOURMIZ\\temps.txt",datal[5]*sizeof(int));
            // ponte - chasse - convoi - constru - labo - ressources+
            for(i=0; i<datal[5]; i++)
                data[5][i] = 0;
            data[5][5] = temps_min();
        }
        // CHASSE        6
        if(!memory_exists("\\\\fls0\\FOURMIZ\\chasse.txt")){
            creation[5] = 1;
            memory_createfile("\\\\fls0\\FOURMIZ\\chasse.txt",datal[6]*sizeof(int));
            // cm² - nbr de JSN - degat infligé - degats recus + (Petite Araignée = 13PA,59PV;  Guepe ; Abeille
            for(i=0; i<datal[6]; i++)
                data[6][i] = 0;
        }
        
    Save();
    
    test_temps();
}


void menu_principal()
{
    const unsigned char banniere[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xff,0xff,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x0,0x0,0x8,0x0,0x0,0x40,0x0,0x2,0x0,0x0,0x10,0x0,0x0,
        0x20,0x10,0x1,0x0,0x40,0x8,0x15,0x80,0x40,0x6c,0x2,0x1,0x80,0x10,0xc,0x0,
        0x20,0x7c,0x1,0x10,0xe1,0x8,0x1d,0xc0,0x40,0x28,0x2,0xf,0x38,0x10,0x2d,0x0,
        0x20,0xde,0x1,0x19,0xb3,0x8,0x8,0x80,0x40,0x44,0x2,0x1f,0x3c,0x10,0x6d,0x80,
        0x20,0xfe,0x1,0x1f,0xff,0x8,0x8,0x80,0x40,0x82,0x2,0x18,0x6c,0x10,0x61,0x80,
        0x20,0xfe,0x1,0x1f,0xff,0x8,0x1c,0x80,0x40,0x82,0x2,0x18,0xc,0x10,0x7f,0x80,
        0x20,0x7c,0x1,0x1f,0xff,0x8,0x14,0x80,0x40,0x7c,0x2,0x18,0xc,0x10,0x3f,0x0
    };
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0xaa,0xe9,0x39,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0xaa,0xaa,0xaa,0xa2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0xaa,0x8a,0x22,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xc,0xe4,0x89,0xa1,0xb2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x11,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x19,0x75,0x75,0xd5,0xc8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x15,0x55,0x54,0x95,0x55,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x13,0x55,0x44,0x95,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x11,0x77,0x44,0x9d,0xd,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,
        0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,
        0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x11,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1b,0x77,0x27,0x5d,0x52,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x15,0x52,0x55,0x55,0x4c,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x11,0x72,0x44,0x5d,0x4c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x11,0x52,0x34,0x55,0xd2,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,
        0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,
        0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1f,0x0,0x0,0x0,0xe0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0x4e,0xee,0xa4,0x92,0x22,0xb9,0x99,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0xaa,0xaa,0xb4,0x95,0x22,0xaa,0x22,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0x88,0x8e,0xac,0x94,0x23,0xb8,0x8a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x4,0x68,0x8a,0xa4,0xe3,0x1a,0xab,0x31,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,
        0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,
        0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x2,0xff,0xfd,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x49,0x95,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x2,0xa9,0x55,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x2,0xe9,0x9d,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x2,0xad,0x15,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x3,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    char buffer[100];
    unsigned long i, j;
    
    while(1){
        test_temps();
        ML_clear_vram();
        ML_bmp_or(banniere, 0, 56, 128, 8);
        ML_bmp_or(fond, 0, 0, 128, 54);
        // nbr d'ouvrieres
            sprintf(buffer,"%u",data[3][0]);
            PrintMini(41,2,buffer,0);
        // nourriture
            sprintf(buffer,"%u",data[0][1]);
            PrintMini(42,9,buffer,0);
            j=1700;
            for(i=0;i<data[2][2];i++)
                j=j*2-500;
            i=j;
            j=100000/j*data[0][1];
            ML_horizontal_line(16, 4, j/1000+4, ML_BLACK);
            sprintf(buffer, "%02u%%", 100*data[0][1]/i);
            PrintMini(110,14,buffer,0);
        // materiaux
            sprintf(buffer,"%u",data[0][2]);
            PrintMini(43,20,buffer,0);
            j=1700;
            for(i=0;i<data[2][1];i++)
                j=j*2-500;
            i=j;
            j=100000/j*data[0][2];
            ML_horizontal_line(27, 4, j/1000+4, ML_BLACK);
            sprintf(buffer, "%02u%%", 100*data[0][2]/i);
            PrintMini(110,25,buffer,0);
        // TDC
            sprintf(buffer,"%u",data[0][0]);
            PrintMini(69,31,buffer,0);
            i=data[0][0];
            j=100000/i*(data[3][1] + data[3][2]);
            ML_horizontal_line(38, 4, j/1000+4, ML_BLACK);
            sprintf(buffer, "%02u%%", 100*(data[3][1] + data[3][2])/i);
            PrintMini(110,36,buffer,0);
        SaveDisp(1);
        fenetre_o(0,54,1);
        SaveDisp(1);
        
        while(!IsKeyDown(KEY_CTRL_F1) && !IsKeyDown(KEY_CTRL_F2) && !IsKeyDown(KEY_CTRL_F3) && !IsKeyDown(KEY_CTRL_F4) && !IsKeyDown(KEY_CTRL_F5) && !IsKeyDown(KEY_CTRL_F6) && !IsKeyDown(KEY_CTRL_EXIT) && !IsKeyDown(KEY_CTRL_ALPHA));
        
        if(IsKeyDown(KEY_CTRL_F1)) ressources();
        if(IsKeyDown(KEY_CTRL_F2)) reine();
        /*
        if(key==KEY_CTRL_F3) construction(),i=1;
        if(key==KEY_CTRL_F4) labo(),i=1;
        if(key==KEY_CTRL_F5) connection(),i=1;
        */
        if(IsKeyDown(KEY_CTRL_F6) || IsKeyDown(KEY_CTRL_EXIT)) return;
    }
}

// RESSOURCES (F1)
void ressources() // Ajouter Champi aux apports
{
    const unsigned char banniere_mp[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xff,0xff,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x55,0x55,0x4a,0xaa,0xaa,0x55,0x55,0x52,0xaa,0xaa,0x95,0x55,0x54,
        0x20,0x10,0x1,0xaa,0xea,0x8d,0x55,0xd4,0x6a,0xee,0xa3,0x55,0xd5,0x1a,0xae,0xa8,
        0x20,0x7c,0x1,0x55,0xf5,0x4a,0xbf,0xea,0x55,0x7d,0x52,0xaf,0xba,0x95,0x7d,0x54,
        0x20,0xde,0x1,0xbb,0xbb,0x8d,0x5d,0xd4,0x6a,0xee,0xa3,0x5f,0x7d,0x1a,0xef,0xa8,
        0x20,0xfe,0x1,0x5f,0xff,0x4a,0xaa,0xaa,0x55,0xd7,0x52,0xba,0xee,0x95,0x75,0xd4,
        0x20,0xfe,0x1,0xbf,0xff,0x8d,0x5d,0xd4,0x6a,0xaa,0xa3,0x5d,0x5d,0x1a,0xff,0xa8,
        0x20,0x7c,0x1,0x5f,0xff,0x4a,0xbe,0xaa,0x55,0x7d,0x52,0xba,0xae,0x95,0x7f,0x54
    };
    const unsigned char banniere_ress[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90,0x0,0x0,
        0x21,0x2,0x71,0x0,0x60,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90,0xe,0x0,
        0x27,0xc2,0xb9,0x0,0x60,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90,0xe,0x0,
        0x2d,0xe4,0xf9,0x1,0xf8,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90,0x1f,0x0,
        0x2f,0xe4,0x71,0x1,0xf8,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90,0xe,0x0,
        0x2f,0xe8,0x21,0x0,0x60,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90,0x4,0x0,
        0x27,0xc8,0x71,0x0,0x60,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x90,0x0,0x0
    };
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0x46,0x64,0xae,0x64,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1c,0xa8,0x8a,0xaa,0x8a,0x84,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0x82,0x2a,0xa8,0x88,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0x6c,0xc4,0xe8,0x66,0xc4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x55,0x5d,0x27,0x23,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x55,0x55,0x55,0x54,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x55,0x51,0x44,0x41,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x9c,0x91,0x34,0x36,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x22,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x23,0x2e,0xae,0xba,0xb9,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3a,0xaa,0xaa,0x92,0xaa,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x6a,0xa8,0x92,0xa2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x2e,0xe8,0x93,0xa1,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x22,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x23,0x6e,0xe4,0xeb,0xaa,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3a,0xaa,0x4a,0xaa,0xa9,0x90,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x2e,0x48,0x8b,0xa9,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x2a,0x46,0x8a,0xba,0x50,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1,0x80,0x0,0x0,0x7,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x5d,0xdd,0xdc,0xc1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x3,0xd5,0x55,0x49,0x1,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x5d,0xd5,0x8,0x45,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x2,0x51,0x1d,0x9,0x82,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x22,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x23,0x2e,0xae,0xba,0xb9,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3a,0xaa,0xaa,0x92,0xaa,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x6a,0xa8,0x92,0xa2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x2e,0xe8,0x93,0xa1,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x22,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x23,0x6e,0xe4,0xeb,0xaa,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x3a,0xaa,0x4a,0xaa,0xa9,0x90,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x2e,0x48,0x8b,0xa9,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x2,0x2a,0x46,0x8a,0xba,0x50,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    
    int i;
    unsigned long jsn, temps_m, temps_h, temps_j;
    unsigned char buffer[50];
    
    fenetre_f(0,54,1);
    for(i=0;i<10;i++){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 56-i, 128, 8);
        ML_bmp_or(banniere_ress, 0, 65-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
    ML_bmp_or(fond, 0, 0, 128, 45);
    SaveDisp(2);
    fenetre_o(0,45,2);
    SaveDisp(2);
    
    while(1){
        test_temps();
        jsn = data[4][2];
        if(data[5][1]) jsn = 0;
        
        RestoreDisp(2);
        
        // OUV NOURRITURE
            sprintf(buffer, "%u", data[3][2]);
            PrintMini(53,14,buffer,0);
        // OUV MATER
            sprintf(buffer, "%u", data[3][1]);
            PrintMini(54,20,buffer,0);
        // APPORT NOURRITURE
            sprintf(buffer, "%u", data[3][2]*48);
            PrintMini(53,32,buffer,0);
        // APPORT MATER
            sprintf(buffer, "%u", data[3][1]*48);
            PrintMini(54,38,buffer,0);
        // TEMPS RESS
            sprintf(buffer, "%u min", data[5][5]-temps_min());
            PrintMini(78,2,"Retour dans:",0);
            PrintMini(102,8,buffer,0);
        // TEMPS CHASSE
            if(data[5][1]){
                ML_rectangle(23,56,104,65,1,ML_BLACK,ML_WHITE);
                temps_m = data[5][1]-temps_min();
                temps_h = temps_m/60;
                temps_m %= 60;
                temps_j = temps_h/24;
                temps_h %= 24;
                sprintf(buffer, "%uj %uh %um", temps_j, temps_h, temps_m);
                PrintMini(25,58,buffer,0);
            }
            
        ML_display_vram();
        
        while(!IsKeyDown(KEY_CTRL_F1) && !IsKeyDown(KEY_CTRL_F2) && !IsKeyDown(KEY_CTRL_F6) && !IsKeyDown(KEY_CTRL_EXIT));
        if(IsKeyDown(KEY_CTRL_F1)) ressources_ouv();
        if(IsKeyDown(KEY_CTRL_F2) && jsn>0) ressources_chasse();
        if(IsKeyDown(KEY_CTRL_F6) || IsKeyDown(KEY_CTRL_EXIT)) break;
    }
    
    fenetre_f(0,45,2);
    for(i=10;i>=0;i--){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 56-i, 128, 8);
        ML_bmp_or(banniere_ress, 0, 65-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
}

void ressources_ouv()
{
    const unsigned char banniere_mp[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xff,0xff,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x55,0x55,0x4a,0xaa,0xaa,0x55,0x55,0x52,0xaa,0xaa,0x95,0x55,0x54,
        0x20,0x10,0x1,0xaa,0xea,0x8d,0x55,0xd4,0x6a,0xee,0xa3,0x55,0xd5,0x1a,0xae,0xa8,
        0x20,0x7c,0x1,0x55,0xf5,0x4a,0xbf,0xea,0x55,0x7d,0x52,0xaf,0xba,0x95,0x7d,0x54,
        0x20,0xde,0x1,0xbb,0xbb,0x8d,0x5d,0xd4,0x6a,0xee,0xa3,0x5f,0x7d,0x1a,0xef,0xa8,
        0x20,0xfe,0x1,0x5f,0xff,0x4a,0xaa,0xaa,0x55,0xd7,0x52,0xba,0xee,0x95,0x75,0xd4,
        0x20,0xfe,0x1,0xbf,0xff,0x8d,0x5d,0xd4,0x6a,0xaa,0xa3,0x5d,0x5d,0x1a,0xff,0xa8,
        0x20,0x7c,0x1,0x5f,0xff,0x4a,0xbe,0xaa,0x55,0x7d,0x52,0xba,0xae,0x95,0x7f,0x54
    };
    const unsigned char banniere_ress[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x55,0x55,0x48,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x95,0x55,0x54,
        0x21,0x2,0x71,0xaa,0xea,0x88,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9a,0xae,0xa8,
        0x27,0xc2,0xb9,0x55,0x75,0x48,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x95,0x5f,0x54,
        0x2d,0xe4,0xf9,0xab,0xfa,0x88,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9a,0xbf,0xa8,
        0x2f,0xe4,0x71,0x55,0xfd,0x48,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x95,0x5f,0x54,
        0x2f,0xe8,0x21,0xaa,0xea,0x88,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9a,0xae,0xa8,
        0x27,0xc8,0x71,0x55,0x75,0x4f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0x55,0x54
    };
    const unsigned char banniere_ress_ouv[]={
        0x3f,0xff,0xf9,0xfe,0x3f,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xf8,0x3f,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x0,0x80,0x48,0x0,0x0,0x40,0x0,0x2,0x3,0x80,0x90,0x0,0x0,
        0x20,0x0,0x1,0x3,0xe0,0x48,0x3,0x0,0x40,0x0,0x2,0x5,0xc0,0x90,0x6,0x0,
        0x20,0x0,0x1,0x6,0xf0,0x48,0x3,0x0,0x40,0x0,0x2,0x7,0xc0,0x90,0x6,0x0,
        0x20,0x7e,0x1,0x7,0xf0,0x48,0xf,0xc0,0x40,0xfc,0x2,0x3,0x80,0x90,0x1f,0x80,
        0x20,0x7e,0x1,0x7,0xf0,0x48,0xf,0xc0,0x40,0xfc,0x2,0x1,0x0,0x90,0x1f,0x80,
        0x20,0x0,0x1,0x3,0xe0,0x48,0x3,0x0,0x40,0x0,0x2,0x3,0x80,0x90,0x6,0x0,
        0x20,0x0,0x1,0xf8,0xf,0xc8,0x3,0x0,0x40,0x0,0x3,0xf8,0x3f,0x90,0x6,0x0
    };
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0xaa,0xe9,0x39,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0xaa,0xaa,0xaa,0xa2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x12,0xaa,0x8a,0x22,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0xc,0xe4,0x89,0xa1,0xb2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x43,0x1,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x44,0xa9,0x24,0xce,0x60,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x77,0xa9,0xca,0xaa,0x88,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x4,0xa9,0x28,0xca,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x4,0xb9,0x26,0x8e,0xc8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x43,0x1,0xf0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x44,0xa8,0x47,0x75,0x71,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x77,0xa8,0x45,0x55,0x55,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x4,0xa8,0x44,0x75,0x75,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x4,0xb8,0x44,0x52,0x55,0xa0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1,0x11,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1,0x19,0x75,0x75,0xd5,0xc8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1,0xd5,0x55,0x54,0x95,0x55,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x13,0x55,0x44,0x95,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x11,0x77,0x44,0x9d,0xd,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1,0x11,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1,0x1b,0x77,0x27,0x5d,0x52,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x1,0xd5,0x52,0x55,0x55,0x4c,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x11,0x72,0x44,0x5d,0x4c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x11,0x52,0x34,0x55,0xd2,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    
    unsigned char buffer[50];
    int i;
    
    /*
    total = data[3][0];
    bois = data[3][1];
    pomme = data[3][2];
    convois = data[3][3];
    tdc = data[0][0];
    */
    
    /*
    // CHAMPI
    j=0;
    i=lire_fichier("constru.txt",2);
    if(i) j=122;
    if(i--){
        k=86;
        do{
            j+=k;
            k*=1.7;
        }while(i--);
    }
    pomme+=j;
    */
    
    fenetre_f(0,45,2);
    for(i=0;i<9;i++){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 46-i, 128, 8);
        ML_bmp_or(banniere_ress, 0, 55-i, 128, 8);
        ML_bmp_or(banniere_ress_ouv, 0, 64-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
    ML_bmp_or(fond, 0, 0, 128, 36);
    sprintf(buffer, "%u", data[3][0]);
    PrintMini(41,2,buffer,0);
    SaveDisp(3);
    fenetre_o(0,36,3);
    SaveDisp(3);
    
    test_temps();
    
    while(1){
        RestoreDisp(3);
        sprintf(buffer, "%u", data[3][0]-data[3][1]-data[3][2]-data[3][3]);
        PrintMini(47,9,buffer,0);
        sprintf(buffer, "%u", data[3][1]+data[3][2]);
        PrintMini(53,15,buffer,0);
        sprintf(buffer, "%u", data[3][2]);
        PrintMini(58,21,buffer,0);
        sprintf(buffer, "%u", data[3][1]);
        PrintMini(59,27,buffer,0);
        ML_display_vram();
        
        if(IsKeyDown(KEY_CTRL_F1) && data[3][2]>0) data[3][2]--;
        if(IsKeyDown(KEY_CTRL_F3) && data[3][2]+data[3][1]<data[3][0]-data[3][3] && data[3][2]+data[3][1]<data[0][0]) data[3][2]++;
        if(IsKeyDown(KEY_CTRL_F4) && data[3][1]>0) data[3][1]--;
        if(IsKeyDown(KEY_CTRL_F6) && data[3][2]+data[3][1]<data[3][0]-data[3][3] && data[3][2]+data[3][1]<data[0][0]) data[3][1]++;
        if(IsKeyDown(KEY_CTRL_EXIT)) break;
        Sleep(10);
        if(IsKeyDown(KEY_CTRL_SHIFT)) Sleep(100);
    }
    
    Save();
    
    SaveDisp(3);
    fenetre_f(0,36,3);
    for(i=9;i>0;i--){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 46-i, 128, 8);
        ML_bmp_or(banniere_ress, 0, 55-i, 128, 8);
        ML_bmp_or(banniere_ress_ouv, 0, 64-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
    fenetre_o(0,45,2);
}

void ressources_chasse()  // VOIR POUR LES DEGATS
{
    const unsigned char banniere_mp[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xff,0xff,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x55,0x55,0x4a,0xaa,0xaa,0x55,0x55,0x52,0xaa,0xaa,0x95,0x55,0x54,
        0x20,0x10,0x1,0xaa,0xea,0x8d,0x55,0xd4,0x6a,0xee,0xa3,0x55,0xd5,0x1a,0xae,0xa8,
        0x20,0x7c,0x1,0x55,0xf5,0x4a,0xbf,0xea,0x55,0x7d,0x52,0xaf,0xba,0x95,0x7d,0x54,
        0x20,0xde,0x1,0xbb,0xbb,0x8d,0x5d,0xd4,0x6a,0xee,0xa3,0x5f,0x7d,0x1a,0xef,0xa8,
        0x20,0xfe,0x1,0x5f,0xff,0x4a,0xaa,0xaa,0x55,0xd7,0x52,0xba,0xee,0x95,0x75,0xd4,
        0x20,0xfe,0x1,0xbf,0xff,0x8d,0x5d,0xd4,0x6a,0xaa,0xa3,0x5d,0x5d,0x1a,0xff,0xa8,
        0x20,0x7c,0x1,0x5f,0xff,0x4a,0xbe,0xaa,0x55,0x7d,0x52,0xba,0xae,0x95,0x7f,0x54
    };
    const unsigned char banniere_ress[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0xff,0xfc,
        0x2a,0xaa,0xa9,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x95,0x55,0x54,
        0x35,0x57,0x71,0x0,0x60,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9a,0xae,0xa8,
        0x2f,0xea,0xb9,0x0,0x60,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x95,0x5f,0x54,
        0x3d,0xf5,0xf9,0x1,0xf8,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9a,0xbf,0xa8,
        0x2f,0xee,0xf9,0x1,0xf8,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x95,0x5f,0x54,
        0x3f,0xfd,0x71,0x0,0x60,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9a,0xae,0xa8,
        0x2f,0xea,0xf9,0x0,0x60,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0x55,0x54
    };
    const unsigned char banniere_ress_chasse[]={
        0x3f,0xff,0xf9,0xfc,0xf7,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xf8,0x3f,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x0,0x70,0x48,0x0,0x0,0x40,0x0,0x2,0x0,0x0,0x90,0x0,0x0,
        0x20,0x0,0x1,0x0,0xf0,0x48,0x3,0x0,0x40,0x0,0x2,0x39,0xb8,0x90,0x6,0x0,
        0x20,0x0,0x1,0x1,0xd0,0x48,0x3,0x0,0x40,0x0,0x2,0x12,0x24,0x90,0x6,0x0,
        0x20,0x7e,0x1,0xb,0x80,0x48,0xf,0xc0,0x40,0xfc,0x2,0x50,0xa4,0x90,0x1f,0x80,
        0x20,0x7e,0x1,0xf,0x0,0x48,0xf,0xc0,0x40,0xfc,0x2,0x23,0x24,0x90,0x1f,0x80,
        0x20,0x0,0x1,0xe,0x0,0x48,0x3,0x0,0x40,0x0,0x2,0x0,0x0,0x90,0x6,0x0,
        0x20,0x0,0x1,0xef,0x3f,0xc8,0x3,0x0,0x40,0x0,0x3,0xf8,0x3f,0x90,0x6,0x0
    };
    const unsigned char fond[]={
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1c,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x21,0xd9,0xd4,0x9d,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x21,0x55,0x55,0x55,0x54,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x21,0x55,0x55,0x11,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x1d,0xd5,0xdc,0xd1,0x44,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x3e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x4d,0x39,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0xaa,0xaa,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x8a,0xb8,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x6a,0xa3,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x3e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0xee,0xae,0x46,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0xaa,0xaa,0xa8,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x8a,0xae,0x82,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x8,0x8e,0xe8,0x6c,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
    };
    
    int i;
    unsigned char buffer[50];
    unsigned long capture, jsn_lance, arme, bouc, vdc;
    
    /*
    jsn_dispo = data[4][2];
    tdc = data[0][0];
    */
    test_temps();
    arme = data[1][3];
    bouc = data[1][2];
    vdc = data[4][6];
    capture = 0;
    jsn_lance = 1;
    
    fenetre_f(0,45,2);
    for(i=0;i<9;i++){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 46-i, 128, 8);
        ML_bmp_or(banniere_ress, 0, 55-i, 128, 8);
        ML_bmp_or(banniere_ress_chasse, 0, 64-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
    ML_bmp_or(fond, 0, 0, 128, 36);
    SaveDisp(3);
    fenetre_o(0,36,3);
    SaveDisp(3);
    
    while(1){
        RestoreDisp(3);
        sprintf(buffer, "%u cm2", capture);
        PrintMini(40,7,buffer,0);
        sprintf(buffer, "%u", data[0][0]+capture);
        PrintMini(29,15,buffer,0);
        sprintf(buffer, "%u jsn", jsn_lance);
        PrintMini(35,22,buffer,0);
        ML_display_vram();
        
        if(IsKeyDown(KEY_CTRL_F1) && capture>0) capture--;
        if(IsKeyDown(KEY_CTRL_F3) && capture<1000000000) capture++;
        if(IsKeyDown(KEY_CTRL_F4) && jsn_lance>1) jsn_lance--;
        if(IsKeyDown(KEY_CTRL_F6) && jsn_lance<data[4][2]) jsn_lance++;
        if(IsKeyDown(KEY_CTRL_EXIT)) break;
        if(IsKeyDown(KEY_CTRL_SHIFT)) Sleep(100);
        Sleep(10);
    }
    
    data[6][0] = capture;
    data[6][1] = jsn_lance;
    data[4][2] -= jsn_lance;
    while(arme) jsn_lance*=1.1,arme--;
    data[6][2] = jsn_lance;
    jsn_lance = data[0][0]+capture;
    while(vdc) jsn_lance*=0.9, vdc--;
    data[5][1] = jsn_lance+temps_min();
    
    Save();
    
    SaveDisp(3);
    fenetre_f(0,36,3);
    for(i=9;i>=0;i--){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 46-i, 128, 8);
        ML_bmp_or(banniere_ress, 0, 55-i, 128, 8);
        ML_bmp_or(banniere_ress_chasse, 0, 64-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
    fenetre_o(0,45,2);
}

// REINE (F2)
void reine()
{
    const unsigned char banniere_mp[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xff,0xff,0x9f,0xff,0xfc,
        0x2a,0xaa,0xa9,0x0,0x0,0xa,0xaa,0xaa,0x55,0x55,0x52,0xaa,0xaa,0x95,0x55,0x54,
        0x35,0x55,0x51,0x0,0x40,0xd,0x55,0xd4,0x6a,0xee,0xa3,0x55,0xd5,0x1a,0xae,0xa8,
        0x2a,0xfe,0xa9,0x10,0xe1,0xa,0xbf,0xea,0x55,0x7d,0x52,0xaf,0xba,0x95,0x7d,0x54,
        0x35,0xdf,0x51,0x19,0xb3,0xd,0x5d,0xd4,0x6a,0xee,0xa3,0x5f,0x7d,0x1a,0xef,0xa8,
        0x2a,0xfe,0xa9,0x1f,0xff,0xa,0xaa,0xaa,0x55,0xd7,0x52,0xba,0xee,0x95,0x75,0xd4,
        0x35,0xff,0x51,0x1f,0xff,0xd,0x5d,0xd4,0x6a,0xaa,0xa3,0x5d,0x5d,0x1a,0xff,0xa8,
        0x2a,0xfe,0xa9,0x1f,0xff,0xa,0xbe,0xaa,0x55,0x7d,0x52,0xba,0xae,0x95,0x7f,0x54
    };
    const unsigned char banniere_reine[]={
        0x3f,0xff,0xf9,0xff,0xff,0xcf,0xff,0xfe,0x7f,0xff,0xf3,0xff,0xff,0x9f,0xff,0xfc,
        0x20,0x0,0x1,0x0,0x0,0x8,0x0,0x2,0x40,0x0,0x2,0x0,0x0,0x10,0x0,0x0,
        0x20,0x10,0x1,0x0,0x60,0x8,0x9,0x2,0x40,0x0,0x2,0x0,0x80,0x10,0xe,0x0,
        0x20,0x3e,0x1,0x0,0x60,0x8,0xd,0x2,0x40,0x0,0x2,0x7,0xc0,0x10,0xe,0x0,
        0x20,0x7e,0x1,0x1,0xf8,0x8,0xb,0x2,0x40,0x7e,0x2,0x7,0xe0,0x10,0x1f,0x0,
        0x20,0x3e,0x1,0x1,0xf8,0x8,0x9,0x2,0x40,0x7e,0x2,0x7,0xc0,0x10,0xe,0x0,
        0x20,0x10,0x1,0x0,0x60,0x8,0x0,0x2,0x40,0x0,0x2,0x0,0x80,0x10,0x4,0x0,
        0x20,0x0,0x1,0x0,0x60,0xf,0xff,0xfe,0x40,0x0,0x2,0x0,0x0,0x10,0x0,0x0
    };
    
    int i, reduc, type;
    unsigned long temps;
    
    reduc = data[2][4] + data[2][5] + data[1][1];
    
    fenetre_f(0,54,1);
    for(i=0;i<10;i++){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 56-i, 128, 8);
        ML_bmp_or(banniere_reine, 0, 65-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
    //ML_bmp_or(fond, 0, 0, 128, 45);
    SaveDisp(2);
    fenetre_o(0,45,2);
    SaveDisp(2);
    
    // TRAITEMENT
    
    fenetre_f(0,45,2);
    for(i=10;i>=0;i--){
        ML_clear_vram();
        ML_bmp_or(banniere_mp, 0, 56-i, 128, 8);
        ML_bmp_or(banniere_reine, 0, 65-i, 128, 8);
        ML_display_vram();
        Sleep(50);
    }
}


// FONCTION SUPPLEMENTAIRE POUR FOURMIZZZ
void test_temps() // A FAIRE: convois
{
    unsigned long temps, i, j, k, pomme, bois, ouv_bois, ouv_pomme;
    unsigned char buffer[40];
    
    
    temps = temps_min();
    Read();
    
    // PONTES
        if(data[5][0] && temps>data[5][0]){
            if(data[4][1]!=13) data[4][data[4][1]+2] = data[4][0];
            else data[3][0] = data[4][0];
            data[5][0] = 0;
        }
    // CHASSE -voir probleme MP
        if(data[5][1] && temps>data[5][1]){
            data[0][0] += data[6][0];
            data[4][2] += data[6][1];
            data[5][1] = 0;
        }
    // CONVOI -voir probleme MP
        
    // CONSTRUCTION
        if(data[5][3] && temps>data[5][3]){
            data[2][data[2][0]+1]++;
            data[5][3] = 0;
        }
    // LABORATOIRE
        if(data[5][4] && temps>data[5][4]){
            data[1][data[1][0]+1]++;
            data[5][3] = 0;
        }
    // RESSOURCES
        // OUVRIERES
            ouv_bois = data[3][1];
            ouv_pomme = data[3][2];
        // CHAMPIGNONIERE
            j = 0;
            i = data[2][1];
            if(i) j=122;
            if(i--){
                k = 86;
                do{
                    j+=k;
                    k*=1.7;
                }while(i--);
            }
            ouv_pomme += j;
        // CALCUL TEMPS
            while(temps>data[5][5]){
                data[5][5]+=30;
                data[0][1] += ouv_pomme;
                data[0][2] += ouv_bois;
            }
        // ENTREPOTS TROP PLEIN ?
            for(i=0, j=1700;i<data[2][2];i++) j=j*2-500;
            if(data[0][1]>j) data[0][1] = j;
            for(i=0, j=1700;i<data[2][3];i++) j=j*2-500;
            if(data[0][2]>j) data[0][2] = j;
    Save();
}


// FONCTONS FENETRES
void fenetre_f(int bas, int haut, int disp)
{
    int y, x;
    const int mid = (haut+bas)/2;
    
    y=mid-bas;
    for(x=64;x>0;x--){
        ML_clear_vram();
        if(disp!=0) RestoreDisp(disp);
        ML_rectangle(0,bas,127,mid-y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,haut,127,mid+y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,bas,64-x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(127,bas,64+x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(64-x,mid+y,64+x,mid-y,1,ML_BLACK,ML_TRANSPARENT);
        ML_pixel(64-x, mid+y, ML_WHITE);
        ML_pixel(64+x, mid+y, ML_WHITE);
        ML_pixel(64-x, mid-y, ML_WHITE);
        ML_pixel(64+x, mid-y, ML_WHITE);
        ML_display_vram();
        if(IsKeyUp(KEY_CTRL_EXE)) Sleep(30);
    }
    for(x=1;y>0;y--){
        ML_clear_vram();
        if(disp!=0) RestoreDisp(disp);
        ML_rectangle(0,bas,127,mid-y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,haut,127,mid+y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,bas,64-x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(127,bas,64+x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(64-x,mid+y,64+x,mid-y,1,ML_BLACK,ML_TRANSPARENT);
        ML_pixel(64-x, mid+y, ML_WHITE);
        ML_pixel(64+x, mid+y, ML_WHITE);
        ML_pixel(64-x, mid-y, ML_WHITE);
        ML_pixel(64+x, mid-y, ML_WHITE);
        ML_display_vram();
        if(IsKeyUp(KEY_CTRL_EXE)) Sleep(30);
    }
}

void fenetre_o(int bas, int haut, int disp)
{
    int y, x;
    const int mid = (haut+bas)/2;
    
    y=1;
    for(x=0;x<64;x++){
        ML_clear_vram();
        if(disp!=0) RestoreDisp(disp);
        ML_rectangle(0,bas,127,mid-y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,haut,127,mid+y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,bas,64-x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(127,bas,64+x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(64-x,mid+y,64+x,mid-y,1,ML_BLACK,ML_TRANSPARENT);
        ML_pixel(64-x, mid+y, ML_WHITE);
        ML_pixel(64+x, mid+y, ML_WHITE);
        ML_pixel(64-x, mid-y, ML_WHITE);
        ML_pixel(64+x, mid-y, ML_WHITE);
        ML_display_vram();
        if(IsKeyUp(KEY_CTRL_EXE)) Sleep(30);
    }
    for(y=1;mid-y>=bas;y++){
        ML_clear_vram();
        if(disp!=0) RestoreDisp(disp);
        ML_rectangle(0,bas,127,mid-y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,haut,127,mid+y,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,bas,64-x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(127,bas,64+x,haut,0,ML_WHITE,ML_WHITE);
        ML_rectangle(0,mid+y,127,mid-y,1,ML_BLACK,ML_TRANSPARENT);
        ML_pixel(0, mid+y, ML_WHITE);
        ML_pixel(127, mid+y, ML_WHITE);
        ML_pixel(0, mid-y, ML_WHITE);
        ML_pixel(127, mid-y, ML_WHITE);
        ML_display_vram();
        if(IsKeyUp(KEY_CTRL_EXE)) Sleep(30);
    }
}


// FONCTIONS POUR LES FICHIERS
void Alloc()
{
    int i;

    data = calloc(NB_FICHIERS,sizeof(int *));
    for(i=0; i<NB_FICHIERS; i++)
        data[i] = calloc(datal[i],sizeof(int));
}

void Read()
{
    const char *adresses[NB_FICHIERS] = {
        "\\\\fls0\\FOURMIZ\\glob.txt",
        "\\\\fls0\\FOURMIZ\\labo.txt",
        "\\\\fls0\\FOURMIZ\\constru.txt",
        "\\\\fls0\\FOURMIZ\\ouvri.txt",
        "\\\\fls0\\FOURMIZ\\arme.txt",
        "\\\\fls0\\FOURMIZ\\temps.txt",
        "\\\\fls0\\FOURMIZ\\chasse.txt"
    };
    int i, handle;
    
    for(i=0;i<NB_FICHIERS;i++)
    {
        handle = memory_openfile(adresses[i],_OPENMODE_READ);
        memory_readfile(handle,(void *)data[i],datal[i]*sizeof(int),0);
        memory_closefile(handle);
    }
}

void Save()
{
    const char *adresses[NB_FICHIERS] = {
        "\\\\fls0\\FOURMIZ\\glob.txt",
        "\\\\fls0\\FOURMIZ\\labo.txt",
        "\\\\fls0\\FOURMIZ\\constru.txt",
        "\\\\fls0\\FOURMIZ\\ouvri.txt",
        "\\\\fls0\\FOURMIZ\\arme.txt",
        "\\\\fls0\\FOURMIZ\\temps.txt",
        "\\\\fls0\\FOURMIZ\\chasse.txt"
    };
    int i;
    
    for(i=0;i<NB_FICHIERS;i++)
        memory_save(adresses[i],data[i],datal[i]*sizeof(int));
}

void Free()
{
    int i;
    
    data = calloc(NB_FICHIERS,sizeof(int *));
    for(i=0; i<NB_FICHIERS; i++)
        free(data[i]);
    free(data);
}

// FONCTIONS POUR LA GESTION DU TEMPS
void RTC_GetDateTime(unsigned char *time)
{
    volatile TRTC*pRTC;

    switch(GetMPU()){
        case 3 :
        case 4 :
            pRTC = (TRTC*)0xA413FEC0;
            break;
        case 2 :
        case 1 :
        case 5 : // mpu7705 ?
            pRTC = (TRTC*)0xFFFFFEC0;
            break;
        default :
            pRTC = 0;
            break;
    }
    
    if ( pRTC ){
        time[0] = (*pRTC).RYEARCNT >> 8;
        time[1] = (*pRTC).RYEARCNT & 0x00FF;
        time[2] = (*pRTC).RMONCNT;
        time[3] = (*pRTC).RDAYCNT;
        time[4] = (*pRTC).RHOURCNT;
        time[5] = (*pRTC).RMINCNT;
        time[6] = (*pRTC).RSECCNT;
        time[7] = 0;
    } else memset( time, 0, sizeof( time ) );
}

int GetMPU()
{
    int mpu;
    unsigned char s[30];
    unsigned int key;
    unsigned char savevalue;
    mpu = 0;
    savevalue = *(unsigned short*)0xA4000114;
    *(unsigned short*)0xA4000114 = 0xFFFF;
    switch ( *(unsigned short*)0xA4000114 ){
        case 0x0FFF :
            mpu = 1;
            break;
            
        case 0x00FF :
            mpu = 2;
            break;
            
        default :
            switch ( *(unsigned int*)0xFF000030 & 0xFFFFFF00 ){
                case 0x10300B00 :
                    switch ( *(unsigned int*)0xFF000044 & 0xFFFFFFF0 ){
                        case 0x00002C00 :
                            mpu = 3;
                            break;
                        
                        case 0x00002200 :
                            mpu = 4;    // just for reference
                            break;
            };
            break;
        };
        break;
    };        
    *(unsigned short*)0xA4000114 = savevalue;
    
    return mpu;
}

int BCD2int(unsigned char *BCD, int bytes)
{
    int i,n;
    for(i=0,n=0;i<bytes;i++)
    {
        n += (*(BCD+i)&240)>>4;
        n *= 10;
        n += *(BCD+i) & 15;
        if(i != bytes-1) n*=10;
    }
    return n;
}

unsigned long temps_min()
{
    unsigned long temps, i;
    unsigned char time[8]={0};
    unsigned char buf[1];
    
    RTC_GetDateTime(time);
    
    buf[0]=time[5];
    temps = BCD2int(buf, 1);
    buf[0]=time[4];
    temps += BCD2int(buf, 1)*60;
    buf[0]=time[3];
    temps += BCD2int(buf, 1)*1440;
    buf[0]=time[2];
    temps += BCD2int(buf, 1)*43200;
    buf[0]=time[1];
    i=BCD2int(buf, 1);
    buf[0]=time[0];
    temps += (BCD2int(buf, 1)*100+i-1500)*518400;
    
    return temps;
}


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum){return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section

Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 21:18 | #


Qu'est-ce que tu nous fait... la fonction qui libère, elle libère mais elle doit pas allouer !
Et puis, ne l'appelle pas Free(), ça laisse un doute avec free().
void Clean()
{
  int i;
  for(i=0;i<NB_FICHIERS;i++) free(data[i]);
  free(data);
}

Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 21:25 | #


Ha oui petite erreur de copié collé
Ca au moins c'est reglé. Reste a voir pourquoi j'ai des 0 partout dans mes fichiers
Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 22:17 | #


Peut-être parce que les noms doivent être en majuscules, en les extensions en minuscules ?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 23:11 | # | Fichier joint


Ca aurait pu mais non ...
En fait c'est plus a la sauvegarde apparemment.
Le fichier glob.txt est en pj
Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 23:12 | #


Oui, il est vide...
Le fichier existait au début de l'exécution ?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 23:16 | #


Oui j'ai lancé, il me met les infos en page d'accueil. Si je vais dans ressources y'a rien. Après je ferme, je rouvre et y'a que des 0...
Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 09/07/2014 23:19 | #


Ben, l'allocation au début de l'exécution mets toutes les données à 0. Tu as une fonction de nouvelle partie qui s'occupe d'initialiser toutes ces valeurs ?
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Theprog Hors ligne Membre Points: 1447 Défis: 20 Message

Citer : Posté le 09/07/2014 23:22 | #


Ha OK j'ai compris mon erreur
Je sauvegarde la mise a 0. Merci

Ajouté le 13/07/2014 à 16:08 :
Bon voila j'ai un petit soucis.
Il me faut adapter cette expression en JS:
dDiff = (TDC_chasse + (TDC_base + TDC_chasse) * 0.01) * (Math.pow(1.04, Math.round(Math.log((TDC_base + TDC_chasse) / 50) / Math.log(Math.pow(10, 0.1))))) * 3;

En C sachant que TDC_chasse et TDC_base sont des nombres assez grands (ça peut aller dans les milliards).
Voila, ma proposition qui ne marche pas:
dDiff = (x + (y + x) * 0.01) * (pow(1.04, (int)(log((y + x) / 50) / log(pow(10, 0.1)))+0.5 )) * 3;

Celle de cartix que je ne peux pas tester vu que je suis pas sur mon PC:
dDiff = (x+(y+x)*.01)*(pow(1.04, (int)((log((y + x))- 3.91202300543)*43.4294481903))+1.0198039027)*3;

Lephenixnoir En ligne Administrateur Points: 24572 Défis: 170 Message

Citer : Posté le 13/07/2014 16:12 | #


Je crois que ton +0.5 n'est pas où il faut.
[red][b]([/b][/red]int[red][b])[/b][/red][red][b]([/b][/red]log[blue][b]([/b][/blue][green][b]([/b][/green]y + x[green][b])[/b][/green] / 50[blue][b])[/b][/blue] / log[blue][b]([/b][/blue]pow[green][b]([/b][/green]10, 0.1[green][b])[/b][/green][blue][b])[/b][/blue][red][b])[/b][/red]+0.5

Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Cartix Hors ligne Membre Points: 2748 Défis: 98 Message

Citer : Posté le 13/07/2014 16:15 | #


Math.log est bien le népérien ?
Et le (int) ne convient pas puisqu'il te faut un round et pas un floor
Précédente 1, 2, 3 ··· 10, 11, 12, 13, 14, 15, 16 ··· 20, 21, 22, 23 Suivante

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 219 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd