Skip to content

Commit

Permalink
DynRes fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Katodiy committed Mar 8, 2023
1 parent 51fbdd5 commit de24863
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/haven/res/gfx/invobjs/meat/Meat.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.*;

/* >ispr: Meat */
@FromResource(name = "gfx/invobjs/meat", version = 22)
@haven.FromResource(name = "gfx/invobjs/meat", version = 23)
public class Meat extends Layered implements haven.res.ui.tt.defn.DynName {
public final String name;

Expand Down
2 changes: 1 addition & 1 deletion src/haven/res/lib/tspec/Spec.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@FromResource(name = "lib/tspec", version = 3, override = true)
public class Spec implements GSprite.Owner, ItemInfo.SpriteOwner {
private static final Object[] definfo = {
new Object[] {Resource.remote().loadwait("ui/tt/defn").pool.load("ui/tt/defn", 5)},
new Object[] {Resource.remote().loadwait("ui/tt/defn").pool.load("ui/tt/defn", 6)},
};
public final Object[] info;
public final ResData res;
Expand Down
2 changes: 1 addition & 1 deletion src/haven/res/ui/croster/CattleId.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.awt.Color;
import java.awt.image.BufferedImage;

@FromResource(name = "ui/croster", version = 72)
@haven.FromResource(name = "ui/croster", version = 73)
public class CattleId extends GAttrib implements RenderTree.Node, PView.Render2D {
public final long id;

Expand Down
4 changes: 2 additions & 2 deletions src/haven/res/ui/croster/CattleRoster.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.awt.Color;
import java.awt.image.BufferedImage;

@FromResource(name = "ui/croster", version = 72)
@haven.FromResource(name = "ui/croster", version = 73)
public abstract class CattleRoster <T extends Entry> extends Widget {
public static final int WIDTH = UI.scale(900);
public static final Comparator<Entry> namecmp = (a, b) -> a.name.compareTo(b.name);
Expand Down Expand Up @@ -201,7 +201,7 @@ public void uimsg(String msg, Object... args) {
delentry(entry.id);
addentry(entry);
} else if(msg == "rm") {
delentry((Long)args[0]);
delentry(((Number)args[0]).longValue());
} else if(msg == "addto") {
GameUI gui = (GameUI)ui.getwidget((Integer)args[0]);
Pagina pag = gui.menu.paginafor(ui.sess.getres((Integer)args[1]));
Expand Down
2 changes: 1 addition & 1 deletion src/haven/res/ui/croster/Column.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.awt.Color;
import java.awt.image.BufferedImage;

@FromResource(name = "ui/croster", version = 72)
@haven.FromResource(name = "ui/croster", version = 73)
public class Column <E extends Entry> {
public final Tex head;
public final String tip;
Expand Down
31 changes: 15 additions & 16 deletions src/haven/res/ui/croster/Entry.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.awt.Color;
import java.awt.image.BufferedImage;

@FromResource(name = "ui/croster", version = 72)
@haven.FromResource(name = "ui/croster", version = 73)
public class Entry extends Widget {
public static final int WIDTH = CattleRoster.WIDTH;
public static final int HEIGHT = UI.scale(20);
Expand All @@ -18,27 +18,26 @@ public class Entry extends Widget {
public static final Function<Integer, String> percent = v -> String.format("%d%%", v);
public static final Function<Number, String> quality = v -> Long.toString(Math.round(v.doubleValue()));
public static final Function<Entry, Tex> namerend = e -> {
return(CharWnd.attrf2.render(e.name, BuddyWnd.gc[e.grp]).tex());
return(CharWnd.attrf.render(e.name, BuddyWnd.gc[e.grp]).tex());
};
public static final Tex male = new TexI(Resource.loadsimg("hud/rosters/male"));
public static final Tex female = new TexI(Resource.loadsimg("hud/rosters/female"));
public static final Tex male = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/male", 2)::get).layer(Resource.imgc).tex();
public static final Tex female = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/female", 2)::get).layer(Resource.imgc).tex();
public static final Function<Boolean, Tex> sex = v -> (v ? male : female);
public static final Tex adult = new TexI(Resource.loadsimg("hud/rosters/adult"));
public static final Tex child = new TexI(Resource.loadsimg("hud/rosters/child"));
public static final Tex adult = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/adult", 2)::get).layer(Resource.imgc).tex();
public static final Tex child = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/child", 2)::get).layer(Resource.imgc).tex();
public static final Function<Boolean, Tex> growth = v -> (v ? child : adult);
public static final Tex dead = new TexI(Resource.loadsimg("hud/rosters/dead"));
public static final Tex alive = new TexI(Resource.loadsimg("hud/rosters/alive"));

public static final Tex dead = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/dead", 2)::get).layer(Resource.imgc).tex();
public static final Tex alive = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/alive", 2)::get).layer(Resource.imgc).tex();
public static final Function<Boolean, Tex> deadrend = v -> (v ? dead : alive);
public static final Tex pregy = new TexI(Resource.loadsimg("hud/rosters/pregnant-y"));
public static final Tex pregn = new TexI(Resource.loadsimg("hud/rosters/pregnant-n"));
public static final Tex pregy = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/pregnant-y", 2)::get).layer(Resource.imgc).tex();
public static final Tex pregn = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/pregnant-n", 2)::get).layer(Resource.imgc).tex();
public static final Function<Boolean, Tex> pregrend = v -> (v ? pregy : pregn);
public static final Tex lacty = new TexI(Resource.loadsimg("hud/rosters/lactate-y"));
public static final Tex lactn = new TexI(Resource.loadsimg("hud/rosters/lactate-n"));
public static final Tex lacty = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/lactate-y", 1)::get).layer(Resource.imgc).tex();
public static final Tex lactn = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/lactate-n", 1)::get).layer(Resource.imgc).tex();
public static final Function<Boolean, Tex> lactrend = v -> (v ? lacty : lactn);
public static final Tex ownedn = new TexI(Resource.loadsimg("hud/rosters/owned-n"));
public static final Tex ownedo = new TexI(Resource.loadsimg("hud/rosters/owned-o"));
public static final Tex ownedm = new TexI(Resource.loadsimg("hud/rosters/owned-m"));
public static final Tex ownedn = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/owned-n", 1)::get).layer(Resource.imgc).tex();
public static final Tex ownedo = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/owned-o", 1)::get).layer(Resource.imgc).tex();
public static final Tex ownedm = Loading.waitfor(Resource.classres(Entry.class).pool.load("gfx/hud/rosters/owned-m", 1)::get).layer(Resource.imgc).tex();
public static final Function<Integer, Tex> ownrend = v -> ((v == 3) ? ownedm : ((v == 1) ? ownedo : ownedn));
public final long id;
public String name;
Expand Down
2 changes: 1 addition & 1 deletion src/haven/res/ui/croster/RosterButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.awt.Color;
import java.awt.image.BufferedImage;

@FromResource(name = "ui/croster", version = 72)
@haven.FromResource(name = "ui/croster", version = 73)
public class RosterButton extends MenuGrid.PagButton {
public final GameUI gui;
public RosterWindow wnd;
Expand Down
6 changes: 2 additions & 4 deletions src/haven/res/ui/croster/RosterWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@
import haven.MenuGrid.Pagina;
import haven.res.gfx.hud.rosters.cow.Ochs;
import haven.res.gfx.hud.rosters.goat.Goat;
import haven.res.gfx.hud.rosters.goat.GoatRoster;
import haven.res.gfx.hud.rosters.horse.Horse;
import haven.res.gfx.hud.rosters.pig.Pig;
import haven.res.gfx.hud.rosters.sheep.Sheep;

import java.awt.Color;
import java.awt.image.BufferedImage;

@FromResource(name = "ui/croster", version = 72)
@haven.FromResource(name = "ui/croster", version = 73)
public class RosterWindow extends Window {
public static final Map<Glob, RosterWindow> rosters = new HashMap<>();
public static int rmseq = 0;
public int btny = 0;
public List<TypeButton> buttons = new ArrayList<>();

RosterWindow() {
super(Coord.z, "Cattle Roster", true);
sz.x+=20;
super(Coord.z, "Cattle Roster", true);
}

public void show(CattleRoster rost) {
Expand Down
2 changes: 1 addition & 1 deletion src/haven/res/ui/croster/TypeButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.awt.Color;
import java.awt.image.BufferedImage;

@FromResource(name = "ui/croster", version = 72)
@haven.FromResource(name = "ui/croster", version = 73)
public class TypeButton extends IButton {
public final int order;

Expand Down

0 comments on commit de24863

Please sign in to comment.