[Change] Change data type to unsigned int for prices rather than signed

int.
This commit is contained in:
Allanis 2014-03-10 14:59:09 +00:00
parent 30e89fe1c8
commit d71dadfa05
5 changed files with 14 additions and 14 deletions

View File

@ -119,7 +119,7 @@ int comm_open(unsigned int pilot) {
static void comm_bribe(unsigned int wid, char* unused) { static void comm_bribe(unsigned int wid, char* unused) {
(void)unused; (void)unused;
int answer; int answer;
int price; unsigned int price;
char* str; char* str;
lua_State* L; lua_State* L;

View File

@ -3,7 +3,7 @@
typedef struct Commodity_ { typedef struct Commodity_ {
char* name; char* name;
char* description; char* description;
int low, medium, high; /* Prices. */ unsigned int low, medium, high; /* Prices. */
} Commodity; } Commodity;
/* Commidity stuff. */ /* Commidity stuff. */

View File

@ -97,7 +97,7 @@ static void shipyard_yoursUpdate(unsigned int wid, char* str);
static void shipyard_yoursChange(unsigned int wid, char* str); static void shipyard_yoursChange(unsigned int wid, char* str);
static void shipyard_yoursSell(unsigned int wid, char* str); static void shipyard_yoursSell(unsigned int wid, char* str);
static void shipyard_yoursTransport(unsigned int wid, char* str); static void shipyard_yoursTransport(unsigned int wid, char* str);
static int shipyard_yoursTransportPrice(char* shipname); static unsigned int shipyard_yoursTransportPrice(char* shipname);
/* Spaceport bar. */ /* Spaceport bar. */
static void spaceport_bar_open(void); static void spaceport_bar_open(void);
/* News. */ /* News. */
@ -108,7 +108,7 @@ static void misn_accept(unsigned int wid, char* str);
static void misn_genList(unsigned int wid, int first); static void misn_genList(unsigned int wid, int first);
static void misn_update(unsigned int wid, char* str); static void misn_update(unsigned int wid, char* str);
/* Refuel. */ /* Refuel. */
static int refuel_price(void); static unsigned int refuel_price(void);
static void spaceport_refuel(unsigned int wid, char* str); static void spaceport_refuel(unsigned int wid, char* str);
/* The local market. */ /* The local market. */
@ -415,7 +415,7 @@ static int outfit_canBuy(Outfit* outfit, int q, int errmsg) {
return 0; return 0;
} }
/* Not enough $$. */ /* Not enough $$. */
else if(q*(int)outfit->price >= player->credits) { else if(q*outfit->price >= player->credits) {
if(errmsg != 0) { if(errmsg != 0) {
credits2str(buf, q*outfit->price - player->credits, 2); credits2str(buf, q*outfit->price - player->credits, 2);
dialogue_alert("You need %s more SCred.", buf); dialogue_alert("You need %s more SCred.", buf);
@ -776,7 +776,7 @@ static void shipyard_yoursUpdate(unsigned int wid, char* str) {
char* shipname; char* shipname;
Pilot* ship; Pilot* ship;
char* loc; char* loc;
int price; unsigned int price;
shipname = toolkit_getList(wid, "lstYourShips"); shipname = toolkit_getList(wid, "lstYourShips");
if(strcmp(shipname, "None")==0) { if(strcmp(shipname, "None")==0) {
@ -904,7 +904,7 @@ static void shipyard_yoursSell(unsigned int wid, char* str) {
static void shipyard_yoursTransport(unsigned int wid, char* str) { static void shipyard_yoursTransport(unsigned int wid, char* str) {
(void)str; (void)str;
int price; unsigned int price;
char* shipname, buf[16]; char* shipname, buf[16];
shipname = toolkit_getList(wid, "lstYourShips"); shipname = toolkit_getList(wid, "lstYourShips");
@ -935,7 +935,7 @@ static void shipyard_yoursTransport(unsigned int wid, char* str) {
shipyard_yoursUpdate(wid, NULL); shipyard_yoursUpdate(wid, NULL);
} }
static int shipyard_yoursTransportPrice(char* shipname) { static unsigned int shipyard_yoursTransportPrice(char* shipname) {
char* loc; char* loc;
Pilot* ship; Pilot* ship;
int price; int price;
@ -1100,8 +1100,8 @@ static void misn_update(unsigned int wid, char* str) {
} }
/* Return how much it will cost to refuel the player. */ /* Return how much it will cost to refuel the player. */
static int refuel_price(void) { static unsigned int refuel_price(void) {
return (player->fuel_max - player->fuel)*3; return (unsigned int)((player->fuel_max - player->fuel)*3);
} }
/* Refuel the player. */ /* Refuel the player. */

View File

@ -153,7 +153,7 @@ typedef struct Pilot_ {
double jam_chance; /**< Jam chance. */ double jam_chance; /**< Jam chance. */
/* Cargo. */ /* Cargo. */
int credits; /**< Moniez the pilot has. */ unsigned int credits; /**< Moniez the pilot has. */
PilotCommodity* commodities; /**< Commodity and quantity. */ PilotCommodity* commodities; /**< Commodity and quantity. */
int ncommodities; /**< Number of commodies. */ int ncommodities; /**< Number of commodies. */
int cargo_free; /**< Free commodity space. */ int cargo_free; /**< Free commodity space. */

View File

@ -52,10 +52,10 @@ typedef struct Ship_ {
ShipClass class; /* Ship class. */ ShipClass class; /* Ship class. */
/* Store stuff. */ /* Store stuff. */
int price; /* Price! */ unsigned int price; /* Price! */
int tech; int tech;
char* fabricator; /* Manufacturer. */ char* fabricator; /* Manufacturer. */
char* description; /* Sales pitch. */ char* description; /* Sales pitch. */
/* Movement. */ /* Movement. */
double thrust, turn, speed; double thrust, turn, speed;