Commits

Andrey Lesnikov committed 0baaaa7

core: add_unit(): Update.

Comments (0)

Files changed (1)

 
 void
 add_unit (Mcrd m, Dir d, int plr, Unit_type_id t_id) {
-  Unit *u        = calloc(1, sizeof(Unit));
-  Unit_type t    = unit_types[t_id];
-  u->player      = plr;
-  u->ap          = t.ap;
-  u->count       = t.count;
-  u->skills_n    = t.skills_n;
-  u->stamina     = t.stamina;
-  u->morale      = t.morale;
-  u->m           = m;
-  u->t           = t_id;
-  u->id          = get_new_unit_id();
-  u->dir         = d;
-  memcpy(u->skills, t.skills, u->skills_n * sizeof(Skill));
+  Unit *u = calloc(1, sizeof(Unit));
+  Unit_type *t = &unit_types[t_id];
+  u->player = plr;
+  u->ap = t->ap;
+  u->count = t->count;
+  u->skills_n = t->skills_n;
+  u->stamina = t->stamina;
+  u->morale = t->morale;
+  u->m = m;
+  u->t = t_id;
+  u->id = get_new_unit_id();
+  u->dir = d;
+  memcpy(u->skills, t->skills, u->skills_n * sizeof(Skill));
   push_node(&units, mk_node(u));
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.