move /api under /lib
This commit is contained in:
parent
1cca8c5806
commit
9cfc675194
12
cli/main.zig
12
cli/main.zig
@ -3,8 +3,8 @@ const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
const Artificer = @import("artificer");
|
||||
const Api = @import("artifacts-api");
|
||||
const Lib = @import("lib");
|
||||
const Api = Lib.Api;
|
||||
|
||||
const simulated = true;
|
||||
|
||||
@ -60,8 +60,8 @@ pub fn main() !void {
|
||||
|
||||
const character_id = (try server.getCharacter("Blondie")).?;
|
||||
|
||||
var system_clock = Artificer.SystemClock{};
|
||||
var sim_server = Artificer.SimServer.init(0, &store);
|
||||
var system_clock = Lib.SystemClock{};
|
||||
var sim_server = Lib.SimServer.init(0, &store);
|
||||
|
||||
if (simulated) {
|
||||
const character = store.characters.get(character_id).?;
|
||||
@ -69,9 +69,9 @@ pub fn main() !void {
|
||||
}
|
||||
|
||||
var artificer = if (simulated)
|
||||
try Artificer.ArtificerSim.init(allocator, &store, &sim_server.clock, &sim_server, character_id)
|
||||
try Lib.ArtificerSim.init(allocator, &store, &sim_server.clock, &sim_server, character_id)
|
||||
else
|
||||
try Artificer.ArtificerApi.init(allocator, &store, &system_clock, &server, character_id);
|
||||
try Lib.ArtificerApi.init(allocator, &store, &system_clock, &server, character_id);
|
||||
|
||||
defer artificer.deinit(allocator);
|
||||
|
||||
|
18
gui/app.zig
18
gui/app.zig
@ -1,7 +1,6 @@
|
||||
// zig fmt: off
|
||||
const std = @import("std");
|
||||
const Api = @import("artifacts-api");
|
||||
const Artificer = @import("artificer");
|
||||
const Lib = @import("lib");
|
||||
const UI = @import("./ui.zig");
|
||||
const RectUtils = @import("./rect-utils.zig");
|
||||
const rl = @import("raylib");
|
||||
@ -13,6 +12,7 @@ const rlgl_h = @cImport({
|
||||
|
||||
const assert = std.debug.assert;
|
||||
const log = std.log.scoped(.app);
|
||||
const Api = Lib.Api;
|
||||
|
||||
const App = @This();
|
||||
|
||||
@ -39,11 +39,11 @@ blur_shader: rl.Shader,
|
||||
|
||||
simulation: bool = false,
|
||||
|
||||
system_clock: Artificer.SystemClock,
|
||||
system_clock: Lib.SystemClock,
|
||||
started_at: i128,
|
||||
artificer: Artificer.ArtificerApi,
|
||||
sim_artificer: Artificer.ArtificerSim,
|
||||
sim_server: Artificer.SimServer,
|
||||
artificer: Lib.ArtificerApi,
|
||||
sim_artificer: Lib.ArtificerSim,
|
||||
sim_server: Lib.SimServer,
|
||||
sim_started_at: i128,
|
||||
last_sim_timestamp: i128 = 0,
|
||||
|
||||
@ -144,7 +144,7 @@ pub fn init(allocator: std.mem.Allocator, store: *Api.Store, server: *Api.Server
|
||||
|
||||
const character_id = store.characters.getId("Blondie").?;
|
||||
|
||||
const sim_server = Artificer.SimServer.init(0, store);
|
||||
const sim_server = Lib.SimServer.init(0, store);
|
||||
|
||||
var app = try allocator.create(App);
|
||||
errdefer allocator.destroy(app);
|
||||
@ -177,10 +177,10 @@ pub fn init(allocator: std.mem.Allocator, store: *Api.Store, server: *Api.Server
|
||||
};
|
||||
app.started_at = app.system_clock.nanoTimestamp();
|
||||
|
||||
app.sim_artificer = try Artificer.ArtificerSim.init(allocator, store, &app.sim_server.clock, &app.sim_server, character_id);
|
||||
app.sim_artificer = try Lib.ArtificerSim.init(allocator, store, &app.sim_server.clock, &app.sim_server, character_id);
|
||||
errdefer app.sim_artificer.deinit(allocator);
|
||||
|
||||
app.artificer = try Artificer.ArtificerApi.init(allocator, store, &app.system_clock, server, character_id);
|
||||
app.artificer = try Lib.ArtificerApi.init(allocator, store, &app.system_clock, server, character_id);
|
||||
errdefer app.artificer.deinit(allocator);
|
||||
|
||||
app.artificer_thread = try std.Thread.spawn(.{ .allocator = allocator }, artificer_thread_cb, .{ app });
|
||||
|
@ -1,6 +1,6 @@
|
||||
// zig fmt: off
|
||||
const std = @import("std");
|
||||
const Api = @import("artifacts-api");
|
||||
const Lib = @import("lib");
|
||||
const rl = @import("raylib");
|
||||
const raylib_h = @cImport({
|
||||
@cInclude("stdio.h");
|
||||
@ -8,6 +8,8 @@ const raylib_h = @cImport({
|
||||
});
|
||||
const App = @import("./app.zig");
|
||||
|
||||
const Api = Lib.Api;
|
||||
|
||||
pub const std_options = .{
|
||||
.log_scope_levels = &[_]std.log.ScopeLevel{
|
||||
.{ .scope = .api, .level = .warn },
|
||||
|
@ -10,7 +10,7 @@ pub const images_uri = std.Uri.parse(images_url) catch @compileError("Images ser
|
||||
pub const api_url = "https://api.artifactsmmo.com";
|
||||
pub const docs_url = api_url ++ "/openapi.json";
|
||||
|
||||
pub const parseDateTime = @import("./date_time/parse.zig").parseDateTime;
|
||||
pub const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
||||
|
||||
pub const Server = @import("server.zig");
|
||||
pub const RateLimit = @import("./ratelimit.zig");
|
@ -2,7 +2,7 @@
|
||||
const std = @import("std");
|
||||
const Store = @import("../store.zig");
|
||||
const EnumStringUtils = @import("../enum_string_utils.zig").EnumStringUtils;
|
||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
||||
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||
const json_utils = @import("../json_utils.zig");
|
||||
pub const Equipment = @import("./equipment.zig");
|
||||
const Task = @import("./task.zig");
|
@ -2,7 +2,7 @@
|
||||
const std = @import("std");
|
||||
const Store = @import("../store.zig");
|
||||
const json_utils = @import("../json_utils.zig");
|
||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
||||
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||
const EnumStringUtils = @import("../enum_string_utils.zig").EnumStringUtils;
|
||||
|
||||
const Cooldown = @This();
|
@ -2,7 +2,7 @@
|
||||
const std = @import("std");
|
||||
const Character = @import("./character.zig");
|
||||
const json_utils = @import("../json_utils.zig");
|
||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
||||
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||
const Store = @import("../store.zig");
|
||||
const Item = @import("./item.zig");
|
||||
|
@ -2,7 +2,7 @@
|
||||
const std = @import("std");
|
||||
const Store = @import("../store.zig");
|
||||
const json_utils = @import("../json_utils.zig");
|
||||
const parseDateTime = @import("../date_time/parse.zig").parseDateTime;
|
||||
const parseDateTime = @import("../../date_time/parse.zig").parseDateTime;
|
||||
const json = std.json;
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
@ -2,9 +2,9 @@
|
||||
const Root = @import("root.zig");
|
||||
const Store = @import("./store.zig");
|
||||
const std = @import("std");
|
||||
const json_utils = @import("json_utils.zig");
|
||||
const json_utils = @import("./json_utils.zig");
|
||||
const errors = @import("./errors.zig");
|
||||
const stb_image = @import("./stb_image/root.zig");
|
||||
const stb_image = @import("../stb_image/root.zig");
|
||||
const RateLimit = @import("./ratelimit.zig");
|
||||
|
||||
const FetchError = errors.FetchError;
|
@ -1,6 +1,6 @@
|
||||
// zig fmt: off
|
||||
const std = @import("std");
|
||||
const Api = @import("artifacts-api");
|
||||
const Api = @import("./api/root.zig");
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
const GatherGoal = @import("gather_goal.zig");
|
||||
|
@ -1,5 +1,5 @@
|
||||
// zig fmt: off
|
||||
const Api = @import("artifacts-api");
|
||||
const Api = @import("./api/root.zig");
|
||||
|
||||
const Artificer = @import("./artificer.zig");
|
||||
const Context = Artificer.GoalContext;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// zig fmt: off
|
||||
const std = @import("std");
|
||||
const Api = @import("artifacts-api");
|
||||
const Api = @import("./api/root.zig");
|
||||
|
||||
const Artificer = @import("./artificer.zig");
|
||||
const Context = Artificer.GoalContext;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// zig fmt: off
|
||||
const Api = @import("artifacts-api");
|
||||
const Api = @import("./api/root.zig");
|
||||
|
||||
const Artificer = @import("./artificer.zig");
|
||||
const Context = Artificer.GoalContext;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// zig fmt: off
|
||||
const Api = @import("artifacts-api");
|
||||
pub const Api = @import("./api/root.zig");
|
||||
|
||||
pub const ArtificerType = @import("./artificer.zig").ArtificerType;
|
||||
pub const SimServer = @import("./sim_server.zig");
|
||||
|
@ -1,6 +1,6 @@
|
||||
// zig fmt: off
|
||||
const std = @import("std");
|
||||
const Api = @import("artifacts-api");
|
||||
const Api = @import("./api/root.zig");
|
||||
const SimClock = @import("./sim_clock.zig");
|
||||
const Server = @This();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user