naev 0.12.5
land_trade.c
Go to the documentation of this file.
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
10#include <stdio.h>
11#include <stdlib.h>
12
13#include "naev.h"
15
16#include "land_trade.h"
17
18#include "array.h"
19#include "commodity.h"
20#include "economy.h"
21#include "hook.h"
22#include "land.h"
23#include "nstring.h"
24#include "player.h"
25#include "player_fleet.h"
26#include "space.h"
27#include "toolkit.h"
28
29/*
30 * Quantity to buy on one click
31 */
32static int commodity_mod =
33 10;
34static Commodity **commodity_list = NULL;
35
36/* Prototypes. */
37static void commodity_exchange_genList( unsigned int wid );
38
39static void commodity_exchange_modifiers( unsigned int wid )
40{
41 int q = commodity_getMod();
42 if ( q != commodity_mod ) {
43 char buf[STRMAX_SHORT];
44 commodity_mod = q;
45 snprintf( buf, sizeof( buf ), _( "Buy (%d %s)" ), q, UNIT_MASS );
46 window_buttonCaption( wid, "btnCommodityBuy", buf );
47 snprintf( buf, sizeof( buf ), _( "Sell (%d %s)" ), q, UNIT_MASS );
48 window_buttonCaption( wid, "btnCommoditySell", buf );
50 }
51}
52
53static int commodity_exchange_events( unsigned int wid, SDL_Event *evt )
54{
55 if ( ( evt->type == SDL_KEYDOWN ) || ( evt->type == SDL_KEYUP ) )
56 commodity_exchange_modifiers( wid );
57 return 0;
58}
59
63void commodity_exchange_open( unsigned int wid )
64{
65 int w, h, iw, dw, bw, titleHeight, infoHeight;
66 char buf[STRMAX_SHORT];
67 size_t l = 0;
68 int q = commodity_getMod();
69
70 /* Mark as generated. */
71 land_tabGenerate( LAND_WINDOW_COMMODITY );
72
73 /* Get window dimensions. */
74 window_dimWindow( wid, &w, &h );
75
76 /* Calculate image array dimensions. */
77 /* Window size minus right column size minus space on left and right */
78 iw = 565 + ( w - LAND_WIDTH );
79 dw = w - iw - 60;
80
81 /* buttons */
82 bw = MIN( LAND_BUTTON_WIDTH, ( dw - 40 ) / 3 );
83 snprintf( buf, sizeof( buf ), _( "Buy (%d %s)" ), q, UNIT_MASS );
84 window_addButtonKey( wid, 40 + iw, 20, bw, LAND_BUTTON_HEIGHT,
85 "btnCommodityBuy", buf, commodity_buy, SDLK_b );
86 snprintf( buf, sizeof( buf ), _( "Sell (%d %s)" ), q, UNIT_MASS );
87 window_addButtonKey( wid, 60 + iw + bw, 20, bw, LAND_BUTTON_HEIGHT,
88 "btnCommoditySell", buf, commodity_sell, SDLK_s );
89 window_addButtonKey( wid, 80 + iw + 2 * bw, 20, bw, LAND_BUTTON_HEIGHT,
90 "btnCommodityClose", _( "Take Off" ),
91 land_buttonTakeoff, SDLK_t );
92
93 /* handle multipliers. */
94 window_handleEvents( wid, commodity_exchange_events );
95 window_setOnFocus( wid, commodity_exchange_modifiers );
96
97 /* store gfx */
98 window_addRect( wid, -20, -40, 192, 192, "rctStore", &cBlack, 0 );
99 window_addImage( wid, -20, -40, 192, 192, "imgStore", NULL, 1 );
100
101 /* text */
102 titleHeight =
103 gl_printHeightRaw( &gl_defFont, LAND_BUTTON_WIDTH + 80, _( "None" ) );
104 window_addText( wid, 40 + iw, -40, dw, titleHeight, 0, "txtName",
105 &gl_defFont, NULL, _( "None" ) );
106
107 l += scnprintf( &buf[l], sizeof( buf ) - l, "%s",
108 ( player.fleet_capacity > 0 ) ? _( "Your fleet has:" )
109 : _( "You have:" ) );
110 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s",
111 ( player.fleet_capacity > 0 ) ? _( "Free Space (fleet):" )
112 : _( "Free Space:" ) );
113 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", _( "Money:" ) );
114 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", _( "Market Price:" ) );
115 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s",
116 _( "Average price here:" ) );
117 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s",
118 _( "Average galactic price:" ) );
119 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", _( "Purchased for:" ) );
120 infoHeight = gl_printHeightRaw( &gl_smallFont, LAND_BUTTON_WIDTH + 80, buf );
121 window_addText( wid, 40 + iw, -60 - titleHeight, 200, infoHeight, 0,
122 "txtSInfo", &gl_smallFont, &cFontGrey, buf );
123 window_addText( wid, 40 + iw + 224, -60 - titleHeight,
124 dw - ( 200 + 20 + 192 ), infoHeight, 0, "txtDInfo",
125 &gl_smallFont, NULL, NULL );
126
127 window_addText( wid, 40 + iw, -80 - titleHeight - infoHeight, dw, 100, 0,
128 "txtDRef", &gl_smallFont, NULL, NULL );
129 window_addText(
130 wid, 40 + iw, MIN( -80 - titleHeight - infoHeight, -192 - 60 ), dw,
131 h - ( 80 + titleHeight + infoHeight ) - ( 40 + LAND_BUTTON_HEIGHT ), 0,
132 "txtDesc", &gl_smallFont, NULL, NULL );
133
134 /* Generate list. */
135 commodity_exchange_genList( wid );
136
137 /* Set default keyboard focuse to the list */
138 window_setFocus( wid, "iarTrade" );
139}
140
141static void commodity_exchange_genList( unsigned int wid )
142{
143 iar_data_t idat;
144 int exists = widget_exists( wid, "iarTrade" );
145 ImageArrayCell *cgoods;
146 int w, h, iw, ih, j, iconsize;
147
148 /* Get window dimensions. */
149 window_dimWindow( wid, &w, &h );
150
151 /* Calculate image array dimensions. */
152 /* Window size minus right column size minus space on left and right */
153 iw = 565 + ( w - LAND_WIDTH );
154 ih = h - 60;
155
156 /* goods list */
157 int ngoods = array_size( land_spob->commodities );
158
159 if ( exists ) {
160 toolkit_saveImageArrayData( wid, "iarTrade", &idat );
161 window_destroyWidget( wid, "iarTrade" );
162 }
163
164 /* Count always sellable goods. */
166 for ( int i = 0; i < array_size( pclist ); i++ ) {
167 PilotCommodity *pc = &pclist[i];
168 if ( pc->id > 0 ) /* Ignore mission stuff. */
169 continue;
170 if ( !commodity_isFlag( pc->commodity, COMMODITY_FLAG_ALWAYS_CAN_SELL ) )
171 continue;
172 ngoods++;
173 }
174 if ( ngoods > 0 ) {
175 cgoods = calloc( ngoods, sizeof( ImageArrayCell ) );
176 if ( commodity_list != NULL )
177 free( commodity_list );
178 commodity_list = malloc( ngoods * sizeof( Commodity * ) );
179 j = 0;
180
181 /* First add special sellable. */
182 for ( int i = 0; i < array_size( pclist ); i++ ) {
183 PilotCommodity *pc = &pclist[i];
184 if ( pc->id > 0 ) /* Ignore mission stuff. */
185 continue;
186 if ( !commodity_isFlag( pc->commodity,
187 COMMODITY_FLAG_ALWAYS_CAN_SELL ) )
188 continue;
189 cgoods[j].image = gl_dupTexture( pc->commodity->gfx_store );
190 cgoods[j].caption = strdup( _( pc->commodity->name ) );
191 commodity_list[j] = (Commodity *)pc->commodity;
192 j++;
193 }
194
195 /* Then add default. */
196 for ( int i = 0; i < array_size( land_spob->commodities ); i++ ) {
197 const Commodity *com = land_spob->commodities[i];
198 ;
199 cgoods[j].image = gl_dupTexture( com->gfx_store );
200 cgoods[j].caption = strdup( _( com->name ) );
201 cgoods[j].quantity = pfleet_cargoOwned( com );
202 commodity_list[j] = land_spob->commodities[i];
203 j++;
204 }
205 } else {
206 ngoods = 1;
207 cgoods = calloc( ngoods, sizeof( ImageArrayCell ) );
208 cgoods[0].image = NULL;
209 cgoods[0].caption = strdup( _( "None" ) );
210 }
211 array_free( pclist );
212
213 /* set up the goods to buy/sell */
214 iconsize = 128;
215 if ( !conf.big_icons ) {
216 if ( toolkit_simImageArrayVisibleElements( iw, ih, iconsize, iconsize ) <
217 ngoods )
218 iconsize = 96;
219 if ( toolkit_simImageArrayVisibleElements( iw, ih, iconsize, iconsize ) <
220 ngoods )
221 iconsize = 64;
222 }
223 window_addImageArray( wid, 20, 20, iw, ih, "iarTrade", iconsize, iconsize,
224 cgoods, ngoods, commodity_update, commodity_update,
226
227 if ( exists )
228 toolkit_loadImageArrayData( wid, "iarTrade", &idat );
229}
230
231void commodity_exchange_cleanup( void )
232{
233 free( commodity_list );
234 commodity_list = NULL;
235}
236
242void commodity_update( unsigned int wid, const char *str )
243{
244 (void)str;
245 char buf[STRMAX];
246 char buf_purchase_price[ECON_CRED_STRLEN], buf_credits[ECON_CRED_STRLEN];
247 size_t l = 0;
248 const Commodity *com;
249 credits_t mean, globalmean;
250 double std, globalstd;
251 char buf_mean[ECON_CRED_STRLEN], buf_globalmean[ECON_CRED_STRLEN];
252 char buf_std[ECON_CRED_STRLEN], buf_globalstd[ECON_CRED_STRLEN];
253 char buf_local_price[ECON_CRED_STRLEN];
254 char buf_tonnes_owned[ECON_MASS_STRLEN], buf_tonnes_free[ECON_MASS_STRLEN];
255 int owned, cargo_free;
256 int i = toolkit_getImageArrayPos( wid, "iarTrade" );
257 credits2str( buf_credits, player.p->credits, 2 );
258 cargo_free = pfleet_cargoFree();
259 tonnes2str( buf_tonnes_free, cargo_free );
260
261 if ( i < 0 || array_size( land_spob->commodities ) == 0 ) {
262 l += scnprintf( &buf[l], sizeof( buf ) - l, "%s", _( "N/A" ) );
263 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", buf_tonnes_free );
264 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", buf_credits );
265 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", "" );
266 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", _( "N/A" ) );
267 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", _( "N/A" ) );
268 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", _( "N/A" ) );
269 window_modifyText( wid, "txtDInfo", buf );
270 window_modifyText( wid, "txtDesc", _( "No commodities available." ) );
271 window_disableButton( wid, "btnCommodityBuy" );
272 window_disableButton( wid, "btnCommoditySell" );
273 return;
274 }
275 com = commodity_list[i];
276
277 /* modify image */
278 window_modifyImage( wid, "imgStore", com->gfx_store, 192, 192 );
279
280 spob_averageSpobPrice( land_spob, com, &mean, &std );
281 credits2str( buf_mean, mean, -1 );
282 snprintf( buf_std, sizeof( buf_std ), _( "%.1f ¤" ),
283 std ); /* TODO credit2str could learn to do this... */
284 economy_getAveragePrice( com, &globalmean, &globalstd );
285 credits2str( buf_globalmean, globalmean, -1 );
286 snprintf( buf_globalstd, sizeof( buf_globalstd ), _( "%.1f ¤" ),
287 globalstd ); /* TODO credit2str could learn to do this... */
288 /* modify text */
289 buf_purchase_price[0] = '\0';
290 owned = pfleet_cargoOwned( com );
291 if ( owned > 0 )
292 credits2str( buf_purchase_price, com->lastPurchasePrice, -1 );
293 credits2str( buf_local_price, spob_commodityPrice( land_spob, com ), -1 );
294 tonnes2str( buf_tonnes_owned, owned );
295 l += scnprintf( &buf[l], sizeof( buf ) - l, "%s", buf_tonnes_owned );
296 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", buf_tonnes_free );
297 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", buf_credits );
298 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n" );
299 l += scnprintf( &buf[l], sizeof( buf ) - l, _( "%s/t" ), buf_local_price );
300 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n" );
301 l += scnprintf( &buf[l], sizeof( buf ) - l, _( "%s/t ± %s/t" ), buf_mean,
302 buf_std );
303 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n" );
304 l += scnprintf( &buf[l], sizeof( buf ) - l, _( "%s/t ± %s/t" ),
305 buf_globalmean, buf_globalstd );
306 l += scnprintf( &buf[l], sizeof( buf ) - l, "\n%s", buf_purchase_price );
307
308 window_modifyText( wid, "txtDInfo", buf );
309 window_modifyText( wid, "txtName", _( com->name ) );
310 window_modifyText( wid, "txtDesc", _( com->description ) );
311
312 /* Add relative price. */
313 l = 0;
314 if ( commodity_isFlag( com, COMMODITY_FLAG_PRICE_CONSTANT ) ) {
315 l += scnprintf( &buf[l], sizeof( buf ) - l, _( "Price is constant." ) );
316 window_modifyText( wid, "txtDRef", buf );
317 } else if ( com->price_ref != NULL ) {
318 char c = '0';
319 if ( com->price_mod > 1. )
320 c = 'g';
321 else if ( com->price_mod < 1. )
322 c = 'r';
323 l += scnprintf(
324 &buf[l], sizeof( buf ) - l,
325 _( "Price is based on #%c%.0f%%#0 of the price of #o%s#0." ), c,
326 com->price_mod * 100., _( com->price_ref ) );
327 window_modifyText( wid, "txtDRef", buf );
328 } else
329 window_modifyText( wid, "txtDRef", NULL );
330
331 /* Button enabling/disabling */
332 if ( commodity_canBuy( com ) )
333 window_enableButton( wid, "btnCommodityBuy" );
334 else
335 window_disableButtonSoft( wid, "btnCommodityBuy" );
336
337 if ( commodity_canSell( com ) )
338 window_enableButton( wid, "btnCommoditySell" );
339 else
340 window_disableButtonSoft( wid, "btnCommoditySell" );
341}
342
347{
348 int failure, incommodities;
349 unsigned int q, price;
350 char buf[ECON_CRED_STRLEN];
351
353 failure = 0;
354 q = commodity_getMod();
355 price = spob_commodityPrice( land_spob, com ) * q;
356
357 if ( !player_hasCredits( price ) ) {
358 credits2str( buf, price - player.p->credits, 2 );
359 land_errDialogueBuild( _( "You need %s more." ), buf );
360 failure = 1;
361 }
362 if ( pfleet_cargoFree() <= 0 ) {
363 land_errDialogueBuild( _( "No cargo space available!" ) );
364 failure = 1;
365 }
366
367 incommodities = 0;
368 for ( int i = 0; i < array_size( land_spob->commodities ); i++ ) {
369 if ( land_spob->commodities[i] == com ) {
370 incommodities = 1;
371 break;
372 }
373 }
374 if ( !incommodities ) {
375 land_errDialogueBuild( _( "%s is not sold here!" ), _( com->name ) );
376 failure = 1;
377 }
378
379 return !failure;
380}
381
386{
387 int failure = 0;
389 if ( pfleet_cargoOwned( com ) == 0 ) {
390 land_errDialogueBuild( _( "You can't sell something you don't have!" ) );
391 failure = 1;
392 }
393 return !failure;
394}
395
401void commodity_buy( unsigned int wid, const char *str )
402{
403 (void)str;
404 int i;
405 Commodity *com;
406 unsigned int q;
407 credits_t price;
408 HookParam hparam[3];
409
410 /* Get selected. */
411 q = commodity_getMod();
412 i = toolkit_getImageArrayPos( wid, "iarTrade" );
413 com = commodity_list[i];
414 price = spob_commodityPrice( land_spob, com );
415
416 /* Check stuff. */
417 if ( !commodity_canBuy( com ) ) {
419 return;
420 }
421
422 /* Make the buy. */
423 q = pfleet_cargoAdd( com, q );
424 com->lastPurchasePrice =
425 price; /* To show the player how much they paid for it */
426 price *= q;
427 player_modCredits( -price );
428 commodity_update( wid, NULL );
429 commodity_exchange_genList( wid );
430
431 /* Run hooks. */
432 hparam[0].type = HOOK_PARAM_COMMODITY;
433 hparam[0].u.commodity = com;
434 hparam[1].type = HOOK_PARAM_NUMBER;
435 hparam[1].u.num = q;
436 hparam[2].type = HOOK_PARAM_SENTINEL;
437 hooks_runParam( "comm_buy", hparam );
438 land_needsTakeoff( 1 );
439}
440
446void commodity_sell( unsigned int wid, const char *str )
447{
448 (void)str;
449 int i;
450 Commodity *com;
451 unsigned int q;
452 credits_t price;
453 HookParam hparam[3];
454
455 /* Get parameters. */
456 q = commodity_getMod();
457 i = toolkit_getImageArrayPos( wid, "iarTrade" );
458 com = commodity_list[i];
459 price = spob_commodityPrice( land_spob, com );
460
461 /* Check stuff. */
462 if ( !commodity_canSell( com ) ) {
464 return;
465 }
466
467 /* Remove commodity. */
468 q = pfleet_cargoRm( com, q, 0 );
469 price = price * (credits_t)q;
470 player_modCredits( price );
471 if ( pfleet_cargoOwned( com ) == 0 ) /* None left, set purchase price to
472 zero, in case missions add cargo. */
473 com->lastPurchasePrice = 0;
474 commodity_update( wid, NULL );
475 commodity_exchange_genList( wid );
476
477 /* Run hooks. */
478 hparam[0].type = HOOK_PARAM_COMMODITY;
479 hparam[0].u.commodity = com;
480 hparam[1].type = HOOK_PARAM_NUMBER;
481 hparam[1].u.num = q;
482 hparam[2].type = HOOK_PARAM_SENTINEL;
483 hooks_runParam( "comm_sell", hparam );
484 land_needsTakeoff( 1 );
485}
486
492{
493 SDL_Keymod mods = SDL_GetModState();
494 int q = 10;
495 if ( mods & ( KMOD_LCTRL | KMOD_RCTRL ) )
496 q *= 5;
497 if ( mods & ( KMOD_LSHIFT | KMOD_RSHIFT ) )
498 q *= 10;
499 if ( mods & ( KMOD_LALT | KMOD_RALT ) )
500 q = 1;
501
502 return q;
503}
504
513void commodity_renderMod( double bx, double by, double w, double h, void *data )
514{
515 (void)data;
516 (void)h;
517 int q;
518 char buf[8];
519
520 q = commodity_getMod();
521 if ( q != commodity_mod ) {
522 // commodity_update( land_getWid(LAND_WINDOW_COMMODITY), NULL );
523 commodity_mod = q;
524 }
525 snprintf( buf, sizeof( buf ), "%dx", q );
526 gl_printMidRaw( &gl_smallFont, w, bx, by, &cFontWhite, -1, buf );
527}
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
Definition array.h:170
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
Definition array.h:179
void credits2str(char *str, credits_t credits, int decimals)
Converts credits to a usable string for displaying.
Definition commodity.c:75
void tonnes2str(char *str, int tonnes)
Converts tonnes to a usable string for displaying.
Definition commodity.c:131
int economy_getAveragePrice(const Commodity *com, credits_t *mean, double *std)
Gets the average price of a good as seen by the player (anywhere).
Definition economy.c:248
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
Definition font.c:1050
glFont gl_smallFont
Definition font.c:159
glFont gl_defFont
Definition font.c:158
int gl_printMidRaw(const glFont *ft_font, int width, double x, double y, const glColour *c, double outlineR, const char *text)
Displays text centered in position and width.
Definition font.c:821
int hooks_runParam(const char *stack, const HookParam *param)
Runs all the hooks of stack.
Definition hook.c:1029
void land_errDialogueBuild(const char *fmt,...)
Generates error dialogues used by several landing tabs.
Definition land.c:226
Spob * land_spob
Definition land.c:87
void land_errClear(void)
Clear error dialogues.
Definition land.c:217
void land_buttonTakeoff(unsigned int wid, const char *unused)
Wrapper for takeoff mission button.
Definition land.c:1124
int land_errDisplay(void)
Displays an error if applicable.
Definition land.c:248
int commodity_canBuy(const Commodity *com)
Checks to see if the player can buy a commodity.
Definition land_trade.c:346
int commodity_getMod(void)
Gets the current modifier status.
Definition land_trade.c:491
void commodity_exchange_open(unsigned int wid)
Opens the local market window.
Definition land_trade.c:63
void commodity_sell(unsigned int wid, const char *str)
Attempts to sell a commodity.
Definition land_trade.c:446
void commodity_renderMod(double bx, double by, double w, double h, void *data)
Renders the commodity buying modifier.
Definition land_trade.c:513
void commodity_buy(unsigned int wid, const char *str)
Buys the selected commodity.
Definition land_trade.c:401
int commodity_canSell(const Commodity *com)
Checks to see if a player can sell a commodity.
Definition land_trade.c:385
void commodity_update(unsigned int wid, const char *str)
Updates the commodity window.
Definition land_trade.c:242
static int commodity_mod
Definition land_trade.c:32
Header file with generic functions and naev-specifics.
#define MIN(x, y)
Definition naev.h:39
int scnprintf(char *text, size_t maxlen, const char *fmt,...)
Like snprintf(), but returns the number of characters ACTUALLY "printed" into the buffer....
Definition nstring.c:102
glTexture * gl_dupTexture(const glTexture *texture)
Duplicates a texture.
Definition opengl_tex.c:891
credits_t player_modCredits(credits_t amount)
Modifies the amount of credits the player has.
Definition player.c:1047
Player_t player
Definition player.c:77
int player_hasCredits(credits_t amount)
Checks to see if the player has enough credits.
Definition player.c:1036
PilotCommodity * pfleet_cargoList(void)
Gets a list of all the cargo in the fleet.
int pfleet_cargoFree(void)
Gets the total amount of free cargo space in the player's fleet.
int pfleet_cargoOwned(const Commodity *com)
Gets the total amount of a commodity type owned by the player's fleet.
int pfleet_cargoAdd(const Commodity *com, int q)
Adds some cargo to the player's fleet.
int pfleet_cargoRm(const Commodity *com, int q, int jet)
Removes some cargo from the player's fleet.
static const double c[]
Definition rng.c:256
int spob_averageSpobPrice(const Spob *p, const Commodity *c, credits_t *mean, double *std)
Gets the average price of a commodity at a spob that has been seen so far.
Definition space.c:336
credits_t spob_commodityPrice(const Spob *p, const Commodity *c)
Gets the price of a commodity at a spob.
Definition space.c:293
Represents a commodity.
Definition commodity.h:57
char * description
Definition commodity.h:59
glTexture * gfx_store
Definition commodity.h:68
char * name
Definition commodity.h:58
credits_t lastPurchasePrice
Definition commodity.h:73
double price_mod
Definition commodity.h:65
char * price_ref
Definition commodity.h:63
The actual hook parameter.
Definition hook.h:40
HookParamType type
Definition hook.h:41
Commodity * commodity
Definition hook.h:49
union HookParam::@065274143236224234262250043114351136253171035204 u
double num
Definition hook.h:43
Stores a pilot commodity.
Definition pilot.h:223
const Commodity * commodity
Definition pilot.h:224
unsigned int id
Definition pilot.h:226
void window_setOnFocus(unsigned int wid, void(*focus)(unsigned int))
Sets the focus function of the window.
Definition toolkit.c:889
void window_setFocus(unsigned int wid, const char *wgtname)
Sets the focused widget in a window.
Definition toolkit.c:2488
void window_dimWindow(unsigned int wid, int *w, int *h)
Gets the dimensions of a window.
Definition toolkit.c:370
void window_destroyWidget(unsigned int wid, const char *wgtname)
Destroys a widget in a window.
Definition toolkit.c:1167
void toolkit_rerender(void)
Marks the toolkit for needing a full rerender.
Definition toolkit.c:1675
int widget_exists(unsigned int wid, const char *wgtname)
Checks to see if a widget exists.
Definition toolkit.c:1144
void window_handleEvents(unsigned int wid, int(*eventhandler)(unsigned int, SDL_Event *))
Sets the event handler for the window.
Definition toolkit.c:979