more tweaks
This commit is contained in:
+2
-1
@@ -379,7 +379,8 @@ fn void handleIncomingMessage(u8* message, u32 len, SocketAddress sender, i32 so
|
|||||||
u32 planet_count = message[msg_pos++];
|
u32 planet_count = message[msg_pos++];
|
||||||
for (u32 i = 0; i < planet_count; i++) {
|
for (u32 i = 0; i < planet_count; i++) {
|
||||||
for (u32 ii = 0; ii < Commodity_Count; ii++) {
|
for (u32 ii = 0; ii < Commodity_Count; ii++) {
|
||||||
parsed.sys.planets[i].commodities[ii] = message[msg_pos++];
|
parsed.sys.planets[i].commodities[ii] = readU32FromBufferLE(message + msg_pos);
|
||||||
|
msg_pos += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
+24
-2
@@ -312,7 +312,7 @@ fn UDPMessage makeMessageSystemCommodities(StarSystem* sys) {
|
|||||||
outgoing_message.bytes[msg_i++] = (u8)planet_count;
|
outgoing_message.bytes[msg_i++] = (u8)planet_count;
|
||||||
for (u32 i = 0; i < planet_count; i++) {
|
for (u32 i = 0; i < planet_count; i++) {
|
||||||
for (u32 ii = 0; ii < Commodity_Count; ii++) {
|
for (u32 ii = 0; ii < Commodity_Count; ii++) {
|
||||||
outgoing_message.bytes[msg_i++] = sys->planets[i].commodities[ii];
|
msg_i += writeU32ToBufferLE(outgoing_message.bytes + msg_i, sys->planets[i].commodities[ii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outgoing_message.bytes_len = msg_i;
|
outgoing_message.bytes_len = msg_i;
|
||||||
@@ -901,7 +901,7 @@ fn void* gameLoop(void* params) {
|
|||||||
.base_cost = template.base_cost,
|
.base_cost = template.base_cost,
|
||||||
.remaining_mortgage = template.base_cost - STARTING_DOWN_PAYMENT,
|
.remaining_mortgage = template.base_cost - STARTING_DOWN_PAYMENT,
|
||||||
.interest_rate = calcInterestRate(template.base_cost, STARTING_DOWN_PAYMENT),
|
.interest_rate = calcInterestRate(template.base_cost, STARTING_DOWN_PAYMENT),
|
||||||
.credits = 10000.0,
|
.credits = 2000.0,
|
||||||
.cu_m_fuel = template.cu_m_fuel,
|
.cu_m_fuel = template.cu_m_fuel,
|
||||||
.cu_m_o2 = template.cu_m_o2,
|
.cu_m_o2 = template.cu_m_o2,
|
||||||
.id = account->id,
|
.id = account->id,
|
||||||
@@ -1152,11 +1152,17 @@ fn void* gameLoop(void* params) {
|
|||||||
fn void setHighProductionCommodity(Planet* p, CommodityType t) {
|
fn void setHighProductionCommodity(Planet* p, CommodityType t) {
|
||||||
p->commodities[t] = (COMMODITIES[t].qty / 2) + (rand() % COMMODITIES[t].qty);
|
p->commodities[t] = (COMMODITIES[t].qty / 2) + (rand() % COMMODITIES[t].qty);
|
||||||
p->production[t] = COMMODITIES[t].consumption + (rand() % COMMODITIES[t].consumption);
|
p->production[t] = COMMODITIES[t].consumption + (rand() % COMMODITIES[t].consumption);
|
||||||
|
if (t == CommodityHydrogenFuel || t == CommodityOxygen) {
|
||||||
|
p->commodities[t] = COMMODITIES[t].qty * 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn void setLowProductionCommodity(Planet* p, CommodityType t) {
|
fn void setLowProductionCommodity(Planet* p, CommodityType t) {
|
||||||
p->commodities[t] = rand() % (COMMODITIES[t].qty / 2);
|
p->commodities[t] = rand() % (COMMODITIES[t].qty / 2);
|
||||||
p->production[t] = rand() % (COMMODITIES[t].consumption / 2);
|
p->production[t] = rand() % (COMMODITIES[t].consumption / 2);
|
||||||
|
if (t == CommodityHydrogenFuel || t == CommodityOxygen) {
|
||||||
|
p->commodities[t] = COMMODITIES[t].qty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bool updateAndRender(TuiState* tui, void* s, u8* input_buffer, u64 loop_count) {
|
fn bool updateAndRender(TuiState* tui, void* s, u8* input_buffer, u64 loop_count) {
|
||||||
@@ -1399,6 +1405,7 @@ i32 main(i32 argc, ptr argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now, build out the commodity info and passenger jobs for the systems
|
// now, build out the commodity info and passenger jobs for the systems
|
||||||
|
char sbuf[SBUFLEN] = {0};
|
||||||
for (u32 i = 0; i < STAR_SYSTEM_COUNT; i++) {
|
for (u32 i = 0; i < STAR_SYSTEM_COUNT; i++) {
|
||||||
u32 planet_count = rand() % MAX_PLANETS + 1;
|
u32 planet_count = rand() % MAX_PLANETS + 1;
|
||||||
for (u32 ii = 0; ii < planet_count; ii++) {
|
for (u32 ii = 0; ii < planet_count; ii++) {
|
||||||
@@ -1409,6 +1416,7 @@ i32 main(i32 argc, ptr argv[]) {
|
|||||||
p->commodities[iii] = (COMMODITIES[iii].qty / 5) + (rand() % COMMODITIES[iii].qty);
|
p->commodities[iii] = (COMMODITIES[iii].qty / 5) + (rand() % COMMODITIES[iii].qty);
|
||||||
p->production[iii] = 1 + (rand() % COMMODITIES[iii].consumption);
|
p->production[iii] = 1 + (rand() % COMMODITIES[iii].consumption);
|
||||||
}
|
}
|
||||||
|
// everyone starts with "a lot" of fuel and o2
|
||||||
p->commodities[CommodityHydrogenFuel] = COMMODITIES[CommodityHydrogenFuel].qty * 2;
|
p->commodities[CommodityHydrogenFuel] = COMMODITIES[CommodityHydrogenFuel].qty * 2;
|
||||||
p->commodities[CommodityOxygen] = COMMODITIES[CommodityOxygen].qty * 2;
|
p->commodities[CommodityOxygen] = COMMODITIES[CommodityOxygen].qty * 2;
|
||||||
// now, override for the "specialty" of the planet
|
// now, override for the "specialty" of the planet
|
||||||
@@ -1476,6 +1484,20 @@ i32 main(i32 argc, ptr argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MemoryZero(sbuf, SBUFLEN);
|
||||||
|
sprintf(
|
||||||
|
sbuf,
|
||||||
|
"%s: fuel: %d o2: %d",
|
||||||
|
STAR_NAMES[i],
|
||||||
|
state.map[i].planets[0].commodities[CommodityHydrogenFuel] +
|
||||||
|
state.map[i].planets[1].commodities[CommodityHydrogenFuel] +
|
||||||
|
state.map[i].planets[2].commodities[CommodityHydrogenFuel],
|
||||||
|
state.map[i].planets[0].commodities[CommodityOxygen] +
|
||||||
|
state.map[i].planets[1].commodities[CommodityOxygen] +
|
||||||
|
state.map[i].planets[2].commodities[CommodityOxygen]
|
||||||
|
);
|
||||||
|
addSystemMessage((u8*)sbuf);
|
||||||
|
|
||||||
u32 planet_divisor = ((MAX_PLANETS - planet_count)+1);
|
u32 planet_divisor = ((MAX_PLANETS - planet_count)+1);
|
||||||
u32 offer_count = 1 + (rand() % (MAX_PASSENGER_JOB_OFFERS / planet_divisor));
|
u32 offer_count = 1 + (rand() % (MAX_PASSENGER_JOB_OFFERS / planet_divisor));
|
||||||
for (u32 ii = 0; ii < offer_count; ii++) {
|
for (u32 ii = 0; ii < offer_count; ii++) {
|
||||||
|
|||||||
+4
-4
@@ -58,14 +58,14 @@ global ShipTemplate SHIPS[] = {
|
|||||||
.vacuum_cargo_slots = 6, .climate_cargo_slots = 0, .passenger_berths = 1,
|
.vacuum_cargo_slots = 6, .climate_cargo_slots = 0, .passenger_berths = 1,
|
||||||
.passenger_amenities_flags = 0,
|
.passenger_amenities_flags = 0,
|
||||||
.smugglers_hold_cu_m = 0, .base_cost = 150000,
|
.smugglers_hold_cu_m = 0, .base_cost = 150000,
|
||||||
.cu_m_fuel = 2000, .cu_m_o2 = 2000,
|
.cu_m_fuel = 2000, .cu_m_o2 = 1500,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = ShipHaulerPrimeZ1, .drive_efficiency = 5, .life_support_efficiency = 2,
|
.type = ShipHaulerPrimeZ1, .drive_efficiency = 5, .life_support_efficiency = 2,
|
||||||
.vacuum_cargo_slots = 30, .climate_cargo_slots = 0, .passenger_berths = 0,
|
.vacuum_cargo_slots = 30, .climate_cargo_slots = 0, .passenger_berths = 0,
|
||||||
.passenger_amenities_flags = 0,
|
.passenger_amenities_flags = 0,
|
||||||
.smugglers_hold_cu_m = 0, .base_cost = 250000,
|
.smugglers_hold_cu_m = 0, .base_cost = 275000,
|
||||||
.cu_m_fuel = 2500, .cu_m_o2 = 1000,
|
.cu_m_fuel = 2500, .cu_m_o2 = 800,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = ShipNX400, .drive_efficiency = 6, .life_support_efficiency = 5,
|
.type = ShipNX400, .drive_efficiency = 6, .life_support_efficiency = 5,
|
||||||
@@ -147,7 +147,7 @@ global Commodity COMMODITIES[Commodity_Count] = {
|
|||||||
},
|
},
|
||||||
{ .type = CommodityOxygen, .unit = StorageUnitKg,
|
{ .type = CommodityOxygen, .unit = StorageUnitKg,
|
||||||
.name = "Oxygen",
|
.name = "Oxygen",
|
||||||
.price = 5, .qty = 10000, .consumption = 100,
|
.price = 5, .qty = 5000, .consumption = 80,
|
||||||
},
|
},
|
||||||
{ .type = CommodityWater, .unit = StorageUnitContainer,
|
{ .type = CommodityWater, .unit = StorageUnitContainer,
|
||||||
.name = "Water",
|
.name = "Water",
|
||||||
|
|||||||
Reference in New Issue
Block a user