Skip to content

Commit

Permalink
Fix a few minor bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
munificent committed Oct 9, 2014
1 parent 643d32f commit e54d620
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 22 deletions.
4 changes: 4 additions & 0 deletions asset/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ footer {
.codehilite .nl { color: $primary; } // keyword label (private: etc.)
.codehilite .nt { color: $primary; } // json key

// Hack: Pygments isn't recognizing preprocessor directives, so just color the
// error like a keyword.
.codehilite .err { color: $primary; }

// On phone-size screens, shrink all of the text a bit.
@media only screen and (max-width: 479px) {
.content {
Expand Down
6 changes: 3 additions & 3 deletions book/command.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ Now the input handling just delegates to those:

<aside name="null">

Notice how we don't check for `null` here? This assumes each button will have
Notice how we don't check for `NULL` here? This assumes each button will have
*some* command wired up to it.

If we want to support buttons that do nothing without having to explicitly check
for `null`, we can define a command class whose `execute()` method does nothing.
Then, instead of setting a button handler to `null`, we point it to that object.
for `NULL`, we can define a command class whose `execute()` method does nothing.
Then, instead of setting a button handler to `NULL`, we point it to that object.
This is a pattern called [Null
Object](http://en.wikipedia.org/wiki/Null_Object_pattern).

Expand Down
2 changes: 1 addition & 1 deletion book/event-queue.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ starts making the speaker wiggle.
We want to defer that work until later so that `playSound()` can return quickly.
To do that, we need to *reify* the request to play a sound. We need a little
structure that stores the details of a pending request so we can keep it around
until later.
until later:

^code play-message

Expand Down
2 changes: 1 addition & 1 deletion book/observer.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ require much knowledge of the other.

## Observers Today

*Design Patterns* came out in the <span name="90s">90s</span>. Back then,
*Design Patterns* came out in <span name="90s">1994</span>. Back then,
object-oriented programming was *the* hot paradigm. Every programmer on Earth
wanted to "Learn OOP in 30 Days," and middle managers paid them based on the
number of classes they created. Engineers judged their mettle by the depth of
Expand Down
1 change: 0 additions & 1 deletion code/cpp/service-locator.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class LoggedAudio : public Audio
wrapped_.stopAllSounds();
}


private:
void log(const char* message)
{
Expand Down
19 changes: 10 additions & 9 deletions code/cpp/update-method.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace UpdateMethod
//^statues
}
}

namespace KeepInMind
{
struct Entity
Expand All @@ -113,7 +113,7 @@ namespace UpdateMethod
};

static const int MAX_ENTITIES = 10;

void refreshGame() {}

void skipAdded()
Expand Down Expand Up @@ -146,7 +146,7 @@ namespace UpdateMethod
namespace SampleCode
{
static const int MAX_ENTITIES = 10;

//^entity-class
class Entity
{
Expand Down Expand Up @@ -179,7 +179,7 @@ namespace UpdateMethod
{}

void gameLoop();

private:
Entity* entities_[MAX_ENTITIES];
int numEntities_;
Expand All @@ -192,7 +192,7 @@ namespace UpdateMethod
while (true)
{
// Handle user input...

// Update each entity.
//^update-component-entities
for (int i = 0; i < numEntities_; i++)
Expand All @@ -213,7 +213,7 @@ namespace UpdateMethod
Skeleton()
: patrollingLeft_(false)
{}

virtual void update()
{
if (patrollingLeft_)
Expand Down Expand Up @@ -247,7 +247,7 @@ namespace UpdateMethod
if (++frames_ == delay_)
{
shootLightning();

// Reset the timer.
frames_ = 0;
}
Expand All @@ -256,7 +256,7 @@ namespace UpdateMethod
private:
int frames_;
int delay_;

void shootLightning()
{
// Shoot the lightning...
Expand Down Expand Up @@ -310,7 +310,8 @@ namespace UpdateMethod
else
{
x += elapsed;
if (x >= 100) {
if (x >= 100)
{
patrollingLeft_ = true;
x = 100 - (x - 100);
}
Expand Down
6 changes: 3 additions & 3 deletions html/command.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ <h2><a href="#configuring-input" name="configuring-input">Configuring Input</a><

<aside name="null">

<p>Notice how we don&#8217;t check for <code>null</code> here? This assumes each button will have
<p>Notice how we don&#8217;t check for <code>NULL</code> here? This assumes each button will have
<em>some</em> command wired up to it.</p>
<p>If we want to support buttons that do nothing without having to explicitly check
for <code>null</code>, we can define a command class whose <code>execute()</code> method does nothing.
Then, instead of setting a button handler to <code>null</code>, we point it to that object.
for <code>NULL</code>, we can define a command class whose <code>execute()</code> method does nothing.
Then, instead of setting a button handler to <code>NULL</code>, we point it to that object.
This is a pattern called <a href="http://en.wikipedia.org/wiki/Null_Object_pattern">Null
Object</a>.</p>
</aside>
Expand Down
2 changes: 1 addition & 1 deletion html/event-queue.html
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ <h2><a href="#sample-code" name="sample-code">Sample Code</a></h2>
<p>We want to defer that work until later so that <code>playSound()</code> can return quickly.
To do that, we need to <em>reify</em> the request to play a sound. We need a little
structure that stores the details of a pending request so we can keep it around
until later.</p>
until later:</p>
<div class="codehilite"><pre><span class="k">struct</span> <span class="n">PlayMessage</span>
<span class="p">{</span>
<span class="n">SoundId</span> <span class="n">id</span><span class="p">;</span>
Expand Down
2 changes: 1 addition & 1 deletion html/observer.html
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ <h3><a href="#what's-going-on" name="what's-going-on">What&#8217;s going on?</a>
minimum of communication between them so that working on either one doesn&#8217;t
require much knowledge of the other.</p>
<h2><a href="#observers-today" name="observers-today">Observers Today</a></h2>
<p><em>Design Patterns</em> came out in the <span name="90s">90s</span>. Back then,
<p><em>Design Patterns</em> came out in <span name="90s">1994</span>. Back then,
object-oriented programming was <em>the</em> hot paradigm. Every programmer on Earth
wanted to &#8220;Learn OOP in 30 Days,&#8221; and middle managers paid them based on the
number of classes they created. Engineers judged their mettle by the depth of
Expand Down
1 change: 0 additions & 1 deletion html/service-locator.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ <h3><a href="#logging-decorator" name="logging-decorator">Logging decorator</a><
<span class="n">wrapped_</span><span class="p">.</span><span class="n">stopAllSounds</span><span class="p">();</span>
<span class="p">}</span>


<span class="nl">private:</span>
<span class="kt">void</span> <span class="n">log</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">message</span><span class="p">)</span>
<span class="p">{</span>
Expand Down
3 changes: 2 additions & 1 deletion html/update-method.html
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ <h3><a href="#passing-time" name="passing-time">Passing time</a></h3>
<span class="k">else</span>
<span class="p">{</span>
<span class="n">x</span> <span class="o">+=</span> <span class="n">elapsed</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">x</span> <span class="o">&gt;=</span> <span class="mi">100</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">x</span> <span class="o">&gt;=</span> <span class="mi">100</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">patrollingLeft_</span> <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>
<span class="n">x</span> <span class="o">=</span> <span class="mi">100</span> <span class="o">-</span> <span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="mi">100</span><span class="p">);</span>
<span class="p">}</span>
Expand Down
10 changes: 10 additions & 0 deletions note/log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2014-10-08 - finish layout, proofread, re-upload to createspace for review
2014-10-07 - layout through data locality
2014-10-06 - layout through event queue
2014-10-05 - layout through subclass sandbox
2014-10-04 - layout through behavioral patterns
2014-10-03 - layout through singleton (!)
2014-10-02 - decimal inches page layout
2014-10-01 - work on new page layout
2014-09-30 - work on new page layout
2014-09-29 - cover and other epub front matter
2014-09-28 - email
2014-09-27 - go through bugs and pull requests
2014-09-26 - finish applying proofreading, tweak other web stuff
Expand Down

0 comments on commit e54d620

Please sign in to comment.