shithub: sce

ref: 4c2c9c8892686ad0a04ec93222a1f51fdafdf4f3
dir: /sim.resource.c/

View raw version
#include <u.h>
#include <libc.h>
#include <draw.h>
#include "dat.h"
#include "fns.h"

void
resourcestate(Mobj *mo)
{
	int os, *t, *te;
	Resource *r;

	r = mo->o->res;
	for(os=OSrich, t=r->thresh, te=t+r->nthresh; t<te; t++, os++)
		if(mo->amount >= *t)
			break;
	mo->state = os;
}