Help in creating a RTW economicalManagerSimulator .

[b][red]This message was edited by imakaia at 2006-3-3 3:50:49[/red][/b][hr]
I'm going to post this instead of little topics asking for help.

I'm creating in C++ a a program whixh wil be a simulator of the game ROME TOTAL WAR. Just the campaign-economical par. There will be no armies and no AI or other provonces. And it will be just in code with no graphics.

THis is the programm.
This is the programm I created so far. There is a function where economical values are set(ERM). A function which aks you what do you want (passing is its name) to do, mean if you want to end the turn or uild something and shows you your income-expenses etc.
And there is a function that ends the turn. Previously there was a function for a builiding called comunnal farming but the problem was that when the programm was addinf the annual income from the building just once mean the year it was constructed. This is waht i'm trying to fix now by setting a value curntMoney in the ebd_turn function and not to the economical manager function where all the others are. This will be ecual with(CurntMoney=(Incm-Expns)+CurntMone) and it will be transported with a pointer to the ERM function where it will be equalized with another which wiill be took by the passing function to be showed to you each time. So at each end of turn the value is going to change

The fact is that despite the debugger says 0 errors 0 warnings when i press run it appears the microsoft probrm report saying that the application has problem.When i press show problem it points to the blue line. This happened after i created that pointer( red color)


[CODE]
#include





class management
{
public:

[GREEN]//ECONOMICAL REMINDER MANAGERS[/GREEN]

long int ERM[RED](long int &pCD)[/RED]
{
long int FIncm=100, TrdIncm=0, TaxIncm=0, CnExpn=0, ARExpn=0, AUExpn=0, [RED]CurntMoney;[/RED]
long int Incm, Expns, denarli, turn=100;

[BLUE]CurntMoney=pCD;[/BLUE]
Incm=FIncm + TaxIncm + TrdIncm;
Expns= CnExpn + ARExpn + AUExpn;
denarli=(Incm-Expns)+CurntMoney;


passing(FIncm,TrdIncm,TaxIncm,CnExpn,ARExpn,AUExpn,Incm,Expns,denarli,turn,CurntMoney);
return 0;

}

[GREEN]//END OF ECONOMICAL REMINDER MANAGERS[/GREEN]


long int passing(long int &FIncm,long int &TrdIncm,long int &TaxIncm,long int &CnExpn,long int &ARExpn,long int &AUExpn,long int &Incm,long int &Expns,long int &denarli, long int &turn, long int &CurntMoney)
{
#include

short int choice;
cout <<"

year"<<turn<<"a.c.

";
cout <<denarli<<"denarli";
cout <<"

Curent: "<<CurntMoney;
cout <<" curent income: "<< Incm <<" expenses: "<< Expns;
cout <<" FarmingIncome: "<<FIncm<<"

";
cout <<"press 1 for end of turn, 2 to build farm";
cin >> choice;
switch (choice)
{
case 1:
cout<<"Turn end";
end_turn (Incm,CurntMoney,Expns,turn);
break;

// case 2: cout<<"farm requires 2 turns to be build. Once build, it will add +200 to your income!";
// building_farm ();
// end_turn (Incm,Expns,CurntDenarli,turn);


}



passing(FIncm,TrdIncm,TaxIncm,CnExpn,ARExpn,AUExpn,Incm,Expns,denarli,turn,CurntMoney);
return 0;
}


private:
[GREEN]
// BUILDINGS'S FUNCTIONS
// END OF BUILDINGS'S FUNCTIONS[/GREEN]




long int end_turn (long int &Incm,long int &Expns,long int ,long int &turn)
{
#include<iostream.h>
[RED] long int CurntMoney=20000;[/RED]
[RED] long int* pCD=&CurntMoney;[/RED]
turn=turn++;
CurntMoney=(Incm-Expns)+CurntMone;
return turn;
return CurntMoney;

}


};

[RED]long int main(long int &pCD)[/RED]
{

management economy;
cout <<"
Hi, from the main

";
economy.ERM(pCD);

cout <<"
Hi form the main

";
return 0;
}
[/CODE]


Comments

  • Some one small comment:

    [code]
    : long int main(long int &pCD)
    [/code]

    Should be
    [code]
    //Option #1
    int main(int argc, char* argv[])
    //Option #2
    int main()
    [/code]

    See e.g. www.codepedia.com/1/CppMain

    Good luck with the rest,

    bilderbikkel

  • : Some one small comment:
    :
    : [code]
    : : long int main(long int &pCD)
    : [/code]
    :
    : Should be
    : [code]
    : //Option #1
    : int main(int argc, char* argv[])
    : //Option #2
    : int main()
    : [/code]
    :
    : See e.g. www.codepedia.com/1/CppMain
    :
    : Good luck with the rest,
    :
    : bilderbikkel
    :
    :

    but the value is a long int. Cant the main be a long int?

  • : : Some one small comment:
    : :
    : : [code]
    : : : long int main(long int &pCD)
    : : [/code]
    : :
    : : Should be
    : : [code]
    : : //Option #1
    : : int main(int argc, char* argv[])
    : : //Option #2
    : : int main()
    : : [/code]
    : :
    : : See e.g. www.codepedia.com/1/CppMain
    : :
    : : Good luck with the rest,
    : :
    : : bilderbikkel
    : :
    : :
    :
    : but the value is a long int. Cant the main be a long int?

    No. See the link. You should define 'pCD' IN main:

    [code]
    int main(int argc, char* argv[])
    {
    long int pCD = 0;
    //Rest of code
    }
    [/code]

    Good luck,
    bilderbikkel

  • Your sugestion does not work! By declarating the value into the main when you pass it as a reference into the ERM it is token from the main and not from the end_turn it must be took from the end_turn!

    I think i have to put the anctions of the end_turn into the ERM what do you think?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories