docs
This commit is contained in:
+10
-2
@@ -1753,7 +1753,7 @@ fn bool updateAndRender(TuiState* tui, void* s, u8* input_buffer, u64 loop_count
|
||||
} else {
|
||||
field = &state->login_state.password;
|
||||
}
|
||||
if (isAlphaUnderscoreSpace(input_buffer[0])) {
|
||||
if (isAlphaUnderscoreSpace(input_buffer[0]) || user_pressed_a_number) {
|
||||
field->bytes[state->login_state.field_index] = input_buffer[0];
|
||||
if (state->login_state.field_index+1 < field->capacity) {
|
||||
state->login_state.field_index += 1;
|
||||
@@ -1765,7 +1765,15 @@ fn bool updateAndRender(TuiState* tui, void* s, u8* input_buffer, u64 loop_count
|
||||
state->login_state.field_index -= 1;
|
||||
field->length -= 1;
|
||||
}
|
||||
} else if (input_buffer[0] == ASCII_RETURN || input_buffer[0] == ASCII_LINE_FEED) {
|
||||
} else if (user_pressed_tab) {
|
||||
state->login_state.selected_field = state->login_state.selected_field == 0 ? 1 : 0;
|
||||
if (state->login_state.selected_field == 0) {
|
||||
field = &state->login_state.name;
|
||||
} else {
|
||||
field = &state->login_state.password;
|
||||
}
|
||||
state->login_state.field_index = field->length;
|
||||
} else if (user_pressed_enter) {
|
||||
if (state->login_state.selected_field == 0) {
|
||||
state->login_state.selected_field = 1;
|
||||
state->login_state.field_index = 0;
|
||||
|
||||
+18
-16
@@ -1059,23 +1059,25 @@ fn void* gameLoop(void* params) {
|
||||
}
|
||||
|
||||
// tick all the star systems (auctions)
|
||||
StarSystem* sys = NULL;
|
||||
Range1u64 sys_range = LaneRange(STAR_SYSTEM_COUNT);
|
||||
for (u32 i = sys_range.min; i < sys_range.max; i++) {
|
||||
sys = &state.map[i];
|
||||
if (player_count > 0) { // don't bother until there's actually a player
|
||||
StarSystem* sys = NULL;
|
||||
Range1u64 sys_range = LaneRange(STAR_SYSTEM_COUNT);
|
||||
for (u32 i = sys_range.min; i < sys_range.max; i++) {
|
||||
sys = &state.map[i];
|
||||
|
||||
// tick the auction price
|
||||
u32 grace_period_ends_at = sys->auction.started_at + (GOAL_GAME_LOOPS_PER_S * 3);
|
||||
bool is_auction_still_running = sys->auction.finished_at == 0;
|
||||
bool is_auction_grace_period_finished = state.frame > grace_period_ends_at;
|
||||
if (is_auction_still_running && is_auction_grace_period_finished) {
|
||||
f32 initial_price = COMMODITIES[sys->auction.type].price * AUCTION_PRICE_START_MULTIPLE;
|
||||
f32 t_sec = ((f32)state.frame - (f32)grace_period_ends_at) / (f32)GOAL_GAME_LOOPS_PER_S;
|
||||
// t is in minutes
|
||||
f32 t = t_sec / 60;
|
||||
f32 decay = -0.50 * t;
|
||||
f32 floor_price = COMMODITIES[sys->auction.type].price * 0.9;
|
||||
sys->auction.price = Max((initial_price * pow(EULERS_E, decay)), floor_price);
|
||||
// tick the auction price
|
||||
u32 grace_period_ends_at = sys->auction.started_at + (GOAL_GAME_LOOPS_PER_S * 3);
|
||||
bool is_auction_still_running = sys->auction.finished_at == 0;
|
||||
bool is_auction_grace_period_finished = state.frame > grace_period_ends_at;
|
||||
if (is_auction_still_running && is_auction_grace_period_finished) {
|
||||
f32 initial_price = COMMODITIES[sys->auction.type].price * AUCTION_PRICE_START_MULTIPLE;
|
||||
f32 t_sec = ((f32)state.frame - (f32)grace_period_ends_at) / (f32)GOAL_GAME_LOOPS_PER_S;
|
||||
// t is in minutes
|
||||
f32 t = t_sec / 60;
|
||||
f32 decay = -0.50 * t;
|
||||
f32 floor_price = COMMODITIES[sys->auction.type].price * 0.9;
|
||||
sys->auction.price = Max((initial_price * pow(EULERS_E, decay)), floor_price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user