# \[Refactoring\] Coordinate system

**URL:** https://discourse.cataclysmdda.org/t/refactoring-coordinate-system/11328
**Category:** The Drawing Board
**Created:** [January 31, 2016, 12:13pm UTC](https://discourse.cataclysmdda.org/t/refactoring-coordinate-system/11328 "2016-01-31T12:13:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![crutchmaster](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@crutchmaster](https://discourse.cataclysmdda.org/u/crutchmaster)
#### Post date: [January 31, 2016, 12:13pm UTC](https://discourse.cataclysmdda.org/t/refactoring-coordinate-system/11328/1 "2016-01-31T12:13:37Z")

</div>

All coordinate values MUST HAVE own type/class. Not “tripoint” for all this omt (overmap terrain), om (overmap), sm (submap), abs. tile etc. Code of/for overmap is unreadable.

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [February 1, 2016, 6:38am UTC](https://discourse.cataclysmdda.org/t/refactoring-coordinate-system/11328/2 "2016-02-01T06:38:35Z")

</div>

Yes it’s a problem, feel free to propose a nice way to implement it and a nice way to migrate the code to it a piece at a time.  
Throwing around “MUST HAVE” with no associated solution isn’t particularly productive.

---

<div class="post-metadata">

### Author: ![crutchmaster](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@crutchmaster](https://discourse.cataclysmdda.org/u/crutchmaster)
#### Post date: [February 1, 2016, 12:20pm UTC](https://discourse.cataclysmdda.org/t/refactoring-coordinate-system/11328/3 "2016-02-01T12:20:50Z")

</div>

[quote=“Kevin Granade, post:2, topic:11328”]Yes it’s a problem, feel free to propose a nice way to implement it and a nice way to migrate the code to it a piece at a time.  
Throwing around “MUST HAVE” with no associated solution isn’t particularly productive.[/quote]  
Code plan:

1. Own type for each coordinate (based by tripoint for example).
2. Disable call methods with tripoint argument. Only with constructor or casting to correct type.
3. Casts to any coord. type by methods like to\_omt() to\_sm() etc.

Refactoring plan:

1. Edit headers
2. Fix all compile errors  
3. Enjoy bugs   
It will not be very hard.

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [February 2, 2016, 8:03am UTC](https://discourse.cataclysmdda.org/t/refactoring-coordinate-system/11328/4 "2016-02-02T08:03:24Z")

</div>

> a nice way to migrate the code to it a piece at a time.

In other words, if you submit a 2,000 line pull request to swap it over all at once, I'm going to close it without looking at it. You need a migration plan for something that big, not just an implementation plan.

I’m not trying to discourage you, that would be a very nice thing to have, I’m just trying to make clear how it needs to work.

I might also be a little cranky because I’m wrapping up hour #3 of code review and merge testing for dda this evening after 10 hrs of work. I couldn’t work in any time to work on my own code tonight.

---

<div class="post-metadata">

### Author: ![crutchmaster](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@crutchmaster](https://discourse.cataclysmdda.org/u/crutchmaster)
#### Post date: [February 3, 2016, 2:52am UTC](https://discourse.cataclysmdda.org/t/refactoring-coordinate-system/11328/5 "2016-02-03T02:52:44Z")

</div>

> [@Kevin Granade](#):
>
> In other words, if you submit a 2,000 line pull request to swap it over all at once

No. Fists stage - writing types and conversion code. Next - rewriting methods. One method - one commit. I don’t think, there are methods who calls 500 times.
