mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 14:32:06 -08:00
Simplification
This commit is contained in:
parent
90487f4120
commit
9c10a09438
1 changed files with 3 additions and 10 deletions
|
|
@ -711,8 +711,7 @@ public class TypeIO{
|
|||
}
|
||||
|
||||
public static void writeStatus(Writes write, StatusEntry entry){
|
||||
//dynamic effects have the high bit of ID set to 1
|
||||
write.s(entry.effect.id | (entry.effect.dynamic ? 1 << 15 : 0));
|
||||
write.s(entry.effect.id);
|
||||
write.f(entry.time);
|
||||
|
||||
//write dynamic fields
|
||||
|
|
@ -742,13 +741,9 @@ public class TypeIO{
|
|||
short id = read.s();
|
||||
float time = read.f();
|
||||
|
||||
StatusEntry result = new StatusEntry();
|
||||
|
||||
//check if it's dynamic (high bit set to 1), remove it, read multipliers
|
||||
if((id & (1 << 15)) != 0){
|
||||
//it's a dynamic effect
|
||||
id ^= (1 << 15);
|
||||
StatusEntry result = new StatusEntry().set(content.getByID(ContentType.status, id), time);
|
||||
|
||||
if(result.effect.dynamic){
|
||||
//read flags that store which fields are set
|
||||
int flags = read.ub();
|
||||
|
||||
|
|
@ -761,8 +756,6 @@ public class TypeIO{
|
|||
if((flags & (1 << 6)) != 0) result.armorOverride = read.f();
|
||||
}
|
||||
|
||||
result.set(content.getByID(ContentType.status, id), time);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue