22 Wrapper::Wrapper(
void (*userErrorFnc)(std::string),
void (*progErrorFnc)(std::string) )
24 vprogErrorFnc = progErrorFnc;
25 vuserErrorFnc = userErrorFnc;
27 tradegoods[0].
name =
"Food";
28 tradegoods[1].
name =
"Textiles";
29 tradegoods[2].
name =
"Radioactives";
30 tradegoods[5].
name =
"Luxuries";
31 tradegoods[7].
name =
"Computers";
32 tradegoods[8].
name =
"Machinery";
33 tradegoods[9].
name =
"Alloys";
34 tradegoods[10].
name =
"Firearms";
35 tradegoods[11].
name =
"Furs";
36 tradegoods[12].
name =
"Minerals";
37 tradegoods[13].
name =
"Gold";
38 tradegoods[14].
name =
"Platinum";
39 tradegoods[15].
name =
"Gem-Stones";
40 tradegoods[16].
name =
"Alien Items";
41 #if POLITICALLY_CORRECT
42 tradegoods[3].
name =
"Robot Slaves";
43 tradegoods[4].
name =
"Beverages";
44 tradegoods[6].
name =
"Rare Species";
46 tradegoods[3].
name =
"Slaves";
47 tradegoods[4].
name =
"Liquor/Wines";
48 tradegoods[6].
name =
"Narcotics";
51 for (
int i = 0; i < numberOfTradegoods; i++)
53 tradegoods[i].
unit =
"t";
55 tradegoods[13].
unit =
"kg";
56 tradegoods[14].
unit =
"kg";
57 tradegoods[15].
unit =
"g";
179 return numberOfTradegoods;
192 std::vector<Tradegood> * list =
new std::vector<Tradegood>;
193 for (
int i = 0; i < numberOfTradegoods; i++) {
194 list->push_back(tradegoods[i]);
211 if (number < 0 || number >= numberOfTradegoods)
212 vprogErrorFnc(
"Error! 'number' not in range!");
214 result = tradegoods[number];
283 return (
float)(fvalue/10);
316 vprogErrorFnc(
"'amount' must not be less than 0! Error occured in getFuelAmount() in Wrapper.cpp");
355 vprogErrorFnc(
"Error! 'amount' is not allowed to be less than 0. Error occured in Wrapper.cpp in the function performPurchase(int number);");
358 vprogErrorFnc(
"Error! 'number' is not allowed to be less than 0. Error occured in Wrapper.cpp in the function performPurchase(int number);");
362 size_t i = report.size()-1;
363 while (i >= 0 && report[i] ==
' ')
365 report.replace(i,1,
"");
388 vprogErrorFnc(
"Error! 'amount' is not allowed to be less than 0. Error occured in Wrapper.cpp in the function performPurchase(int number);");
391 vprogErrorFnc(
"Error! 'number' is not allowed to be less than 0. Error occured in Wrapper.cpp in the function performPurchase(int number);");
395 size_t i = report.size()-1;
396 while (i >= 0 && report[i] ==
' ')
398 report.replace(i,1,
"");
418 if (amount < -100000 || amount > 100000){
419 vprogErrorFnc(
"'amount' has to be between -100000 and 100000. Error occured in setCash(float amount) in Wrapper.cpp");
422 float f = amount * 10;
423 signed long i = (
signed long) f;
433 if (amount < 0 || amount > 7.0){
434 vprogErrorFnc(
"'amount' has to be between 0 and 7. Error occured in setFuel(float amount) in Wrapper.cpp");
437 float f = amount * 10;
438 signed long i = (
signed long) f;
457 if (amount < 0 || amount > 7.0){
458 vprogErrorFnc(
"'amount' has to be between 0 and 7. Error occured in adFuel(float amount) in Wrapper.cpp");
463 vprogErrorFnc(
"'amount' does not fit into the tank and was reduced (in addFuel in Wrapper.cpp)");