This commit is contained in:
RadsammyT 2026-03-17 19:24:03 -04:00
commit 1be98f2163
No known key found for this signature in database

View file

@ -165,23 +165,16 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
if (std.mem.startsWith(u8, field.header, "cmd:")) {
const key = field.header[4..];
const keyZ = temporary_allocator.dupe(u8, key) catch |e|
std.debug.panic("CustomCommands.binds: {} while duping key {s}", .{e, key});
const keyZ = temporary_allocator.dupe(u8, key) catch "";
if (!CustomCommands.binds.contains(key)) {
CustomCommands.binds.put(keyZ, .{}) catch |e| {
std.debug.panic("CustomCommands.binds: {} while putting for key {s}", .{e, key});
};
CustomCommands.binds.put(keyZ, .{}) catch {};
}
if (CustomCommands.binds.getPtr(keyZ)) |command| {
if (std.mem.eql(u8, field.key, "name")) {
command.name = temporary_allocator.dupe(u8, field.value) catch |e| {
std.debug.panic("CustomCommands.binds: {} while duping name '{s}'", .{e, field.value});
};
command.name = temporary_allocator.dupe(u8, field.value) catch "";
}
if (std.mem.eql(u8, field.key, "cmd")) {
command.cmd = temporary_allocator.dupe(u8, field.value) catch |e| {
std.debug.panic("CustomCommands.binds: {} while duping command '{s}", .{e, field.value});
};
command.cmd = temporary_allocator.dupe(u8, field.value) catch "";
}
if (std.mem.eql(u8, field.key, "posX")) {
command.posX = std.fmt.parseInt(u32, field.value, 10) catch blk: { break :blk 0; };
@ -194,20 +187,15 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
if (std.mem.startsWith(u8, field.header, "lbl:")) {
const key = field.header[4..];
const keyZ = temporary_allocator.dupe(u8, key) catch |e|
std.debug.panic("CustomCommands.labels: {} while duping key {s}", .{e, key});
const keyZ = temporary_allocator.dupe(u8, key) catch "";
if (!CustomCommands.labels.contains(keyZ)) {
CustomCommands.labels.put(keyZ, .{
.name = keyZ
}) catch |e| {
std.debug.panic("CustomCommands.labels: {} while putting for key {s}", .{e, key});
};
}) catch {};
}
if (CustomCommands.labels.getPtr(keyZ)) |label| {
if (std.mem.eql(u8, field.key, "cmd")) {
label.cmd = temporary_allocator.dupe(u8, field.value) catch |e| {
std.debug.panic("CustomCommands.labels: {} while duping command '{s}'", .{e, field.value});
};
label.cmd = temporary_allocator.dupe(u8, field.value) catch "";
}
if (std.mem.eql(u8, field.key, "posX")) {
label.posX = std.fmt.parseInt(u32, field.value, 10) catch blk: { break :blk 0; };